Skip to content

Fix Gemini through Cloudflare AI Gateway (5.4.8) - #128

Merged
linxule merged 1 commit into
mainfrom
fix/gemini-gateway-key
Nov 30, 2026
Merged

linxule merged 1 commit into
mainfrom
fix/gemini-gateway-key

Conversation

@linxule

@linxule linxule commented Nov 30, 2026

Copy link
Copy Markdown
Owner

What was wrong

On an installation that sends provider requests through Cloudflare AI Gateway, every Gemini request was refused by the gateway before it reached Google: "Customer-provided provider credentials are required for this request". The gateway is set to require provider credentials (the installer's policy), and it no longer treats the x-goog-api-key header as one. Anthropic, OpenAI and OpenRouter requests are forwarded as before.

Checked with requests that cost nothing (a fake key): the header form is refused on v1beta/interactions and on generateContent; the ?key= form is forwarded to Google. Then one small real call through a gateway each way: header only fails, header plus ?key= returns a response.

The change

  • On the gateway route, the Gemini adapter also sends the key as the key query parameter. The direct route is unchanged.
  • No server contract, storage, schema or binding change. Version 5.4.8, with a release note that says what a key in a URL costs and that refused requests leave empty entries in the gateway's log list.

Checks

  • New test with the real SDK against a local server: on the gateway route the request URL carries the key; on the direct route it does not. It failed before the change.
  • The adapter's errors and log lines do not contain the key on a 400 or a dropped connection (checked by hand).
  • npm run check (3,766 tests), test:setup, test:setup:cloudflare, test:cloudflare (511 tests) pass locally.
  • The full release check and a staging interview on Gemini run before deployment.

🤖 Generated with Claude Code

A gateway that requires provider credentials no longer counts the
`x-goog-api-key` header as one and refuses every Gemini request before it
reaches Google ("Customer-provided provider credentials are required").
On the gateway route the adapter now also sends the key as the `key`
query parameter, which the gateway accepts. The direct route is unchanged.

The new test uses the real SDK against a local server and checks where
the key travels on each route.

Release 5.4.8: version, release note, README pointer.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
@linxule
linxule merged commit cacd198 into main Nov 30, 2026
6 checks passed
@linxule
linxule deleted the fix/gemini-gateway-key branch November 30, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant