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.

toolsobject[] nullable

Function-calling tool definitions, in OpenAI schema

Response

Successful Response

idstring required
objectstring
createdinteger required
modelstring required

Changes

Changed in 4 of the 80 revisions of this API.246

  • 045f2bf862b916See the full diff
    • ▲

      response property choices/items/finish_reason list-of-types was widened by adding types null to media type application/json of response 200

      response-property-list-of-types-widened

    • ○

      added the new optional request property //

      new-optional-request-property

    • ○

      added the new optional request property //

      new-optional-request-property

    • ○

      added the new optional request property

      new-optional-request-property

    • ○

      added the new optional request property

      new-optional-request-property

    • ○

      added the optional property /// to the response with the status

      response-optional-property-added

    • ○

      added the optional property /// to the response with the status

      response-optional-property-added

    • ▲

      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