Help us shape the future of Go! Take the 2026 Go Developer Survey

codexcat

package
v0.1.2168 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package codexcat renders models the way Codex describes them: the entries of its models.json, for `model_catalog_json` and for the model list magpie hands Codex in place of the ChatGPT backend's.

Index

Constants

View Source
const AppList = 100

AppList is how much of Codex's model list the Codex app and its VS Code extension read: each asks its app-server for model/list with includeHidden, cursor null and limit 100, and never for the next page (ChatGPT.app 26.1013's and openai.chatgpt 26.51021's webview), so a model past the 100th by priority is in no picker of theirs and can't be chosen there. The CLI's /model lists every one.

Variables

View Source
var Prompt string

Prompt is Codex's generic system prompt (Apache-2.0, openai/codex, core/gpt-5.2-codex_prompt.md). Third-party models need one because the bundled catalog only carries prompts for OpenAI models.

View Source
var SignInPlan func() string

SignInPlan is the plan of the ChatGPT account this machine's Codex is signed in to, as its ID token names it ("free", "plus", "pro" …), "" when it is unknown or Codex isn't signed in (provider.CodexSignInPlan).

Functions

func AutoReview added in v0.1.1062

func AutoReview(e map[string]any, v string)

AutoReview has one of Codex's own entries name the auto-review model in effect, v (AutoReviewModel, read once for a whole list: it reads Codex's sign-in). With none picked, one magpie put there before — a magpie id, which has a "/" where OpenAI's slugs have none, kept in Codex's cache — is taken out, and one OpenAI gave it is left.

func AutoReviewModel added in v0.1.1588

func AutoReviewModel() string

AutoReviewModel is the auto-review setting in effect: settings.CodexAutoReview, but with nothing picked and Codex signed in to a Free ChatGPT plan, the session's (settings.CodexAutoReviewSession). Left to Codex the review runs on codex-auto-review, kept as the default for being free on a ChatGPT sign-in (#1593, from a paid account); on a Free plan it is not (cybercaius on Discord measured it spending the plan's allowance), so there it follows the session as Codex's other side calls do. A plan magpie can't read keeps Codex's pick.

func CacheEntries

func CacheEntries() map[string]map[string]any

CacheEntries is Codex's own models, as models_cache.json describes them for the ChatGPT account it last asked with, by slug.

func Catalog

func Catalog(ms []catalog.Model) []byte

Catalog renders models as a whole models.json, for the effort this machine's Codex starts new sessions at (NewSessionEffort).

func CatalogAt added in v0.1.1214

func CatalogAt(ms []catalog.Model, effort string) []byte

