DocForge AIDocForge AIAPI v1
Back to appOpen Chat
Public Beta

Generate code from a prompt, with a single API call.

The DocForge AI v1 API turns natural-language prompts into structured, multi-file projects — and deploys them to a public URL. Same engine that powers the chat app, now callable from your code.

QuickstartTry it live
10 req/min
per IP, free
5 models
Nemotron, GLM, Gemma…
Edge runtime
Cloudflare Pages
No auth needed
for the beta
Get started in 30 seconds

Quickstart

Generate a complete todo app from a single prompt. Copy the example for your language and run it.

bash
curl -X POST https://www.docforgeai.jo3.org/api/v1/generate \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Build a todo app with React and localStorage",
    "model": "auto",
    "duration": "auto"
  }'
Auth

Authentication

The v1 API is in public beta — no API key is required. Just send requests directly.

No key needed (beta)
During the beta, all requests are anonymous and rate-limited per IP. You can start building right now — no signup, no billing setup.
# No Authorization header needed
POST /api/v1/generate
Content-Type: application/json
API keys (coming soon)
When keys ship, requests with a valid Authorization: Bearer <key> header will get higher rate limits and usage analytics.
# Future:
Authorization: Bearer dfk_live_…
Reference

Endpoints

Two POST endpoints. Both run on the edge runtime and accept JSON request bodies.

POST/api/v1/generate
Generate multi-file code from a natural-language prompt. Returns structured files (path, content, language) plus token usage and duration.

Request body

FieldTypeRequiredDescription
promptstringrequiredNatural-language description of what to build. Max 10,000 chars.
modelstringoptionalauto (default) | nemotron | glm-5.2 | gemma | poolside
durationstringoptionalauto (default) | 5min | 10min — longer durations produce more files

Request example

curl
curl -X POST https://www.docforgeai.jo3.org/api/v1/generate \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Build a todo app with React and localStorage",
    "model": "auto",
    "duration": "auto"
  }'

Response fields

filesarray

Generated files: { path, content, language }.

tokensUsednumber

Estimated tokens consumed (prompt + output, 4 chars ≈ 1 token).

durationnumber

Generation time in milliseconds.

modelstring

The provider that was actually used (e.g. nemotron-nothinking).

fileCountnumber

Number of files in the response.

promptstring

Echoed prompt (truncated to 200 chars) for debugging.

Response example

json
{
  "files": [
    {
      "path": "index.html",
      "content": "<!DOCTYPE html>\n<html>\n  <head>...",
      "language": "html"
    },
    {
      "path": "src/App.tsx",
      "content": "import { useState } from \"react\";\n...",
      "language": "tsx"
    },
    {
      "path": "src/styles.css",
      "content": "body { margin: 0; }\n...",
      "language": "css"
    }
  ],
  "tokensUsed": 4521,
  "duration": 8234,
  "model": "nemotron-nothinking",
  "fileCount": 3,
  "prompt": "Build a todo app with React and localStorage"
}
POST/api/v1/deploy
Deploy an array of files (path + content) to a public URL. Files are served at /d/<id> with all CSS/JS inlined and a small DocForge badge.

Request body

FieldTypeRequiredDescription
filesarrayrequiredArray of { path: string, content: string }. Max 200 files, 1 MB each, 10 MB total.
projectIdstringoptionalOptional. Re-deploys with the same projectId reuse the same URL.

Request example

curl
curl -X POST https://www.docforgeai.jo3.org/api/v1/deploy \
  -H "Content-Type: application/json" \
  -d '{
    "files": [
      { "path": "index.html", "content": "<h1>Hello world</h1>" },
      { "path": "styles.css", "content": "body { font-family: sans-serif; }" }
    ],
    "projectId": "my-app"
  }'

Response fields

idstring

Short URL-safe deployment id (e.g. bskrxjre).

urlstring

Public URL where the deployment is served.

entrystring

Path of the entry HTML file (empty string when none).

fileCountnumber

Number of files stored.

titlestring|null

Title extracted from the first <title> tag, if any.

createdAtnumber

Unix timestamp (ms) when the deployment was created.

Response example

json
{
  "id": "bskrxjre",
  "url": "https://www.docforgeai.jo3.org/d/bskrxjre",
  "entry": "index.html",
  "fileCount": 2,
  "title": "Hello world",
  "createdAt": 1722633600000
}
Interactive

Try it live

Send a real request to /api/v1/generate right from this page. The response renders below — file tree on the left, code on the right.

Request
77 / 10,000

Calls POST /api/v1/generate from your browser. Counts against your per-IP rate limit.

Response
Send a request to see the response here.
Limits & pricing

Rate limits & pricing

Free during the public beta. Rate limits are per IP and reset every 60 seconds.

Current
Free (beta)
For everyone, no signup.
Rate limit10 req / min / IP
Max prompt10,000 chars
Max files / deploy200
Deploy size10 MB total
Modelsall 5
Cost$0
Coming soon
Pro API
For production apps.
Rate limit1,000 req / min / key
Max prompt50,000 chars
Max files / deploy1,000
Deploy size100 MB total
Modelsall 5 + priority queue
Cost$9 / month
Coming soon
Enterprise
Custom volume & SLA.
Rate limitcustom
Max promptcustom
Deploy retentioncustom TTL
Modelsall + private models
SLA99.9% uptime
Costcontact sales
How rate limiting works
Every response includes X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers. When you exceed the limit, the API returns 429 with a Retry-After header (seconds). Limits are tracked per IP and reset 60 seconds after the first request in the window.
Errors

Error responses

All errors return JSON with an error field. 4xx errors should be handled client-side; 5xx errors are usually transient — retry with backoff.

StatusLabelWhen
400Bad RequestMissing or invalid prompt/files. Response body includes a human-readable error message.
413Payload Too LargeA file or the total deployment exceeds the size limit.
429Rate LimitedMore than 10 requests in the last 60 seconds from your IP. Retry after the number of seconds in retryAfter.
502Bad GatewayThe deployer backend (dev) is unreachable. Make sure the deployer mini-service on port 3009 is running.
503Service UnavailableAll LLM providers failed. Wait a few seconds and retry.
504Gateway TimeoutGeneration exceeded the per-provider timeout (2 min). Try a shorter prompt.

Example: 429 response

json
{
  "error": "Rate limit exceeded. Maximum 10 requests per minute per IP.",
  "retryAfter": 42,
  "docs": "/api-docs#rate-limits"
}

Retry strategy

For 429 and 5xx errors, use exponential backoff: wait 1s, then 2s, then 4s. Stop after 3 retries. The Retry-After header (when present) tells you exactly how long to wait.

Tip
Don't fire requests in a tight loop — even on success, you'll burn through your 10 req/min budget in seconds. Cache responses when the same prompt is sent repeatedly.

Ready to build?

Copy a quickstart example and ship something today.

QuickstartTry it live
DocForge AI · API v1 · Public Beta
HomePricingTermsPrivacyContact