OpenrouterSdk.Config (OpenRouter SDK v0.1.0)

Copy Markdown View Source

immutable configuration for the sdk.

built once via new/1, then merged with per-call opts inside each api function. anything you'd ever want to override on a single request — api key, headers, middleware — lives here.

Summary

Functions

merge a keyword override into an existing config (used per-call)

build a config. opts override application env, application env overrides defaults.

Types

t()

@type t() :: %OpenrouterSdk.Config{
  api_key: String.t() | nil,
  base_url: String.t(),
  default_headers: [{String.t(), String.t()}],
  finch_name: atom(),
  middleware: [module() | {module(), keyword()}],
  pool_timeout: pos_integer(),
  receive_timeout: pos_integer(),
  request_timeout: pos_integer(),
  telemetry_metadata: map()
}

Functions

merge(base, opts)

@spec merge(
  t(),
  keyword()
) :: t()

merge a keyword override into an existing config (used per-call)

new(opts \\ [])

@spec new(keyword()) :: t()

build a config. opts override application env, application env overrides defaults.