User GuideAPI ReferenceAI Applications

Claude Compatibility Protocol

Learn how to connect clients, CLI programming tools, and Anthropic SDKs that only support Claude's native interface to OpenRely via the official Anthropic native protocol (/v1/messages).

Protocol Overview

Certain clients, command-line agents (such as Claude Code native mode, some Immersive Translate plugins, and Claude Desktop extensions) built specifically for the Anthropic ecosystem, as well as development projects using the official @anthropic-ai/sdk, typically only support the Anthropic Native Messages Protocol Specification.

OpenRely API natively supports the Anthropic /v1/messages endpoint format. Simply redirect your request Base URL to OpenRely and provide your OpenRely API Key to access world-leading models like Claude directly at high speed without network barriers.


📌 Core Connection Specifications

ParameterStandard ValueDescription
API Service Address (Base URL)https://api.openrely.aiIf the client automatically appends /v1/messages under the hood, just enter the root domain; some tools may require https://api.openrely.ai/v1
Authentication Header (Headers)x-api-key: sk-••••Enter your OpenRely API Key (the system is also automatically compatible with Authorization: Bearer sk-••••)
Version Control Header (Version)anthropic-version: 2023-06-01Official recommended standard API version by Anthropic
Data FormatContent-Type: application/jsonStandard JSON request and response body

⚡ Core Endpoints and Request Examples

Message Creation (Messages API)

Anthropic's official core chat message endpoint, natively supporting the Thinking deep thought process, Prompt Caching, and tool use.

  • Endpoint: POST /v1/messages
  • Full URL: https://api.openrely.ai/v1/messages

Request Example

curl -X POST "https://api.openrely.ai/v1/messages" \
  -H "x-api-key: sk-••••" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude",
    "max_tokens": 1024,
    "messages": [
      { "role": "user", "content": "Hello Claude!" }
    ]
  }'

Response Example

{
  "id": "msg_01XyZ987...",
  "type": "message",
  "role": "assistant",
  "model": "claude",
  "content": [
    {
      "type": "text",
      "text": "Claude message routed."
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 11,
    "output_tokens": 18
  }
}

🛠️ Quick Client & SDK Integration

from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.openrely.ai",
    api_key="sk-your-openrely-key",
)

message = client.messages.create(
    model="claude",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Introduce yourself in one sentence"}
    ],
)

print(message.content[0].text)
import Anthropic from '@anthropic-ai/sdk';

const anthropic = new Anthropic({
  baseURL: 'https://api.openrely.ai',
  apiKey: 'sk-your-openrely-key',
});

const response = await anthropic.messages.create({
  model: 'claude',
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Hello Claude!' }],
});

console.log(response.content[0].text);

If the third-party CLI tool you use follows Anthropic's official environment variable naming conventions, you can execute the following directly in your terminal:

export ANTHROPIC_BASE_URL="https://api.openrely.ai"
export ANTHROPIC_API_KEY="sk-your-openrely-key"

Was this page helpful?

Claude Compatibility Protocol | OpenRely Docs