---
title: "LiteLLM API key setup: one prepaid key"
canonical: https://relayswitch.io/guides/litellm
generated: 2026-11-02T10:50:31.792Z
source: https://api.relayswitch.io/v1/catalog
base_url: https://api.relayswitch.io/v1
---

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](https://relayswitch.io/models).

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](https://docs.litellm.ai/docs/providers/openai_compatible) (read 2026-10-28).

## 01What you need

-   Python 3.10 or newer with LiteLLM installed. The SDK and the proxy are separate extras:
    
    bash
    
    1`pip install litellm # the SDK`
    
    2`pip install 'litellm[proxy]' # the proxy server`
    
-   A RelaySwitch key. Sign in with an email code at the [console](https://app.relayswitch.io/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

1`import os`

2`import litellm`

3

4`response = 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`)`

10`print(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](https://docs.litellm.ai/docs/completion/drop_params), read 2026-10-28).

yaml

1`model_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

33`litellm_settings:`

34 `drop_params: true`

Export the key and start the proxy:

bash

1`export RELAYSWITCH_API_KEY="sk-relay-..."`

2`litellm --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](https://docs.litellm.ai/docs/proxy/quick_start) (read 2026-10-28) uses a placeholder `api_key` on the client; the proxy adds the real key from the config.

python

1`import openai`

2

3`client = openai.OpenAI(api_key="anything", base_url="http://0.0.0.0:4000")`

4`response = 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`)`

8`print(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](https://docs.litellm.ai/docs/proxy/virtual_keys) (read 2026-10-28); the full config reference is on the [proxy config page](https://docs.litellm.ai/docs/proxy/configs).

## 04Which model ids to use

Any id on the [Models page](https://relayswitch.io/models) 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\_name | Model | Context |
| --- | --- | --- |
| `claude-sonnet-5-5` | [Claude Sonnet 5.5](https://relayswitch.io/models/claude-sonnet-5-5) | 1,000,000 |
| `claude-opus-5-5` | [Claude Opus 5.5](https://relayswitch.io/models/claude-opus-5-5) | 1,000,000 |
| `gpt-6.1-sol` | [GPT-6.1 Sol](https://relayswitch.io/models/gpt-6.1-sol) | 1,050,000 |
| `gemini-4-argon` | [Gemini 4 Argon](https://relayswitch.io/models/gemini-4-argon) | 1,048,576 |
| `deepseek-v4-pro` | [DeepSeek V4 Pro 0423](https://relayswitch.io/models/deepseek-v4-pro) | 1,048,576 |
| `glm-5.3` | [GLM 5.3](https://relayswitch.io/models/glm-5.3) | 1,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:

| Model | Input | Cached | Output | Developer list in / out |
| --- | --- | --- | --- | --- |
| [Claude Sonnet 5.5](https://relayswitch.io/models/claude-sonnet-5-5) | $1.20 (40% under) | $0.075 | $3.00 (70% under) | $2.00 / $10.00 |
| [Claude Opus 5.5](https://relayswitch.io/models/claude-opus-5-5) | $2.80 (30% under) | $0.15 | $10.00 (50% under) | $4.00 / $20.00 |
| [GPT-6.1 Sol](https://relayswitch.io/models/gpt-6.1-sol) | $0.60 (70% under) | $0.06 | $3.00 (70% under) | $2.00 / $10.00 |
| [Gemini 4 Argon](https://relayswitch.io/models/gemini-4-argon) | $0.60 (70% under) | $0.06 | $3.00 (70% under) | $2.00 / $10.00 |
| [DeepSeek V4 Pro 0423](https://relayswitch.io/models/deepseek-v4-pro) | $0.792 (40% under) | $0.0264 | $2.376 (40% under) | $1.32 / $3.96 |
| [GLM 5.3](https://relayswitch.io/models/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](https://relayswitch.io/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

1`curl 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

1`curl -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.

Related

-   [All guides](https://relayswitch.io/guides)
-   [OpenAI and Anthropic SDKs](https://relayswitch.io/guides/sdks)
-   [Open WebUI](https://relayswitch.io/guides/open-webui)
-   [Models and prices](https://relayswitch.io/models)
-   [How pricing works](https://relayswitch.io/pricing)
-   [Pay by card or crypto](https://relayswitch.io/pay-with-crypto)
-   [Docs](https://relayswitch.io/docs)

## One key behind LiteLLM

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

[Models](https://relayswitch.io/models)[Get a key](https://app.relayswitch.io/console)

