Skip to content
cosmodev ~/tools/code-explainer

AI-kodeforklarer

AI & Agents

Indsæt et kodestykke og få en klar forklaring fra en LLM — begynder-, udvikler- eller ekspertniveau — med din egen gratis Groq-nøgle, direkte fra browseren.

Detected: text · input capped at 12000 characters

Prøv:

Dette værktøj kalder Groq med DIN gratis API-nøgle — gem den én gang, i denne browser:

Your key stays in this browser (localStorage) and is sent only to api.groq.com — never to CosmoDev servers. Get a free Groq key

Indsæt kode og tryk på Forklar for at se gennemgangen.

(Dokumentation på engelsk)

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

  1. Save your free Groq API key once — the panel keeps it in this browser’s localStorage. Get a key at console.groq.com/keys.
  2. Paste a snippet (up to 12,000 characters — longer inputs are truncated).
  3. Pick a depth: Beginner, Developer, or Expert.
  4. 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 to api.groq.com as 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.
Kildekode14 sprog

Runs in your browser · your snippet goes straight to api.groq.com using YOUR key (BYO). CosmoDev has no backend in the path and stores nothing. Fandt du dette nyttigt? Del det med en i dit team.