---
title: "Base URL, Endpoints, and Authentication"
description: "Base URL, available endpoints, request header formats for 1折AI, and whether to add /v1 in different tools."
headingIds: {"Available Endpoints":"section-1","Whether to Add /v1":"section-2","Authentication Request Headers":"section-3","Check Whether the API Key Is Usable":"section-4","Rate Limits":"section-5","Network":"section-6"}
---

<aside className="docs-publication" data-pagefind-ignore>

Documentation maintained by [1ZheAI](https://1zheai.com/en/editorial/#publisher). [Sources and corrections](https://1zheai.com/en/editorial/).

Found an error? [Contact support](mailto:support@1zheai.com) with the page address and a description. Do not send API keys or account credentials.

</aside>
All requests are sent to the same domain, with two sets of paths based on the protocol.

```text
https://1zheai.com
```

## 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:

```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 ](/en/docs/pricing-explained/#section-3).

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

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

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

<CodeGroup>
```text title="Anthropic 原生"
x-api-key: sk-你的Key
anthropic-version: 2023-06-01
content-type: application/json
```
```text title="Bearer（两种协议都支持）"
Authorization: Bearer sk-你的Key
content-type: application/json
```
</CodeGroup>

- 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.

## Check Whether the API Key Is Usable

```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 ](/en/docs/troubleshooting/).

## 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 ](/en/docs/troubleshooting/) for details.

## 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.
