PureBridge API Docs

OpenAI-compatible API reference for developers and power users. This page keeps endpoint, SDK, CLI, agent, and error-handling details.

API Key · For individual developers and lightweight projects.

If you only want direct chat, writing, or image generation, start with the user guide or open Chatbox. This page is for users who need API Key, Base URL, SDK, CLI, IDE agent, and automation setup.

https://api.purebridge.uk

Use the API domain for programmatic traffic. Manage accounts, keys, and billing in the console.

Bearer API KEY

Create an API KEY in the console, then send it in the Authorization header.

OpenAI-style JSON

Works with OpenAI SDK style base_url, bearer authentication, and JSON request/response payloads.

Chat completions support stream: true for interactive responses. Use stream: false when you want a simple header-verification request.

Get from account to first request.

Create an account, generate an API KEY, then configure base_url in the OpenAI SDK.

  1. Create a PureBridge account and open the console.
  2. Create an API KEY, then set quota and rate limits as needed.
  3. Send requests to the API domain with Authorization: Bearer <your_key>.
  4. Call GET /v1/models first, then send a minimal POST /v1/chat/completions request.

Current public surface

PureBridge keeps the public contract small and predictable. These are the routes currently documented for user-facing integrations.

GET /v1/models

List available models

Returns enabled PureBridge model IDs that can be used in completion requests.

POST /v1/chat/completions

Create chat completions

Streaming supported

Accepts an OpenAI-style chat payload; supports stream: true SSE responses and stream: false JSON responses.

GET /health

Health check

Returns a lightweight OK signal for deployment and probe checks.

POST /v1/chat/completions

Chat completions support stream: true for interactive responses. Use stream: false when you want a simple header-verification request.

Model values shown here are PureBridge model IDs returned by GET /v1/models. Use them exactly as returned; they may be routing aliases rather than upstream provider release names.

curl https://api.purebridge.uk/v1/chat/completions \
  -H "Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "codex-auto-review",
  "messages": [
    {
      "role": "system",
      "content": "You are a concise assistant."
    },
    {
      "role": "user",
      "content": "Say hello from PureBridge."
    }
  ],
  "stream": true
}'

Standard SSE streaming payload

