model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package model centralises model selection for the agent loop.

Priority order (mirrors getRuntimeMainLoopModel in the TS source):

  1. Runtime /model override (highest)
  2. ANTHROPIC_MODEL env var
  3. CLAUDE_CODE_MODEL env var
  4. settings.json "model" field (via SetDefault at startup)
  5. Default constant

The default matches the model shipped in Claude Code 2.1.126.

Index

Constants

View Source
const Default = "claude-opus-4-7"

Default is the hardcoded fallback model. Matches Claude Code 2.1.126.

View Source
const Fast = "claude-sonnet-4-6"

Fast is the faster/cheaper model used when /fast is active. Mirrors getSmallFastModel() — Sonnet for fast responses.

View Source
const MaxTokens = 16000

MaxTokens is the default max_tokens value for /v1/messages. Real CC uses 16000 for the main loop; we match that.

Variables

View Source
var ThinkingBudgets = map[string]int{
	"low":    1000,
	"normal": 0,
	"high":   8000,
	"max":    16000,
}

ThinkingBudgets maps effort levels to token budgets. Mirrors the thinking budget constants from the real CLI.

Functions

func ClearOverride

func ClearOverride()

ClearOverride removes the runtime override (for testing).

func Resolve

func Resolve() string

Resolve returns the model name to use, applying priority order.

func SetDefault

func SetDefault(name string)

SetDefault sets the model from settings.json. Called once at startup before any goroutines read Resolve(). Lower priority than env vars.

func SetOverride

func SetOverride(name string)

SetOverride sets the runtime model override (from /model slash command).

Types

This section is empty.

Jump to

Keyboard shortcuts

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