Errors & Status Codes
The gateway follows OpenAI-compatible error conventions with additional nikcli-specific codes.
HTTP Status Codes
| Code | Meaning |
|---|---|
200 | Success |
400 | Bad request — invalid parameters |
401 | Unauthorized — invalid or missing API key |
403 | Forbidden — key revoked or rate limited |
429 | Too many requests — rate limit exceeded |
500 | Internal error — upstream failure |
503 | Service unavailable — all providers down |
Error Response Shape
{
"error": {
"message": "Invalid API key",
"type": "invalid_request_error",
"code": "invalid_api_key",
"param": null
}
}
Common Errors
invalid_api_key (401)
Your API key is missing, malformed, or revoked.
curl https://inference.nikcli-ai.dev/v1/chat/completions \
-d '{"model":"nikseek","messages":[{...}]}'
# Missing Authorization header
Fix: Check your key at Dashboard → API Keys
rate_limit_exceeded (429)
Too many requests. Back off and retry.
{
"error": {
"message": "Rate limit exceeded",
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"retry_after": 5
}
}
Fix: Implement exponential backoff, or upgrade your tier for higher limits.
model_not_found (404)
The model identifier doesn’t exist.
{
"error": {
"message": "Model 'gpt-5' not found",
"type": "invalid_request_error",
"code": "model_not_found"
}
}
Fix: Check available models
context_length_exceeded (400)
Your prompt exceeds the model’s context window.
{
"error": {
"message": "This model's maximum context length is 128000 tokens",
"type": "invalid_request_error",
"code": "context_length_exceeded"
}
}
Fix: Truncate your input or use a model with larger context.
upstream_error (502)
The upstream provider returned an error.
{
"error": {
"message": "Upstream provider error: timeout",
"type": "upstream_error",
"code": "upstream_timeout"
}
}
Fix: Retry — the gateway will route to a different provider on retry.
nikcli-Specific Errors
| Code | Meaning |
|---|---|
circuit_open | Provider health circuit breaker triggered |
no_healthy_provider | All providers for model are unhealthy |
cache_write_failed | Cache write error (non-fatal) |
Debugging Tips
- Enable verbose logging — check
X-Request-IDheader for correlation - Test upstream directly — see
/v1/providersfor current health - Check dashboard — Usage page shows error breakdown