LiteLLM installed
Use either the LiteLLM proxy server or the Python SDK.
LiteLLM integration
Add ChinaAPI as an OpenAI-compatible backend in LiteLLM proxy or the Python SDK, then route applications to Chinese models with one key.
Prerequisites
Use either the LiteLLM proxy server or the Python SDK.
Base URL is https://api.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-flash
api_base: https://api.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://api.chinaapi.ai/v1
api_key: os.environ/CHINAAPI_API_KEY
- model_name: qwen-max
litellm_params:
model: openai/qwen3.7-max
api_base: https://api.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-flash",
api_base="https://api.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
For current model details and rate evidence, review DeepSeek-V4 Flash and Kimi K2.7 Code before setting a production route.
deepseek-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
Standard model rates follow providers' international list prices at 100%; some models have a separate Paid rate after the first top-up. Register for $2 free credit, then check live pricing before routing production traffic.