data: {"id":"chatcmpl_123","object":"chat.completion.chunk","model":"codex-auto-review","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}

data: {"id":"chatcmpl_123","object":"chat.completion.chunk","model":"codex-auto-review","choices":[{"index":0,"delta":{"content":"Hello from PureBridge."},"finish_reason":null}]}

data: {"id":"chatcmpl_123","object":"chat.completion.chunk","model":"codex-auto-review","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: [DONE]

Check the official request id for OpenAI-routed calls

When the selected model routes to the official OpenAI upstream, PureBridge passes through the x-request-id returned by OpenAI. You can also send X-Client-Request-Id so your own trace id is available in upstream troubleshooting.

  • x-request-id is the request ID generated by the OpenAI API for the upstream request. Record it for PureBridge-side troubleshooting and reconciliation.
  • X-Client-Request-Id is generated by you and sent with the request, making it easier to connect local logs, PureBridge usage records, and upstream support traces.
  • If the model ID routes to a non-OpenAI upstream, use that upstream's response headers and error format instead.
  • The body sha256 in the sample is the hash of the bytes you sent locally. If gateway-level body-sha256 echoing is enabled later, it can be used to compare the upstream body as well.

Response-header verification sample

export PB_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxx"
CLIENT_REQUEST_ID="pb-verify-$(date +%s)"
BODY='{"model":"codex-auto-review","messages":[{"role":"user","content":"ping"}],"stream":false}'

printf "%s" "$BODY" | shasum -a 256

curl -sS -D - -o /tmp/purebridge-verify.json https://api.purebridge.uk/v1/chat/completions \
  -H "Authorization: Bearer $PB_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Client-Request-Id: $CLIENT_REQUEST_ID" \
  --data-binary "$BODY" \
  | grep -Ei '^(x-request-id|openai-|x-ratelimit|date):'

PureBridge model IDs available in this environment

Model values shown here are PureBridge model IDs returned by GET /v1/models. Use them exactly as returned; they may be routing aliases rather than upstream provider release names.

  • codex-auto-review codex-auto-review ·
  • gpt-5.4-mini gpt-5.4-mini ·
  • gpt-5.5 gpt-5.5 ·

GET /v1/models response shape

{
  "object": "list",
  "data": [
    {
      "id": "codex-auto-review",
      "object": "model",
      "owned_by": ""
    },
    {
      "id": "gpt-5.4-mini",
      "object": "model",
      "owned_by": ""
    },
    {
      "id": "gpt-5.5",
      "object": "model",
      "owned_by": ""
    }
  ]
}

Operational expectations before production use.

Keep implementation simple: one API domain, bearer authentication, explicit model selection, and normal HTTP error handling.

Authentication and keys

  • Send Authorization: Bearer <your_key> on every API request.
  • Create and rotate account-scoped keys from the PureBridge console.
  • Do not place production keys in browser code, public repositories, or client-side logs.

Errors and limits

  • 401 means the Bearer API KEY is missing, invalid, or disabled.
  • 429 means the account or current environment is rate limited. Retry with backoff.
  • 5xx responses should be treated as transient upstream or routing failures.

Recommended setup for API Key users

The API Key flow is: purchase or redeem a plan, create an API KEY, configure PureBridge as an OpenAI-compatible provider, then monitor requests, tokens, and cost from the usage page.

  1. Create an API KEY in the API Key workspace. Use separate API KEY for different tools, projects, or automations so each one can be disabled, rotated, and costed independently.
  2. Use the Base URL shown at the top of this page plus /v1 in most tools. If a tool appends /v1 automatically, use the base domain only.
  3. Send API KEY as Authorization: Bearer <your_key>. Do not put API KEY in frontend code, public repositories, screenshots, or client logs.
  4. Use model IDs returned by GET /v1/models. Do not assume upstream provider release names are valid PureBridge model IDs.
  5. Use Streaming for interactive chat. Temporarily use stream=false when troubleshooting or verifying response headers.
  6. Agents, Codex-style coding tasks, workflows, and long-context jobs can consume tokens quickly. Set daily/monthly budgets, rate limits, and notification email per API KEY.

Use PureBridge as an OpenAI-compatible provider

Most CLI, IDE agent, and workflow tools need four fields: Provider set to OpenAI Compatible or Custom OpenAI, Base URL set to the PureBridge /v1 URL, API KEY set to your personal API KEY, and Model set to a value returned by /v1/models.

Codex / opencode

Best for repository edits, code explanation, refactors, tests, and longer coding automation.

  • For Codex, use a separate CODEX_HOME to isolate PureBridge config.toml and auth.json from other upstream providers.
  • For opencode, configure a custom provider; OpenAI-compatible chat-completions providers use @ai-sdk/openai-compatible with baseURL, apiKey, and models.
  • These tools can use large context and repeated calls, so use a dedicated API KEY with daily budget and rate limits.

Aider

Good for small Git-aware changes, focused tests, diff explanations, and pre-commit cleanup.

  • Use the tool's OpenAI-compatible base URL settings with the PureBridge /v1 URL and your API Key.
  • Start with small files and small context before opening larger repository scopes.
  • Use a dedicated API KEY for Aider so coding spend is visible in usage records.

Continue

Good for VS Code / JetBrains code chat, completions, local edits, and project rules.

  • Choose an OpenAI-compatible or custom OpenAI provider in model settings.
  • Fill in Base URL, API KEY, and model ID; if chat/edit/autocomplete are separate, enable chat first.
  • IDE tools may run background requests, so use a separate budget limit.

Cline / Roo Code

Good for local agents that read and write files, run shell commands, use browser tools, or execute multi-step tasks.

  • Select OpenAI Compatible / Custom Provider, then enter the PureBridge /v1 URL, API KEY, and model ID.
  • Start with cautious file and terminal permissions before allowing broader automation.
  • Set a key-level budget before long tasks to avoid unexpected looping spend.

Dify / n8n / LiteLLM / custom scripts

Good for note processing, message summaries, daily reports, personal bots, scheduled jobs, and low-code automation.

  • Use an OpenAI-compatible connector and store API KEY server-side, not in browser or mobile client code.
  • Use separate API KEY for different workflows, environments, and projects so usage can be audited and stopped quickly.
  • Start with GET /v1/models and one minimal chat request; temporarily use stream=false when you need to inspect response headers.

Copy and replace API KEY and model

These examples are generated from the current site API domain and model list. Replace sk-xxxxxxxxxxxxxxxxxxxxxxxx with an API KEY created in your API Key workspace.

Environment variables

Useful for SDKs and CLI tools that read OpenAI-compatible settings from the shell.

export OPENAI_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxx"
export OPENAI_BASE_URL="https://api.purebridge.uk/v1"
export PUREBRIDGE_MODEL="codex-auto-review"

OpenAI Python SDK

Use the PureBridge base URL exactly like an OpenAI-compatible provider.

from openai import OpenAI

client = OpenAI(
    api_key="sk-xxxxxxxxxxxxxxxxxxxxxxxx",
    base_url="https://api.purebridge.uk/v1",
)

response = client.chat.completions.create(
    model="codex-auto-review",
    messages=[{"role": "user", "content": "Say hello from PureBridge."}],
    stream=True,
)

Generic agent tool fields

For tools that provide an OpenAI-compatible or custom OpenAI provider form.

Provider: OpenAI Compatible / Custom OpenAI
Base URL: https://api.purebridge.uk/v1
API Key: sk-xxxxxxxxxxxxxxxxxxxxxxxx
Model: codex-auto-review
Streaming: On for interactive chat; off for header verification

Codex config pattern

Use a separate CODEX_HOME when you want PureBridge isolated from another Codex setup.

model_provider = "PureBridge"
model = "codex-auto-review"

[model_providers.PureBridge]
name = "PureBridge"
base_url = "https://api.purebridge.uk/v1"
wire_api = "responses"
requires_openai_auth = true

# auth.json
{"OPENAI_API_KEY":"sk-xxxxxxxxxxxxxxxxxxxxxxxx"}

opencode provider pattern

For OpenAI-compatible chat-completions providers, opencode uses the AI SDK compatible provider shape.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "purebridge": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "PureBridge",
      "options": {
        "baseURL": "https://api.purebridge.uk/v1",
        "apiKey": "{env:OPENAI_API_KEY}"
      },
      "models": {
        "codex-auto-review": {
          "name": "codex-auto-review"
        }
      }
    }
  },
  "model": "purebridge/codex-auto-review"
}

What this path is for

  • OpenAI-compatible API usage: configure PureBridge in SDKs, CLI tools, IDE agents, or workflow tools.
  • Developer productivity: Codex, opencode, Aider, Continue, Cline, Roo Code, and similar tools for code edits, explanations, tests, and automation.
  • Personal automation: daily reports, document processing, message summaries, content generation, personal bots, scheduled scripts, and low-code workflows.
  • Budget control: split keys by tool, project, or workflow, then track requests, tokens, cost, and unusual spend from usage records.

What to do after reading

Register an account, create an API KEY in App Workspace, then call the API domain.

Behavioral constraints