LiteLLM → AI24X
LiteLLM unifies many LLM providers behind one SDK/proxy. Register AI24X as an OpenAI-compatible endpoint and call flash/pro with one key.
1) Prerequisites
Sign up → Console → create an API key → keep a small credit balance. Python with litellm installed, or a LiteLLM proxy.
2) Python SDK
Use openai/pro the same way. VIP ids: openai/vip-kimi (membership required).
3) Proxy config.yaml
Set AI24X_API_KEY in the proxy environment, then call your LiteLLM proxy as usual.
4) Pitfalls
- Prefix models with
openai/so LiteLLM uses the OpenAI-compatible driver. api_baseends at/v1—do not append/chat/completions.- 401 = bad or truncated key; 402 = top up in Console. Paste the full key.
Verify the endpoint before debugging LiteLLM
When a LiteLLM call fails, separate the two layers first: prove the AI24X endpoint works on its own, then look at LiteLLM. A one-line request from the curl guide takes ten seconds and tells you whether the key and the base URL are right.
If curl succeeds but LiteLLM does not, the cause is almost always the model prefix or the api_base value, not the key.
Choosing a tier
Expose the tier you need as a LiteLLM model_name. Map flash for high-volume steps such as classification, extraction and routing, and pro for calls that genuinely need deeper reasoning or a longer context. Named VIP models use a vip- prefix, for example vip-kimi, and only resolve once VIP access is active on the account.
Each entry in config.yaml is independent, so you can point part of your traffic at AI24X and keep the rest on other providers while you evaluate — no all-or-nothing migration.
Troubleshooting order
- Reproduce the request with curl against
https://api.ai24x.com/v1. - Confirm every model string starts with
openai/. - Confirm
api_basestops at/v1and is not doubled up. - Confirm the key is visible to the environment the proxy actually runs in — a proxy started from another shell will not see it.
- Read the proxy log for the exact HTTP status before changing configuration.
Gateway guides: What is an AI gateway · OpenAI-compatible API · Pricing · Start free