Chat

Create Chat Completion

Changed on

Create a chat completion with automatic session creation if enabled.

Supports both streaming and non-streaming responses based on the 'stream' parameter. Tool calling is supported but may work better with streaming enabled.

Billing is applied to both streaming and non-streaming requests:

  • Balance is checked before the request starts
  • 402 Payment Required is returned if insufficient credits
  • Usage is finalized after completion with actual token counts
  • Holds are voided on failures or disconnects
post/api/v1/chat/completions

Request

  • The document declares no server URL.
  • Auth
    API key in header Authorization

Request body

modelstring
temperaturenumber
top_pnumber
ninteger
streamboolean
max_tokensinteger
presence_penaltynumber
frequency_penaltynumber
session_idstring

Optional session ID to use for this request. If not provided, the system will use the session associated with the API key.

Response

Successful Response

unknown required

Changes

    • info

      request property // list-of-types was widened by adding types array to media type application/json

    • info

      the endpoint scheme security BearerAuth was removed from the API

    • info

      the endpoint scheme security OAuth2 was removed from the API