@arbytra/ai-sdk-provider is at 0.2.0. Expect API changes before 1.0.Prerequisites
- An Arbytra API key
- Node.js 18+
Install
Use the provider
Create a provider instance and pass it to any AI SDK function:createArbytra() reads your ARBYTRA_API_KEY environment variable by default.
Stream responses
UsestreamText for streaming:
Configure options
createArbytra() accepts these parameters:
Configure routing
Set routing defaults when you create the provider:Access routing metadata
For non-streaming calls, readresult.providerMetadata?.arbytra:
await the metadata:
ArbytraResponseMetadata from @arbytra/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 Arbytra’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 @arbytra/ai-sdk-provider.