CatalogAt renders models as a whole models.json for a Codex that starts new sessions at effort ("" for its models' own defaults): each model's default_reasoning_level is ModelDefault's.

func CatalogUsed added in v0.1.1727

func CatalogUsed(ms []catalog.Model, effort string, used []string) []byte

CatalogUsed is CatalogAt with the models Codex used, most recent first, and a ChatGPT account's own (ChatGPTOwn), kept where the Codex app reads them (FitOwn).

func ChatGPTOwn added in v0.1.1930

func ChatGPTOwn(slug string) bool

ChatGPTOwn reports whether slug is a ChatGPT account's own model in magpie's list for Codex (codex/<slug>): Codex's own GPT models, for a Codex that reaches them through magpie, which FitOwn keeps in the first AppList.

func DefaultEffort

func DefaultEffort(e []string) string

DefaultEffort picks the middle of the road: "medium" or "high" when offered, else whatever the list starts with.

func Entries

func Entries(ms []catalog.Model, after int) []any

Entries renders models as models.json entries, ranked after the first `after`. Only fields Codex requires or that change behaviour are set; the rest take Codex's defaults. A model's default effort is ModelDefault's for the effort this machine's Codex starts new sessions at.

func Fit added in v0.1.1727

func Fit(entries []any, used []string)

Fit ranks entries, Codex's own and magpie's, so the first AppList by priority are ones the Codex app can show and the user wants: a hidden entry, which no picker shows, goes after every listed one; and when more than AppList are listed, the ones used (slugs, most recent first, as usage.CodexUsed has them) are brought into the first AppList, in the order they stood, in place of the last of the others there. The order is otherwise kept, and the priorities numbered 1 to n in it. The slice is put in that order too.

func FitOwn added in v0.1.1930

func FitOwn(entries []any, used []string, own func(slug string) bool)

FitOwn is Fit with Codex's own models (own reports them by slug) kept in the first AppList ahead of the ones used, wherever the user's order (Order) put them: Codex lists them itself, so a user who didn't take them out of its list expects them in the app. An order set while the list had none of them names only magpie's, and put every one past the 100th (maiya on Discord). A hidden one still goes last.

func Keep added in v0.1.1151

func Keep(cur, b []byte) []byte

Keep is the catalog b, as Catalog renders it, with what the user added by hand to the entries of cur, the catalog on disk magpie is about to write over: a key of an entry of the same slug that magpie doesn't own, and a true where magpie says false of a keepTrue key — supports_reasoning_ summaries, put in for Codex to send a model's effort and show its thinking (#1450). Another key magpie writes takes magpie's value; the entry of a model magpie no longer serves goes. b as it is when there is nothing to keep, or cur isn't a catalog.

func MarkedV1 added in v0.1.715

func MarkedV1(etag string) bool

MarkedV1 reports whether an ETag is of a list magpie stamped V1.

func ModelDefault added in v0.1.1214

func ModelDefault(levels []string, chosen string) string

ModelDefault is the default_reasoning_level of a model of these levels with chosen set for new sessions: chosen when the model takes it, else the level of its own nearest chosen (catalog.NearestEffort: by strength, a tie going up — xhigh on a model of high and max is max), the one the gateway would send it at anyway. Codex takes a model's default when it is switched to: the CLI's /model offers it first and saves it as the effort, and the Codex app keeps the current effort only for a model that lists it. With the middle of the road there, a session started at xhigh dropped to medium on a switch to a routing group (Creat.wu on Discord). Nothing chosen, or nothing near it, keeps DefaultEffort.

func NewSessionEffort added in v0.1.1214

func NewSessionEffort() string

NewSessionEffort is the effort a new Codex session starts at, as the top of this machine's Codex config.toml says it (model_reasoning_effort, magpie's "New sessions" effort, or the one Codex's own picker last saved); "" when it is unset or the config can't be read.

func Order added in v0.1.952

func Order(entries []any, at map[string]int)

Order ranks entries — Codex's own, as the backend gives them, and magpie's from Entries — in the order the user put them in (#855): Codex lists its models by priority, lowest first. The ones at names go first, by their place there; the others after them, as they stood. The slice is put in that order too.

func PolicyTag added in v0.1.715

func PolicyTag(tag string) string

PolicyTag is a list's tag with the V1 setting in it.

func Remember added in v0.1.715

func Remember(entries []any)

Remember keeps the versions of entries as the backend gave them, before any is stamped: those of slugs it names are replaced, the rest kept.

func ServiceTiers added in v0.1.1159

func ServiceTiers(ms []catalog.Model) map[string][]tier

ServiceTiers are the service tiers Entries offers Codex on each of ms, by id, where it offers any: what this magpie's list tells another magpie that has it as its provider, so that one's Codex is offered them too (#1234).

func Stamp added in v0.1.715

func Stamp(e map[string]any)

Stamp has an entry say multi-agent V1.

func Tag added in v0.1.54

func Tag(ms []catalog.Model) string

Tag names a list of magpie's models: another list, another tag.

func Tagged added in v0.1.54

func Tagged(etag, tag string) bool

Tagged reports whether an ETag carries this tag.

func TakesEffort added in v0.1.1149

func TakesEffort(ms []catalog.Model, id string) string

TakesEffort is the effort Codex takes for the model id when none is set: the default_reasoning_level of the entry it reads for it. Codex's own model and a ChatGPT account's (codex/) keep their entry from Codex's models_cache.json, so it is that entry's (gpt-6.1-sol: low); one of magpie's other models takes the one Entries writes. "" when the model has no levels, or Codex's entry names none.

func UsedTag added in v0.1.1727

func UsedTag(used []string) string

UsedTag names the set of models Codex used (Fit's used): the list Fit makes changes with the set, not with which of them came last.

func V1 added in v0.1.715

func V1() bool

V1 reports whether the OpenAI models magpie hands Codex say "v1".

func Window added in v0.1.757

func Window(e map[string]any, n, most int)

Window has one of Codex's own entries say a context window of n tokens (none: as it says), and most at the most it may be raised to (0: as it says). Only those two fields change. An entry whose max_context_window is below its window — one the user set past what OpenAI lists — would say two things at once, and Codex may hold the window to the max, so the max is raised to it.

func WithTag added in v0.1.54

func WithTag(etag, tag string) string

WithTag is an ETag of the backend's (or none) with magpie's tag in it: W/"abc" becomes W/"abc+magpie-<tag>".

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL