@auriko/ai-sdk-provider is at 0.2.0. Expect API changes before 1.0.Prerequisites
- An Auriko API key
- Node.js 18+
Install
Use the provider
Create a provider instance and pass it to any AI SDK function:createAuriko() reads your AURIKO_API_KEY environment variable by default.
Stream responses
UsestreamText for streaming:
Configure options
createAuriko() accepts these parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
apiKey | string | AURIKO_API_KEY env | API key |
baseURL | string | "https://api.auriko.ai/v1" | API base URL |
headers | Record<string, string> | undefined | Custom headers |
fetch | typeof fetch | globalThis.fetch | Custom fetch implementation |
routing | RoutingOptions | undefined | Default routing configuration |
metadata | AurikoMetadataParam | undefined | Request metadata (tags, user ID, trace ID) |
Configure routing
Set routing defaults when you create the provider:Access routing metadata
For non-streaming calls, readresult.providerMetadata?.auriko:
await the metadata:
AurikoResponseMetadata from @auriko/ai-sdk-provider for type-safe access.
Configure manually
Alternative: use @ai-sdk/openai directly
Alternative: use @ai-sdk/openai directly
You can point the OpenAI-compatible provider at Auriko’s API:This approach doesn’t include built-in routing or response metadata. You can set a routing strategy with a suffix shortcut (e.g.,
openai.chat("gpt-4o:cost-focus")). For routing configuration and typed metadata, use @auriko/ai-sdk-provider.