POST /v1/chat/completions
The core routing endpoint.
POST
/v1/chat/completionsuserRoute a chat-completion request to the optimal LLM tier.
Request body
Fully OpenAI-compatible. The fields HiWay cares about specifically:
| Field | Type | Meaning |
|---|---|---|
| model | string | auto (smart routing) or a tier (light, standard, heavy) or a pinned model (claude-sonnet, gpt-4o-mini, …) |
| messages | array | Standard chat-completions format, system+user+assistant+tool roles. |
| max_tokens | int | Upper bound on output tokens. Directly affects the worst-case cost HiWay reserves before forwarding. |
| stream | bool | SSE streaming. Works with every supported provider. |
| tools | array | OpenAI tool-use format. Forwarded as-is to compatible providers. |
Response headers
X-HiWay-Model— provider model actually used.X-HiWay-Tier— routing tier picked.X-HiWay-Cost-USD— cost debited from your balance.X-HiWay-Routing-Ms— time the router took to decide (always under 5 ms).