Base URL, Endpoints, and Authentication
Base URL, available endpoints, request header formats for 1折AI, and whether to add /v1 in different tools.
All requests are sent to the same domain, with two sets of paths based on the protocol.
https://1zheai.comAvailable Endpoints
Section titled “Available Endpoints”| Endpoint | Protocol | Purpose |
|---|---|---|
POST /v1/messages | Anthropic native | Conversations. Used by Claude Code, Anthropic SDK, Cline (Anthropic mode) |
POST /v1/chat/completions | OpenAI compatible | Conversations. Used by OpenAI SDK, Cursor, Cherry Studio (OpenAI mode) |
GET /v1/models | OpenAI compatible | Lists the models your API key can use |
POST /v1/messages/count_tokens | Anthropic native | Counts the tokens of a given input; does not generate a conversation and does not charge fees |
The request body of count_tokens is the same as /v1/messages (model, messages, and can include system and tools). The response contains only one field:
{"input_tokens":19}count_tokens only counts the content you send. When actually calling via SDK, curl, or third-party tools, each request also includes a system prompt, which is billed as input tokens (Claude Code does not include one). See system prompt billing .
Claude-specific capabilities such as Prompt Caching, extended thinking, and tool calls work most reliably with the native /v1/messages. The OpenAI-compatible endpoint is suitable for scenarios where you already have OpenAI code and just want to switch models.
Whether to Add /v1
Section titled “Whether to Add /v1”Different tools interpret the Base URL differently. This is the most common pitfall when integrating:
| Tool / SDK | What to Fill In | Reason |
|---|---|---|
Claude Code (ANTHROPIC_BASE_URL) | https://1zheai.com | The tool itself appends /v1/messages |
Anthropic SDK (base_url) | https://1zheai.com | Same as above |
OpenAI SDK (base_url) | https://1zheai.com/v1 | The SDK only appends /chat/completions |
| Cursor (Override OpenAI Base URL) | https://1zheai.com/v1 | Same as OpenAI SDK |
| Cherry Studio | https://1zheai.com | Automatically appends /v1/... |
| Cline (OpenAI Compatible) | https://1zheai.com/v1 | Same as OpenAI SDK |
Rule: Anthropic-family tools take the root address; OpenAI-family tools take it up to /v1. The typical symptom of filling it in wrong is a 404.
Authentication Request Headers
Section titled “Authentication Request Headers”The API key is placed in the request header. Both formats work:
x-api-key: sk-你的Keyanthropic-version: 2023-06-01content-type: application/jsonAuthorization: Bearer sk-你的Keycontent-type: application/json- When calling
/v1/messages, includeanthropic-versionaccording to the official protocol; the current value is2023-06-01. In testing, it works without it, but official SDKs and tools all include it, so include it when writing requests yourself. - Claude Code’s
ANTHROPIC_AUTH_TOKENsendsAuthorization: Bearer, andANTHROPIC_API_KEYsendsx-api-key; we accept both. - When beta features are needed, include the
anthropic-betaheader as per the official documentation. Including an unrecognized value does not cause an error, so whether a beta feature is in effect should be judged by the actual effect in the response.
Check Whether the API Key Is Usable
Section titled “Check Whether the API Key Is Usable”curl https://1zheai.com/v1/models \ -H "Authorization: Bearer sk-你的Key"Returning a model list means both the API key and the address are correct. Returning 401 means there is a problem with the API key. The response looks like this (tested on 2026-10-15):
{"error":{"code":"","message":"Invalid token (request id: 202610150244361675490398268d9d6eKJPmcph)","type":"authentication_error"}}When requesting /v1/models with the x-api-key and anthropic-version headers, the response is a model list in Anthropic format (data[].id, display_name, has_more). Claude Code’s model auto-discovery reads this format.
For other cases, see error codes and troubleshooting .
Rate Limits
Section titled “Rate Limits”Currently, no rate limits are set on API keys. Receiving a 429 usually means high upstream load; retry later, and add exponential backoff for batch jobs. See error codes and troubleshooting for details.
Network
Section titled “Network”When there is a connection timeout or TLS error, first confirm the network the terminal is using: if a global proxy is on, turn it off and connect directly, then try again; if the corporate network has an egress whitelist, 1zheai.com needs to be allowed.
