AI Code Assistant

Describe what the program should do, or paste your code or the error you got. Pick a task and a language; you get code in formatted blocks plus a short explanation.

Code Assistant
Your result will appear here

What the code assistant does

Paste a function that misbehaves, an error message you do not understand, or a plain description of a script you need, then pick a task. The code assistant writes new code, finds and fixes bugs, explains code line by line, reviews it, writes unit tests, refactors it, or converts it to another language. Code always comes back in formatted blocks with the right language tag, so it is easy to copy.

Behind it is GPT-6 Luna, the speed-focused member of OpenAI's GPT-6 lineup, which answers most coding questions in a few seconds. The language list covers 20 programming languages, from Python, JavaScript, TypeScript and Java to Go, Rust, Kotlin, Swift, R, Lua, SQL, Bash, PowerShell, and HTML with CSS, plus automatic detection.

How to use it

  1. Paste code, an error or a request. For bugs, include the full error text and say what you expected to happen.
  2. Choose the task: write, find and fix bugs, explain, review, write tests, clean up (refactor), or convert to another language.
  3. Choose the language, or leave Detect automatically. For conversions, pick the language you want the code converted into.
  4. Generate, copy the code with the copy button on each block, or continue in the chat to iterate.

Example from a live test

We used the second sample, a classic JavaScript surprise, with the task set to Find and fix bugs:

This JavaScript should show the numbers 1, 2, 3 after one second each, but prints 4 three times: for (var i = 1; i <= 3; i++) { setTimeout(() => console.log(i), i * 1000); }

The answer came back in about two seconds. It named the cause first: var creates a single i shared by the whole loop, the loop ends before any timer fires, and by then i is 4. The fix was one word, shown as a complete block:

for (let i = 1; i <= 3; i++) {
  setTimeout(() => console.log(i), i * 1000);
}

With let, each pass of the loop gets its own i, so the timers print 1, 2 and 3.

Tips for useful answers

  • Give versions. "Python 3.12 with pandas 2" or "Node 22" avoids answers written for an older API.
  • Paste the smallest failing piece. A short example that reproduces the bug gets a sharper answer than a whole project.
  • Include the real error. Copy the full message and the line number; do not paraphrase it.
  • Ask for tests after a fix. Run Write tests on the corrected code to see whether the edge cases hold.
  • Turn on thinking for hard problems. For tricky algorithms or design questions, continue in the chat with GPT-6.1 Terra, which reasons briefly before it answers. Our guide to coding with GPT has more workflows.

What to watch out for

  • Always run the code. Generated code can look right and still fail on your data. Test it before you rely on it, and never paste it straight into production.
  • It cannot see your project. The assistant only knows what you paste. Imports, configuration and other files you left out can change the answer.
  • Library details change. The model has a training cut-off and cannot read current documentation, so check function names and options against the official docs.
  • Secrets stay out. Remove API keys, passwords and customer data before pasting. Your code passes through our server to OpenRouter and OpenAI and is not stored by us, but it should not contain secrets anyway.
  • Security matters. A review can catch common problems, such as SQL injection, but it is not a security audit.

Code Assistant FAQ

Is the code assistant free?

Yes, with no sign-up. Each run takes one message from your free daily allowance, the same allowance the chat uses.

Can I write my question in another language?

Yes. Explanations follow the language of your text, so a question in Portuguese gets Portuguese explanations, while the code stays code.

Can it understand a regular expression or a SQL query?

Yes, use Explain code. For a regex, a handy chat prompt is explain this regex with matching examples.

Can I upload a screenshot of an error?

Not here; this page is text only. You could attach a screenshot in the chat instead (both chat models understand images), but pasting the error as text gives more reliable answers. For maths behind an algorithm, try the Math Solver.

Got a question? Ask it now

No account and no download. Open the chat, type what is on your mind, and the answer starts appearing in a second or two.

Start chatting