Quick diagnosis
401: unauthorized
Use exactly this header shape:- There is one space after
Bearer. - The key was copied completely with no quotes or trailing whitespace.
- The key has not been revoked.
- Your environment variable is available to the running process.
- macOS and Linux
- Windows PowerShell
Confirm only that a value exists without printing the secret:
400: bad request
A minimal valid body is:- Single quotes or missing commas in JSON
messagessent as an object instead of an array- Missing
roleorcontent - Unsupported model value
- Sending a JSON string inside another JSON object
- Forgetting
Content-Type: application/json
404: not found
Use:/v1:
/v1 twice.
429: rate limited
Wait before retrying. Repeated immediate retries make the problem worse.- Respect
Retry-Afterwhen present. - Use exponential backoff and a small random delay.
- Limit concurrency in loops and background jobs.
- Stop after a small number of failed attempts.
Timeout or connection failure
- Confirm the URL begins with
https://. - Run the model-list cURL check from the same machine.
- Check whether a proxy, VPN, firewall, or hosting provider blocks outbound HTTPS.
- Set a reasonable client timeout such as 30 seconds.
- Retry temporary failures a limited number of times.
500 or 503 means the API did respond but could not complete the request.
SDK uses the wrong service
The most common configuration error is forgetting the custom base URL.- Python
- JavaScript
base_url; JavaScript uses baseURL.
Streaming shows nothing
Confirm all three conditions:- The request includes
stream: true. - Your code iterates over chunks instead of waiting for a normal completion object.
- Your terminal or web server flushes output instead of buffering it.
Before contacting support
Collect:- Approximate time of the failed request and your timezone
- HTTP status code
- Error
type,code, and message - Endpoint and SDK name/version
- A minimal request with private data removed
Contact support
Email support@llm.kiwi with the safe diagnostic details above.
Error reference
Look up status-specific behavior.