Chat Completions

Create a chat completion

POST
/v1/chat/completions

Creates a model response for the given conversation, compatible with OpenAI Chat Completions. Supports streaming (stream: true, SSE), function calling (tools) and image input.

See GET /v1/models or the model square for the available models.

Authorization

BearerAuth
headerAuthorizationBearer <token>

Authenticate with an API key. Format: Authorization: Bearer sk-xxxxxx. Create keys on the API Keys page of the console (https://ai.myaiexp.com/keys).

Request Body

application/json
  1. body
model*string

Model ID, for example your-model-id. Replace it with a model ID from the model square (https://ai.myaiexp.com/pricing), or call GET /v1/models to list the models your key can use.

messages*array<>

Conversation messages

temperature?number

Sampling temperature

Range0 <= value <= 2
Default1
top_p?number

Nucleus sampling parameter

Range0 <= value <= 1
Default1
n?integer

Number of choices to generate

Range1 <= value
Default1
stream?boolean

Whether to stream the response

Defaultfalse
stream_options?
stop?|array<string>

Stop sequences

max_tokens?integer

Maximum number of tokens to generate

max_completion_tokens?integer

Maximum number of completion tokens

presence_penalty?number
Range-2 <= value <= 2
Default0
frequency_penalty?number
Range-2 <= value <= 2
Default0
logit_bias?
user?string
tools?array<>
tool_choice?|
response_format?
seed?integer
reasoning_effort?string

Reasoning effort (for models that support reasoning)

Value in"low""medium""high"
modalities?array<>
audio?

Response Body

Response created

application/json
  1. response
id?string
object?string
created?integer
model?string
choices?array<>
usage?
system_fingerprint?string
Example Request
curl -X POST 'https://ai.myaiexp.com/v1/chat/completions' \  -H 'Content-Type: application/json' \  -d '{  "model": "your-model-id",  "messages": [    {      "role": "user",      "content": "Introduce yourself in one sentence"    }  ]}'
Example Response
{  "id": "chatcmpl-2dae0f9d-c174-9590-aebc-de8398e9a09a",  "object": "chat.completion",  "created": 1791367078,  "model": "your-model-id",  "choices": [    {      "index": 0,      "message": {        "role": "assistant",        "content": "Hi! I'm an AI assistant."      },      "finish_reason": "stop"    }  ],  "usage": {    "prompt_tokens": 8,    "completion_tokens": 19,    "total_tokens": 27  }}

This service is provided for learning and research purposes only. Please follow each model provider's usage policies.