Skip to content

[AI Gateway] Document Bedrock API key auth for Unified API - #32693

Closed
superhighfives wants to merge 1 commit into
productionfrom
aig-bedrock-compat-apikey-region
Closed

[AI Gateway] Document Bedrock API key auth for Unified API#32693
superhighfives wants to merge 1 commit into
productionfrom
aig-bedrock-compat-apikey-region

Conversation

@superhighfives

Copy link
Copy Markdown
Contributor

Summary

Documents a new authentication option for Amazon Bedrock on the Unified API (/compat/chat/completions): a plain Bedrock API key (bearer token). Previously the compat path required BYOK SigV4 credentials with an explicit region and rejected bearer-only requests, so a Bedrock API key never worked there. AI Gateway now defaults the region to us-east-1 for the bearer path, so key-only Bedrock compat works out of the box. SigV4 BYOK is unchanged and still requires an explicit region.

Adds an Authentication subsection contrasting BYOK (SigV4) vs. Bedrock API key auth, plus an OpenAI SDK example using a Bedrock API key and a note on targeting other regions via BYOK.

Documentation checklist

@github-actions github-actions Bot added product:ai-gateway AI Gateway: https://developers.cloudflare.com/ai-gateway/ size/s labels Aug 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/ai-gateway/ @abhishekkankani, @palashgo, @thebongy, @roerohan, @kathayl, @mchenco, @zeke, @superhighfives, @adriandlam, @mattrothenberg, @ethulia, @aninibread, @kflansburg, @cloudflare/product-owners

@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review

⚠️ 1 warning found in commit f2c9404.

👉 Fix in your agent 👈
Fix the following review findings in PR #32693 (https://github.com/cloudflare/cloudflare-docs/pull/32693).

Before making changes, review each finding and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g. the fix requires disproportionate effort for minimal benefit,
  or the finding is factually incorrect), explain why
- If you need clarification before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order

After triaging, follow this order:
1. Post a comment on this PR for any findings you are skipping, with the finding ID and your reasoning.
2. Then commit the fixes for the legitimate findings.

The comment must come before the commit — the bot reads PR comments when a new
push triggers a review, so skip comments posted after the push will be missed.

---

## Code Review

### Warnings (1)

#### CR-3a82d26193fb · Missing gateway authentication in provider-key SDK example
- **File:** `src/content/docs/ai-gateway/usage/providers/bedrock.mdx` line 246
- **Issue:** The new Bedrock API key OpenAI SDK snippet sets `apiKey: "{BEDROCK_API_KEY}"`, which sends the Bedrock token in the `Authorization` header. It does not show how to also send `cf-aig-authorization: Bearer {CF_AIG_TOKEN}`, so users with authenticated gateways will get a 401.
- **Fix:** Add `defaultHeaders: { "cf-aig-authorization": "Bearer {CF_AIG_TOKEN}" }` and note that it is only needed for authenticated gateways, or use Details/Tabs for authenticated vs. unauthenticated variants like the OpenAI provider page.

Code Review

This code review is in beta and may not always be helpful — use your judgment.

Warnings (1)
File Issue
ai-gateway/usage/providers/bedrock.mdx line 246 Missing gateway authentication in provider-key SDK example — The new Bedrock API key OpenAI SDK snippet sets apiKey: "{BEDROCK_API_KEY}", which sends the Bedrock token in the Authorization header. It does not show how to also send cf-aig-authorization: Bearer {CF_AIG_TOKEN}, so users with authenticated gateways will get a 401. Fix: Add defaultHeaders: { "cf-aig-authorization": "Bearer {CF_AIG_TOKEN}" } and note that it is only needed for authenticated gateways, or use Details/Tabs for authenticated vs. unauthenticated variants like the OpenAI provider page.

Conventions

No convention issues found.

Style Guide Review

No style-guide issues found.

Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.
/ignore-review-limit Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal.
/disable-auto-review Stops automatic reviews from triggering on future pushes to this PR. Codeowners can still run /review or /full-review manually.
/rebase Rebases the PR branch against production. On conflict, attempts to resolve automatically using AI. Stops with an explanation if confidence is not high enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:ai-gateway AI Gateway: https://developers.cloudflare.com/ai-gateway/ size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.