OpenAI Compatible

Chat Completions (OpenAI-compatible)

OpenAI-compatible chat completions endpoint. Accepts the standard OpenAI request schema and returns the standard OpenAI response schema. Supports both streaming (SSE) and non-streaming modes. Works as a drop-in replacement with the OpenAI Python and TypeScript SDKs.

post/v1/chat/completions

Headers

x-api-keystring required

Request body

modelstring required

Model to use for completion

temperaturenumber nullable

Sampling temperature (0 to 2)

top_pnumber nullable

Nucleus sampling parameter

ninteger nullable

Number of completions to generate

streamboolean nullable

Whether to stream partial results

max_tokensinteger nullable

Maximum tokens to generate

max_completion_tokensinteger nullable

Maximum completion tokens (takes precedence over max_tokens)

presence_penaltynumber nullable

Presence penalty

frequency_penaltynumber nullable

Frequency penalty

userstring nullable

Unique identifier for the end-user

max_loopsinteger nullable

Maximum number of agent reasoning loops (Swarms extension). Defaults to 1 (single pass), at most 50. Use via extra_body in the OpenAI SDK.

Response

Successful Response

idstring required
objectstring
createdinteger required
modelstring required

Changes

Changed in 3 of the 53 revisions of this API.14

    • the / request property's max was decreased to 50.00

      request-property-max-decreased

    • the / request property's max was set to 100.00

      request-property-max-set

    • the / request property's min was set to 1.00

      request-property-min-set

    • the / request property's max was set to 2.00

      request-property-max-set

    • the / request property's min was set to 0.00

      request-property-min-set