/v1/chat/completions
Bearer
Generate a chat completion for any supported model.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model |
string | Yes | Model ID from the model catalog |
messages |
array | Yes | Conversation messages, OpenAI format |
max_tokens |
integer | No | Maximum output tokens |
temperature |
number | No | Sampling temperature 0-2 |
stream |
boolean | No | Stream the response incrementally |
Examples
curl https://api.onefast.ai/v1/chat/completions
-H "Content-Type: application/json"
-H "Authorization: Bearer sk-your-api-key"
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}],
"max_tokens": 200
}'
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"model": "gpt-4o",
"choices": [
{ "index": 0, "message": { "role": "assistant", "content": "Hi there!" }, "finish_reason": "stop" }
],
"usage": { "prompt_tokens": 5, "completion_tokens": 20, "total_tokens": 25 }
}