ForHosting KIT · Developer Utilities

Explain code

A pull request with a two-hundred-line function and no description asks the reviewer to reconstruct the author's intent from scratch. This endpoint reads a block of code and returns a plain-language explanation of what it does and how, so that reconstruction doesn't have to happen inside someone's head.

● StablePer request + per 1,000 words$0.003
Use it from WebAPIEmailApp soonTelegram soon

Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.

The function that outgrew its name

Most functions start out doing one clear thing, named accordingly, and then accumulate an edge case here, a retry branch there, a conditional someone added under deadline pressure, until the name no longer describes the behavior and the logic requires actually reading it line by line to understand. That's a normal way for code to evolve, but it leaves behind exactly the kind of function that slows down a review or trips up whoever touches it next. dev.code_explain reads through that accumulated complexity and states plainly what the code actually does now, not what its name suggests it should do.

From source to summary

POST /dev/code-explain with the function, method or code block you want explained, and the call returns a task_id while it's analyzed in the background. The explanation, delivered by signed webhook or a signed link valid for 24 hours, covers what the code does, the logic it follows, and notable behavior like error handling, side effects or edge cases, in language that doesn't require re-reading the code to make sense of.

Reading code has always been harder than writing it

The observation that programmers spend far more time reading code than writing it goes back decades in software engineering literature, and it's part of why disciplines like literate programming and self-documenting code emerged as explicit responses to the same problem: intent gets lost the moment code changes hands or time passes since it was written. Comments explaining why a function exists tend to survive; comments explaining exactly what each line does tend to rot, because they fall out of sync the first time the logic changes and nobody updates the prose next to it. An explanation generated on demand, from the code as it exists right now, doesn't have that decay problem.

Where it changes how a team actually works

In code review, a reviewer unfamiliar with a module gets a plain-language summary before diving into the diff, which turns review from line-by-line archaeology into checking whether the described behavior is actually what should happen. In onboarding, a new hire can explain unfamiliar files in a legacy codebase instead of pulling a senior engineer away from their own work to narrate it out loud. And for documentation, generating explanations for every public function in a library produces a first draft of API docs that a human only needs to edit, not write from nothing. Billed per request plus per thousand words of code, the cost scales with how much there actually is to explain, and a failed explanation is never charged.

Pull request review

A reviewer explains an unfamiliar function added in a pull request to understand its behavior before checking whether the logic is correct.

Onboarding into a legacy codebase

A new engineer explains core modules of an inherited system to build a working mental model without interrupting a senior teammate for a walkthrough.

First-draft API documentation

A documentation pipeline explains every public function in a library to produce an initial description that a technical writer then refines.

Auditing inherited automation scripts

An operations team explains an old deployment script nobody currently on the team originally wrote, before deciding whether it's safe to modify or should be replaced.

How do I get code explained with the API?

POST the function or code block to /dev/code-explain, keep the returned task_id, and collect the plain-language explanation by webhook or a signed link valid for 24 hours.

Is the code explainer API free?

No, there is no free tier or trial; it costs $0.003 per request plus $0.0135 per 1,000 words of code, and a failed explanation is never charged.

Which programming languages does it support?

It handles code in mainstream languages; include the language or note anything unusual about the syntax so the explanation reflects that language's conventions accurately.

Does it explain a whole file or just a function?

You can submit anything from a single function to a larger file or module; the explanation scales with what you send and price scales with the word count of the code submitted.

Will it point out bugs or just describe behavior?

It primarily describes what the code does, including notable behavior like error handling and edge cases; it is not a substitute for a dedicated code review or security audit.

Can I explain many files in bulk?

Yes, submit one async task per file or function and collect each explanation by webhook as it completes, which suits documenting an entire module at once.

Is this endpoint live?

Yes, /dev/code-explain is live and accepting requests now.

Is the code I submit stored afterward?

No, submitted code and its explanation are deleted after the retention window and are never used for training.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/dev/code-explain

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.

curl -X POST https://api.kit.forhosting.com/dev/code-explain \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"…"}'
{
  "text": "…"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "dev.code_explain",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.003
Per 1,000 words$0.0135

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.
422task_failedThe task failed after 3 retries. You are never charged for it.

Read the full KIT documentation →