Chat completion

POSThttps://ai.khatash.com/api/v1/chat/completions
POSTRequest
curl -X POST https://ai.khatash.com/api/v1/chat/completions \
  -H "Authorization: Bearer $KHATASH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "openai/gpt-4o-mini",
  "messages": [
    {
      "role": "user",
      "content": "What is the meaning of life?"
    }
  ]
}'
200Response
{
  "id": "gen-12345",
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "The meaning of life is a complex and subjective question...",
        "refusal": ""
      },
      "logprobs": {},
      "finish_reason": "stop",
      "index": 0
    }
  ],
  "provider": "OpenAI",
  "model": "openai/gpt-4o-mini",
  "object": "chat.completion",
  "created": 1735317796,
  "system_fingerprint": {},
  "usage": {
    "prompt_tokens": 14,
    "completion_tokens": 163,
    "total_tokens": 177
  }
}
این درخواست یک تکمیل مکالمه از مدل انتخاب‌شده برمی‌گرداند. آرایه‌ی messages الزامی است.