DEVELOPER DOCUMENTATION

Build on QuantumCoder

Use an OpenAI-compatible API for inference and the QuantumCoder CLI to work with configured models in your project.

Quickstart

  1. Create a QuantumCoder account and add credits.
  2. Create an API key in the dashboard. The key is shown once.
  3. Choose a model that appears in the live model catalog.
curl https://api.quantumcoder.xyz/v1/chat/completions \
+  -H "Authorization: Bearer $QUANTUMCODER_API_KEY" \
+  -H "Content-Type: application/json" \
+  -d '{"model":"MODEL_ID","messages":[{"role":"user","content":"Hello QuantumCoder"}]}'

Authentication and API keys

Send your QuantumCoder key as a bearer token. Keep it in a server-side environment variable or secret manager. Do not ship it in browser code or commit it to source control.

Authorization: Bearer qc_live_...

Create, rename, limit, or revoke keys in API keys. Revoked keys stop authenticating immediately.

Models endpoint

Only enabled models with a live provider route and explicit published pricing are returned.

GET https://api.quantumcoder.xyz/v1/models

Use each model's exact id in completion requests. Context window and modalities are only listed when configured.

Chat completions

Endpoint: POST /v1/chat/completions. The request follows the OpenAI chat completions shape, including messages, temperature, max output tokens, and tool calls where the selected upstream model supports them.

{"model":"MODEL_ID","messages":[{"role":"system","content":"Be concise."},{"role":"user","content":"Explain this code."}],"temperature":0.7,"max_tokens":512}

OpenAI Node SDK example:

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.QUANTUMCODER_API_KEY,
  baseURL: "https://api.quantumcoder.xyz/v1",
});

const result = await client.chat.completions.create({
  model: "MODEL_ID",
  messages: [{ role: "user", content: "Hello QuantumCoder" }],
});
console.log(result.choices[0].message.content);

Streaming

Set stream: true to receive Server-Sent Events. Stream usage accounting depends on the upstream model returning its final usage event; choose a provider route configured to include usage in streaming responses.

{"model":"MODEL_ID","messages":[{"role":"user","content":"Write a short poem."}],"stream":true}

Usage and billing

Token usage is read from the provider response. Charges are calculated on the server from the model's published input and output prices and configured platform markup. The gateway records the request, usage, and immutable credit transaction.

Buy credits through the billing dashboard. Credits are added after a verified Stripe webhook confirms payment. Insufficient balances return an API error instead of running inference.

Errors

HTTPMEANINGWHAT TO CHECK
400Invalid requestRequest fields and selected model ID
401Authentication failedBearer key and revocation status
402Insufficient creditsAccount balance
404Model not availableLive catalog and model ID
429Spending limit reachedPer-key spending limit
502Provider errorUpstream provider availability
503Gateway not configuredOperator LiteLLM and database configuration

Errors use the OpenAI-style { "error": { "message", "type", "code" } } response shape.

QuantumCoder CLI

Install the CLI package from the QuantumCoder source repository with Node.js 20 or newer:

npm install --global ./packages/cli
quantumcoder auth
cd path/to/project
quantumcoder

Build mode applies tool calls in the local project and runs checks through your shell. Plan mode is read-only. Both modes send model requests to the configured QuantumCoder API. Use quantumcoder --model MODEL_ID to select a starting model.

CLI setup guide