<!-- GENERATED BY scripts/gen_markdown_twins.py; source: guides/litellm/index.html -->

# Use LiteLLM with Chinese AI models through ChinaAPI.

> Configure LiteLLM proxy and SDK with ChinaAPI's OpenAI-compatible endpoint for DeepSeek, Kimi, Qwen, GLM, and MiniMax models.

- Canonical page: https://chinaapi-ru.com/guides/litellm/
- Human-readable page: https://chinaapi-ru.com/guides/litellm/
- Live pricing: https://dash.chinaapi-ru.com/pricing?utm_source=chinaapi&utm_medium=markdown&utm_campaign=litellm

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.

[Start free — $2 credit](https://dash.chinaapi-ru.com/register?utm_source=chinaapi&utm_medium=web&utm_campaign=guide-litellm)

[Live model pricing](https://dash.chinaapi-ru.com/pricing)

## Before editing config.

### LiteLLM installed

Use either the LiteLLM proxy server or the Python SDK.

### ChinaAPI endpoint

Base URL is `https://api.chinaapi-ru.com/v1`. API keys are created under Dashboard -> Console -> Tokens.

## Use `openai/<model>` entries in `config.yaml`.

```
model_list:
  - model_name: deepseek-fast
    litellm_params:
      model: openai/deepseek-v4-flash
      api_base: https://api.chinaapi-ru.com/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-ru.com/v1
      api_key: os.environ/CHINAAPI_API_KEY

  - model_name: qwen-max
    litellm_params:
      model: openai/qwen3.7-max
      api_base: https://api.chinaapi-ru.com/v1
      api_key: os.environ/CHINAAPI_API_KEY
```

```
export CHINAAPI_API_KEY="sk-..."
litellm --config config.yaml --port 4000
```

## Call ChinaAPI directly from LiteLLM.

```
import os
from litellm import completion

response = completion(
    model="openai/deepseek-v4-flash",
    api_base="https://api.chinaapi-ru.com/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="")
```

## Good LiteLLM routes.

For current model details and rate evidence, review [DeepSeek-V4 Flash](https://chinaapi-ru.com/models/deepseek-v4-flash/) and [Kimi K2.7 Code](https://chinaapi-ru.com/models/kimi-k2.7-code/) before setting a production route.

### `deepseek-v4-flash`

Fast fallback route for chat, coding help, and agent loops.

### `kimi-k2.7-code`

Good coding route for repository-level tasks and longer sessions.

### `qwen3.7-max`

Reasoning-heavy route when quality matters more than latency.

### `glm-5.2`

Long-context route for larger documents and codebases.

### `MiniMax-M3`

Multimodal coding and long-context model for alternate routing.

## Common LiteLLM issues.

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](https://dash.chinaapi-ru.com/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.

## Use gateway-synchronized token pricing behind your LiteLLM gateway.

Rates may follow providers' official China list prices where configured. Register for $2 free credit, then check live pricing before routing production traffic.

[Register — $2 credit](https://dash.chinaapi-ru.com/register?utm_source=chinaapi&utm_medium=web&utm_campaign=guide-litellm)

[Live pricing](https://dash.chinaapi-ru.com/pricing)

---

Markdown twin of https://chinaapi-ru.com/guides/litellm/ — generated from its canonical HTML by scripts/gen_markdown_twins.py. Full site reference: https://chinaapi-ru.com/llms-full.txt
