Skip to content

[FEATURE]: Support preferred APIs for open weight models on Bedrock (OpenAI APIs on Runtime) #66015

Backlog

Description

@athewsey

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

The Problem

OpenCode's native amazon-bedrock provider currently routes models through the Converse API, and its existing OpenAI-compatible alternative targets the bedrock-mantle API endpoints.

However, recent (Kimi & GLM) open weight models on Bedrock:

  1. Do not support the Mantle endpoint (The inference endpoints doc page now explicitly recommends new applications to use Runtime over Mantle endpoints), and
  2. Strongly recommend the OpenAI-compatible APIs over Converse. The Kimi model cards, in particular, call out significant limitations of Converse in the "usage considerations" sections.

In some cases, this can cause significantly degraded output quality when using these models on OpenCode, through Bedrock - for example if trying to attach PDFs.

For reference:

For K3 and K3.1, the Chat Completions API in particular is recommended. For GLM 5.3, either OpenAI-compatible API is preferred.

Current implementation

  • amazon-bedrock.ts provides native Runtime Converse support and uses the existing Bedrock authentication utilities for SigV4/default AWS credentials or bearer authentication.
  • amazon-bedrock-mantle.ts already composes the native Chat Completions and Responses protocol implementations, but defaults to bedrock-mantle.<region>.api.aws and signs with the bedrock-mantle service. It cannot simply be repointed at Runtime without accounting for these endpoint and authentication differences.
  • models.dev treats the first declared API as the normal default. OpenCode currently honors recommended_api only when its experimental recommended_api feature is enabled, so adding a recommendation alone would not change normal routing.

Proposed scope

  1. Add a native Runtime OpenAI-compatible provider entrypoint, reusing the existing Chat Completions and Responses protocol implementations and Bedrock authentication support rather than duplicating wire protocols.
    • Chat Completions is the initial requirement for the Kimi models.
    • Expose Responses for models whose Runtime metadata declares support for it.
    • Default to https://bedrock-runtime.<region>.amazonaws.com/openai/v1.
    • Support SigV4 through the default AWS credential chain and existing profile/static-credential options, as well as Bedrock API keys.
    • Preserve Runtime model and inference-profile IDs without applying Mantle-specific routing behavior.
  2. Coordinate models.dev metadata for the affected Kimi and GLM model entries:
    • Declare the supported Runtime APIs, base URL, and native OpenCode package entrypoint.
    • Set recommended_api = "chat-completions" for the Kimi models, per their model cards.
    • Decide Chat Completions versus Responses for GLM 5.3 from its supported capabilities, rather than applying a blanket rule to every open-weight model.
  3. Define default API selection explicitly. Either make the preferred API first in the catalog or graduate/extend recommended_api handling so it influences normal routing. An explicit user-configured API/package must continue to override catalog recommendations.
  4. Retain Converse as a supported route and fallback where appropriate... But IMO an explicitly selected API should not silently fall back to another wire protocol when its request fails.
  5. Add recorded authentication, request, streaming, reasoning, tool-call/result, and error coverage for the new Runtime routes, plus catalog-routing tests covering recommendation, default, and explicit-override behavior.

This should not change the existing Mantle provider's behavior, but would likely refactor its implementation to share components.

Design questions

  1. Should this extend the existing @opencode/ai/providers/amazon-bedrock with Chat Completions and Responses model constructors? Or create a separate package e.g. @opencode/ai/providers/amazon-bedrock-runtime (which might be more confusing but reduce within-package bloat)?
  2. Could we move recommended_api from an opt-in to default behavior, either for the Bedrock provider in particular or perhaps for all of OpenCode? Maybe there's some change control process to follow here?

Related issues

  • feat(llm): design native Bedrock Mantle support #36208 — native Bedrock Mantle design and per-model protocol selection. This request follows a similar catalog/provider design but targets Runtime, which has different endpoint, authentication, and capability semantics.
  • [FEATURE]: General Bedrock retouch #49953 — broader Bedrock authentication, model-discovery, and ZDR improvements. Related in terms of authentication in particular, but this request is specific to Runtime protocol support and per-model API selection.

I can raise a corresponding models.dev issue and link the two if it's helpful, so that the package metadata and OpenCode implementation land in a coordinated way.

Activity

  1. opencodejr commented on Nov 24, 2026

    @opencodejr
    Contributor

    Thanks for the detailed proposal, @athewsey!

    You're asking for a native OpenAI-compatible route on Bedrock Runtime (bedrock-runtime.<region>.amazonaws.com/openai/v1). It would reuse the existing Chat Completions and Responses implementations and Bedrock auth. Models like Kimi K3/K3.1 and GLM 5.3 would then use the API AWS recommends for them instead of Converse, with catalog metadata and default-API selection to match. Maintainers will consider it, including your two design questions.

    Related issues and PRs:

  2. added
    area/providers
    type/feature
    version/v2
    on Nov 24, 2026
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

    area/providerstype/featureversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions