POST /v1/chat/completions
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model |
string | yes | Model ID from the catalog |
messages |
array | yes | Conversation messages, OpenAI format |
max_tokens |
integer | no | Max output tokens |
temperature |
number | no | Sampling temperature 0-2 |
stream |
boolean | no | Stream the response |
Request
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": 100
}'
Response
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"model": "gpt-4o",
"choices": [{ "index": 0, "message": { "role": "assistant", "content": "Hi there!" } }],
"usage": { "prompt_tokens": 5, "completion_tokens": 20, "total_tokens": 25 }
}