Endpoint compatibile con Anthropic Messages API per modelli AI open source cinesi tramite AI Gateway.
/api/ai/v1/anthropic/messages| Parametro | Obbligatorio | Descrizione |
|---|---|---|
Authorization | Obbligatorio | Bearer YOUR_API_KEY |
anthropic-version | Obbligatorio | Valore fisso 2023-06-01 |
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
model | string | Obbligatorio | Nome del modello, ad es. deepseek-v4.1-flash, qwen3.8-max |
messages | array | Obbligatorio | Array di messaggi nel formato seguente |
max_tokens | integer | Obbligatorio | Numero massimo di token di output |
stream | boolean | Opzionale | Abilita la risposta in streaming, imposta su true per SSE |
| Parametro | Tipo | Descrizione |
|---|---|---|
id | string | Identificatore univoco della risposta |
model | string | Modello effettivamente utilizzato |
content | string | Contenuto testuale generato |
usage | object | Statistiche sull'utilizzo dei 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"}]
}'