Dokümantasyona Dön
/v1/messages
Claude modellerine mesaj gönderin
Anthropic uyumlu API kullanarak mesajlar oluşturun. ustaGPT'de mevcut tüm Claude modelleriyle çalışır.
Base URL:
https://api.ustagpt.com.trPOST
/v1/messagesİstek Örnekleri
cURL
curl https://api.ustagpt.com.tr/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-sonnet-4-5-20250929",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, Claude!"}
]
}'Akış Yanıtları
Gerçek zamanlı yanıtlar için stream: true veya akış istemcisini kullanın.
Streaming Example (Python)
import anthropic
client = anthropic.Anthropic(
api_key="YOUR_API_KEY",
base_url="https://api.ustagpt.com.tr"
)
with client.messages.stream(
model="claude-sonnet-4-5-20250929",
max_tokens=1024,
messages=[{"role": "user", "content": "Write a short poem"}]
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)Parametreler
| Ad | Tip | Gerekli | Açıklama |
|---|---|---|---|
model | string | Evet | Kullanılacak model ID'si (örn: claude-sonnet-4-5-20250929) |
messages | array | Evet | Sohbetteki mesaj dizisi |
max_tokens | integer | Evet | Oluşturulacak maksimum token sayısı |
system | string | Hayır | Sohbet için sistem komut istemi |
temperature | number | Hayır | Örnekleme sıcaklığı (0-1) |
stream | boolean | Hayır | Yanıtların akış olarak alınıp alınmayacağı |
Gerekli Başlıklar
| Başlık | Değer |
|---|---|
x-api-key | ustaGPT API anahtarınız |
anthropic-version | 2023-06-01 |
Content-Type | application/json |
Desteklenen Modeller
- claude-opus-4-5-20251101
- claude-sonnet-4-5-20250929
- claude-haiku-4-5-20251001
- claude-opus-4-1-20250805