# Quickstart

> One API key, three SDKs, 205+ models

来源：https://zhonkemodel.dflop.top/en/docs/quickstart

> **Call any model with any SDK — without changing your code**

This platform is a multi-protocol AI gateway. The OpenAI, Anthropic or Google Gemini SDK you already know can call 205+ models directly — 103 text models across 12 vendors including Claude, GPT, Gemini, Grok, DeepSeek, Kimi, Qwen, MiniMax and GLM, plus image, video and embedding models (see [Image / video / music APIs](./reference/media-apis.md)).

## 1. Get an API key

Sign up at [zhonkemodel.dflop.top](https://zhonkezhonkemodel.dflop.top) and create a key:

- Console path: **Dashboard → API Keys → Create Key**
- Format: `sk-gpushare-` followed by **64 hex characters** (76 characters in total)
- **Sign up and get $0.30 in trial credit** — enough to run every example on this page
- Top up at dflop.top/dashboard/billing (Stripe, $1 minimum; same SSO account as zhonkemodel.dflop.top, shared balance)
- All keys draw on the same account balance. Per key you can set a model allowlist (`allowed_models`), an expiry and an on/off switch — that's for access control and auditing, **not** for budget isolation
- The raw key can be **viewed again at any time** on its detail page in the console (it's stored encrypted server-side)

```bash
export PLATFORM_API_KEY=sk-gpushare-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

## 2. Use the SDK you already have

### 2.1 OpenAI SDK

```python
from openai import OpenAI

client = OpenAI(
    base_url="https://zhonkezhonkeapi.dflop.top/v1",
    api_key="sk-gpushare-xxx",
)

# Call any model — including ones that aren't OpenAI's
response = client.chat.completions.create(
    model="claude-sonnet-4-6",  # calling Claude with the OpenAI SDK
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)
```

Full Python / TypeScript / curl examples: [OpenAI SDK guide](./sdks/openai-sdk.md).

### 2.2 Anthropic SDK

```python
from anthropic import Anthropic

client = Anthropic(
    base_url="https://zhonkezhonkeapi.dflop.top",  # ⚠️ no /v1
    api_key="sk-gpushare-xxx",
)

# Works for almost every model (exceptions in the compatibility matrix) — including non-Anthropic ones
message = client.messages.create(
    model="gpt-5.5",                    # calling GPT with the Anthropic SDK
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
print(message.content[0].text)
```

Full examples: [Anthropic SDK guide](./sdks/anthropic-sdk.md).

### 2.3 Google Gemini SDK

```python
from google import genai

client = genai.Client(
    api_key="sk-gpushare-xxx",
    http_options={"base_url": "https://zhonkezhonkeapi.dflop.top"},
)

# Works for almost every model (exceptions in the compatibility matrix) — including non-Gemini ones
response = client.models.generate_content(
    model="glm-5.1",                    # calling GLM with the Gemini SDK
    contents="Hello",
)
print(response.text)
```

The `x-goog-api-key` header the SDK sends by default is recognised by the gateway as-is — no auth changes needed. Full examples: [Gemini SDK guide](./sdks/gemini-sdk.md).

## 3. How does it work?

Internally the platform runs a protocol adaptation engine:

```
your SDK (OpenAI / Anthropic / Gemini)
        ↓
this gateway: translates the protocol automatically
        ├─ T1: OpenAI Chat   → Anthropic Messages
        ├─ T2: OpenAI Chat   → Gemini Native
        ├─ T3: Anthropic     → OpenAI Chat
        ├─ T4: Gemini Native → OpenAI Chat
        └─ T6: Gemini Native → Anthropic Messages
        ↓
upstream model (Claude / GPT / Gemini / GLM / DeepSeek / Grok / ...)
        ↓
the response is translated back into the shape your SDK expects
        ↓
your code never notices
```

Almost every "SDK protocol × model" combination is either passed through natively (byte-faithful) or translated automatically; only a few combinations aren't supported yet. You **don't** need to know which path you're on — the gateway picks the best one, and translated paths are marked in the `X-Protocol-Translation` response header. Full grid: [Compatibility matrix](./reference/compatibility-matrix.md).

## 4. Client integrations

The platform works as a custom API provider in the major AI coding clients:

- [Claude Code](./integrations/claude-code.md) — point `ANTHROPIC_BASE_URL` at this gateway
- [Cursor](./integrations/cursor.md) / [Cline](./integrations/cline.md) — custom OpenAI endpoint
- [Continue](./integrations/continue.md) / [Open WebUI](./integrations/open-webui.md)

## 5. Which model should I use?

### By vendor

| Vendor | Model ID | Suggested SDK |
|---|---|---|
| Anthropic | `claude-opus-4-8`, `claude-opus-4-7`, `claude-opus-4-6`, `claude-sonnet-4-6`, `claude-haiku-4-5-20251001` | Anthropic SDK |
| OpenAI | `gpt-5.5` | OpenAI SDK |
| Google | `gemini-2.5-flash`, `gemini-2.5-pro`, `gemini-3-flash-preview`, `gemini-3-pro-preview` | Gemini SDK |
| xAI | `grok-4`, `grok-4.1`, `grok-4.2`, `grok-4-fast-reasoning`, `grok-4-fast-non-reasoning` | any |
| Zhipu | `glm-4.7`, `glm-5`, `glm-5-turbo`, `glm-5.1` | any |
| DeepSeek | `deepseek-v3.2`, `deepseek-v4-flash`, `deepseek-v4-pro` | any |
| Moonshot | `kimi-k2.5`, `kimi-k2.6` | any |
| MiniMax | `MiniMax-M2.5`, `MiniMax-M2.7` | any |

The full list with pricing and context windows is in [Models](./reference/models.md); image and video models are in [Image / video APIs](./reference/media-apis.md).

### By job

| Job | Suggested model | Why |
|---|---|---|
| Hard reasoning / agents | `claude-opus-4-8`, `claude-opus-4-7` | strongest reasoning, 1M context, vision and thinking |
| Everyday coding | `claude-sonnet-4-6`, `gpt-5.5` | good price/performance balance |
| Sub-second responses | `gemini-2.5-flash`, `grok-4-fast-non-reasoning` | low latency |
| China-compliant (Chinese content) | `glm-5.1`, `deepseek-v3.2`, `hunyuan-2.0-instruct-20251111` | domestic vendors |
| Long context | `gemini-2.5-pro` (2M), `grok-4-fast-*` (2M), `kimi-k2.6` (256K) | context window |
| Cheap at volume | `grok-4-fast-*` ($0.2/M), `deepseek-v3.2` ($0.27/M) | around $0.20–$0.30/M |
| Multimodal vision | `claude-*`, `gpt-5.x`, `gemini-*`, `grok-4`, `grok-4.x` | accept vision input |

> **Limitations**: the Gemini family doesn't support the Anthropic Messages endpoint yet (Anthropic→Gemini translation is on the roadmap), and GPT-5.x doesn't support the Gemini Native endpoint. Calling an unsupported combination returns 503 `no_channel_available`. Everything else works — see the [compatibility matrix](./reference/compatibility-matrix.md).

## 6. Billing

- **Prepaid wallet**: top up your **account balance** (USD). Every API key draws on the same balance and is deducted by actual usage. Keys do not carry their own budget pool — if you need budget isolation, split it on your side (usage logs are broken down per key, which makes auditing straightforward).
- **Billing units**: chat and embeddings by token; images per image; video per second (settled on the actual generated duration, fully refunded on failure). See [Image / video / music APIs](./reference/media-apis.md).
- **Cached pricing**: when the upstream returns `cached_tokens`, the model's cached-input rate is applied automatically — you don't need to (and can't) switch it on. Per-model cache rates are on the [model plaza](https://zhonkezhonkemodel.dflop.top/models); models without a listed cache rate bill cached tokens at the normal input price. For multi-turn `/v1/responses` sessions, send a stable `session_id` request header (the gateway forwards it upstream for session stickiness), which raises the cache hit rate substantially.
- **Uniform errors**: HTTP 4xx/5xx plus the JSON shape native to the protocol you called (OpenAI, Anthropic or Gemini format).
- **Out of balance**: HTTP **402** with code `quota_exceeded` (OpenAI format; Anthropic format uses type `billing_error`, Gemini uses status `RESOURCE_EXHAUSTED`). When the balance runs out **every key stops working at once, and creating a new key won't help** — top up at dflop.top/dashboard/billing.

The four errors you're most likely to hit:

| HTTP | code | Meaning |
|---|---|---|
| 402 | `quota_exceeded` | Account balance exhausted; resolves on top-up |
| 429 | `rate_limit_exceeded` | Over your account's per-minute request or concurrency limit (read `Retry-After`), or an upstream rate limit passed through |
| 503 | `no_channel_available` | No channel serves that model over the protocol you used |
| 504 | `upstream_timeout` | Upstream timed out at 180s; set your SDK timeout to ≥200s |

Full error codes, the three-protocol error-body comparison and retry advice: [Error codes](./reference/errors.md).

### Checking your balance

```bash
curl https://zhonkezhonkeapi.dflop.top/v1/key/balance \
  -H "Authorization: Bearer $PLATFORM_API_KEY"
# {"object":"key.balance","remaining_usd":"12.3456","used_usd":"7.6544","total_usd":"20.0000","expires_at":null}
```

It still returns 200 at a zero balance (every other billing endpoint would 402), and costs neither credit nor rate limit — so use it to monitor rather than discovering the problem as a 402.

If you run a New API / One API relay, **the balance column works out of the box**: this platform implements OpenAI's own billing endpoints, `GET /v1/dashboard/billing/subscription` and `/usage`, verbatim. Desktop clients like Cherry Studio and ChatBox mostly use the same pair for "check balance", depending on your client's version. Setup steps: [New API and relay platforms](./integrations/new-api.md).

## 7. Next steps

- Full API reference: [API reference](./reference/api-reference.md)
- Authentication details: [Authentication](./reference/authentication.md)
- Streaming: [Streaming guide](./guides/streaming.md)
- Tool calling: [Tool calling](./guides/tool-calling.md)
- Image / video / embeddings: [Media APIs](./reference/media-apis.md)
- Knowledge search (REST + MCP): [Knowledge base API & MCP](./reference/wiki-api.md)
- Feedback: support@dflop.top
