Aiter AI World
EnglishSign inGet started
Loading…

Chat completions

Request fields, tools, structured output and the response object.

Base URL for this deployment: https://www.aiteraiworld.com/api/v1

POST /chat/completions

The request body follows the OpenAI chat format. Fields outside the list below are passed through to providers that understand them.

FieldTypeNotes
modelstringCatalog id such as author/model, or an alias such as author/model:free.
messagesarrayRoles system, user, assistant and tool. Content may be a string or an array of parts (text and images where the model supports them). Tool results need tool_call_id.
streambooleanServer-sent events; see Streaming.
max_tokensintegerOutput cap. Defaults to 256, so set it explicitly for long answers. max_completion_tokens is accepted as a synonym.
temperature, top_p, stop, seedvariousSampling controls. Support varies per endpoint; see the model page.
toolsarrayFunction definitions in the OpenAI shape. Models without tool support are skipped when provider.require_parameters is set.
response_formatobjectjson_object or json_schema. Endpoints that cannot honour it are skipped.
transformsarray["middle-out"] trims the middle of an over-long conversation to fit the context window instead of failing.
providerobjectRouting preferences; see Provider routing.
user, metadatastring, objectStored on the generation record for your own reporting.

Tool calling

json
{
  "model": "author/model",
  "messages": [{ "role": "user", "content": "What is the weather in Bristol?" }],
  "tools": [{
    "type": "function",
    "function": {
      "name": "get_weather",
      "parameters": { "type": "object", "properties": { "city": { "type": "string" } }, "required": ["city"] }
    }
  }]
}

A tool call is returned as message.tool_calls with finish_reason set to tool_calls. Append the assistant message and a tool message carrying the result, then call again. Filter the catalog by Tool calling to find models that support it.

Structured output

Set response_format to {"type": "json_object"} or supply a JSON schema. Providers that cannot enforce the format are excluded from routing for that request, so a 503 means no eligible endpoint remained.

Generation records

Every request creates a generation record with token counts, provider, latency, status and final cost. Fetch it with the id from the response header; the gen- prefix is optional.

bash
curl https://www.aiteraiworld.com/api/v1/generation?id=6f1c… -H "Authorization: Bearer $AITER_API_KEY"

GET /activity lists your recent records with daily, weekly and monthly totals. The same data is on the Usage page and in the CSV export.