Developers
Swap one base URL
Relay speaks the OpenAI and Anthropic APIs verbatim. Point your existing SDK, coding agent, or curl script at the endpoint below and keep everything else.
Quickstart
Base URL for OpenAI-compatible calls: https://ai-gateway.getborg.com/api/v1/proxy/v1. Model ids match the gateway catalog on /models/ — copy the exact id shown there for each model.
curl https://ai-gateway.getborg.com/api/v1/proxy/v1/chat/completions \ -H "Authorization: Bearer $RELAY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "glm-5.3", "messages": [{ "role": "user", "content": "Explain vector search in one paragraph." }] }'from openai import OpenAI client = OpenAI( base_url="https://ai-gateway.getborg.com/api/v1/proxy/v1", api_key="$RELAY_API_KEY",) resp = client.chat.completions.create( model="glm-5.3", messages=[{"role": "user", "content": "Explain vector search in one paragraph."}],) print(resp.choices[0].message.content)import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://ai-gateway.getborg.com/api/v1/proxy/v1", apiKey: process.env.RELAY_API_KEY,}); const resp = await client.chat.completions.create({ model: "glm-5.3", messages: [{ role: "user", content: "Explain vector search in one paragraph." }],}); console.log(resp.choices[0].message.content);import anthropic client = anthropic.Anthropic( base_url="https://ai-gateway.getborg.com/api/v1/proxy", api_key="$RELAY_API_KEY",) msg = client.messages.create( model="glm-5.3", max_tokens=1024, messages=[{"role": "user", "content": "Explain vector search in one paragraph."}],) print(msg.content)Authentication
Every request authenticates with an API key created in the console using the standard Authorization: Bearer header.
# Authenticate with a Bearer token. curl https://ai-gateway.getborg.com/api/v1/proxy/v1/chat/completions \ -H "Authorization: Bearer $RELAY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "glm-5.3", "messages": [...] }'Coding agents
Set these environment variables once and the agent routes every call through Relay — no config file changes.
export ANTHROPIC_BASE_URL="https://ai-gateway.getborg.com/api/v1/proxy"export ANTHROPIC_AUTH_TOKEN="$RELAY_API_KEY"export ANTHROPIC_MODEL="glm-5.3"export OPENAI_BASE_URL="https://ai-gateway.getborg.com/api/v1/proxy/v1"export OPENAI_API_KEY="$RELAY_API_KEY"// Cursor > Settings > Models > OpenAI API Key// Base URL:https://ai-gateway.getborg.com/api/v1/proxy/v1// API Key:$RELAY_API_KEYImages
Image generation is not available on Relay yet. We’ll publish the supported model, price, and quickstart at /images/when it is ready.
Errors
Two error codes matter in day-to-day use. Everything else follows the standard HTTP + JSON error body shape.
| Code | Name | What it means |
|---|---|---|
| 402 | insufficient_balance | Your prepaid balance is at or below $0. Top up in the console — the request is rejected before it reaches any model provider, so you are never charged for it. |
| 429 | concurrency_limit | Your account has more than 8 in-flight requests across its API keys. Retry with backoff, or contact us to raise your account concurrency cap. |