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
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-bedrockprovider, given a bearerapiKey(no AWS SigV4, no region) and abaseURLof{workspace}/ai-gateway, builds/model/{id}/converse-streamrequests. That is the only dialect the gateway serves for theamazon_bedrockprovider type, so it is the right fit. TheDatabricks-Model-Provider-Serviceheader 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-bedrockon first use, the generated config survives a token refresh, andopencode runreturns real Bedrock output across Claude, Nova, GPT-family, Grok, and Qwen targets.Notes
maxTokens(for example Nova's 10k limit).