Disclaimer — use at your own risk. This is an unofficial tool, not affiliated with Kiro/Amazon/AWS. Using a Kiro subscription outside its official client may violate the provider''s Terms of Service and could get your account suspended or banned. It is intended for personal, local use only. You assume all risk.
Use the credentials kiro-cli already stored (AWS SSO / Builder ID) as an opencode
provider. No separate login: opencode keeps only a sentinel marker, and the real
bearer token is read and refreshed live from ~/.aws/sso/cache/kiro-auth-token.json
on every request. Requests are shaped to match kiro-cli''s wire format.
- Log in with kiro-cli once:
kiro-cli login - Verify the plugin can read/refresh the token (never prints it):
bun run script/check-auth.ts - Add the plugin and the
providerblock to~/.config/opencode/opencode.json(seeopencode.example.jsonc). Pick one plugin spec form:- Local folder:
"file:///ABSOLUTE/PATH/TO/opencode-kiro-auth" - Git:
"github:<user>/opencode-kiro-auth"(optionally#<tag>to pin) - npm (if published):
"opencode-kiro-auth@latest"
- Local folder:
- Connect:
opencode auth login-> pick Kiro -> "Use existing kiro-cli login". - Run:
opencode run "hello" --model kiro/claude-sonnet-4.6
auth.tsreads/refreshes kiro-cli''s SSO token in place (shared cache).profile.tsresolves the profileArn like kiro-cli: real ARN for accounts that have one, else the fixed Builder-ID placeholder.transform.tsmaps the Anthropic Messages request opencode sends into Kiro''s CodeWhispererGenerateAssistantResponserequest (text, tool calls, images), and converts the AWS event-stream response back into an Anthropic SSE stream.plugin.tsregisters the opencodeauthhook whose loader returns the interceptingfetch.
Kiro caps the total size of a request (history plus images), returning a 400
CONTENT_LENGTH_EXCEEDS_THRESHOLD when exceeded. Because opencode resends the full
history — including every prior image — image-heavy sessions can hit this limit even
when the token count looks small. To avoid it, the plugin keeps images only on the most
recent image-bearing turns and replaces older ones with an [image omitted] marker.
- Tune with
KIRO_KEEP_IMAGE_TURNS(default2;0strips all images). - If a request still overflows, the error is surfaced as a context-overflow message, so
opencode suggests starting a new session or running
/compact.
The plugin also registers a web_search tool backed by Kiro''s built-in web search,
the same one kiro-cli uses. It runs server-side on Kiro''s backend through the
CodeWhisperer InvokeMCP operation, authenticated with your existing kiro-cli login,
so it needs no third-party search API key.
mcp.tscallsInvokeMCP(JSON-RPCtools/callforweb_search) and parses the{ "results": [...] }payload.tools.tsexposes it to opencode as theweb_searchtool, returning titles, URLs, and snippets with inline citation hints.
Verify it end to end (uses your live login, prints no token):
bun run script/test-websearch.ts "latest Node.js LTS version"
Toan Doan [email protected]