All guides

One API key for multiple LLM providers: four approaches compared

To call models from several vendors with one key and one base URL, there are four common approaches: a hosted router such as OpenRouter, a self-hosted open-source proxy such as LiteLLM, a hosted gateway such as Portkey, and a prepaid gateway such as XHuoAPI. All four are OpenAI-compatible and all four can be used with Claude Code; they differ in how they are deployed, whose provider keys they use, and how you pay. XHuoAPI is this site.

Third-party data checked:

Side by side

TypeProvider keys and accountsHow you payAPI formats
OpenRouter
source
Hosted router; routes across providers with automatic fallbackOne OpenRouter key and one credit balance; you can also bring your own provider keys (BYOK)Model prices are passed through from providers; a fee is charged on credit purchases (5.5% on the Standard plan). BYOK is free up to $25,000 of list-price usage per month, then 5%OpenAI (chat/completions, responses); Anthropic-format base URL https://openrouter.ai/api
LiteLLM Proxy
source
Open-source gateway you deploy yourself (Docker, Helm and others), with an admin UIYou open an account and get a key with each provider and add them to the gateway; the gateway issues virtual keys per user or teamThe open-source version is free; you pay each provider directly, plus your own hosting. Enterprise features are paidOpenAI; Claude Code can point ANTHROPIC_BASE_URL at the gateway
Portkey
source
Hosted gateway (an open-source self-hosted version also exists), focused on logging, guardrails and team controls; now part of Palo Alto Networks' Prisma AIRS AI GatewayYou supply the provider keys and Portkey stores and manages themDeveloper plan free (10k logged requests per month); Production plan $49/month; you pay each provider directly for modelsOpenAI; Anthropic-format base URL https://api.portkey.ai
XHuoAPI
Pricing
Hosted gateway (this site); 82 models, including DeepSeek, Qwen, GLM, Kimi, GPT, Claude and GeminiOne key and one balance; no account with each vendor, and sign-up needs only an email address, no Chinese phone numberPrepaid, $5 minimum, no subscription; each model has a listed price per tier (Standard, Saver, Spot, Official); new accounts start with $0.50 of creditOpenAI (chat/completions) and Anthropic (/v1/messages), both tested; for Claude Code set ANTHROPIC_BASE_URL to https://api.xhuoapi.ai

In practice: change only the model field

All four work the same way in code: the base URL and key stay the same and you switch models by changing model. Below is the XHuoAPI version; all three models passed our tests in coding tools.

curl https://api.xhuoapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $XHUOAPI_KEY" -H "Content-Type: application/json" \
  -d '{"model": "deepseek-v4.1-flash-1017", "messages": [{"role": "user", "content": "Hello"}]}'

curl https://api.xhuoapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $XHUOAPI_KEY" -H "Content-Type: application/json" \
  -d '{"model": "qwen3.8-max", "messages": [{"role": "user", "content": "Hello"}]}'

curl https://api.xhuoapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $XHUOAPI_KEY" -H "Content-Type: application/json" \
  -d '{"model": "glm-5.3", "messages": [{"role": "user", "content": "Hello"}]}'

How to choose

Also check

Related

Use XHuoAPI in Claude Code DeepSeek vs Qwen vs GLM: API prices, official and XHuoAPI Chinese models in coding agents: test results OpenAI-compatible gateways for Chinese AI models: what four platforms actually list DeepSeek vs Qwen vs GLM price comparison Pricing About XHuoAPI
Sign up and create an API key