Chat Completions
POST /v1/chat/completions
Creates a completion for a conversation. This is the primary inference endpoint and is compatible with the OpenAI Chat Completions API.
Request
Headers
| Header | Value |
|---|---|
Authorization | Bearer ct_live_YOUR_KEY |
Content-Type | application/json |
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | yes | The model ID to use (e.g. openai/gpt-4o, or an Actor slug) |
messages | array | yes | Array of message objects with role and content |
stream | boolean | no | If true, returns a server-sent events stream. Default false. |
temperature | number | no | Sampling temperature 0–2. Default model-dependent. |
max_tokens | integer | no | Maximum completion tokens. |
top_p | number | no | Nucleus sampling parameter. |
stop | string or array | no | Stop sequence(s). |
user | string | no | An end-user identifier for abuse tracking. |
Example request
curl https://api.cleverthis.com/v1/chat/completions \
-H "Authorization: Bearer ct_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o-mini",
"messages": [
{
"role": "system",
"content": "You are a precise technical assistant."
},
{
"role": "user",
"content": "What is the capital of France?"
}
],
"temperature": 0.2,
"max_tokens": 50
}'
Example response
{
"id": "chatcmpl-Xy9AbCdEfGhIjKlMn",
"object": "chat.completion",
"created": 1720000000,
"model": "openai/gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 8,
"total_tokens": 32
}
}
Streaming
Set "stream": true to receive a server-sent events (SSE) stream. Each event is a JSON-encoded chat.completion.chunk object. The stream ends with data: [DONE].
curl https://api.cleverthis.com/v1/chat/completions \
-H "Authorization: Bearer ct_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "Count to 5"}], "stream": true}'
Coming soon
Tool/function calling, vision input (image_url content parts), and JSON mode (response_format) are being added.