API Reference
One Route Handler serves every tool: POST /api/ai/[slug], where slug is any tool slug from config/tools.config.ts.
Request body
{
"input": { "input": "...", "language": "TypeScript" },
"model": "qwen/qwen3-coder:free",
"temperature": 0.4,
"maxTokens": 2048
}inputis a flat string-keyed object — its exact shape depends on the tool’s fields. model must be one of the IDs in config/models.ts.
Response
On success, the response body is a raw UTF-8 text stream (Content-Type: text/plain) — the completion, streamed as it’s generated. There is no JSON envelope on success.
On failure, the response is JSON:
{
"error": { "message": "...", "code": "VALIDATION_ERROR" }
}Error codes
| Code | Status | Meaning |
|---|---|---|
VALIDATION_ERROR | 400 | Request body or tool input failed schema validation |
TOOL_NOT_FOUND | 404 | The slug doesn’t match a registered tool |
MODEL_NOT_ALLOWED | 400 | The requested model isn’t in the allowlist |
MISSING_API_KEY | 500 | OPENROUTER_API_KEYisn’t set on the server |
RATE_LIMITED | 429 | OpenRouter rate-limited the request |
UPSTREAM_ERROR | 502 | OpenRouter returned a non-2xx response |
Available tool slugs
code-explainerbug-findercommit-message-generatorreadme-generatorregex-generatorsql-generatorjson-to-typescriptemail-generatorcode-optimizercode-reviewer