Quick Tour
End-to-end flow from install to your first model call. 从安装到调用第一个模型的端到端流程。
This guide assumes a Docker-ready machine (Linux / macOS / Windows). See Requirements for the full setup.
本指南假设你已经有了一台机器(Linux / macOS / Windows)和 Docker。完整说明见 Install & Upgrade。
Step 1 — Launch / 第 1 步:启动
docker run -d --name one-api-pro \
--restart always \
-p 3000:3000 \
-v $(pwd)/data:/app/data \
-e TZ=Asia/Shanghai \
ghcr.io/modelbus/one-api-pro:latestAfter start, open http://localhost:3000. Default root: root / 123456 — change it immediately.
启动后访问 http://localhost:3000,看到登录页即成功。默认 root 账号:root / 123456,首次登录后立即改密。
Step 2 — Sign in & create an Access Token / 第 2 步:登录与创建 Access Token
- Sign in as root, then go to "Personal Center" → "Access Token".
- Click "Generate", copy the UUID (user-level token, used for
/api/*). - Or just use the Cookie Session for admin endpoints.
# Login (cookie)
curl -X POST http://localhost:3000/api/user/login \
-H "Content-Type: application/json" \
-d '{"username":"root","password":"123456"}' \
-c cookies.txt
# Self
curl http://localhost:3000/api/user/self -b cookies.txtThe language toggle lives in the top-right of auth pages; the choice is persisted in
localStorage.lang. 登录页右上角可切换中 / English(localStorage.lang持久化)。
Step 3 — Add a Channel / 第 3 步:新建渠道
Navigate to "Channels" → "New Channel":
- Type: OpenAI (or DeepSeek, Gemini, Anthropic, …).
- Name / Base URL: prefilled; editable.
- Key: upstream API key.
- Models: empty = all models supported by that provider (from
relay/adaptor/<provider>/constants.go).
After saving, click "Test"; a 200 means the channel is reachable.
新建完成后点「测试」,看到 200 即渠道可用。
Step 4 — Create an API Key / 第 4 步:创建 API Key
Navigate to "Tokens" → "New Token":
- Name: any recognizable string.
- Quota: optional;
0= unlimited. - Expires at: optional;
0/ "Never expire" means never. - Models: empty = unlimited.
Click copy — the key is shown only once. It is prefixed with sk- and works against any /v1/* compatible endpoint.
点复制,只显示这一次。该 Key 以 sk- 前缀,可用于调用 /v1/* 兼容接口。
Step 5 — Call your first model / 第 5 步:调用第一个模型
curl http://localhost:3000/v1/chat/completions \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role":"user","content":"Hello from One API Pro!"}]
}'A JSON reply means success. Streaming ("stream": true), tool calls (tools), multimodal (image_url) all pass through per the OpenAI protocol.
返回 JSON 即成功。流式("stream": true)、工具调用(tools)、多模态(image_url)均按 OpenAI 协议透传。
Verify / 验证
From the "Logs" page or curl /api/log/self -b cookies.txt:
prompt_tokens/completion_tokens/total_tokensare exact counts from embedded tiktoken BPE — seeTIKTOKEN_CACHE_DIR.quotais computed from the price table and the group ratio.- User-level
quotaandtoken.remain_quotaare decremented atomically; the Redis cache is refreshed viaIncreaseUserQuotato stay consistent.
进入「日志」或运行 curl http://localhost:3000/api/log/self -b cookies.txt 查看本次调用。
Next: Architecture · Subscriptions · Top-up.