Call it · one snippet per SDK
curl · OpenAI format
curl https://api.uplinkswitch.com/v1/chat/completions \
-H "Authorization: Bearer sk-uplink-live-…" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-6.1-sol","messages":[{"role":"user","content":"Hello"}]}'GPT models and every open-weight model. Streaming with "stream": true.
curl · Anthropic format
curl https://api.uplinkswitch.com/v1/messages \
-H "x-api-key: sk-uplink-live-…" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-5-5","max_tokens":256,"messages":[{"role":"user","content":"Hello"}]}'Claude models use the Anthropic request shape and the x-api-key header.
Python · openai
from openai import OpenAI
client = OpenAI(base_url="https://api.uplinkswitch.com/v1", api_key="sk-uplink-live-…")
response = client.chat.completions.create(
model="gpt-6.1-sol",
messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)pip install openai
Python · anthropic
import anthropic
client = anthropic.Anthropic(base_url="https://api.uplinkswitch.com/v1", api_key="sk-uplink-live-…")
message = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=256,
messages=[{"role": "user", "content": "Hello"}],
)
print(message.content[0].text)pip install anthropic
TypeScript · openai
import OpenAI from 'openai';
const client = new OpenAI({ baseURL: 'https://api.uplinkswitch.com/v1', apiKey: 'sk-uplink-live-…' });
const completion = await client.chat.completions.create({
model: 'gpt-6.1-sol',
messages: [{ role: 'user', content: 'Hello' }],
});
console.log(completion.choices[0]?.message.content);npm install openai
TypeScript · @anthropic-ai/sdk
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({ baseURL: 'https://api.uplinkswitch.com/v1', apiKey: 'sk-uplink-live-…' });
const message = await client.messages.create({
model: 'claude-sonnet-5-5',
max_tokens: 256,
messages: [{ role: 'user', content: 'Hello' }],
});
console.log(message.content[0]);npm install @anthropic-ai/sdk
Python · google-genai
from google import genai
client = genai.Client(api_key="sk-uplink-live-…", http_options={"base_url": "https://api.uplinkswitch.com/v1"})
response = client.models.generate_content(model="gemini-3.5-flash", contents="Hello")
print(response.text)pip install google-genai
Claude Code
export ANTHROPIC_BASE_URL=https://api.uplinkswitch.com
export ANTHROPIC_AUTH_TOKEN=sk-uplink-live-…
claudeTwo environment variables. Claude Code sends the key as a bearer token.
Endpoints
- POST
/v1/chat/completionsOpenAI chat, streaming supported - POST
/v1/responsesOpenAI responses - POST
/v1/embeddingsOpenAI embeddings - POST
/v1/messagesAnthropic messages, streaming supported - POST
/v1beta/models/{model}:generateContentGemini - POST
/v1beta/models/{model}:streamGenerateContentGemini, streaming - GET
/v1/modelsEvery model your key can call, plus your aliases - GET
/v1/catalogThe public price list, no key needed - GET
/v1/requests/{request_id}One request: tokens, charge, list price and saving. Any key of your org - GET
/v1/requests/{request_id}/receiptThe signed receipt for any request, streams included - POST
/v1/estimateCost on every model before sending: { prompt or input_tokens, output_tokens }. Key optional - GET
/v1/statements/public-keyThe Ed25519 key that signs your monthly statements, no key needed
Response headers · on every reply
x-uplink-request-idQuote it when you write in; it finds the exact call.x-uplink-modelThe model that answered, after any alias.x-uplink-aliasThe alias the request named, when it named one.x-uplink-chargeWhat the request cost you, USD. On non-streamed responses.x-uplink-list-costThe same tokens at the developer's list price, USD, where one is on record.x-uplink-savedList cost minus your charge. Streams: GET /v1/requests/{id} after they finish.x-uplink-validtrue or false: whether the answer matches the JSON or schema the request asked for.x-uplink-refundrefusal or invalid_output: this answer was not billed.x-uplink-receiptSigned: the model that answered, what was billed, and hashes of the request and response. Check it at uplinkswitch.ai/statements/verify.x-uplink-autopilotThe model the request asked for, when the key's budget autopilot answered with its cheaper model near the monthly limit.x-uplink-crowd-cacheon when the gateway cached a large system prompt that many accounts send. Cached reads bill at the cached rate; the cache write bills as plain input.x-uplink-wasteThe share of the request that repeated earlier text or was pasted base64, when it is 10% or more.x-uplink-routingfastest when the key is set to fastest routing.
Request headers · optional
x-uplink-require: jsonBill only an answer that parses as JSON. A miss is retried once and not billed. A JSON schema or JSON mode in the request does the same.x-uplink-crowd-cache: offLeave this request out of shared prompt caching: no cache breakpoint is added and its system prompt is not counted.x-uplink-app: <slug>Tags the request for an app registered on the Apps page. Its share accrues to the app once approved; requests from the app's own organization do not count, and the header never changes what the caller pays.