Create a chat completion
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.
BearerAuthAuthorizationBearer <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).
application/json- body
model*stringModel 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?numberSampling temperature
0 <= value <= 21top_p?numberNucleus sampling parameter
0 <= value <= 11n?integerNumber of choices to generate
1 <= value1stream?booleanWhether to stream the response
falsestream_options?stop?|array<string>Stop sequences
max_tokens?integerMaximum number of tokens to generate
max_completion_tokens?integerMaximum number of completion tokens
presence_penalty?number-2 <= value <= 20frequency_penalty?number-2 <= value <= 20logit_bias?user?stringtools?array<>tool_choice?|response_format?seed?integerreasoning_effort?stringReasoning effort (for models that support reasoning)
"low""medium""high"modalities?array<>audio?Response created
application/json- response
id?stringobject?stringcreated?integermodel?stringchoices?array<>usage?system_fingerprint?stringcurl -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" } ]}'{ "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.