RouterHubDocs Back to RouterHub Get an API key

RouterHub API documentation

One API key for 26 models, on OpenAI- and Anthropic-compatible endpoints. Pick your tool for step-by-step setup, or call the API directly.

Set up your tool

Use the API directly

You need an account, credits and an API key. Save the key as ROUTERHUB_API_KEY.

Base URLhttps://routerhub.si/v1

Responses (/v1/responses) · cURL

curl --connect-timeout 30 --max-time 600 https://routerhub.si/v1/responses \
  -H "Authorization: Bearer $ROUTERHUB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6.1-sol","input":"Reply with OK.","max_output_tokens":256}'

Responses (/v1/responses) · Python

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["ROUTERHUB_API_KEY"],
    base_url="https://routerhub.si/v1",
    timeout=600.0,
    max_retries=0,
)
response = client.responses.create(
    model="gpt-6.1-sol",
    input="Reply with OK.",
    max_output_tokens=256,
)
print(response.output_text)

Messages (/v1/messages) · cURL

curl --connect-timeout 30 --max-time 600 https://routerhub.si/v1/messages \
  -H "x-api-key: $ROUTERHUB_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-5-5","max_tokens":256,"messages":[{"role":"user","content":"Reply with OK."}]}'

Messages (/v1/messages) · Python

import os
from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ["ROUTERHUB_API_KEY"],
    base_url="https://routerhub.si",
    timeout=600.0,
    max_retries=0,
)
response = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=256,
    messages=[{"role": "user", "content": "Reply with OK."}],
)
print(response.content)

Chat Completions (/v1/chat/completions) · cURL

curl --connect-timeout 30 --max-time 600 https://routerhub.si/v1/chat/completions \
  -H "Authorization: Bearer $ROUTERHUB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4-pro","messages":[{"role":"user","content":"Reply with OK."}],"max_tokens":256}'

Chat Completions (/v1/chat/completions) · Python

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["ROUTERHUB_API_KEY"],
    base_url="https://routerhub.si/v1",
    timeout=600.0,
    max_retries=0,
)
response = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[{"role": "user", "content": "Reply with OK."}],
    max_tokens=256,
)
print(response.choices[0].message.content)

Each model uses one of these three APIs; its model page says which. The examples use GPT-6.1 Sol, Claude Sonnet 5.5 and DeepSeek V4 Pro. PowerShell versions are in the API request guide.

Keys and billing

API keys

Create keys in API keys and copy the full value when it is shown. Your password is not an API key. Keep filled-in config files out of source control.

Credits

Each request reserves its maximum cost from your prepaid balance before it runs, and the unused part is returned afterwards. If a request is refused, lower the output limit or add credits. Every charge appears in Usage.

For agents and scripts: quickstart.md, openapi.json, llms.txt.