plaingateway
Features

Structured outputs

Ask for JSON that matches a schema.

Structured output means the model must answer with JSON that matches a JSON Schema you send. Check that structured_outputs is in the model's supported_parameters in GET /models.

sh
curl https://api.plaingateway.com/api/v1/chat/completions \
  -H "Authorization: Bearer $PLAINGATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "openai/gpt-5.6-luna",
  "messages": [{"role": "user", "content": "Name a city and its country."}],
  "response_format": {
    "type": "json_schema",
    "json_schema": {
      "name": "place",
      "strict": true,
      "schema": {
        "type": "object",
        "properties": {"city": {"type": "string"}, "country": {"type": "string"}},
        "required": ["city", "country"],
        "additionalProperties": false
      }
    }
  }
}'

The JSON is the text of choices[0].message.content. A host that rejects the schema answers 400, and metadata.raw carries its message. For a Claude model on an Anthropic host, the gateway passes a json_schema format on when that Claude model supports structured output. It drops json_object, and drops json_schema for a Claude model without that support; check supported_parameters first.