TamgaStudio API Dökümantasyonu
Açık kaynak veya ticari LLM modellerine tek bir API anahtarıyla erişin. OpenAI SDK'leri tamamen uyumludur.
Hızlı Başlangıç
TamgaStudio, tamamen OpenAI uyumlu bir API gatewaydir. Tüm endpointler OpenAI formatını takip eder. Sadece base_url ve API anahtarınızı değiştirin.
curl https://api.tamga.studio/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tamgastudio/gpt-5",
"messages": [{"role": "user", "content": "Hello!"}]
}'
Temel URL: https://api.tamga.studio/v1
Kimlik Doğrulama
Her isteğe API anahtarınızı Authorization başlığıyla ekleyin.
Authorization: Bearer tl-sk-your-api-key-here
Chat API
Tek bir istekte tamamlanan cevap alın.
POST /v1/chat/completionsÖrnek İstek Gövdesi
{
"model": "tamgastudio/gpt-5",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is AI?"}
],
"temperature": 0.7,
"max_tokens": 1024,
"stream": false
}
Parametreler
| Parametre | Tür | Varsayılan | Açıklama |
|---|---|---|---|
model | string | – | Model kimliği (ör. tamgastudio/gpt-5) |
messages | array | – | role ve content alanına sahip mesaj nesneleri listesi |
temperature | number | 0.7 | 0-2 arası örnekleme sıcaklığı |
max_tokens | integer | 1024 | Maksimum yanıt token sayısı |
stream | boolean | false | SSE akışını etkinleştirir |
top_p | number | 1 | Nucleus örnekleme eşiği |
stop | string / array | null | Durdurma dizileri |
tools | array | null | Fonksiyon çağırma (tools) tanımları |
seed | integer | null | Deterministik örnekleme için seed |
Streaming (Akış)
stream: true ile kelime kelime cevap alın.
curl https://api.tamga.studio/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tamgastudio/gpt-5",
"messages": [{"role": "user", "content": "Tell me a story"}],
"stream": true
}'
Yanıt data: {"choices":[...]} şeklinde SSE paketleriyle gelir ve data: [DONE] ile sonlanır.
Python SDK
pip install openai ile kurun, sonra yalnızca base URL'yi değiştirin.
from openai import OpenAI
client = OpenAI(
base_url = "https://api.tamga.studio/v1",
api_key = "YOUR_API_KEY",
)
# Chat
response = client.chat.completions.create(
model = "tamgastudio/gpt-5",
messages = [{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
# Streaming
stream = client.chat.completions.create(
model = "tamgastudio/gpt-5",
messages = [{"role": "user", "content": "Tell me a story"}],
stream = True,
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
# Models list
for m in client.models.list():
print(m.id)
Modeller
Hesabınıza tanımlı tüm modelleri listeleyin.
GET /v1/modelsModel başına güncel fiyat, token ve bağlam penceresi bilgileri için Fiyatlandırma sayfasına bakın.
Fiyatlandırmaya Git →Krediler & Fatura
Ön ödemeli kredi ile çalışırsınız. Her API çağrısı model fiyatına göre bakiyenizden düşülür.
- 1 USD = 1 kredi
- Bakiye bitince çağrılar
402 insufficient_creditshatası döner - Kredi yüklemek için Dashboard → Top Up sayfasını kullanın
Hız Limitleri
| Limit | Değer |
|---|---|
| Dakikada istek | 20 |
| Aşıldığında yanıt | HTTP 429 + JSON error |
Hata Kodları
| Kod | HTTP Durum | Açıklama |
|---|---|---|
invalid_api_key | 401 | Geçersiz veya süresi dolmuş API anahtarı |
insufficient_credits | 402 | Kredi bakiyesi sıfır |
model_not_found | 404 | Bilinmeyen model kimliği |
rate_limit_exceeded | 429 | Çok fazla istek |
missing_parameters | 400 | Zorunlu alanlar eksik |