AI Gateway API v1 • OpenAI Uyumlu

Base URL: https://syntax.tr/api/v1https://syntax.tr/api/v1

Auth: X-API-Key: sk_... veya Authorization: Bearer sk_...

Hızlı Başlangıç

import OpenAI from 'openai'
const client = new OpenAI({
  baseURL: 'https://syntax.tr/api/v1',
  apiKey: 'sk_...'
})
await client.chat.completions.create({
  model: 'big-pickle', // veya muse-spark-1.2-contributor-free, hy3/syntax/free
  messages: [{role:'user', content:'Merhaba!'}]
})
// responses için: POST /api/v1/responses  {model, input}

AI Gateway Endpointleri

POST/chat/completionsauth, model, messages
Chat Completions (OpenAI uyumlu) — sıralı proxy + failover
curl -H "X-API-Key: KEY" -H "Content-Type: application/json" -d '{"model":"big-pickle","messages":[{"role":"user","content":"Sadece OK yaz."}]}' https://syntax.tr/api/v1/chat/completions
POST/responsesauth, model, input
Responses API — muse-spark için
curl -H "X-API-Key: KEY" -H "Content-Type: application/json" -d '{"model":"muse-spark-1.2-contributor-free","input":"Sadece OK yaz."}' https://syntax.tr/api/v1/responses
GET/models-
Tüm birleşik aktif modeller (failover bilgisi)
curl https://syntax.tr/api/v1/models/active
GET/models/active-
Aktif modeller (opencode)
curl https://syntax.tr/api/v1/models/active

Panel & Diğer

GET/meauth
Kullanıcı bilgisi
curl -H "X-API-Key: KEY" https://syntax.tr/api/v1/me
GET/balanceauth
Bakiye
curl -H "X-API-Key: KEY" https://syntax.tr/api/v1/balance
GET/services-
Hizmetler (legacy)
curl -H "X-API-Key: KEY" https://syntax.tr/api/v1/services

Failover Mantığı

Ortak modeller `syntax/free` olarak birleştirilir. Örnek: `deepseek-v4-flash-free` hem opencode hem kiloda varsa → önce opencode (sıralı proxy), başarısız olursa kilo otomatik denenecek. `unified_active.json` içinde `providers: ["opencode","kilo"]` ve `failover:true`.

curl https://syntax.tr/unified_active.json

Sıralı Proxy

`proxies.txt` (`host:port:user:pass`) her istekte sırayla bir sonraki IP, `flock` ile çakışma yok, sona gelince başa döner. Header `X-Proxy-Used` döner.

X-Proxy-Used: p.webshare.io:80:xxx
X-Provider: opencode → kilo

Rate Limit

Dakikada 60 istek. Aşılırsa 429 döner. Saatlik model sağlık kontrolü `active_models.json` ve `kilo_active.json`.