The Anthropic API is the model interface provided by Anthropic for calling the Claude family of models. Many people mix up "Anthropic API," "Claude API," and "Claude Code," but they describe different layers.

This article explains what the Anthropic API is, how to call it, how it differs from the OpenAI protocol, and the two common ways to access it from mainland China.

Note: Anthropic and Claude are trademarks of their respective owners. This article reflects common usage as of October 2026. Endpoints and prices are subject to the official documentation and this site.

1. How the three concepts relate

  • Anthropic: the company that develops Claude models.
  • Anthropic API / Claude API: the interface for calling Claude models, usually the Messages API.
  • Claude Code: Anthropic's command-line coding tool, which calls models through the API internally.

That is why "Anthropic API" and "Claude API" appear interchangeably across documentation. In most contexts they mean the same model interface.

2. What the Anthropic API offers

1. Messages API

The core endpoint is POST /v1/messages. The request body includes:

  • model
  • max_tokens
  • messages
  • system (optional)
  • temperature, top_p, and similar parameters (optional)
  • tools (optional)

2. Request headers

The native interface usually requires:

x-api-key: sk-...
anthropic-version: 2023-06-01
content-type: application/json

Some versions and gateways also accept a Bearer token. Follow the documentation for your setup.

3. Model tiers

Common Claude tiers:

Tier Best for
Opus Complex reasoning, long-running agents, hard problems
Sonnet Everyday coding, bug fixing, code review
Haiku Simple tasks, batch processing, low-cost workloads

Specific model names and prices are listed under Model Pricing.

3. Direct call example

export ANTHROPIC_API_KEY="sk-your-key"

curl "https://api.anthropic.com/v1/messages" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5",
    "max_tokens": 256,
    "messages": [
      {"role": "user", "content": "Explain the Messages API in three sentences."}
    ]
  }'

If you use an SDK, initialize it the way the Anthropic SDK expects. Do not reuse the OpenAI SDK request format.

4. How the Anthropic API differs from the OpenAI API

Dimension Anthropic API OpenAI API
Core path /v1/messages /v1/chat/completions
Auth header x-api-key Authorization: Bearer
Version header anthropic-version None
Message format messages plus system messages with a system role
Tool calls tools tools / functions
SDK Anthropic SDK OpenAI SDK

The two are not directly compatible. Many gateways provide both entry points: an Anthropic-compatible endpoint for Claude Code and an OpenAI-compatible endpoint for OpenAI SDKs and tools.

5. Two ways to access it from mainland China

Option A: Direct official access

Base URL: https://api.anthropic.com

This suits teams that can reach Anthropic reliably and already have an official account and payment method.

Option B: ZSQH AI Gateway

  • Anthropic-compatible endpoint: https://ai.zhongshangqihang.com (for Claude Code and similar tools)
  • OpenAI-compatible endpoint: https://ai.zhongshangqihang.com/v1 (for OpenAI SDKs and tools)

Register at ZSQH AI Gateway, create a key, top up, and start using it. Model names are listed under Model Pricing.

6. Calling Claude with the OpenAI SDK

If your tooling only supports the OpenAI protocol, use the gateway's OpenAI-compatible endpoint:

from openai import OpenAI

client = OpenAI(
    api_key="sk-your-key",
    base_url="https://ai.zhongshangqihang.com/v1",
)

resp = client.chat.completions.create(
    model="claude-sonnet-4-5",
    messages=[{"role": "user", "content": "Reply with OK only"}],
)
print(resp.choices[0].message.content)

Note that this is not the native Anthropic protocol, so parameters and capabilities may differ. When you need native tool calls or caching, prefer the Anthropic-compatible endpoint.

7. Understanding billing

The Anthropic API typically bills for input tokens, output tokens, and caching. Keep in mind:

  • Output tokens usually cost more than input tokens.
  • Long context multiplies the number of input tokens.
  • Cache hits save money, but not every request hits the cache.
  • Prices differ significantly between tiers: Opus, Sonnet, and Haiku.

For current unit prices, see Model Pricing. For estimation methods, see Claude Code Pricing: Subscription vs API.

8. FAQ

Are the Anthropic API and the Claude API the same thing?

In most contexts they refer to the same model interface under different names.

Does the Anthropic API support the OpenAI format?

Not natively. You need a gateway's OpenAI-compatible endpoint or an adapter layer.

How can I call it reliably from mainland China?

You can use direct official access if your network allows it, or a gateway that is reachable from mainland China. Pay attention to data compliance and the terms of service.

Which interface does Claude Code use?

Claude Code uses the Anthropic Messages API. For configuration, see the Claude Code API guide.

Next steps

If you need stable access from mainland China, a unified bill, or multi-model switching, sign up for ZSQH AI Gateway, create a test key, and complete one Messages request. Model names and prices are listed under Model Pricing.

Further reading: