# EZAT Router > 一个 API key、一个预付余额,调用领先的 AI 模型。兼容 Anthropic Messages API 和 OpenAI Chat Completions,按量付费。 关键信息: - 兼容 Anthropic 的 base URL:https://api.router.ezat.io(POST /v1/messages、POST /v1/messages/count_tokens、GET /v1/models) - 兼容 OpenAI 的 base URL:https://api.router.ezat.io/openai/v1(POST /chat/completions、GET /models) - 鉴权:`x-api-key: ezat_sk_…` 或 `Authorization: Bearer ezat_sk_…` - 模型 id 格式为 `author/model`(例如 `anthropic/claude-sonnet-5-5`),Anthropic 自己的模型名可作为别名使用。用 GET /v1/models 列出。 - API key、余额和充值:https://router.ezat.io/zh - Claude Code:设置 ANTHROPIC_BASE_URL=https://api.router.ezat.io 和 ANTHROPIC_AUTH_TOKEN= 完整文档(单个文件):https://docs.router.ezat.io/zh/llms-full.txt OpenAPI 规范:https://docs.router.ezat.io/openapi.yaml Agent skill:https://docs.router.ezat.io/skill/ezat-router.zip(SKILL.md:https://docs.router.ezat.io/skill/ezat-router/SKILL.md) English: https://docs.router.ezat.io/llms.txt ## 开始使用 - [简介](https://docs.router.ezat.io/zh/index.md): EZAT Router 是什么,它的两种 API 格式和各自的 base URL,以及在哪里获取 API key。 - [快速开始](https://docs.router.ezat.io/zh/quickstart.md): 注册、充值、创建 API key,并用 curl、Python 或 TypeScript 发送第一个请求。 - [认证](https://docs.router.ezat.io/zh/authentication.md): 在 x-api-key 或 Authorization Bearer 中发送 ezat_sk_ key,妥善保管 key,并解决 401 和 403 错误。 ## API - [Anthropic Messages API](https://docs.router.ezat.io/zh/anthropic/messages.md): 用 Anthropic 的 Messages 格式发送请求(流式或非流式)、计算 token 数、列出模型,并了解支持哪些功能。 - [OpenAI 兼容 API](https://docs.router.ezat.io/zh/openai/base-url.md): 面向使用 OpenAI API 格式的工具和代码:base URL、认证、端点对应关系和 SDK 配置。 - [Chat Completions](https://docs.router.ezat.io/zh/openai/chat-completions.md): 详解 POST /openai/v1/chat/completions:消息、流式输出、工具、图片、推理、缓存、会被忽略或拒绝的字段,以及错误。 - [提示缓存与会话](https://docs.router.ezat.io/zh/guides/prompt-caching.md): 提示缓存如何在 EZAT Router 上帮你省钱、如何在两种 API 上使用,以及为什么一个对话会固定在同一个部署上。 ## 模型与价格 - [模型](https://docs.router.ezat.io/zh/models.md): 通过 EZAT Router 可以调用的所有 AI 模型、模型 id 和别名的规则、模型状态、各项能力的含义,以及如何通过 API 列出模型。 - [价格](https://docs.router.ezat.io/zh/pricing.md): 每个模型每百万 token 的实时价格、每个价格列的含义、长上下文档位,以及如何根据 usage 算出一个请求的费用。 ## 工具 - [Claude Code](https://docs.router.ezat.io/zh/tools/claude-code.md): 设置 ANTHROPIC_BASE_URL 和 ANTHROPIC_AUTH_TOKEN 两个环境变量,就能用 EZAT Router 余额运行 Claude Code。 - [OpenAI 格式的工具](https://docs.router.ezat.io/zh/tools/openai-tools.md): 把可以自定义 OpenAI base URL 的工具和库(Cline、Continue、LangChain、Vercel AI SDK、LiteLLM)指向 EZAT Router。 - [从其他服务迁移](https://docs.router.ezat.io/zh/tools/migrate.md): 把调用 Anthropic API 或 OpenRouter 等 OpenAI 兼容路由服务的代码迁移到 EZAT Router,以及迁移后要检查什么。 ## 账户与计费 - [API key](https://docs.router.ezat.io/zh/api-keys.md): 创建、命名、复制和吊销 API key,并设置 key 的消费上限、可用模型和有效期。 - [组织和成员](https://docs.router.ezat.io/zh/organizations.md): 组织持有余额、API key 和用量。介绍如何创建和切换组织、邀请成员,以及每个角色能做什么。 - [计费方式](https://docs.router.ezat.io/zh/billing.md): 按组织预付的额度、通过 Stripe 充值、自动充值、税费和带税号的发票、每个请求如何计费(缓存 token、长上下文、中断的流式输出)、负余额、402 错误,以及退款。 ## 示例 - [curl](https://docs.router.ezat.io/zh/examples/curl.md): 两种 API 格式的 curl 请求,可直接复制使用:普通请求、流式输出、工具调用往返、图片、计算 token 数、列出模型和处理错误。 - [Node.js](https://docs.router.ezat.io/zh/examples/node.md): 使用 Anthropic 和 OpenAI SDK 的 Node.js 示例:普通请求、流式输出、工具调用往返、图片、计算 token 数、列出模型和处理错误。 - [Python](https://docs.router.ezat.io/zh/examples/python.md): 使用 Anthropic 和 OpenAI SDK 的 Python 示例:普通请求、流式输出、工具调用往返、图片、计算 token 数、列出模型和处理错误。 ## 参考 - [错误](https://docs.router.ezat.io/zh/reference/errors.md): 网关以 Anthropic 和 OpenAI 格式返回的所有 HTTP 状态码和错误类型、各自的原因以及是否应该重试、流式输出中的错误,以及联系支持时需要提供的请求 id。 - [速率限制](https://docs.router.ezat.io/zh/reference/rate-limits.md): 每个 key 的每分钟请求数限制、每个 key 的消费上限、组织余额、容量限制、会返回的响应头,以及如何退避和重试。 ## Anthropic Messages - [Create a message](https://docs.router.ezat.io/zh/reference/api/createMessage.md): Sends a conversation to a model and returns its reply, in Anthropic's Messages format. Set `"stream": true` to receive the reply as Server-Sent Events. - [Count tokens](https://docs.router.ezat.io/zh/reference/api/countMessageTokens.md): Counts the input tokens a Messages request would use, without running the model. It is free and isn't billed or listed in your usage, but it counts toward your key's requests per minute. ## OpenAI Chat Completions - [Create a chat completion](https://docs.router.ezat.io/zh/reference/api/createChatCompletion.md): Sends a conversation to a model and returns its reply, in OpenAI's Chat Completions format. Set `"stream": true` to receive `chat.completion.chunk` events. ## 模型 - [List models (Anthropic format)](https://docs.router.ezat.io/zh/reference/api/listModels.md): Lists the models your key can use, in Anthropic's format, with canonical `author/model` ids. A key restricted to some models lists only those. Deprecated models are listed while they are still served; models in preview only for keys allowed to use them. - [Get a model (Anthropic format)](https://docs.router.ezat.io/zh/reference/api/getModel.md): Returns one model, looked up by canonical id or alias. The response always carries the canonical id. - [List models (OpenAI format)](https://docs.router.ezat.io/zh/reference/api/listOpenAIModels.md): Lists the models your key can use, in OpenAI's format: the same models as `GET /v1/models`, with canonical `author/model` ids. `owned_by` is the part of the id before the slash. - [Get a model (OpenAI format)](https://docs.router.ezat.io/zh/reference/api/getOpenAIModel.md): Returns one model, looked up by canonical id or alias. The response always carries the canonical id. Here the slash in a canonical id can be sent as it is (`/openai/v1/models/anthropic/claude-opus-5-5`) or encoded as `%2F`. - [List the model catalog](https://docs.router.ezat.io/zh/reference/api/listCatalogModels.md): The public model catalog: every active and deprecated model, with its aliases, limits, capabilities and prices. No API key is needed. - [更新日志](https://docs.router.ezat.io/zh/changelog.md): EZAT Router 的 API、控制台、文档和 agent 技能中客户可见的变更,按日期列出,最新的在前。 ## 给 AI agent - [AI agent 须知](https://docs.router.ezat.io/zh/agents.md): 供 AI agent 在配置工具或代码使用 EZAT Router 时参考:必需的值、安全的配置流程和禁止事项清单。 - [Agent 技能](https://docs.router.ezat.io/zh/agents/skill.md): 安装 ezat-router agent 技能,让 Claude Code 和其他 agent 能自行配置和排查 EZAT Router。 - [故障排查](https://docs.router.ezat.io/zh/troubleshooting.md): 按症状列出 EZAT Router 的常见问题(base URL 错误、401、402、未知模型、429 和 529、工具不使用你的设置、流式输出中断),以及原因和解决方法。