Skip to content
English

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.

text
https://1zheai.com
EndpointProtocolPurpose
POST /v1/messagesAnthropic nativeConversations. Used by Claude Code, Anthropic SDK, Cline (Anthropic mode)
POST /v1/chat/completionsOpenAI compatibleConversations. Used by OpenAI SDK, Cursor, Cherry Studio (OpenAI mode)
GET /v1/modelsOpenAI compatibleLists the models your API key can use
POST /v1/messages/count_tokensAnthropic nativeCounts 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:

json
{"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.

Different tools interpret the Base URL differently. This is the most common pitfall when integrating:

Tool / SDKWhat to Fill InReason
Claude Code (ANTHROPIC_BASE_URL)https://1zheai.comThe tool itself appends /v1/messages
Anthropic SDK (base_url)https://1zheai.comSame as above
OpenAI SDK (base_url)https://1zheai.com/v1The SDK only appends /chat/completions
Cursor (Override OpenAI Base URL)https://1zheai.com/v1Same as OpenAI SDK
Cherry Studiohttps://1zheai.comAutomatically appends /v1/...
Cline (OpenAI Compatible)https://1zheai.com/v1Same 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.

The API key is placed in the request header. Both formats work:

Anthropic 原生
x-api-key: sk-你的Key
anthropic-version: 2023-06-01
content-type: application/json
  • When calling /v1/messages, include anthropic-version according to the official protocol; the current value is 2023-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_TOKEN sends Authorization: Bearer, and ANTHROPIC_API_KEY sends x-api-key; we accept both.
  • When beta features are needed, include the anthropic-beta header 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.
bash
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):

json
{"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 .

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.

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.