Skip to Content
API ReferenceError Codes

Error Codes

Error Response Format

When an error occurs, FlowAPI returns a JSON response like this:

{ "error": { "message": "A human-readable description of the error.", "type": "invalid_request_error", "code": "invalid_api_key" } }

Common Error Codes

HTTP statusError typeCommon causeRecommendation
400invalid_request_errorMalformed request body or invalid parameter valuesValidate types and ranges such as temperature
401invalid_api_keyMissing, malformed, or invalid API keyVerify the Authorization header and active key
403permission_errorInsufficient permissions for the resourceCheck account access and plan limits
402insufficient_balanceAccount balance is zero or belowTop up credits before retrying
404not_found_errorUnknown model or endpointVerify the model ID and request path
429rate_limit_errorToo many requests in a short periodApply exponential backoff and retry
500server_errorInternal platform errorRetry the request, then contact support if it persists
502server_errorGateway could not reach upstream services cleanlyRetry after a short delay and inspect request ID
503service_unavailableModel is temporarily overloadedRetry after a short delay or switch models
504gateway_timeoutRequest took too long to processStream responses or raise the client timeout

Retry with Exponential Backoff

For transient errors such as 429, 503, and 504, implement retries with increasing delays:

import time from openai import OpenAI, RateLimitError client = OpenAI( api_key="YOUR_FLOW_API_KEY", base_url="https://api.flowapi.net/v1" ) max_retries = 3 for attempt in range(max_retries): try: response = client.chat.completions.create( model="gpt-4o", messages=[{"role": "user", "content": "Hello"}] ) break except RateLimitError: wait_time = 2 ** attempt print(f"Rate limited. Retrying in {wait_time}s...") time.sleep(wait_time)

Need Help?

If you encounter persistent errors, contact contact@flowapi.net and include the X-Request-ID header value when available.

Last updated on