Skip to content

Support Amazon Bedrock as a provider for OpenCode (via Converse through the AI Gateway) #482

Description

@bjanssen11

Request

Let OpenCode route to an Amazon Bedrock Model Provider Service (MPS) through the Databricks AI Gateway, the same way Pi does.

Approach

OpenCode declares providers by npm package. The @ai-sdk/amazon-bedrock provider, given a bearer apiKey (no AWS SigV4, no region) and a baseURL of {workspace}/ai-gateway, builds /model/{id}/converse-stream requests. That is the only dialect the gateway serves for the amazon_bedrock provider type, so it is the right fit. The Databricks-Model-Provider-Service header must ride per-model, since OpenCode overwrites provider-level headers.

The provider block also has to survive OpenCode's launch-time and 30-minute token refresh, which otherwise re-renders the config and drops it.

Verification

Confirmed end to end against a live gateway: OpenCode installs @ai-sdk/amazon-bedrock on first use, the generated config survives a token refresh, and opencode run returns real Bedrock output across Claude, Nova, GPT-family, Grok, and Qwen targets.

Notes

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions