---
description: Provider authentication failures now return consistent HTTP status codes through the AI Gateway REST API.
title: Standardize provider credential error responses in AI Gateway
image: https://developers.cloudflare.com/changelog/post/2026-10-05-provider-credential-errors/og.png?v=007c51d24b1bd95f
---

[Skip to content](#main-content)

[View RSS feeds](https://developers.cloudflare.com/fundamentals/new-features/available-rss-feeds/) [ Subscribe to RSS](https://developers.cloudflare.com/changelog/rss/index.xml)

[Back to all posts](https://developers.cloudflare.com/changelog)

October 6, 2026

## Standardize provider credential error responses in AI Gateway

[AI Gateway](https://developers.cloudflare.com/ai-gateway/)

Copy as Markdown| [View as Markdown](https://developers.cloudflare.com/changelog/post/2026-10-05-provider-credential-errors/index.md)| [Agent setup](https://developers.cloudflare.com/agent-setup/)

AI Gateway's REST API now returns consistent responses when an AI provider rejects credentials. The change applies to [`POST /ai/run` ↗︎](https://api.cloudflare.com/client/v4/accounts/%7BACCOUNT_ID%7D/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](https://developers.cloudflare.com/ai-gateway/features/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](https://developers.cloudflare.com/ai-gateway/configuration/bring-your-own-keys/).

```json
{"@context":"https://schema.org","@type":"BlogPosting","@id":"https://developers.cloudflare.com/changelog/post/2026-10-05-provider-credential-errors/#page","headline":"Standardize provider credential error responses in AI Gateway","description":"Provider authentication failures now return consistent HTTP status codes through the AI Gateway REST API.","url":"https://developers.cloudflare.com/changelog/post/2026-10-05-provider-credential-errors/","inLanguage":"en","image":"https://developers.cloudflare.com/changelog/post/2026-10-05-provider-credential-errors/og.png?v=007c51d24b1bd95f","dateModified":"2026-10-06","datePublished":"2026-10-06","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```
