Skip to content

feat(auth): add AWS Bedrock Mantle platform support to /login flow#1784

Open
nimit2801 wants to merge 3 commits intoMoonshotAI:mainfrom
nimit2801:feat/bedrock-mantle-login
Open

feat(auth): add AWS Bedrock Mantle platform support to /login flow#1784
nimit2801 wants to merge 3 commits intoMoonshotAI:mainfrom
nimit2801:feat/bedrock-mantle-login

Conversation

@nimit2801
Copy link
Copy Markdown

@nimit2801 nimit2801 commented Apr 7, 2026

Summary

This PR adds AWS Bedrock Mantle (OpenAI-compatible API) as a first-class platform in the interactive /login setup flow.

Changes

  • platforms.py: Add BedrockMantle platform with openai_legacy provider type, dynamic region-based base URL construction, and OpenAI-compatible model listing
  • setup.py: Add interactive region selection for Bedrock Mantle during /login, handle model fetching with custom base URLs, and disable Kimi-specific services (search/fetch) for this platform
  • Documentation: Update EN/ZH provider docs with Bedrock Mantle section
  • Examples: Add examples/bedrock-mantle.md with setup guide
  • Tests: Add tests/auth/test_bedrock_mantle_platform.py for URL construction and model parsing

Features

  • Interactive region selection (us-east-1, us-west-2, eu-west-1, eu-west-2, ap-south-1, ap-northeast-1)
  • Automatic base URL construction: https://bedrock-mantle.{region}.api.aws/v1
  • Kimi model support with 128K context default for OpenAI-compatible endpoints
  • No breaking changes to existing providers

Testing

  • Run /login and select "AWS Bedrock Mantle (OpenAI-compatible)"
  • Verify region prompt appears and base URL is correctly constructed
  • Verify model listing works with provided API key

Made with Cursor


Open with Devin

- Add Bedrock Mantle platform to PLATFORMS with openai_legacy provider type
- Add interactive region selection for Bedrock Mantle in setup flow
- Handle OpenAI-compatible model listing for Mantle endpoints
- Add documentation and examples for Bedrock Mantle usage
- Add tests for Bedrock Mantle URL construction and model parsing
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review


**`/login` flow:** choose **AWS Bedrock Mantle (OpenAI-compatible)**, pick a region, enter the API key, then select a model. This writes a managed provider `managed:bedrock-mantle` and clears Moonshot search/fetch (those tools are Kimi Code–specific).

**Environment overrides** (optional): `OPENAI_BASE_URL` and `OPENAI_API_KEY` override the saved `base_url` and `api_key` for `openai_legacy` providers only when set; they do not change other providers’ URLs.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Documentation incorrectly states env overrides apply to openai_legacy only, but code also applies them to openai_responses

The new documentation in three places claims that OPENAI_BASE_URL and OPENAI_API_KEY environment variable overrides apply exclusively to openai_legacy providers. However, src/kimi_cli/llm.py:87 shows case "openai_legacy" | "openai_responses":, meaning these env vars also override openai_responses providers. The Chinese source-of-truth doc at docs/zh/configuration/providers.md:71 explicitly states 不会影响其他供应商 ("will not affect other providers"), which is factually wrong for openai_responses users. The same incorrect claim appears in the English providers doc and examples/bedrock-mantle.md:44.

Prompt for agents
The documentation in three files claims that OPENAI_BASE_URL and OPENAI_API_KEY env var overrides apply only to openai_legacy providers. But the actual implementation at src/kimi_cli/llm.py:87 applies them to both openai_legacy and openai_responses via a combined match case. Update the wording in all three locations:

1. docs/en/configuration/providers.md:71 — change 'for openai_legacy providers only' to 'for openai_legacy and openai_responses providers'
2. docs/zh/configuration/providers.md:71 — change the Chinese text similarly, updating the 不会影响其他供应商 claim to reflect that openai_responses is also affected
3. examples/bedrock-mantle.md:44 — change 'For any openai_legacy provider' to 'For any openai_legacy or openai_responses provider'

Alternatively, if the intent is to restrict the override scope to openai_legacy only (excluding openai_responses), then the code in src/kimi_cli/llm.py:87 should be changed to separate the two cases.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3010c6d0b7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +82 to +84
Platform(
id=BEDROCK_MANTLE_PLATFORM_ID,
name="AWS Bedrock Mantle (OpenAI-compatible)",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep Kimi Code as the default /login platform choice

Placing Bedrock first in PLATFORMS changes the default selection in /login, because the prompt uses choices[0] as the default option. Users who hit Enter immediately now get routed into the Bedrock region/API-key flow instead of the Kimi Code OAuth flow, which is a regression in the common onboarding path. Keep Kimi Code first (or set an explicit default) to preserve prior behavior.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant