feat: add Kiro provider with @ai-sdk/kiro SDK#18408
Conversation
Add Kiro language model SDK with converters, streaming, tokenizer, provider factory, and model resolver for AWS CodeWhisperer integration.
Add Kiro plugin with Builder ID SSO authentication flow, token refresh, and register it in the plugin index. Add @anthropic-ai/sdk dependency.
Register Kiro in provider database with models: claude-sonnet-4-5, claude-opus-4-5, claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5, claude-sonnet-4, claude-3-7-sonnet. Add @ai-sdk/kiro reasoning variants to transform.
Add Kiro model ID fallback in agent resolution and extend message-v2 for Kiro provider compatibility.
Add tests for Kiro provider registration, model definitions, tool pairing, compaction, overflow recovery, and plugin auth flow.
Remove tests that depend on compaction functions (shouldCompact, fitMessages, truncateModelMessages, aggressive mode) not present in dev baseline. Fix kiro-provider context limit assertion (210K -> 200K).
|
The following comment was made by an LLM, it may be inaccurate: Potential duplicate found:
This PR appears to be an earlier attempt at adding Kiro provider support. The current PR #18408 is likely an updated/improved implementation with the @ai-sdk/kiro SDK, suggesting the previous PR may have been closed or superseded. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
- Use ModelID.make() for all kiro model id fields in provider.ts - Use ProviderID.kiro for kiro provider id and model providerID fields - Add kiro to ProviderID well-known list in schema.ts - Fix agent.ts variant fallback to use ModelID.make() - Fix kiro-provider.test.ts to use branded types in assertions - Fix mockPlugin to return async for proper .catch() support
|
Will it have support for other Kiro logins such as Sign in with Google? |
|
@duckida no.. i have no account for Goole login. so I can only support aws login way. |
|
Is it supporting login by AWS SSO? |
fix: support IAM Identity Center (SSO) users in Kiro provider
|
@veli-kaksonen Thanks for your effort! Finally! kiro supports 1M token with Opus4.6, Sonnet 4.6! |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
N/A — new feature, no existing issue.
Type of change
What does this PR do?
Adds Kiro as a provider in OpenCode. Kiro uses AWS CodeWhisperer-backed Claude models via Builder ID SSO auth.
Changes:
@ai-sdk/kiroSDK undersrc/provider/kiro/(converters, streaming, tokenizer, language model, provider factory)src/plugin/kiro.ts) handling Builder ID SSO auth + token refreshtransform.tsBuilt on top of work from:
Two main gotchas with Kiro's API: context window is ~200K tokens (exceeding it causes rejection), and there's no official docs on the exact request payload format — the opencode-kiro-auth repo was essential for figuring that out.
Thanks to both authors for their work 🙏 This is a baseline implementation — some edge cases may not be fully covered, so feedback is welcome.
How did you verify your code works?
bun typecheckpasses (only pre-existing branded type warnings)bun test— 1450 pass, 8 skip, 1 fail (pre-existingcowsaypackage issue, unrelated)Screenshots / recordings
N/A — no UI changes, provider shows up in existing model selection UI.
Checklist