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
  }'

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).