Skip to main content
The Swarms API exposes an OpenAI Responses API-compatible POST /v1/responses endpoint. Code written for client.responses.create(...) in the OpenAI SDK works after changing the base_url and api_key. The endpoint is non-streaming and text-only. It runs through the same path as /v1/chat/completions, so model routing, billing, rate limits and logging are the same.

Endpoint Information


Quick Start

Response:

Request Fields

Message Items

When input is a list, each item is a message:
  • role is user, assistant, system or developer. system and developer messages become part of the system prompt.
  • content is a string, or a list of input_text / output_text parts, e.g. [{"type": "input_text", "text": "..."}]. The parts’ text is joined with spaces.
  • An item’s type, if set, must be message.

Not Supported Yet

These return 400 with "Not supported yet: <field>" or a message naming the problem:
  • stream: true
  • tools
  • previous_response_id
  • Any other field not listed above, when set to a non-empty value
  • Image or file content parts, and item types other than message (e.g. function call items)
  • input with no user message

Response Fields


Errors

Errors use the OpenAI error shape, so the OpenAI SDK’s exception classes work:
As on /v1/chat/completions, 401 and 402 come from the authentication layer in the Swarms shape (error.type, error.message, error.detail, error.status_code). See Error Response Schema.

Billing

Billing, rate limits and the minimum balance are the same as /v1/chat/completions: the provider-reported input and output tokens at the model’s price plus a 15% service fee, deducted after the run. The endpoint is billable, so it needs a purchased credit balance above $1.00. See Pricing.