kiro

package module
v0.0.0-...-dfc2574 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2026 License: MIT Imports: 19 Imported by: 0

README

Kiro AI Adapter for llm-router

Kiro AI adapter for llm-router, using Kiro's AWS CodeWhisperer-compatible streaming API.

Features

  • Interactive dashboard device login for AWS Builder ID and AWS IAM Identity Center
  • Automatic token refresh for credentials created by device login
  • Non-streaming and streaming chat completions
  • Hardcoded Kiro model catalog fallback
  • AWS EventStream decoding for Kiro responses

Installation

Add to adapters.conf:

github.com/TheSlopMachine/llm-router-adapter-kiro main

Then rebuild llm-router.

Credential Shape

{
  "access_token": "eyJ...",
  "refresh_token": "aorAAAAAG...",
  "expires_at": "2026-05-21T14:30:00Z",
  "auth_method": "builder-id",
  "client_id": "client-id-from-device-login",
  "client_secret": "client-secret-from-device-login",
  "region": "us-east-1"
}

The interactive auth flow stores these automatically after device login and reuses them for refresh.

License

MIT

Documentation

Overview

Package kiro implements an llm-router adapter for Kiro AI.

The adapter targets Kiro's AWS CodeWhisperer-compatible streaming API and supports OAuth-style credentials with automatic refresh.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

func (*Adapter) AuthType

func (a *Adapter) AuthType() sdk.AuthType

func (*Adapter) Complete

func (*Adapter) CompleteStream

func (a *Adapter) CompleteStream(
	ctx context.Context,
	cred *sdk.Credential,
	req *sdk.ChatCompletionRequest,
	w io.Writer,
) error

func (*Adapter) GetAuthFlow

func (a *Adapter) GetAuthFlow() sdk.AuthFlowHandler

func (*Adapter) GetDefaultProviders

func (a *Adapter) GetDefaultProviders() []sdk.ProviderInfo

func (*Adapter) GetModelInfos

func (a *Adapter) GetModelInfos(
	ctx context.Context,
	cred *sdk.Credential,
	providerQualifier string,
) ([]sdk.ModelInfo, error)

func (*Adapter) NeedsRefresh

func (a *Adapter) NeedsRefresh(cred *sdk.Credential) bool

func (*Adapter) RefreshCredential

func (a *Adapter) RefreshCredential(ctx context.Context, cred *sdk.Credential) (*sdk.Credential, error)

func (*Adapter) TypeKey

func (a *Adapter) TypeKey() string

func (*Adapter) ValidateCredentials

func (a *Adapter) ValidateCredentials(data map[string]string) error

type AuthFlow

type AuthFlow struct {
	// contains filtered or unexported fields
}

func (*AuthFlow) HandleStep

func (f *AuthFlow) HandleStep(ctx sdk.AuthFlowContext, input map[string][]string) (sdk.AuthFlowState, error)

func (*AuthFlow) InitiateFlow

func (f *AuthFlow) InitiateFlow(ctx sdk.AuthFlowContext) (sdk.AuthFlowState, error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

func (*Client) Generate

func (c *Client) Generate(
	ctx context.Context,
	cred *sdk.Credential,
	req *generateAssistantResponseRequest,
	modelID string,
) (*sdk.ChatCompletionResponse, error)

func (*Client) GenerateStream

func (c *Client) GenerateStream(
	ctx context.Context,
	cred *sdk.Credential,
	req *generateAssistantResponseRequest,
	modelID string,
	w io.Writer,
) error

func (*Client) PollDeviceToken

func (c *Client) PollDeviceToken(
	ctx context.Context,
	clientID, clientSecret, deviceCode, region string,
) (*devicePollResult, error)

func (*Client) RefreshCredential

func (c *Client) RefreshCredential(ctx context.Context, credData map[string]string) (*tokenRefreshResponse, error)

func (*Client) RegisterClient

func (c *Client) RegisterClient(ctx context.Context, region string) (*clientRegistrationResponse, error)

func (*Client) StartDeviceAuthorization

func (c *Client) StartDeviceAuthorization(
	ctx context.Context,
	clientID, clientSecret, startURL, region string,
) (*deviceAuthorizationResponse, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL