Skip to content

restrict amazon-bedrock provider to curated model allowlist#14

Closed
lgarceau768 wants to merge 410 commits into
flexfrom
task/bedrock-model-allowlist
Closed

restrict amazon-bedrock provider to curated model allowlist#14
lgarceau768 wants to merge 410 commits into
flexfrom
task/bedrock-model-allowlist

Conversation

@lgarceau768
Copy link
Copy Markdown
Collaborator

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds a hardcoded BEDROCK_ALLOWED_MODELS set in packages/opencode/src/provider/provider.ts that restricts the amazon-bedrock provider to a curated list of 30 approved models. The filter runs inside the existing provider initialization loop, immediately after the deprecated status check and before the config blacklist/whitelist check.

Approved models by family:

  • Anthropic/Claude: Sonnet 4.6 (US), Opus 4.6 (US), Haiku 4.5 (US)
  • Google Gemma (Bedrock): 27B, 12B, 4B
  • OpenAI/GPT (Bedrock): GPT Safeguard 120B, GPT Safeguard 20B
  • Amazon Nova: Nova 2 Lite
  • Qwen: 235B, 80B, 32B, Coder 30B
  • NVIDIA Nemotron: Nano 30B, Nano 12B, Nano 9B
  • Mistral: Large 675B, Magistral Small, Ministral 14B, Ministral 8B, Voxtral 24B
  • DeepSeek: R1
  • Minimax: M2
  • Moonshot/Kimi: K2 (kimi-k2.5), K2 Thinking
  • ZAI/GLM: GLM-4.7, GLM-4.7 Flash
  • Writer/Palmyra: X5, X4
  • Meta/Llama: Llama 3.1 8B

Because the built-in allowlist runs before the config-level whitelist/blacklist, users can still add custom models (e.g. a Bedrock fine-tune) via their opencode config without being blocked.

How did you verify your code works?

  • Ran bun typecheck in packages/opencode — passes clean.
  • Verified the 30 model IDs against the current models-snapshot.js to confirm each entry exists and maps to the expected model.

Screenshots / recordings

N/A — no UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

rekram1-node and others added 30 commits April 16, 2026 17:45
On Windows, native terminals don't support POSIX suspend (ctrl+z), so we now
assign ctrl+z to input undo instead of terminal suspend. Terminal suspend is
disabled on Windows to avoid conflicts with the undo functionality.
thdxr and others added 25 commits April 19, 2026 19:34
…n headers (anomalyco#22927)

Co-authored-by: Kit Langton <kit.langton@gmail.com>
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
Adds a hardcoded BEDROCK_ALLOWED_MODELS Set in the provider
initialization loop that filters the amazon-bedrock provider
down to 30 approved models across Claude, Gemma, GPT Safeguard,
Nova 2 Lite, Qwen, Nemotron, Mistral, DeepSeek, Minimax, Kimi,
GLM, Palmyra, and Llama families.

The allowlist runs before the existing config blacklist/whitelist
check, so users can still override via config (e.g. to add a
custom Bedrock fine-tune).
@github-actions
Copy link
Copy Markdown

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • No issue referenced. Please add Closes #<number> linking to the relevant issue.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Copy Markdown

Hey! Your PR title restrict amazon-bedrock provider to curated model allowlist doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.