Checked 2026-10-28

LiteLLM on one prepaid key

Give LiteLLM one RelaySwitch API key instead of an account per provider: the SDK and the proxy both reach Claude, GPT, Gemini and the open models through https://api.relayswitch.io/v1, billed per token from a balance you top up by card or crypto.

A LiteLLM API key setup normally means one key per provider and a billing account behind each. With RelaySwitch it is one key: prefix the model id with openai/, set api_base to https://api.relayswitch.io/v1, and LiteLLM treats the whole catalog as one OpenAI-compatible endpoint. Every model bills the same prepaid balance at the per-token price on its model page.

This guide covers both ways people run LiteLLM: the Python SDK call, and the proxy with a config.yaml that other tools point at. The config block is generated from the live catalog, so the ids in it exist today. The field names follow LiteLLM's OpenAI-compatible provider docs (read 2026-10-28).

01What you need

  • Python 3.10 or newer with LiteLLM installed. The SDK and the proxy are separate extras:
    bash
    1pip install litellm # the SDK
    2pip install 'litellm[proxy]' # the proxy server
  • A RelaySwitch key. Sign in with an email code at the console and create one. Keys start with sk-relay-. Export it as RELAYSWITCH_API_KEY; both code blocks below read it from there.
  • A balance. Top-ups start at $10 by Card or in USDT, USDC, BTC, ETH, SOL. Pay as you go, no subscription, no KYC. The console chat gives you 12 free turns a day before the first top-up; LiteLLM requests bill the balance.

02LiteLLM API key setup in the SDK

The SDK needs three things per call: the model id behind openai/, the base URL and the key. LiteLLM's docs say the openai/ prefix routes to /chat/completions on whatever api_base you give it, and that api_base should end in /v1.

python
1import os
2import litellm
3
4response = litellm.completion(
5 model="openai/claude-sonnet-5-5", # openai/ = any OpenAI-compatible endpoint
6 api_base="https://api.relayswitch.io/v1",
7 api_key=os.environ["RELAYSWITCH_API_KEY"],
8 messages=[{"role": "user", "content": "Say ok."}],
9)
10print(response.choices[0].message.content)

Claude ids answer the OpenAI format here, so openai/claude-sonnet-5-5 is correct even though the model is Anthropic's. There is no anthropic/ prefix to set and no second key. To change models, change the id after the prefix; the key and base stay.

03The proxy: config.yaml model_list

The proxy maps a client-facing model_name to a litellm_params block with the real target. The os.environ/RELAYSWITCH_API_KEY value tells LiteLLM to read the key from the environment at start, so the file holds no secret. drop_params under litellm_settings makes the proxy drop a parameter a model rejects instead of failing the request (drop_params docs, read 2026-10-28).

yaml
1model_list:
2 - model_name: claude-sonnet-5-5
3 litellm_params:
4 model: openai/claude-sonnet-5-5
5 api_base: https://api.relayswitch.io/v1
6 api_key: os.environ/RELAYSWITCH_API_KEY
7 - model_name: claude-opus-5-5
8 litellm_params:
9 model: openai/claude-opus-5-5
10 api_base: https://api.relayswitch.io/v1
11 api_key: os.environ/RELAYSWITCH_API_KEY
12 - model_name: gpt-6.1-sol
13 litellm_params:
14 model: openai/gpt-6.1-sol
15 api_base: https://api.relayswitch.io/v1
16 api_key: os.environ/RELAYSWITCH_API_KEY
17 - model_name: gemini-4-argon
18 litellm_params:
19 model: openai/gemini-4-argon
20 api_base: https://api.relayswitch.io/v1
21 api_key: os.environ/RELAYSWITCH_API_KEY
22 - model_name: deepseek-v4-pro
23 litellm_params:
24 model: openai/deepseek-v4-pro
25 api_base: https://api.relayswitch.io/v1
26 api_key: os.environ/RELAYSWITCH_API_KEY
27 - model_name: glm-5.3
28 litellm_params:
29 model: openai/glm-5.3
30 api_base: https://api.relayswitch.io/v1
31 api_key: os.environ/RELAYSWITCH_API_KEY
32
33litellm_settings:
34 drop_params: true

Export the key and start the proxy:

bash
1export RELAYSWITCH_API_KEY="sk-relay-..."
2litellm --config config.yaml
3# Proxy running on http://0.0.0.0:4000

Then any OpenAI-compatible client talks to the proxy. The quick start (read 2026-10-28) uses a placeholder api_key on the client; the proxy adds the real key from the config.

python
1import openai
2
3client = openai.OpenAI(api_key="anything", base_url="http://0.0.0.0:4000")
4response = client.chat.completions.create(
5 model="claude-sonnet-5-5", # the model_name alias from config.yaml
6 messages=[{"role": "user", "content": "Say ok."}],
7)
8print(response.choices[0].message.content)

If the proxy is reachable by anyone but you, set general_settings.master_key (it must start with sk-) and clients send that as their key. See LiteLLM's virtual keys page (read 2026-10-28); the full config reference is on the proxy config page.

