Last updated: 2026-06-14
Request Format
All API requests use the HTTPS protocol with JSON request bodies.Prefer
https://api.crazyrouter.com/v1 by default. If you are unsure whether a client should use the root domain or /v1, check API Endpoints first.Required Headers
Optional Headers
Request Example
Sending a gzip request body
If your request body is large, for example long context, long documents, or a large message history, you can gzip-compress the original JSON body before sending it. gzip only changes the transport format. It does not change the request semantics. Crazyrouter decompresses the body before parsing the JSON. Add these headers:Content-Encoding: gzip means the request body itself is gzip-compressed. It is different from Accept-Encoding: gzip, which is usually used for response compression.Python
Node.js
cURL
Automatically enable gzip by body size
If your system is a workflow, you usually do not need to manually decide which business steps should use gzip. Put the decision in your shared HTTP client wrapper: serialize the JSON body first, check its byte size, and gzip only when it is above a threshold. Recommended threshold:256KB is also a reasonable threshold. Do not force gzip for very small requests, because compression overhead and gzip headers can make them larger.
Python wrapper example:
- a single request body is often larger than 1 MB
- you repeatedly upload long context or long documents
- your client can directly control the HTTP body and headers
Streaming Requests
Setstream: true to enable SSE streaming output:
data: and the stream ends with data: [DONE].
Online Debugging
You can debug the API online using the following methods:- Crazyrouter Playground - After signing in, visit crazyrouter.com/console/playground to test directly in your browser
- cURL - Send requests using the command-line tool
- Postman / Apifox - Use API debugging tools