Chat

Create a chat completion

OpenAI-compatible chat completion. The synchronous response is a standard chat-completion object. Set stream: true to receive Server-Sent Events as standard OpenAI chat.completion.chunk objects — delta.content / delta.reasoning / delta.tool_calls fragments, a terminal frame carrying finish_reason, then a usage frame (choices: [] + token counts), then data: [DONE]. Tool calls (function calling) are passed through verbatim: send tools as you would to OpenAI and accumulate streamed delta.tool_calls by index. A mid-stream model failure arrives as an {"error":{...}} frame (the stream status was already committed as 200) and still refunds the full estimate — there is no OpenAI-standard error frame after the 200. The customer is charged an upper-bound estimate before the call, and the actual usage is reconciled when the model responds — successful responses refund the unused estimate to the exact wallet buckets it was drawn from; failed / stream-error responses refund the full estimate. Serving-account faults we cannot let you fix return 503 with a Retry-After header (the affected serving account is on a short cooldown — retry after it); model overload is 502; your own rate limit is 429 with code: rpm_exceeded, while a passed-through model throttle always carries a different code.

post/v1/chat/completions

Request

  • Base URL: https://api.hotapi.ai
  • URL: https://api.hotapi.ai/v1/chat/completions
  • Auth: HTTP bearer

Request body

modelstring required
streamboolean

Stream the response as SSE (text/event-stream).

max_tokensinteger
temperaturenumber

Example request

{
  "model": "some-house-llm",
  "messages": [
    {
      "content": "Hello!",
      "tool_calls": [
        {
          "id": "chatcmpl-tool-8sd9f7aQ2",
          "function": {
            "name": "get_weather",
            "arguments": "{\"city\":\"Paris\"}"
          }
        }
      ]
    }
  ]
}

Response

OpenAI-compatible chat completion (non-streaming). When stream: true, the response is instead an SSE stream of standard chat.completion.chunk objects: choices[0].delta fragments (content, reasoning, tool_calls), a terminal frame with finish_reason, a usage frame with empty choices, then data: [DONE].

idstring required
object'chat.completion' required
createdinteger required

Unix seconds.

modelstring required

Example response

{
  "id": "chatcmpl_8sd9f7aQ2",
  "choices": [
    {
      "message": {
        "content": "Hello!",
        "tool_calls": [
          {
            "id": "chatcmpl-tool-8sd9f7aQ2",
            "function": {
              "name": "get_weather",
              "arguments": "{\"city\":\"Paris\"}"
            }
          }
        ]
      },
      "finish_reason": "stop"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.