Packages

Minimal Elixir AI SDK scaffolding for streaming text with tool calls.

Current section

Files

Jump to
ai_sdk_ex lib ai openrouter.ex
Raw

lib/ai/openrouter.ex

defmodule AI.OpenRouter do
@moduledoc """
OpenRouter model helpers.
"""
@doc """
Creates a model that uses the OpenRouter Responses API.
Options are stored on the model and passed to the provider. Common options:
- `:base_url` - override the API base URL
- `:api_key` - override the API key
- `:referer` - set the HTTP-Referer header for attribution
- `:title` - set the X-Title header for attribution
"""
def responses(model_id, opts \\ []) do
%AI.Model{
provider: AI.Providers.OpenRouter.Responses,
model_id: model_id,
options: Enum.into(opts, %{})
}
end
end