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.
Prefer a guided start? Follow the Python quickstart, the Node.js quickstart, or the migration checklist.
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.
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."}
]
}'Chat completions
/v1/chat/completionsOne of broken-one, broken-one-pro, or broken-two.
System, user, and assistant messages with string content.
Return incremental SSE chunks, ending with [DONE].
Optional caller-chosen cap. Omit it to let the model finish naturally.
Function declarations; your application executes returned tool calls.
Text, JSON object, or server-validated JSON Schema output.
Passed through when the selected private route supports deterministic generation.
Sampling temperature passed to the configured provider.
Nucleus sampling control.
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.
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
})
}
);Responses, batches, tokens, and usage
The same scoped key can use the focused compatibility endpoints below. See the repository API reference for complete request and response schemas.
Text/function Responses objects and lifecycle-event streaming.
Persist and process up to 100 non-streaming chat requests.
Estimate the full serialized input envelope before inference; final billing uses model-reported usage when available.
Read usage for a key with the usage:read scope.
Errors and request IDs
Every API response includes x-request-id. Keep it when contacting support. Errors use an OpenAI-style error object.
Use the error and troubleshooting guide for retry rules, context sizing, quota failures, and streaming recovery.
Pricing & limits
Billing supports model-specific prepaid usage or Pro at $29/month with 10M included tokens. Unused Pro tokens expire at the end of the paid billing period; prepaid credits do not. See the pricing page for current rates and the billing dashboard to subscribe or top up.
broken-one · $0.50 input / $2.00 output per 1Mbroken-one-pro · $1.00 input / $3.00 output per 1Mbroken-two · $0.60 input / $3.00 output per 1MRequests are rate-limited per keyCredits never expirePro tokens are consumed before prepaid credits. When both are empty, requests return 429 until you add credits or the next paid Pro period begins. Both input and output tokens are metered.