API Documentation & Setup Guide
AI Bridge provides OpenAI and Anthropic compatible endpoints with automatic multi-provider fallback. Connect Claude Code, Claude Desktop, or custom applications in seconds.
Set the base_url parameter in any OpenAI SDK or compatible client to point to AI Bridge:
https://ai-bridge.up.railway.app/v1
Pass your AI Bridge API key via standard Bearer authorization header or x-api-key:
Authorization: Bearer bridge_YOUR_API_KEY
Select your language or tool to copy a ready-to-run request:
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
}'
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="")
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();
Claude Code uses the Anthropic Messages protocol (/v1/messages). AI Bridge translates requests dynamically and handles streaming reasoning, token counting, and tool execution.
Configure Claude Code permanently by editing its settings file. The file location depends on your operating system:
~/.claude/settings.json%USERPROFILE%\.claude\settings.json (or %APPDATA%\Claude\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"
}
}
/v1 to ANTHROPIC_BASE_URL; the Anthropic SDK appends /v1/messages automatically.
Alternatively, export variables in your shell (e.g. ~/.zshrc, ~/.bashrc, or PowerShell):
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"
Route Claude Desktop through AI Bridge as a custom gateway. Support MCP servers, local tools, function calling, and multi-provider failover without rate limits.
https://ai-bridge.up.railway.appStatic API Keybridge_YOUR_API_KEYx-api-key or BearerUse any of these model identifiers in the model parameter of your API calls:
| Model ID | Name | Provider Family |
|---|
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