AibubuDevelopers
Developer Docs
Text Models

Chat Completions

Call text models with an OpenAI Chat Completions compatible API.

POST /v1/chat/completions is for text models only, not image or video generation. Use a public model ID returned by GET /v1/models.

Overview

ItemDescription
RoutePOST /v1/chat/completions
AuthenticationAuthorization: Bearer sk_yeehoo_xxx
IdempotencyIdempotency-Key recommended
Bodyapplication/json
Response200 OK, or SSE when stream=true

Text versus media

Text models use Chat Completions or Responses. Image and video tasks use asynchronous POST /v1/generations.

Request

FieldTypeRequiredDescription
modelstringYesPublic text model ID from /v1/models
messagesarrayYesOrdered multi-turn messages
temperaturenumberNoSampling randomness, when supported by the model schema
max_tokens / max_completion_tokensintegerNoOutput token limit
streambooleanNoReturn SSE deltas; defaults to false
reasoningobjectNoReasoning configuration such as { "effort": "high" }

System instructions

Do not send a custom systemPrompt field. Put the system instruction in messages with role: "system":

{
  "model": "gpt_5_6_luna",
  "messages": [
    { "role": "system", "content": "You are a precise programming assistant." },
    { "role": "user", "content": "Write a Python example." }
  ]
}

The system message is optional. For a continuing conversation, send prior user and assistant messages in order.

Streaming

Set stream to true to receive text/event-stream deltas, ending with [DONE]:

data: {"id":"chatcmpl_123","choices":[{"delta":{"content":"Here is"}}]}
data: {"id":"chatcmpl_123","choices":[{"delta":{"content":" a Python example."}}]}
data: [DONE]

Common errors

  • Model not found or not authorized.
  • No available route.
  • Unsupported parameter.
  • Insufficient balance.
  • Upstream failure.

Use asynchronous POST /v1/generations for image and video tasks.