Documentation

API // v1

One familiar API.
Your open model.

BrokenGPT exposes the core OpenAI Chat Completions shape, including server-sent event streaming. Point an existing client at your BrokenGPT base URL and use a BrokenGPT key.

Compatibility scopeText messages, sampling controls, stop sequences, usage objects, SSE chunks, and OpenAI-style errors are supported. Tools, images, audio, logprobs, and structured outputs are not yet supported.
01

Create and use a key

Create a secret from the API keys dashboard. The full value is shown once and only its SHA-256 hash is stored. Send it as a Bearer token.

Request
curl https://brokengpt.com/v1/chat/completions \
  -H "Authorization: Bearer $BROKENGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "broken-one",
    "messages": [
      {"role": "user", "content": "Explain continuous batching."}
    ]
  }'
02

Chat completions

POST/v1/chat/completions
modelstring · required

The public model alias, currently broken-one.

messagesarray · required

System, user, and assistant messages with string content.

streamboolean

Return incremental SSE chunks, ending with [DONE].

max_tokensinteger

Capped by the caller's plan and the model context window.

temperature0–2

Sampling temperature passed to the configured provider.

top_p0–1

Nucleus sampling control.

03

Stream the answer

Set stream: true. Each event contains a chat.completion.chunk. Usage is included in the terminal chunk when the provider reports it; otherwise BrokenGPT records a conservative estimate.

Request
const response = await fetch(
  "https://brokengpt.com/v1/chat/completions",
  {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.BROKENGPT_API_KEY}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      model: "broken-one",
      messages: [{ role: "user", content: "Write a parser." }],
      stream: true
    })
  }
);
04

Errors and request IDs

Every API response includes x-request-id. Keep it when contacting support. Errors use an OpenAI-style error object.

400Invalid request or context too long
401Missing, invalid, or revoked API key
404Unknown model alias
429Rate limit hit, or credit balance is empty
503Inference provider temporarily unavailable
05

Pricing & limits

Billing is pay-as-you-go. Add credits to your balance and spend them per token — no monthly subscription. See the pricing page for current rates and the billing dashboard to top up.

$0.50 per 1M input tokens$2.00 per 1M output tokensRequests are rate-limited per keyCredits never expire

When your balance reaches $0, requests return 429 until you add credits. Both input and output tokens are metered on every call.

Ready to make the first call?Create an account