API reference

Endpoints, authentication, streaming behavior and error semantics.

v0.3.0 · Updated November 2, 2026
On this page

Authentication

Generation and model endpoints require a gateway bearer key. Messages ingress also accepts the Anthropic-style x-api-key gateway credential. A provider key cannot authenticate to Conflux. Keys are scoped to their owner, allowed models, expiry, budget and optional IP allowlist.

HTTP header
Authorization: Bearer YOUR_GATEWAY_KEY

Supported endpoints

  • POST /v1/chat/completions: OpenAI Chat Completions JSON and SSE.
  • POST /v1/responses: practical OpenAI Responses subset for local coding tools.
  • POST /v1/messages: practical Anthropic Messages subset for Claude Code.
  • GET /v1/models: virtual model IDs and names. Full chains are in the authenticated console.
  • GET /api/health: process health. GET /api/ready: database readiness.

A short streaming request

Terminal
curl -N http://localhost:3000/v1/chat/completions \
  -H "Authorization: Bearer $CONFLUX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"conflux/chat","messages":[{"role":"user","content":"Say hello."}],"max_tokens":32,"stream":true}'

SSE responses are relayed through the selected dialect. Failover before substantive output preserves the client-facing model. Once output is committed, an interrupted stream fails explicitly and is not replayed.

Error status guide

  • 400: malformed request, invalid options or an unsupported protocol feature.
  • 401: invalid or expired gateway authentication.
  • 402: ordinary API Key quota exceeded.
  • 429: gateway rate limit or Harness Profile budget exceeded.
  • 503: no eligible provider can complete the request.

An upstream 403 or 404 can be recorded on a failed attempt while the overall gateway returns 503 after all routes fail. Inspect the receipt rather than treating gateway status as the exact upstream error.