Skip to content

Advanced requests

Use streaming, function tools, structured output, vision and cache-aware models within each published model’s verified capabilities.

Check capabilities first

Each model page is authoritative for its published context, output limit, protocol and supported parameters. CHUA ONE rejects an unverified parameter instead of silently changing the request.

Compare models · Read the capability matrix

Streaming

Set stream to true only when the selected model lists stream. Read Server-Sent Events until [DONE]. If an error event arrives after output begins, treat partial output as incomplete and check the request record.

Handle interrupted streams

Function tools

A request supports up to 64 function definitions. Tool names are at most 100 characters and descriptions at most 5,000 characters. Execute a returned tool call in your application, then send a tool message with the matching tool_call_id.

POST https://chuaone.si/v1/chat/completions

{
  "model": "YOUR_ALLOWED_MODEL",
  "messages": [
    {
      "role": "user",
      "content": "What is the weather in Hong Kong?"
    }
  ],
  "max_tokens": 256,
  "stream": false,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Read current weather",
        "parameters": {
          "type": "object",
          "properties": {
            "city": {
              "type": "string"
            }
          },
          "required": [
            "city"
          ],
          "additionalProperties": false
        },
        "strict": true
      }
    }
  ],
  "tool_choice": "auto"
}

Structured JSON

Use response_format only when the model lists that parameter. json_object asks for valid JSON. A model may also support json_schema through the compatible request contracts; verify the exact model page before relying on it.

{
  "model": "YOUR_ALLOWED_MODEL",
  "messages": [
    {
      "role": "user",
      "content": "Return one JSON object with a summary field."
    }
  ],
  "max_tokens": 128,
  "stream": false,
  "response_format": {
    "type": "json_object"
  }
}

Vision input

  • Use image_url content parts only for a model that lists vision. A public HTTPS URL or a bounded PNG, JPEG, WebP or GIF data URL is accepted by the common contract.
  • The full JSON body is limited to 2 MiB. Vision requests reserve a conservative full-context budget before dispatch and settle confirmed usage afterward.
  • Haiku 5.5 accepts Base64 images on its verified route with detail omitted or set to auto.

Cache usage

When the provider confirms cached reads or cache writes, usage.prompt_tokens_details reports those counts. Charges use the cache price components published for the selected model. Treat only reported cache details as confirmed cache usage.

Read usage and billing