Documentation
¶
Overview ¶
Package claudecode adapts the Claude Code CLI (`claude`) into an inference backend.
The CLI is launched in headless print mode with every tool disabled, in an empty scratch directory, with a sanitized environment: agent2api uses it as a plain LLM, never as an agent that touches the machine.
Index ¶
- Constants
- func New(opts adapter.Options) (adapter.Adapter, error)
- type Adapter
- func (a *Adapter) EffortLevels(ctx context.Context) []ir.Effort
- func (a *Adapter) EnforcesSchema(ctx context.Context) bool
- func (a *Adapter) ID() string
- func (a *Adapter) Probe(ctx context.Context) (adapter.Health, error)
- func (a *Adapter) Run(ctx context.Context, req ir.Request) (<-chan ir.Event, error)
Constants ¶
const ID = "claude-code"
ID is the adapter id used to namespace this backend's models.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter is the Claude Code backend.
func (*Adapter) EffortLevels ¶ added in v0.1.5
EffortLevels implements adapter.EffortSetter.
How much a level changes depends on the model behind it, which the adapter cannot know from a flag: measured on 2.1.274, `sonnet` spent 0 thinking tokens at `low` and ~130 at `max`, while `haiku` showed no separation across three runs at each end. The flag is passed on either way — what the model then does with it is the model's business, the same as `temperature`.
func (*Adapter) EnforcesSchema ¶ added in v0.1.3
EnforcesSchema implements adapter.SchemaEnforcer. The CLI holds the answer to a caller's JSON Schema with `--json-schema`; an install too old for the flag says so, and the frontend refuses the request rather than returning JSON nobody checked.