Documentation
¶
Overview ¶
Package models lists available Codex CLI models from on-disk files only (~/.codex/models_cache.json and config.toml). It does not spawn `codex`.
Index ¶
Constants ¶
View Source
const ( // DefaultConfigFile is the Codex home config name. DefaultConfigFile = "config.toml" // ModelsCacheFile is the Codex home models cache name. ModelsCacheFile = "models_cache.json" // VisibilityList marks cache entries Codex shows in its model picker. VisibilityList = "list" )
Variables ¶
This section is empty.
Functions ¶
func DefaultHome ¶
func DefaultHome() string
DefaultHome returns $CODEX_HOME when set, otherwise $HOME/.codex. Empty HOME falls back to a temp-dir based path (same idea as sessions home).
func FormatJSON ¶
FormatJSON returns indented Catalog JSON for CLI --json output.
func FormatText ¶
FormatText returns a human-readable catalog listing. The configured default model is marked with a leading "* ".
Types ¶
type Catalog ¶
type Catalog struct {
// Home is the resolved Codex data directory used for the listing.
Home string `json:"home"`
// Default is the top-level `model` from config.toml (empty when unset/missing).
Default string `json:"default,omitempty"`
// Models is the picker model list: cache entries with visibility "list",
// plus the configured model when the cache omits it, in cache order.
Models []Model `json:"models"`
// FromConfig is true when config.toml was read successfully.
FromConfig bool `json:"from_config"`
// FromCache is true when models_cache.json was read successfully.
FromCache bool `json:"from_cache"`
}
Catalog is the merged file-backed model list for a Codex home.
type Model ¶
type Model struct {
// Slug is the model id passed to codex (e.g. "gpt-5.6-sol"); for a
// configured provider-qualified id it may look like "provider/model".
Slug string `json:"slug"`
// DisplayName is Codex's human name (cache only; empty otherwise).
DisplayName string `json:"display_name,omitempty"`
// DefaultReasoning is the cache's default_reasoning_level (empty when unknown).
DefaultReasoning string `json:"default_reasoning,omitempty"`
// Reasoning is the supported effort levels in cache order (low…ultra).
Reasoning []string `json:"reasoning,omitempty"`
}
Model is one selectable Codex model.
Click to show internal directories.
Click to hide internal directories.