İçeriğe geç

Hatalar

Tüm hata yanıtları tutarlı formatta döner:

{
"error": {
"message": "Invalid API key",
"type": "auth_error"
}
}

Bazı hatalar (özellikle yanlış endpoint × model kombinasyonu) opsiyonel bir details nesnesi içerir. Mevcut entegrasyonlar error.message ve error.type üzerinden çalışmaya devam eder; yeni details nesnesi geriye uyumlu eklenmiştir.

{
"error": {
"message": "The model \"google/gemini-3.1-flash-image\" does not support /v1/images/edits. Use /v1/images/generations instead. For image-to-image, try-on or image merging, send reference images via the 'file_ids' field (after uploading them through /v1/files), or via 'image_urls' for hosted URLs.",
"type": "unsupported_operation",
"details": {
"param": "model",
"model": "google/gemini-3.1-flash-image",
"attempted_endpoint": "/v1/images/edits",
"supported_endpoints": ["/v1/images/generations"],
"suggested_endpoint": "/v1/images/generations",
"hint": "For image-to-image, try-on or image merging, send reference images via the 'file_ids' field (after uploading them through /v1/files), or via 'image_urls' for hosted URLs.",
"docs_url": "https://llmtr.com/docs/gateway/image-generation/"
}
}
}

details alanları:

AlanAçıklama
paramHatalı request alanı (genellikle model)
modelÇağrıdaki canonical model ID’si
attempted_endpointİsteğin yapıldığı endpoint
supported_endpointsBu modelin gerçekten desteklediği endpoint listesi
suggested_endpointÇağrıyı düzeltmek için tek tıkta gidilecek endpoint
hintProvider/model bazlı kısa yönlendirme (örn. file_ids kullan)
docs_urlKonuyla ilgili kılavuz

Emekliye ayrılan model kimlikleri HTTP 410 ile replacement bilgisini döner:

{
"error": {
"message": "Model \"mimo/mimo-v2-pro\" was retired on 2026-06-30. Use \"mimo/mimo-v2.5-pro\" instead.",
"type": "model_retired",
"details": {
"model": "mimo/mimo-v2-pro",
"replacement_model": "mimo/mimo-v2.5-pro",
"retirement_date": "2026-06-30"
}
}
}
HTTPtypeNedenNe yapmalı?
400invalid_request_errorGeçersiz JSON, eksik alan, bilinmeyen parametreİsteği düzelt, schema’ya bak
401auth_errorGeçersiz/revoke edilmiş anahtarDashboard’dan yeni anahtar üret
402insufficient_balanceKredi bakiyesi yetersizDashboard > Faturalandırma’dan top-up yap
403forbiddenModel bu hesap için kullanılamazModel erişimini kontrol et
404model_not_foundmodel alanı bilinmeyenCanonical ID’yi kontrol et (provider/model)
410model_retiredModel kimliği kullanımdan kaldırıldıerror.details.replacement_model değerine geç
413request_too_largeContext window aşıldımessages içeriğini kısalt
429rate_limit_exceededRate limit aşıldıExponential backoff ile retry et
500internal_errorGateway iç hatasıKısa süre sonra tekrar dene
502provider_errorSağlayıcı tarafında hataGeçici olabilir, retry dene
503provider_unavailableSağlayıcı erişilemezBir süre sonra tekrar dene
504timeoutİstek zaman aşımına uğradıDaha kısa çıktı iste veya streaming dene
Retry sadece 429, 500, 502, 503, 504 için.
Backoff: exponential + jitter.
Max retry: 3.

Örnek (Python):

import time, random
from openai import OpenAI, APIStatusError
RETRIABLE = {429, 500, 502, 503, 504}
def call(client, payload, attempt=0):
try:
return client.chat.completions.create(**payload)
except APIStatusError as e:
if e.status_code in RETRIABLE and attempt < 3:
time.sleep(2 ** attempt + random.random())
return call(client, payload, attempt + 1)
raise

Retry uygularken istemci tarafında timeout, bağlantı kopması ve çift gönderim senaryolarını da hesaba katın.