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 API MCP server now serves Cloudflare skills
The Cloudflare API MCP server now integrates with the Skills over MCP extension, allowing MCP clients to discover and access Cloudflare skills. Users can add the MCP server endpoint to compatible MCP clients to access these skills.
WAF failed detections field now available in Rules
A new cf.appsec.request.failed_detections field lets you control how rules handle requests when security detections fail. This array of detection IDs covers content scanning, WAF attack scoring, attack signatures, leaked credentials, and AI-based PII/prompt injection/custom topic detection failures, and works across custom rules, rate limiting rules, and request header transform rules.
Markdown for Agents: More efficient in-process streaming conversion
Markdown for Agents now uses an in-process streaming engine at the edge to convert HTML, reducing overhead and memory use. The conversion limit increased from 2 MiB to 6 MiB, and token count headers are no longer generated.