04Which model ids to use

Any id on the Models page works after openai/. The id is the slug in the model page URL, not the display name. The 6 in the config above cover the usual spread:

model_nameModelContext
claude-sonnet-5-5Claude Sonnet 5.51,000,000
claude-opus-5-5Claude Opus 5.51,000,000
gpt-6.1-solGPT-6.1 Sol1,050,000
gemini-4-argonGemini 4 Argon1,048,576
deepseek-v4-proDeepSeek V4 Pro 04231,048,576
glm-5.3GLM 5.31,000,000

Context in tokens, read from the live catalog when this page was built.

GET https://api.relayswitch.io/v1/models with your key returns every id it can call, which is the list to generate a longer model_list from.

05Price per token

LiteLLM's own cost tracking multiplies tokens by the developer list prices in its model map. The charge here is the RelaySwitch rate, which the console's Usage page shows per request. These are the live rates for the models in the config:

ModelInputCachedOutputDeveloper list in / out
Claude Sonnet 5.5$1.20 (40% under)$0.075$3.00 (70% under)$2.00 / $10.00
Claude Opus 5.5$2.80 (30% under)$0.15$10.00 (50% under)$4.00 / $20.00
GPT-6.1 Sol$0.60 (70% under)$0.06$3.00 (70% under)$2.00 / $10.00
Gemini 4 Argon$0.60 (70% under)$0.06$3.00 (70% under)$2.00 / $10.00
DeepSeek V4 Pro 0423$0.792 (40% under)$0.0264$2.376 (40% under)$1.32 / $3.96
GLM 5.3$0.3276 (70% under)$0.068$1.0296 (70% under)$1.092 / $3.432

USD per million tokens, read from the RelaySwitch catalog when this page was built. Developer list: the catalog's record of the developer's own price.

One chat turn of 2,000 input tokens and 500 output tokens costs $0.0012 on GLM 5.3 and $0.0106 on Claude Opus 5.5 at those rates. How the balance and the cached rate work is on Pricing.

06Check the key before LiteLLM

Two curl calls separate a key or base URL problem from a LiteLLM one. The first lists the ids your key can call:

bash
1curl https://api.relayswitch.io/v1/models -H "Authorization: Bearer $RELAYSWITCH_API_KEY"

The second sends one request the way LiteLLM does. -i prints the headers, including the request id and, on a non-streamed answer, the charge in USD.

bash
1curl -i https://api.relayswitch.io/v1/chat/completions \
2 -H "Authorization: Bearer $RELAYSWITCH_API_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{"model": "claude-sonnet-5-5", "messages": [{"role": "user", "content": "Say ok."}]}'

If both work, what is left is in the LiteLLM call or config. Send one request through LiteLLM and it shows on the console's Usage page within seconds, with its tokens and its charge.

07Errors and fixes

  • LLM Provider NOT provided: the openai/ prefix is missing from the model string.
  • NotFoundError with no model code: api_base is missing /v1 or carries an extra path. LiteLLM adds /chat/completions itself.
  • 401: the key is wrong, revoked or cut short, or RELAYSWITCH_API_KEY was not exported in the shell that started the proxy. Paste it again and run the curl check.
  • 402: the balance is too low for the request. Top up in the console; the key works again at once.
  • 404 with a model code: the id after openai/ is not in the catalog. Check for a typo or a display name in place of the id.
  • 429: the key hit its rate limit. Wait and resend, or create a key with a higher Requests / min in the console.
  • A parameter error on one model only: set drop_params: true as in the config above, or pass drop_params=True to that completion() call.

Questions

Does LiteLLM work with an OpenAI-compatible API key?
Yes. Prefix the model id with openai/ and pass api_base and api_key. LiteLLM then sends the request to https://api.relayswitch.io/v1/chat/completions with your RelaySwitch key.
What api_base does LiteLLM need for a custom model?
https://api.relayswitch.io/v1, with the /v1 at the end and nothing after it. LiteLLM appends the endpoint path itself.
Can I use Claude through LiteLLM with this key?
Yes. The Claude ids on RelaySwitch answer the OpenAI format, so openai/claude-sonnet-5-5 works with no Anthropic key and no anthropic/ prefix.
How do I keep the key out of the LiteLLM proxy config file?
Write api_key: os.environ/RELAYSWITCH_API_KEY in config.yaml and export RELAYSWITCH_API_KEY before starting the proxy. LiteLLM reads the variable at start.
How do I pay for the key?
Top up a balance in the console from $10 by Card or in USDT, USDC, BTC, ETH, SOL. Each request draws from it at the live per-token price. No subscription, no KYC.
Why does LiteLLM show a different cost from the console?
LiteLLM multiplies tokens by the developer list prices in its own model map. The console Usage page shows the RelaySwitch charge, which is what the balance pays.

One key behind LiteLLM

Prepaid from $10 by card or crypto. Pay as you go, no subscription, no KYC.