TodAPI / Guide Model plaza Pricing 中文 Use cases API keys

TodAPI integration guide

New here? Create an account, then top up (you must top up before the first API call; signing up does not include free usage), then open API keys to create or configure a key and choose a group before you call. For Claude Code, use the dedicated Claude Code setup page.

Task guides (scripts and data cleaning, connecting a phone or work app, small-studio costs, papers and fiction) live at the use-case index. Those pages ship with the application embed; this guide is the separate Caddy static tree under /guide/en/.

TodAPI is an LLM API gateway compatible with both OpenAI and Anthropic protocols. One API key lets you call the models enabled for that key’s group from common clients. Before you start, top up (required before the first call), create or configure a key, pick the right group, and copy the model ID from the model plaza.


1. Create a key and choose a group

  1. Open https://todapi.work and sign in (or register first).
  2. From the top menu open the API keys page: https://todapi.work/keys.
  3. Click Create key, enter a name, and save.
  4. Assign the key to a group (use the Group column in the key list to choose or change it).

The group decides which models the key can call and which rates apply. Groups on the platform fall roughly into:

Group type Typical use
Anthropic Claude Code, the Anthropic SDK, and the /v1/messages protocol
OpenAI the OpenAI SDK, Chat Completions, the Responses API, and most third-party clients
Domestic models DeepSeek, Kimi, Zhipu GLM, MiniMax, and similar
Other Gemini, Grok

Keys look like sk-xxxxxxxx. A dedicated key must be used with the group it belongs to. Calling a model from group B with a group A key will fail.


2. Quick setup

There are two compatibility modes. Pick the one your client expects:

Mode Base URL Notes
OpenAI-compatible https://todapi.work/v1 For the OpenAI SDK, Chat Completions, the Responses API, and most clients
Anthropic-compatible https://todapi.work For Claude Code and the Anthropic SDK. The client appends /v1/messages itself — do not add /v1 by hand

On the API keys page you can also click Import to CCS to configure CCSwitch in one step.

Example settings:

Field Value
URL https://todapi.work/v1
API Key your key
Model the model ID shown on the model plaza

3. Where the model name comes from

Do not type a model name from memory. Copy the model ID exactly as it appears on the model plaza. Do not reuse names from other sites or docs:

  1. Open https://todapi.work/model-plaza (no trailing slash).
  2. Find the group that belongs to your key.
  3. Copy the model ID and paste it into the client unchanged.

Model prices move with the market. The rate that applies is the one shown on the model plaza.


4. Client examples

1. Generic OpenAI-compatible clients (workbuddy, trae, pi, openclaw, and similar)

Field Value
API address / Base URL https://todapi.work/v1
API Key your sk-xxxxxxxx
Model the model ID for that group on the model plaza

2. Claude Code

The full walkthrough, including the usual /v1 mistake and a settings.json example, is on the Claude Code setup page. The shortest working example is below.

Set these environment variables in your shell (add them to ~/.bashrc or ~/.zshrc to persist):

export ANTHROPIC_BASE_URL="https://todapi.work"
export ANTHROPIC_AUTH_TOKEN="sk-xxxxxxxx"
export ANTHROPIC_MODEL="your-plaza-model-id"

You can also click Use key in the key list and copy the snippet from the Claude Code tab.

3. OpenAI SDK (Python)

from openai import OpenAI

client = OpenAI(
    api_key="sk-xxxxxxxx",
    base_url="https://todapi.work/v1",
)

resp = client.chat.completions.create(
    model="your-plaza-model-id",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)

4. Anthropic SDK (Python)

from anthropic import Anthropic

client = Anthropic(
    api_key="sk-xxxxxxxx",
    base_url="https://todapi.work",
)

msg = client.messages.create(
    model="your-plaza-model-id",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content[0].text)

5. curl

curl https://todapi.work/v1/chat/completions \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "your-plaza-model-id",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

5. Check the connection first

If you are unsure the setup is right, list models first:

curl https://todapi.work/v1/models \
  -H "Authorization: Bearer sk-xxxxxxxx"

A model list means the base URL, key, and group already match. Then send a chat request. Directly usable endpoints include:

Method Path Notes
POST /v1/chat/completions OpenAI Chat Completions
POST /v1/responses OpenAI Responses API
POST /v1/messages Anthropic Messages
POST /v1/embeddings Embeddings (only some groups)
POST /v1/images/generations Image generation
POST /v1/videos/generations Video generation
GET /v1/models Available models
GET /v1/usage Usage and billing for the current key

6. Billing and balance


7. Common errors

What you see Likely cause What to try
401 Missing, mistyped, or deleted key Check that the header is Bearer sk-...
403 The key’s group does not match the protocol or model Use a key from the matching group, or a model that group supports
Model not found / 404 The model ID is not in that group Check the ID on the model plaza
429 Rate limit or insufficient balance Check usage and balance; slow down requests
5xx Upstream fluctuation Retry later; contact support if it persists

Error body format:

{"error": {"type": "invalid_request_error", "message": "..."}}

8. Safety


Prices and available models are whatever the site shows at the time you look.