ExTypesafe.Config (ExTypesafe v0.2.0)

Copy Markdown View Source

Configuration for the TypeSafe API client.

Options can be passed directly to ExTypesafe.Client.new/1 or set via environment variables:

VariableConfiguresDefault
TYPESAFE_API_KEYAPI key (required)—
TYPESAFE_BASE_URLAPI root URLhttps://api.typesafe.ai
TYPESAFE_DEFAULT_MODELDefault modeljev-latest

Summary

Functions

Builds a Config from keyword options, falling back to environment variables and then defaults.

Types

t()

@type t() :: %ExTypesafe.Config{
  api_key: String.t(),
  base_url: String.t(),
  max_retries: non_neg_integer(),
  max_retry_delay_ms: non_neg_integer(),
  model: String.t(),
  retry_delay_ms: non_neg_integer()
}

Functions

new(opts \\ [])

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

Builds a Config from keyword options, falling back to environment variables and then defaults.

Options

  • :api_key — TypeSafe API key. Falls back to TYPESAFE_API_KEY env var. Required.
  • :base_url — Base URL for the API. Falls back to TYPESAFE_BASE_URL env var.
  • :model — Default model to use. Falls back to TYPESAFE_DEFAULT_MODEL env var.
  • :max_retries — Max retry attempts on retryable responses and transport failures (default: 3).
  • :retry_delay_ms — Initial retry delay in ms, doubles each attempt (default: 500).
  • :max_retry_delay_ms — Maximum exponential-backoff delay and accepted Retry-After value in ms (default: 5000).