Skip to main content
POST
/
api
/
public
/
v1
/
chat
/
completions
Chat Completions
curl --request POST \
  --url https://mibyanai.com/api/public/v1/chat/completions
{
  "model": "<string>",
  "messages": [
    {
      "role": "<string>",
      "content": "<string>"
    }
  ],
  "stream": true,
  "id": "<string>",
  "object": "<string>",
  "created": 123,
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "<string>",
        "content": "<string>"
      },
      "finish_reason": "<string>"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}
Creates a model response for the given chat conversation. This endpoint is fully compatible with the OpenAI Chat Completions API.

Request Headers

HeaderTypeRequiredDescription
AuthorizationstringYesMust be set to Bearer <your-api-key> (starts with mb-).
Content-TypestringYesMust be set to application/json.
x-mibyan-api-keystringNoAlternative way to pass your API key.

Request Body

model
string
default:"mibyan-4.1"
The model to use. Currently, mibyan-4.1 is the primary chat model.
messages
array
required
A list of messages comprising the conversation so far.
stream
boolean
default:"false"
If set to true, partial message deltas will be sent as Server-Sent Events (SSE).

Response Body

id
string
A unique identifier for the chat completion.
object
string
The object type, always chat.completion.
created
integer
The Unix timestamp (in seconds) of when the chat completion was created.
model
string
The model used for the completion.
choices
array
A list of chat completion choices.
usage
object
Usage statistics for the completion request.

Examples

cURL (Standard)

curl https://mibyanai.com/api/public/v1/chat/completions \
  -H "Authorization: Bearer mb-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mibyan-4.1",
    "messages": [
      { "role": "user", "content": "Write a short tagline for a logistics startup." }
    ]
  }'

cURL (Streaming)

curl https://mibyanai.com/api/public/v1/chat/completions \
  -H "Authorization: Bearer mb-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mibyan-4.1",
    "messages": [
      { "role": "user", "content": "Write a short tagline for a logistics startup." }
    ],
    "stream": true
  }'

Response Example (JSON)

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "mibyan-4.1",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Mibyan: Delivering trust, one parcel at a time."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 15,
    "completion_tokens": 10,
    "total_tokens": 25
  }
}