Hujjatlardan qidirish

Sahifa yoki bo‘lim nomini kiriting

APIOpenAI-compatible

OpenAI-mos CLI API

`/v1/models`, Chat Completions va Responses integratsiyasi.

Endpointlar

MethodPathScopeVazifa
GET/v1/modelsmodels:readKey uchun ruxsat etilgan model aliaslari
POST/v1/chat/completionschat:writeChat Completions, stream/non-stream
POST/v1/responsesresponses:writeResponses formatidagi inference

Chat Completions

Non-stream request
curl -sS "$APP_URL/v1/chat/completions" \
  -H "Authorization: Bearer $EDUBASE_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: demo-chat-001' \
  -d '{
    "model": "gpt-main",
    "messages": [{"role": "user", "content": "Salom!"}],
    "stream": false
  }'
OpenAI SDK bilan
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.EDUBASE_API_KEY,
  baseURL: `${process.env.EDUBASE_URL}/v1`,
});

const stream = await client.chat.completions.create({
  model: "gpt-main",
  messages: [{ role: "user", content: "Hisobotni qisqacha yozing" }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}

Responses

Responses request
curl -N "$APP_URL/v1/responses" \
  -H "Authorization: Bearer $EDUBASE_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: demo-response-001' \
  -d '{"model":"gpt-main","input":"3 ta asosiy xulosa bering","stream":true}'

Moslik chegarasi

Endpointlar eng ko‘p ishlatiladigan OpenAI request/response va streaming semantikasini beradi, ammo providerning har bir eksperimental maydoni avtomatik qo‘llanmaydi. Unsupported capability request validatsiyasida rad qilinadi.