Skip to content

Anthropic API: Messages ​

Daya supports the Anthropic API. See the API call examples below for usage. For detailed request parameters and response schemas, refer to the Anthropic documentation.

Supported Features ​

All Anthropic API features are supported except for the following:

  1. The header parameter anthropic-version only supports "2023-06-01".
  2. The header parameter anthropic-beta does not support "code-execution-2025-08-25", i.e., the code_execution tool is unavailable.

API Call Examples ​

When using cURL directly, you must specify anthropic-version: 2023-06-01 (this is the only supported version).

python
import anthropic

## 1. Initialize the Anthropic client
client = anthropic.Anthropic(
    # Replace with the API key from your Daya console
    api_key="<YOUR DAYA_API_KEY>", 
    # 3. Point the base URL to the Daya endpoint
    base_url="https://api.dayaai.com/v1"
)
message = client.messages.create(
    model="anthropic/claude-sonnet-4.5",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Hello, Claude"}
    ]
)
print(message.content)
ts
import Anthropic from "@anthropic-ai/sdk";

// 1. Initialize the Anthropic client
const anthropic = new Anthropic({
  // 2. Replace with the API key from your Daya console
  apiKey: "<YOUR DAYA_API_KEY>", 
  // 3. Point the base URL to the Daya endpoint
  baseURL: "https://api.dayaai.com/v1", 
});

async function main() {
  const msg = await anthropic.messages.create({
    model: "anthropic/claude-sonnet-4.5",
    max_tokens: 1024,
    messages: [{ role: "user", content: "Hello, Claude" }],
  });
  console.log(msg);
}

main();
bash
curl https://api.dayaai.com/v1/messages \
     --header "x-api-key: $DAYA_API_KEY" \
     --header "anthropic-version: 2023-06-01" \
     --header "content-type: application/json" \
     --data \
'{
    "model": "anthropic/claude-sonnet-4.5",
    "max_tokens": 1024,
    "messages": [
        {"role": "user", "content": "Hello, world"}
    ]
}'

Claude Code Usage ​

See Claude Code Integration