Claudex.Models (Claudex v0.6.1)

Copy Markdown View Source

The Models API — find out which models your key can use and what each one supports.

Useful for resolving an alias like "claude-opus-latest" to the model id it currently points at.

Summary

Functions

Lists the models available to your key, newest first.

Looks up one model by id or alias.

Functions

list(client, opts \\ [])

@spec list(Claudex.Client.t(), keyword()) ::
  {:ok, Claudex.Page.t(Claudex.Model.t())} | {:error, Claudex.Error.t()}

Lists the models available to your key, newest first.

Options become query parameters. The API defines three:

  • :limit - how many to return per page, 1 to 1000. Defaults to 20.
  • :after_id - return the page right after this model id.
  • :before_id - return the page right before this model id.

The result is one page. Check has_more and pass after_id: page.last_id to get the next one.

retrieve(client, model_id)

@spec retrieve(Claudex.Client.t(), String.t()) ::
  {:ok, Claudex.Model.t()} | {:error, Claudex.Error.t()}

Looks up one model by id or alias.

{:ok, model} = Claudex.Models.retrieve(client, "claude-opus-5")