POST https://api.ticonai.com/v1/chat/completions follows the OpenAI Chat Completions format, so OpenAI SDKs work after you change the base URL and key.
curl -sS https://api.ticonai.com/v1/chat/completions \
-H "Authorization: Bearer $AIP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model-id",
"messages": [
{ "role": "system", "content": "You answer in one short sentence." },
{ "role": "user", "content": "What is a prepaid wallet?" }
],
"max_tokens": 80,
"temperature": 0.2
}'The request must have Content-Type: application/json, a valid UTF-8 JSON body, and be at most 2 MiB. Larger bodies fail with 413 request_too_large.
Request fields
| Field | Type | Notes |
|---|---|---|
model | string, required | A model id from GET /v1/models. |
messages | array, required | At least one message. Roles: system, developer, user, assistant, tool. system and developer messages are combined into the system prompt; there must be at least one other message. |
max_tokens or max_completion_tokens | integer | Upper bound on generated tokens. If both are sent, max_completion_tokens is used. If neither is sent, the model's default maximum output applies. A value above the model's maximum output is lowered to that maximum. |
temperature | number, 0 to 2 | |
top_p | number, 0 to 1 | |
stop | string or array of up to 16 strings | |
stream | boolean | true returns server-sent events. See Streaming. |
stream_options.include_usage | boolean | With stream, adds a final chunk that carries usage. |
tools, tool_choice | any | Accepted and forwarded to the model. |
n | integer | Only 1 is supported; any other value fails with 400 invalid_request and param: "n". |
Other fields, including response_format and user, are accepted so that existing client code keeps working, but this release does not act on them.
Message content may be a string or an array of content parts. Text parts are metered as text. Image, audio, file and other non-text parts are passed through and counted with a fixed token allowance for the pre-flight hold.
Response
{
"id": "chatcmpl-req_0123456789abcdef",
"object": "chat.completion",
"created": 1767225600,
"model": "your-model-id",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "A prepaid wallet holds money you add before you spend it." },
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 31,
"completion_tokens": 14,
"total_tokens": 45,
"prompt_tokens_details": { "cached_tokens": 0 }
}
}modelis the model id you requested.finish_reasonisstop,length(hitmax_tokens),tool_callsorcontent_filter.prompt_tokensincludes the cached tokens reported inprompt_tokens_details.cached_tokens. Cached tokens may be billed at a lower price; see Billing and wallet.- The
x-request-idresponse header identifies the request. Quote it to support.
Context window
The input plus the requested output must fit the model's context window. Otherwise the request fails with 400 invalid_request or 400 context_length_exceeded (with param: "messages"), and nothing is charged.
Errors
Errors use the OpenAI shape and carry a stable code. See Errors.
curl -sS https://api.ticonai.com/v1/chat/completions \
-H "Authorization: Bearer $AIP_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "no-such-model", "messages": [{ "role": "user", "content": "hi" }] }'