AI コード解説
AI & Agentsコードスニペットを貼り付けると、LLM が平易な言葉で解説します。初心者・開発者・エキスパートの 3 レベルから選べます。自分の無料 Groq キーを使って、ブラウザから直接 API を呼び出せます。
Detected: text · input capped at 12000 characters
このツールは、あなた自身の無料 API キーで Groq を呼び出します。このブラウザに一度保存すれば OK:
Your key stays in this browser (localStorage) and is sent only to api.groq.com — never to CosmoDev servers. Get a free Groq key
コードを貼り付けて「解説」を押すと、解説が表示されます。(ドキュメントは英語)
AI Code Explainer
What it does
Explains a pasted code snippet in plain language, at the depth you pick: Beginner (no jargon, one analogy, step by step), Developer (what it does, the flow, the patterns, the pitfalls), or Expert (invariants, complexity, edge cases — the things a reviewer would flag). The tool detects the language first (Go, Rust, Python, SQL, TypeScript, JavaScript, CSS, HTML) and tells the model, so the explanation starts from the right place.
This is an AI Studio tool: it calls the model directly from your browser with your own free Groq API key. Nothing passes through CosmoDev servers, and we store nothing.
How to use
- Save your free Groq API key once — the panel keeps it in this browser’s localStorage. Get a key at console.groq.com/keys.
- Paste a snippet (up to 12,000 characters — longer inputs are truncated).
- Pick a depth: Beginner, Developer, or Expert.
- Press Explain code, then copy the result.
The hint under the input shows the detected language as you paste.
Examples
Input with depth = Developer:
msgs := []string{"a", "b"}
for i, m := range msgs {
fmt.Println(i, m)
}
Output (abridged): creates a slice of two strings, iterates with range which yields index and value per iteration, prints each pair — the idiomatic Go replacement for a C-style loop.
With depth = Beginner the same snippet is explained without words like “slice” or “range” being assumed — what they mean comes first.
Good to know
- Key custody: your key lives only in this browser (localStorage, namespaced
cosmodev:aistudio.groq) and is sent only toapi.groq.comas a request header — never to CosmoDev, never in a URL. The key panel has a Remove key button that wipes it. - Free tier: Groq’s free tier makes this genuinely free — see /ai-studio for every BYO-key tool and your key status.
- Rate limits: if Groq rate-limits the call (HTTP 429), the tool stops and shows the error with a manual Retry button — it never retries automatically.
- Detection is cheap: language detection is keyword heuristics, not a parser — it only steers the prompt. If it says the wrong language, the model usually recovers; you can also just trust the explanation.
- Privacy: your code goes only from your browser to Groq. CosmoDev has no backend in the path — the same egress model as every AI Studio tool. Still, don’t paste secrets.