Endpoint tương thích Anthropic Messages API cho các mô hình AI mã nguồn mở Trung Quốc qua AI Gateway.
/api/ai/v1/anthropic/messages| Tham số | Bắt buộc | Mô tả |
|---|---|---|
Authorization | Bắt buộc | Bearer YOUR_API_KEY |
anthropic-version | Bắt buộc | Giá trị cố định 2023-06-01 |
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
model | string | Bắt buộc | Tên mô hình, ví dụ: deepseek-v4.1-flash, qwen3.8-max |
messages | array | Bắt buộc | Mảng tin nhắn có định dạng |
max_tokens | integer | Bắt buộc | Số token đầu ra tối đa |
stream | boolean | Tùy chọn | Bật phản hồi streaming, đặt true cho SSE |
| Tham số | Kiểu | Mô tả |
|---|---|---|
id | string | Định danh phản hồi duy nhất |
model | string | Mô hình thực tế được sử dụng |
content | string | Nội dung văn bản được tạo |
usage | object | Thống kê sử dụng token |
curl --location 'https://your-domain.com/api/ai/v1/anthropic/messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'anthropic-version: 2023-06-01' \
--data '{
"model": "deepseek-v4.1-flash",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, who are you?"}
]
}'import requests
response = requests.post(
"https://your-domain.com/api/ai/v1/anthropic/messages",
headers={
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY",
"anthropic-version": "2023-06-01"
},
json={
"model": "deepseek-v4.1-flash",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, who are you?"}
]
}
)
print(response.json())curl --location 'https://your-domain.com/api/ai/v1/anthropic/messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'anthropic-version: 2023-06-01' \
--data '{
"model": "deepseek-v4.1-flash",
"max_tokens": 1024,
"stream": true,
"messages": [{"role": "user", "content": "Hello"}]
}'