Skip to main content
The /v1/chat/completions endpoint is the primary interface for text-based workflows. It supports streaming, tool calling, and structured outputs across all providers.

Standard Request

curl --request POST \
  --url https://api.inworld.ai/v1/chat/completions \
  --header 'Authorization: Bearer <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "auto",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Write a 50-word bio for a software engineer."}
    ],
    "stream": true
  }'

Multimodal Inputs

To send images or audio alongside text, use the array form of content with typed content blocks.

Images

Use image_url with a base64 data URI or an HTTP URL. Google AI Studio and Vertex AI require base64 data URIs; other providers also accept HTTP URLs.
curl --request POST \
  --url https://api.inworld.ai/v1/chat/completions \
  --header 'Authorization: Bearer <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "google-ai-studio/gemini-2.5-flash",
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "Describe this image." },
          { "type": "image_url", "image_url": { "url": "data:image/jpeg;base64,/9j/4AAQ..." } }
        ]
      }
    ]
  }'

Audio

Use input_audio with base64-encoded audio data:
curl --request POST \
  --url https://api.inworld.ai/v1/chat/completions \
  --header 'Authorization: Bearer <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "google-ai-studio/gemini-2.5-flash",
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "Transcribe this audio." },
          { "type": "input_audio", "input_audio": { "data": "UklGRi...", "format": "wav" } }
        ]
      }
    ]
  }'
Multimodal support depends on the underlying model. Refer to the provider’s documentation for supported input types, formats, and limits.

Advanced Features

Tool Calling (Function Calling)

Inworld Router normalizes tool calling. You define tools in the OpenAI format, and the router translates them for Anthropic or Google models.

Structured Outputs (JSON Mode)

Force the model to return valid JSON by setting response_format: { "type": "json_object" }. Inworld Router ensures the underlying provider respects this constraint.

Streaming

Real-time token streaming is supported for all providers. The stream format is identical to OpenAI’s Server-Sent Events (SSE). See Web search for extra_body.web_search, web_search_options, and citation annotations.