Planck.AI.Model (Planck.AI v0.1.6)

Copy Markdown View Source

Represents an LLM model and its metadata.

The base_url field is used for self-hosted or OpenAI-compatible endpoints (llama.cpp, vLLM, LM Studio). When nil, the provider's default endpoint is used.

Examples

iex> %Planck.AI.Model{
...>   id: "claude-sonnet-4-6",
...>   name: "Claude Sonnet 4.6",
...>   provider: :anthropic,
...>   context_window: 200_000,
...>   max_tokens: 8096,
...>   supports_thinking: true,
...>   input_types: [:text, :image]
...> }

Summary

Types

Per-token cost in USD per million tokens.

Supported LLM provider backends.

t()

An LLM model struct.

Functions

Returns the list of supported provider atoms.

Types

cost()

@type cost() :: %{
  input: float(),
  output: float(),
  cache_read: float(),
  cache_write: float()
}

Per-token cost in USD per million tokens.

provider()

@type provider() :: :anthropic | :openai | :google

Supported LLM provider backends.

t()

@type t() :: %Planck.AI.Model{
  api_key: String.t() | nil,
  base_url: String.t() | nil,
  context_window: pos_integer(),
  cost: cost(),
  default_opts: keyword(),
  has_api_key: boolean(),
  id: String.t(),
  identifier: String.t() | nil,
  input_types: [:text | :image | :image_url | :file | :video_url],
  max_tokens: pos_integer(),
  model: String.t() | nil,
  name: String.t(),
  provider: provider(),
  supports_thinking: boolean()
}

An LLM model struct.

  • id — user-facing alias (e.g. "sonnet"); used to look up the model in config.
  • model — actual API identifier sent to the provider (e.g. "claude-sonnet-4-6"); falls back to id when nil (legacy flat-config path).
  • identifier — uppercase env-var prefix for custom OpenAI-compat providers (e.g. "NVIDIA" → resolves NVIDIA_API_KEY).
  • has_api_key — when false, the adapter skips env-var lookup and sends "not-needed" as the API key (for local servers like llama.cpp).
  • api_key — not used at runtime; reserved for future in-memory overrides.

Functions

providers()

@spec providers() :: [provider()]

Returns the list of supported provider atoms.