Trình giải thích mã bằng AI
AI & AgentsDán bất kỳ đoạn mã nào và nhận lời giải thích bằng ngôn ngữ giản dị từ một LLM — mức độ mới bắt đầu, lập trình viên hoặc chuyên gia — với khóa Groq miễn phí của riêng bạn, trực tiếp từ trình duyệt của bạn.
Detected: text · input capped at 12000 characters
Công cụ này gọi Groq bằng API key miễn phí CỦA BẠN — lưu một lần trong trình duyệt này:
Your key stays in this browser (localStorage) and is sent only to api.groq.com — never to CosmoDev servers. Get a free Groq key
Dán mã và nhấn Giải thích để xem lời giải thích.(Tài liệu bằng tiếng Anh)
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.