Anthropic Compatible Interface

Protocol Selection

The AI POOL platform's Claude models support both the native Anthropic protocol and OpenAI-compatible protocol. The model names are the same, but the calling methods differ. We recommend using the native protocol as the first choice unless you have special requirements, as it is more stable, feature-rich, and supports advanced features such as chain-of-thought and native plugins. The OpenAI-compatible format has limited compatibility and is only recommended for use in cases where only custom OpenAI interfaces are supported, such as in Cursor.

Interface Examples

Claude Native Protocol

curl --location 'https://ai-gate.haozcloud.com/' \
--header 'x-api-key: sk-xxxx' \
--header 'anthropic-version: 2023-06-01' \
--header 'content-type: application/json' \
--data '{
    "model": "claude-sonnet-4-20250514",
    "max_tokens": 1024,
    "stream":false,
    "messages": [
        {"role": "user", "content": "hi"}
    ]
}'

OpenAI Compatible Protocol

curl https://ai-gate.haozcloud.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxx" \
-d '{
"model": "claude-sonnet-4-20250514",
"messages": [{"role": "user", "content": "Hello!"}]
}'

Python Usage

from anthropic import Anthropic

if __name__ == '__main__':
    client = Anthropic(
        base_url='https://ai-gate.haozcloud.com/anthropic',
        api_key='sk-xxxx',
    )

    message = client.messages.create(
        max_tokens=1024,
        messages=[
            {
                "role": "user",
                "content": "Hello, Claude",
            }
        ],
        model="claude-sonnet-4-20250514",
    )
    print(message.content)