Дата обновления: 2026-06-14
All API requests use the HTTPS protocol with JSON request bodies.
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:
If your requests are often MB-sized, 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:
Node.js wrapper example:
Use this when:
- 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
Set stream: true to enable SSE streaming output:
Streaming responses use the Server-Sent Events (SSE) format. Each event starts with 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