API

The Bridge API

Use your Bridge account from any code, with any OpenAI-compatible SDK. The base URL, keys, models, billing, errors, and the project keys Bridge makes for the apps it builds.

View as Markdown · source site/docs/api.md

A Bridge account is also an API. One key reaches every model Bridge offers (several hundred, from every major lab), billed from the same prepaid balance Bridge itself uses. It works anywhere: your own scripts, servers and apps, with no Bridge install, no tailnet and no desktop app.

Source: services/router/ (the API and the accounts dashboard), services/router/src/childKeys.ts (project keys), packages/server/src/projectApiKeys.ts (how Bridge makes them).

Base URL and keys

Base URLhttps://router.bridgedesktop.com/v1
Keysmade on API keys at accounts.bridgedesktop.com
Key formatsk-br-v1- followed by 43 letters and digits

The host is permanent. Read it from an environment variable anyway (BRIDGE_BASE_URL below), so moving is a configuration change.

A key is shown once, when it is made. Only its hash is stored, so a lost key cannot be recovered; make another and revoke the old one.

Send the key the way your SDK already does. All of these are accepted:

  • Authorization: Bearer sk-br-v1-… (OpenAI SDKs)
  • x-api-key: sk-br-v1-… (Anthropic SDK)
  • x-goog-api-key: sk-br-v1-… or ?key=sk-br-v1-… (Google SDK)

Quick start

export BRIDGE_API_KEY=sk-br-v1-...
export BRIDGE_BASE_URL=https://router.bridgedesktop.com/v1

curl "$BRIDGE_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $BRIDGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "anthropic/claude-sonnet-5", "messages": [{"role": "user", "content": "Hello"}]}'

Python, with the OpenAI SDK. Only the base URL changes:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["BRIDGE_API_KEY"],
    base_url=os.environ.get("BRIDGE_BASE_URL", "https://router.bridgedesktop.com/v1"),
)

reply = client.chat.completions.create(
    model="anthropic/claude-sonnet-5",
    messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)

TypeScript:

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.BRIDGE_API_KEY,
  baseURL: process.env.BRIDGE_BASE_URL ?? "https://router.bridgedesktop.com/v1",
});

const stream = await client.chat.completions.create({
  model: "deepseek/deepseek-v4-flash",
  messages: [{ role: "user", content: "Hello" }],
  stream: true,
});
for await (const chunk of stream) process.stdout.write(chunk.choices[0]?.delta?.content ?? "");

Every model, Claude and Gemini included, answers on /v1/chat/completions in OpenAI's shape, streamed or not, with a final usage chunk.

Models

GET /v1/models lists the catalogue in OpenAI's {object: "list", data: [...]} shape. It needs no key. Ids are vendor/model, for example anthropic/claude-sonnet-5 or deepseek/deepseek-v4-flash. Each entry also carries context_length, max_output_tokens and native_format, and a pricing object in OpenRouter's shape: prompt, completion, input_cache_read and input_cache_write, each USD per token as a decimal string ("0.000005" is $5 per million). That is the rate a request is billed at, with no markup. The object is left out when a model has no price yet.

Native endpoints

Each vendor's own API is served too, so its official SDK works by changing only its base URL, and features the OpenAI shape has no room for (prompt caching, thinking blocks) work:

PathForSDK base URL
POST /v1/messagesanthropic/… modelsAnthropic SDK: https://router.bridgedesktop.com
POST /v1beta/models/{model}:streamGenerateContent (and :generateContent)google/… modelsGoogle GenAI SDK: https://router.bridgedesktop.com
POST /v1/responsesOpenAI modelsOpenAI SDK: https://router.bridgedesktop.com/v1

Vendor-hosted tools billed outside token usage (server-side web search, code execution, stored conversation state) are refused with 400 feature_not_supported.

Usage

GET /v1/usage returns the key's account spend over the last 30 days (?days= up to 90) and the balance. It also returns account: the account's name and, for a Bridge server key, the email of the person who connected it. That email is null for a key made on the API keys page. The dashboard's Requests page shows every request with its model, tokens and cost.

Billing

Tokens are charged at each provider's list price, from your prepaid balance. The only fee is a 5.5% platform fee on top-ups, added on top of the credit ($100 of credit costs $105.50). There are no seats and no subscriptions; for Enterprise terms, email sales@bridgedesktop.com.

KeyMade byPaid from
API keyyou, on the API keys pagebalance
Bridge server keyConnect an account in Bridgebalance
Project keyBridge, for an app it builds (below)balance

An account that had a monthly plan before October 2026 keeps it until it is cancelled; only its Bridge server key is covered by it.

Give a key a spend cap when you make it. A key stops at its cap with 402 key_spend_cap_reached; the balance is the hard stop for every key.

Errors

Errors use the OpenAI envelope ({"error": {"code", "message", "type"}}) on OpenAI paths, and each vendor's own envelope on its native path.

StatusCodeMeaning
401missing_api_key, invalid_api_keyNo key, or a wrong or revoked one
402insufficient_creditTop up at accounts.bridgedesktop.com/billing
402key_spend_cap_reachedThis key reached its cap
402account_spend_limitThe account's monthly safety limit
403model_not_allowedThe key is limited to other models
403account_under_review, account_inactiveThe account is paused
429plan_limit_reachedA monthly-plan window is full (Bridge server keys on a legacy monthly plan only)
502all_routes_failedEvery provider for that model failed. The router fails over before sending any output, including when an upstream accepted the request and then failed before its first token; the message lists each attempt

Project keys

When the Bridge agent builds something that itself calls a model (a chatbot, a summariser, any AI feature), it can give that project its own key instead of asking you for a provider key. This needs the Project API keys flag on at /flags, and a Bridge account connected with Connect an account.

The agent's CreateProjectApiKey tool:

  1. asks the connected account for a new key, a child of this Bridge server's key (POST /v1/keys), capped at $5 unless the project sets otherwise;
  2. writes BRIDGE_API_KEY and BRIDGE_BASE_URL into the project's env file (.env by default) through the agent on that machine;
  3. adds the env file to .gitignore if it is not already covered.

The plaintext key goes from the account straight into the file. The model sees only a masked hint, so the key is never in the chat or the model provider's logs. A project keeps one key; asking again reuses it unless the agent is told to rotate.

A project key:

  • is always paid from the balance;
  • cannot make keys of its own;
  • dies with its Bridge server key: disconnecting a server on the dashboard revokes every project key under it;
  • is revoked when its project is deleted in Bridge.

Who can see what. The Bridge account is told only opaque ids for who made a key and for which project. The Bridge server keeps the names, and shows them to its owners and admins under Providers & Models, beside each key's spend. Each key also appears with a Revoke button in the chat that made it and on the project's settings (Models tab), where a project admin sets the cap. On the accounts dashboard they are listed, without names, under the Bridge server that made them.

Key endpoints

Only a Bridge server key may call these; any other key gets 403 cannot_mint. A key pasted into Bridge by hand is an ordinary API key, so project keys need the server connected with Connect an account.

MethodPathBodyReturns
POST/v1/keys{spendCapUsd, name?, attribution?, tag?, models?}{id, key, hint, spendCap}
GET/v1/keys{keys: [{id, name, hint, spendCapMicros, spentMicros, revoked, createdAt, lastUsedAt, attribution, tag}]}
DELETE/v1/keys/{id}{ok: true}

spendCapUsd is required, above 0 and at most 500. A parent may hold 500 active project keys.