LiteLLM installed
Use either the LiteLLM proxy server or the Python SDK.
Request pricing
LiteLLM integration
Add ChinaAPI as an OpenAI-compatible backend in LiteLLM proxy or the Python SDK, then route applications to official-price Chinese models with one key.
Prerequisites
Use either the LiteLLM proxy server or the Python SDK.
Base URL is https://dash.chinaapi.ai/v1. API keys are created under Dashboard -> Console -> Tokens.
Proxy setup
openai/<model> entries in config.yaml.model_list:
- model_name: deepseek-fast
litellm_params:
model: openai/deepseek-v4-flash
api_base: https://dash.chinaapi.ai/v1
api_key: os.environ/CHINAAPI_API_KEY
- model_name: kimi-code
litellm_params:
model: openai/kimi-k2.7-code
api_base: https://dash.chinaapi.ai/v1
api_key: os.environ/CHINAAPI_API_KEY
- model_name: qwen-max
litellm_params:
model: openai/qwen3.7-max
api_base: https://dash.chinaapi.ai/v1
api_key: os.environ/CHINAAPI_API_KEY
export CHINAAPI_API_KEY="sk-..."
litellm --config config.yaml --port 4000
Python SDK
import os
from litellm import completion
response = completion(
model="openai/deepseek-v4-flash",
api_base="https://dash.chinaapi.ai/v1",
api_key=os.environ["CHINAAPI_API_KEY"],
messages=[{"role": "user", "content": "Say LiteLLM is connected to ChinaAPI."}],
stream=True,
)
for chunk in response:
print(chunk, end="")
Recommended models
deepseek-v4-flashFast fallback route for chat, coding help, and agent loops.
kimi-k2.7-codeGood coding route for repository-level tasks and longer sessions.
qwen3.7-maxReasoning-heavy route when quality matters more than latency.
glm-5.2Long-context route for larger documents and codebases.
MiniMax-M3Multimodal coding and long-context model for alternate routing.
Troubleshooting
Thinking models such as qwen3.7-max can generate reasoning tokens before final output. Use streaming in clients behind LiteLLM or raise upstream/client timeouts.
Model not found: check the exact model ID on live pricing, then update litellm_params.model. Keep the openai/ prefix for OpenAI-compatible routing.
401: confirm CHINAAPI_API_KEY resolves to an sk-... key and LiteLLM is passing it as the provider API key.
Pricing and signup
Register for $1 free credit, then check live pricing before routing production traffic.