Yapay Zeka Operasyonları
Yapay zeka kullanımınızı izlemeye yönelik operasyonel durum uç noktaları. Hız sınırlarını, sağlayıcı sağlığını, oturum belirteci tüketimini ve önbellek durumunu kontrol edin.
Uç noktalar
| Method | Path | Description | Auth | Rate Limit |
|---|---|---|---|---|
| GET | /ai/operations/rate-limit | Current rate limit status | JWT + Entitlement | 60/min |
| GET | /ai/operations/models/health | AI provider health status | JWT + Entitlement | 60/min |
| GET | /ai/operations/sessions/:sessionId/usage | Token usage for a session | JWT + Entitlement | 60/min |
| GET | /ai/operations/cache/stats | Prompt cache statistics | JWT + Entitlement | 60/min |
GET /ai/operations/rate-limit
Mevcut AI hız limiti tüketiminizi alın. Geçerli pencerede kaç istek kaldığını ve ne zaman sıfırlandığını döndürür.
Kimlik Doğrulama: JWT Taşıyıcı jetonu + aktif AI yetkisi gereklidir. Hız sınırı: 60/dak
Rica etmek
- Başlıklar:
Authorization: Bearer <token>
Cevap
Yanıt Örneği
{
"data": {
"limit": 60,
"remaining": 42,
"resetsAt": "2026-03-17T14:01:00.000Z",
"scope": "account"
}
}Yanıt Alanları
| Field | Type | Description |
|---|---|---|
limit | number | Maximum requests allowed in the window |
remaining | number | Requests remaining in the current window |
resetsAt | string | ISO 8601 timestamp when the window resets |
scope | string | Rate limit scope (currently account) |
Kod Örnekleri
curl https://api.chainabit.com/api/v1/ai/operations/rate-limit \
-H "Authorization: Bearer $TOKEN"const res = await fetch(`${BASE_URL}/ai/operations/rate-limit`, {
headers: { Authorization: `Bearer ${TOKEN}` },
});
const { data } = await res.json();import requests
res = requests.get(
f"{BASE_URL}/ai/operations/rate-limit",
headers={"Authorization": f"Bearer {TOKEN}"},
)
data = res.json()["data"]GET /ai/operations/models/health
Yapay zeka sağlayıcı uç noktalarının sağlık durumunu alın. Sağlayıcının kullanılabilirliğini bildirmek için devre kesici modelini kullanır.
Kimlik Doğrulama: JWT Taşıyıcı jetonu + aktif AI yetkisi gereklidir. Hız sınırı: 60/dak
Rica etmek
- Başlıklar:
Authorization: Bearer <token>
Cevap
Yanıt Örneği
{
"data": [
{
"provider": "openai",
"status": "healthy",
"circuitState": null,
"lastCheckedAt": null
},
{
"provider": "anthropic",
"status": "healthy",
"circuitState": null,
"lastCheckedAt": null
},
{
"provider": "google",
"status": "degraded",
"circuitState": "half-open",
"lastCheckedAt": "2026-03-17T13:55:00.000Z"
}
]
}Yanıt Alanları
| Field | Type | Description |
|---|---|---|
provider | string | Provider name (openai, anthropic, google) |
status | string | healthy, degraded, or unavailable |
circuitState | string | null | Circuit breaker state (closed, half-open, open) |
lastCheckedAt | string | null | ISO 8601 last health check timestamp |
Durum anlamları:
| Status | Circuit State | Description |
|---|---|---|
healthy | closed or absent | Provider is operating normally |
degraded | half-open | Provider is being tested after a failure |
unavailable | open | Provider is blocked due to repeated failures |
Kod Örnekleri
curl https://api.chainabit.com/api/v1/ai/operations/models/health \
-H "Authorization: Bearer $TOKEN"const res = await fetch(`${BASE_URL}/ai/operations/models/health`, {
headers: { Authorization: `Bearer ${TOKEN}` },
});
const { data } = await res.json();import requests
res = requests.get(
f"{BASE_URL}/ai/operations/models/health",
headers={"Authorization": f"Bearer {TOKEN}"},
)
data = res.json()["data"]GET /ai/operations/sessions/:sessionId/usage
Bir oturumdaki tüm AI çalıştırmaları için belirteç kullanım özetini alın.
Kimlik Doğrulama: JWT Taşıyıcı jetonu + aktif AI yetkisi gereklidir. Hız sınırı: 60/dak
Rica etmek
- Başlıklar:
Authorization: Bearer <token> - Yol parametreleri:
sessionId
Cevap
Yanıt Örneği
{
"data": {
"sessionId": "cm5sess01",
"totalInputTokens": 4250,
"totalOutputTokens": 1823,
"totalTokens": 6073,
"estimatedCostUsd": 0.018,
"runCount": 5
}
}Yanıt Alanları
| Field | Type | Description |
|---|---|---|
sessionId | string | The queried session ID |
totalInputTokens | number | Total input tokens consumed across all runs |
totalOutputTokens | number | Total output tokens consumed across all runs |
totalTokens | number | Combined input + output tokens |
estimatedCostUsd | number | null | Estimated cost in USD |
runCount | number | Number of AI runs in the session |
Kod Örnekleri
Oturum Oluştur yanıtındaki "id"yi "$SESSION_ID" olarak kullanın.
curl https://api.chainabit.com/api/v1/ai/operations/sessions/$SESSION_ID/usage \
-H "Authorization: Bearer $TOKEN"const sessionId = process.env.SESSION_ID; // id of the AI session to inspect
const res = await fetch(`${BASE_URL}/ai/operations/sessions/${sessionId}/usage`, {
headers: { Authorization: `Bearer ${TOKEN}` },
});
const { data } = await res.json();import os
import requests
session_id = os.environ["SESSION_ID"] # id of the AI session to inspect
res = requests.get(
f"{BASE_URL}/ai/operations/sessions/{session_id}/usage",
headers={"Authorization": f"Bearer {TOKEN}"},
)
data = res.json()["data"]GET /ai/operations/cache/stats
Hesabınız için anında önbellek istatistiklerini alın. Şu anda hangi bilgi istemi derleme katmanlarının önbelleğe alındığını gösterir.
Kimlik Doğrulama: JWT Taşıyıcı jetonu + aktif AI yetkisi gereklidir. Hız sınırı: 60/dak
Rica etmek
- Başlıklar:
Authorization: Bearer <token>
Cevap
Yanıt Örneği
{
"data": {
"cachedLayers": 3,
"layers": ["preferences", "persona", "session"]
}
}Yanıt Alanları
| Field | Type | Description |
|---|---|---|
cachedLayers | number | Number of cached prompt layers |
layers | string[] | Names of cached layers |
Olası katmanlar:
| Layer | Description |
|---|---|
preferences | Your language and tone preferences |
persona | Active persona profile |
twin | Digital twin context |
session | Session-scoped conversation state |
memory | Long-term memory context |
Kod Örnekleri
curl https://api.chainabit.com/api/v1/ai/operations/cache/stats \
-H "Authorization: Bearer $TOKEN"const res = await fetch(`${BASE_URL}/ai/operations/cache/stats`, {
headers: { Authorization: `Bearer ${TOKEN}` },
});
const { data } = await res.json();import requests
res = requests.get(
f"{BASE_URL}/ai/operations/cache/stats",
headers={"Authorization": f"Bearer {TOKEN}"},
)
data = res.json()["data"]