Anthropic Messages API-kompatibel slutpunkt för kinesiska open source-AI-modeller via AI Gateway.
/api/ai/v1/anthropic/messages| Parameter | Obligatorisk | Beskrivning |
|---|---|---|
Authorization | Obligatoriskt | Bearer YOUR_API_KEY |
anthropic-version | Obligatoriskt | Fast värde 2023-06-01 |
| Parameter | Typ | Obligatorisk | Beskrivning |
|---|---|---|---|
model | string | Obligatoriskt | Modellnamn, t.ex. deepseek-v4.1-flash, qwen3.8-max |
messages | array | Obligatoriskt | Meddelandearray i formatet |
max_tokens | integer | Obligatoriskt | Maximalt antal utdata-tokens |
stream | boolean | Valfritt | Aktivera strömmande svar, sätt till true för SSE |
| Parameter | Typ | Beskrivning |
|---|---|---|
id | string | Unikt svars-ID |
model | string | Faktisk modell som använts |
content | string | Genererat textinnehåll |
usage | object | Statistik över tokenanvändning |
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"}]
}'