AI Bridge

API Documentation & Setup Guide

Universal API Gateway

One Key. All Models. Endless Compatibility.

AI Bridge provides OpenAI and Anthropic compatible endpoints with automatic multi-provider fallback. Connect Claude Code, Claude Desktop, or custom applications in seconds.

01

Base URL

Set the base_url parameter in any OpenAI SDK or compatible client to point to AI Bridge:

base url
https://ai-bridge.up.railway.app/v1
02

Authentication

Pass your AI Bridge API key via standard Bearer authorization header or x-api-key:

header
Authorization: Bearer bridge_YOUR_API_KEY
03

Code Snippets

Select your language or tool to copy a ready-to-run request:

cURL (OpenAI Chat Completions)
bash
curl https://ai-bridge.up.railway.app/v1/chat/completions \
  -H "Authorization: Bearer bridge_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-sol",
    "messages": [{"role": "user", "content": "Hello AI Bridge!"}],
    "stream": true
  }'
Python (OpenAI SDK v1.0+)
python
from openai import OpenAI

client = OpenAI(
    base_url="https://ai-bridge.up.railway.app/v1",
    api_key="bridge_YOUR_API_KEY"
)

response = client.chat.completions.create(
    model="gpt-5.6-sol",
    messages=[{"role": "user", "content": "Hello AI Bridge!"}],
    stream=True
)

for chunk in response:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")
Node.js (TypeScript / JavaScript)
typescript
import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: 'https://ai-bridge.up.railway.app/v1',
  apiKey: 'bridge_YOUR_API_KEY',
});

async function main() {
  const stream = await openai.chat.completions.create({
    model: 'gpt-5.6-sol',
    messages: [{ role: 'user', content: 'Hello AI Bridge!' }],
    stream: true,
  });

  for await (const chunk of stream) {
    process.stdout.write(chunk.choices[0]?.delta?.content || '');
  }
}

main();
01

Claude Code CLI Integration

Claude Code uses the Anthropic Messages protocol (/v1/messages). AI Bridge translates requests dynamically and handles streaming reasoning, token counting, and tool execution.

Persistent Configuration (`settings.json`)

Configure Claude Code permanently by editing its settings file. The file location depends on your operating system:

  • macOS / Linux: ~/.claude/settings.json
  • Windows: %USERPROFILE%\.claude\settings.json (or %APPDATA%\Claude\settings.json)
settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://ai-bridge.up.railway.app",
    "ANTHROPIC_AUTH_TOKEN": "bridge_YOUR_API_KEY",
    "ANTHROPIC_MODEL": "gpt-5.6-sol"
  }
}
Note: Do not append /v1 to ANTHROPIC_BASE_URL; the Anthropic SDK appends /v1/messages automatically.
Environment Variables Alternative

Alternatively, export variables in your shell (e.g. ~/.zshrc, ~/.bashrc, or PowerShell):

bash / zsh
export ANTHROPIC_BASE_URL="https://ai-bridge.up.railway.app"
export ANTHROPIC_AUTH_TOKEN="bridge_YOUR_API_KEY"
export ANTHROPIC_MODEL="gpt-5.6-sol"
01

Claude Desktop & Custom Gateway Setup

Route Claude Desktop through AI Bridge as a custom gateway. Support MCP servers, local tools, function calling, and multi-provider failover without rate limits.

Custom Gateway Setup via Developer Mode
  1. Open the Claude Desktop app.
  2. In the top menu bar, click Help → Troubleshooting → Enable Developer Mode (or Settings → Developer). Acknowledge the prompt and restart the app.
  3. After restart, click the new Developer menu in the top menu bar.
  4. Select Configure Third-Party Inference (or Gateway).
  5. In the configuration dialog, choose Gateway and fill in:
    • Gateway Base URL: https://ai-bridge.up.railway.app
    • Credential Kind: Static API Key
    • API Key: bridge_YOUR_API_KEY
    • Auth Scheme: x-api-key or Bearer
  6. Click Test Connection, then save and launch with your custom gateway.
01

Available Public Models

Use any of these model identifiers in the model parameter of your API calls:

Model ID Name Provider Family
02

Error Codes & Statuses

AI Bridge uses standard HTTP status codes and OpenAI error objects for clean client error handling:

Status Error Code Description
401 invalid_api_key API key is missing, invalid, or disabled.
429 rate_limit_exceeded Quota exceeded (spend cap, rate limit, or concurrent requests).
400 invalid_request Invalid parameters or missing model identifier.
502 upstream_error Upstream provider failed.
503 service_unavailable Service unstable.

AI Bridge API Documentation · Updated August 2026