Call it
curl https://api.unrestrictable.ai/v1/chat/completions \
-H "Authorization: Bearer sk-unr-live-…" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-6.1-sol","messages":[{"role":"user","content":"Hello"}]}'GPT and open-weight models.
curl https://api.unrestrictable.ai/v1/messages \
-H "x-api-key: sk-unr-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.
curl -X PATCH https://api.unrestrictable.ai/v1/keys/KEY_ID \
-H "Authorization: Bearer sk-unr-live-ADMIN" \
-H "Content-Type: application/json" \
-d '{"guardrails":{"blocked_patterns":[{"pattern":"project\\s+falcon","action":"block"}],"prompt_injection":"flag","tool_policy":{"deny":["shell"]}}}'Admin key. A block answers 400 guardrail_blocked and costs nothing.
from openai import OpenAI
client = OpenAI(base_url="https://api.unrestrictable.ai/v1", api_key="sk-unr-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
import anthropic
client = anthropic.Anthropic(base_url="https://api.unrestrictable.ai/v1", api_key="sk-unr-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
import OpenAI from 'openai';
const client = new OpenAI({ baseURL: 'https://api.unrestrictable.ai/v1', apiKey: 'sk-unr-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
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({ baseURL: 'https://api.unrestrictable.ai/v1', apiKey: 'sk-unr-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
from google import genai
client = genai.Client(api_key="sk-unr-live-…", http_options={"base_url": "https://api.unrestrictable.ai/v1"})
response = client.models.generate_content(model="gemini-3.5-flash", contents="Hello")
print(response.text)pip install google-genai
curl https://api.unrestrictable.ai/v1/chat/completions \
-H "Authorization: Bearer sk-unr-live-…" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-6.1-sol","models":["claude-sonnet-5-5","gemini-3.5-flash"],"messages":[{"role":"user","content":"Hello"}]}'Each model is tried in order once every route of the one before has failed; the one that answers is named in model and x-uplink-model, and billed at its own price.
curl https://api.unrestrictable.ai/v1/chat/completions \
-H "Authorization: Bearer sk-unr-live-…" \
-H "Content-Type: application/json" \
-d '{"model":"@preset/support-bot","messages":[{"role":"user","content":"Hello"}]}'A preset from the Presets page: its model, fallbacks, params, system prompt and tools, under your own fields.
curl https://api.unrestrictable.ai/v1/chat/completions \
-H "Authorization: Bearer sk-unr-live-…" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-6.1-sol","tools":[{"type":"web_search"},{"type":"web_fetch"}],"messages":[{"role":"user","content":"What changed in the latest Node.js release?"}]}'Web search, web fetch, code and remote MCP run inside the request.
curl https://api.unrestrictable.ai/v1/chat/completions \
-H "Authorization: Bearer sk-unr-live-…" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-6.1-sol:online","messages":[{"role":"user","content":"What changed in the latest Node.js release?"}]}'Add :online to any model id and web search is on, same fee per search, no tools field. SillyTavern, JanitorAI, Chub, Risu: Custom (OpenAI-compatible) endpoint, base URL above, key above, model gpt-6.1-sol:online.
from openai import OpenAI
client = OpenAI(base_url="https://api.unrestrictable.ai/v1", api_key="sk-unr-live-…")
vectors = client.embeddings.create(model="bge-m3", input=["first", "second"])
text = client.audio.transcriptions.create(model="whisper-large-v3-turbo", file=open("call.mp3", "rb"))
upload = client.files.create(file=open("requests.jsonl", "rb"), purpose="batch")
batch = client.batches.create(input_file_id=upload.id, endpoint="/v1/chat/completions", completion_window="24h")pip install openai
export ANTHROPIC_BASE_URL=https://api.unrestrictable.ai
export ANTHROPIC_AUTH_TOKEN=sk-unr-live-…
claudeEndpoints
- POST
/v1/chat/completionsOpenAI chat, streaming supported - POST
/v1/responsesOpenAI responses - POST
/v1/embeddingsOpenAI embeddings, billed per input token - POST
/v1/moderationsOpenAI moderation: passed to a moderation model (text-moderation-latest when none is named), OpenAI categories - POST
/v1/rerankRerank { model, query, documents, top_n }, best first. Per input token - POST
/v1/audio/transcriptionsSpeech to text, OpenAI multipart, 25 MB. Per audio minute, billed by the second - POST
/v1/audio/translationsSpeech to English text, same shape - POST
/v1/images/editsOpenAI image edits: image[] upload or image URLs, on the edit models - POST
/v1/filesUpload a batch file: JSONL, purpose=batch, 50 MB, 50,000 lines - POST
/v1/batchesRun a file within 24 h at the normal prices: { input_file_id, endpoint, completion_window: "24h" } - GET
/v1/batches/{batch_id}Status and request counts; output_file_id and error_file_id when done - POST
/v1/batches/{batch_id}/cancelStop the lines not started - GET
/v1/files/{file_id}/contentA batch file: the upload, or the output or error JSONL - 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/presetsYour presets and their recent changes. A console session or an admin key - POST
/v1/presetsCreate a preset: { name, model, models?, params?, system_prompt?, system_mode?, tools?, description? } - GET
/v1/presets/{name}One preset with its version history - PUT
/v1/presets/{name}Create or replace a preset; the old version is kept - DELETE
/v1/presets/{name}Delete a preset; requests naming it get 404 preset_not_found - GET
/v1/statements/public-keyThe Ed25519 key that signs your monthly statements, no key needed - GET
/v1/sessionsRequests grouped by x-session-id: count, models, cost, errors. Admin key or console - GET
/v1/sessions/{session_id}One session as a timeline, oldest first, with totals - GET
/v1/usage/export?from=&to=Your requests as CSV for a date range, up to 92 days - GET
/v1/exportsLog export to a signed webhook, Langfuse or an OTLP endpoint. POST, PATCH, DELETE with an admin key - PATCH
/v1/keys/{key_id}session_max_requests, session_max_spend_usd and loop_guard cap one session of a key - POST
/v1/auth/keysSign-in for apps: a PKCE code and its verifier for a key, no key needed - PATCH
/v1/guardrailsThe org default guardrails; a key takes its own as guardrails on PATCH /v1/keys/{id}. Admin key - GET
/v1/mcp-serversYour MCP servers for /mcp/org; POST, PATCH, DELETE. Admin key - POST
/mcp/orgOne MCP endpoint for every server you registered, tools as server__tool
Routing controls
models: [...]Up to 5 fallback model ids or aliases, tried in order after model (or alone, the first being the model). The key's allowlist applies to every one. A stream falls back only before its first byte.model: "@preset/<name>"Runs one of your presets; "@<name>" and "<model>@preset/<name>" work too, as does preset: "@preset/<name>" beside a model. Your own params, system prompt and tools win over the preset's.fallback_models (key)A key's default fallback list, set in its settings or with PATCH /v1/keys/{id}: used when a request names no models of its own.model: "auto"Picks a model per request from the tiers in GET /v1/catalog auto_router: reasoning asks, or tools with code, go to frontier; tools, code, images, JSON schemas or long prompts to balanced; the rest to fast. Billed at the chosen model's price.auto: {"tier_max": "balanced"}Caps the tier auto may pick.model: "auto/uncensored"A profile: auto/uncensored, auto/abliterated, auto/security (or auto/cyber) and auto/roleplay pick only from that profile's lists in GET /v1/catalog auto_router.profiles, each pick carrying the tag.auto_router (key)An auto router key: every chat request on it is sent as "auto" or "auto/<profile>", whatever model it names. Set it when creating the key or in its settings (PATCH /v1/keys/{id}).routing: "throughput"Route order for this request: price, latency or throughput. provider.sort takes the same values. Same price either way.
Response headers · on every reply
x-uplink-request-idQuote it when you write in.x-uplink-guardrailflagged: a flag-mode guardrail matched. tool_call_stripped: a denied tool call was taken out. blocked: on a 400 guardrail_blocked.x-uplink-modelThe model that answered, after any alias or fallback.x-uplink-aliasThe alias the request named.x-uplink-presetThe preset the request named.x-uplink-chargeWhat the request cost you, USD. Non-streamed responses only.x-uplink-list-costThe same tokens at the developer's list price, USD, when on record.x-uplink-savedList cost minus your charge. Streams: GET /v1/requests/{id} after they finish.x-uplink-validtrue or false: the answer matches the requested JSON or schema.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 unrestrictable.ai/statements/verify.x-uplink-autopilotThe requested model, 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 or throughput when the key or the request set that route order.x-uplink-auto-tierfast, balanced or frontier: the tier the auto router picked from. x-uplink-model names the model.x-uplink-cacheHIT, MISS or BYPASS when the request asked for the response cache. A HIT bills a tenth of the original charge.x-uplink-cache-source-idOn a HIT: the request that paid for the answer. x-uplink-cache-ttl and x-uplink-cache-age say how long it is kept.x-uplink-compressedMessages middle-out dropped to fit the model's context window.x-uplink-tool-callsServer tools: tool calls run in the request; x-uplink-tool-charge their fees, x-uplink-total-charge every round plus the fees.x-uplink-round-idsServer tools: each model round, billed and receipted on its own.
Server tools · in tools[]
web_search$0.01 a search. {"type":"web_search"} or web_search_preview; Anthropic web_search_20250305; allowed_domains, blocked_domains, max_uses. Or model "<id>:online" with no tools field.web_fetch$0.001 a fetch. {"type":"web_fetch"}; Anthropic web_fetch_20250910; public http(s) pages, 2 MB, max_content_tokens.code_execution$0.05 a container-hour, one minute at least a call. bash and javascript, no network, 60 s a run; session_id keeps its files.mcpNo fee beyond tokens. {"type":"mcp","server_label","server_url","headers","allowed_tools","require_approval":"never"}; Anthropic mcp_servers.max_tool_rounds1 to 8, default 8. With stream: true the final answer streams once the tools resolve. Prices: GET /v1/catalog server_tools.
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-session-id: <id>Groups requests into a session: the Sessions page, log exports, and the key's session caps and loop guard. With model "auto" the same model answers the session for 30 minutes from its last request. x-uplink-session, or session_id or user in the body, also names a session for everything but auto.x-uplink-cache: onAnswer an exact repeat of an earlier request from your account from the cache, streamed or not. x-uplink-cache-ttl: 60 to 86400 seconds, 300 by default; x-uplink-cache-clear: true asks the model again.transforms: ["middle-out"]A body field, not a header: a prompt longer than the model's context window loses whole messages from its middle until it fits. System messages, the first user message and the latest turn stay.x-uplink-app: <slug>Tags the request for an app registered on the Apps page. Its share accrues once the app is approved; the app's own organization does not count. Never changes what the caller pays.x-uplink-max-tool-rounds: <1-8>Server tools: the most tool rounds the request may run, as max_tool_rounds in the body.