Standardize provider credential error responses in AI Gateway
AI Gateway now returns consistent HTTP 401 responses with error code 2009 when any AI provider rejects credentials, replacing previously provider-specific error responses. Applications using the AI Gateway REST API must be updated to treat HTTP 401 as an invalid or rejected provider credential.
AI Gateway's REST API now returns consistent responses when an AI provider rejects credentials. The change applies to POST /ai/run ↗︎.
| Scenario | Previous AI Gateway response | New AI Gateway response |
|---|---|---|
| ElevenLabs | Provider-specific UserCredentialsError with HTTP 403 |
HTTP 401 with error code 2009 |
| Google Vertex | HTTP 500 for rejected credentials, with upstream retries |
HTTP 401 with error code 2009; the request fails without retrying the provider |
| All other providers | HTTP 402 or another provider-specific status for rejected credentials |
HTTP 401 with error code 2009 |
| When using Unified Billing, the provider rejects the credentials | Provider-specific authentication error | HTTP 503 |
Update applications that handle AI Gateway REST API errors to treat HTTP 401 as an invalid or rejected provider credential.
For details about providing provider credentials, refer to Bring your own provider keys.
Source: original entry ↗
More from Cloudflare
Follow Cloudflare to get its new changes in your feed and email digest.
Cloudflare One Client for macOS 2026.8.2100.0
GA release for macOS Cloudflare One Client with improved split tunnel handling that no longer briefly blocks traffic during reconnects, support for non-RFC 1918 local IPv4 networks, faster connects with lower memory use, and numerous reliability fixes across DNS, reauthentication, and client stability.
Cloudflare One Client for Windows 2026.8.2100.0
This GA release improves split tunnel reliability, adds support for non-RFC 1918 local networks, optimizes connection performance with faster reconnections and lower memory usage, and includes numerous bug fixes for DNS, registration, and network handling. The client now features a service recovery mechanism that automatically restarts on system unlock and better handles large hosts files without blocking traffic.
Cloudflare One Client for Linux 2026.8.2100.0
New GA release for Linux with improved split tunnel handling that no longer briefly blocks traffic during reconnects, support for non-RFC 1918 local IPv4 networks, faster tunnel reconnections, and lower memory usage. Includes numerous stability and reliability fixes for DNS, reconnection behavior, and crash issues.