# LiteLLM

> Call this platform from the LiteLLM SDK with the openai/ or anthropic/ prefix plus api_base, and configure LiteLLM Proxy's config.yaml

Source: https://qd.zsopc.com/en/docs/integrations/litellm

> [LiteLLM](https://docs.litellm.ai) is a Python SDK that unifies calls to many model vendors, and it can also run as an OpenAI-compatible proxy. These steps were checked against the official docs for LiteLLM 1.109.1 (released 2026-11-12).

## Get an API key

Create one at [qd.zsopc.com/dashboard/keys](https://qd.zsopc.com/dashboard/keys). The examples read it from an environment variable:

```bash
export PLATFORM_API_KEY="sk-gpushare-xxx"
```

## SDK

Prefix the model with `openai/` and LiteLLM calls it as an OpenAI-compatible endpoint; `api_base` needs `/v1`:

```python
import os
import litellm

resp = litellm.completion(
    model="openai/gpt-6.1-sol",          # openai/ followed by a model ID from this platform
    api_base="https://qd.zsopc.com/v1",
    api_key=os.environ["PLATFORM_API_KEY"],
    messages=[{"role": "user", "content": "Introduce yourself in one sentence"}],
)
print(resp.choices[0].message.content)
```

The `openai/` prefix takes any text model here (`openai/claude-sonnet-4-6`, `openai/gemini-3.1-pro-low`, `openai/deepseek-v4.1-flash` …); the gateway translates the protocol for non-OpenAI models.

To send Claude over the native Anthropic protocol, use the `anthropic/` prefix with an `api_base` **without** `/v1` (LiteLLM adds `/v1/messages` itself):

```python
resp = litellm.completion(
    model="anthropic/claude-sonnet-4-6",
    api_base="https://qd.zsopc.com",
    api_key=os.environ["PLATFORM_API_KEY"],
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
```

The Responses API works too:

```python
resp = litellm.responses(
    model="openai/gpt-6.1-sol",
    input="Hello",
    api_base="https://qd.zsopc.com/v1",
    api_key=os.environ["PLATFORM_API_KEY"],
)
```

## Proxy

`config.yaml`:

```yaml
model_list:
  - model_name: gpt-6.1-sol             # the name clients use when calling the proxy
    litellm_params:
      model: openai/gpt-6.1-sol
      api_base: https://qd.zsopc.com/v1
      api_key: os.environ/PLATFORM_API_KEY
  - model_name: claude-sonnet-4-6
    litellm_params:
      model: anthropic/claude-sonnet-4-6
      api_base: https://qd.zsopc.com
      api_key: os.environ/PLATFORM_API_KEY

general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY   # the key callers of the proxy must send; don't expose an open proxy
```

Start it (it listens on port 4000 by default):

```bash
uv tool install 'litellm[proxy]'
litellm --config config.yaml
```

Or with Docker:

```bash
docker run -v "$PWD/config.yaml:/app/config.yaml:ro" \
  -e PLATFORM_API_KEY -e LITELLM_MASTER_KEY -p 4000:4000 \
  ghcr.io/berriai/litellm:v1.109.1 --config /app/config.yaml
```

Call the proxy:

```bash
curl http://localhost:4000/v1/chat/completions \
  -H "Authorization: Bearer $LITELLM_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-6.1-sol", "messages": [{"role": "user", "content": "Hello"}]}'
```

## Things to know

- By default LiteLLM raises an error on parameters it thinks the model doesn't support; to let them through, set `drop_params: true` under `litellm_settings`.
- Send Gemini models through the `openai/` prefix: the LiteLLM docs don't spell out a custom `api_base` format for the `gemini/` prefix.
- Every call is charged in credits to the account behind your key. Budgets and rate limits on the proxy side are LiteLLM's own features, separate from this platform.

## Troubleshooting

| Symptom | What to check |
|---|---|
| 404 Not Found | `api_base` for `openai/` must end in `/v1`; for `anthropic/` it has no `/v1` |
| 401 `invalid_api_key` | Whether the key was copied in full (76 characters), and whether the variable behind `os.environ/` is exported |
| 400 `model_not_found` | Spelling of the model ID after the prefix — it must match [Models](../reference/models.md) exactly |
| 402 `quota_exceeded` | Balance exhausted. Every key shares one account balance — top up on the [Top up page](https://qd.zsopc.com/dashboard/billing) |

Full error reference: [Error codes](../reference/errors.md).

## Related pages

- [LangChain](./langchain.md) — Python / JS app framework
- [Vercel AI SDK](./vercel-ai-sdk.md) — TypeScript app framework
- [OpenAI SDK](../sdks/openai-sdk.md) — the official SDK directly
