diff --git a/README.md b/README.md index 028a241..abad787 100644 --- a/README.md +++ b/README.md @@ -82,12 +82,12 @@ ANTHROPIC_API_KEY= swift run ClaudeExample --search "Top spaceflight news t Model identifiers are values of `ClaudeModel`. Use a compiled-in constant, or construct one with explicit capabilities for an ID that isn't compiled in yet (see [Capabilities](#capabilities)): ```swift -ClaudeLanguageModel(name: .opus4_8, auth: auth) +ClaudeLanguageModel(name: .opus5, auth: auth) ``` -Constants mirror API model IDs (`.opus4_8` is `claude-opus-4-8`) and carry each model's capabilities. New models ship as new constants in package releases. +Constants mirror API model IDs (`.opus5` is `claude-opus-5`) and carry each model's capabilities. New models ship as new constants in package releases. -Dateless model IDs like `claude-opus-4-8` (the 4.6 generation onward) are pinned snapshots, not evergreen pointers — the model behind an ID doesn't change underneath you. +Dateless model IDs like `claude-opus-5` (the 4.6 generation onward) are pinned snapshots, not evergreen pointers — the model behind an ID doesn't change underneath you. ### Capabilities @@ -106,7 +106,7 @@ ClaudeLanguageModel(name: model, auth: auth) Pin a Claude effort level for every request with `fixedEffort:`. It takes precedence over the framework's per-request reasoning hints. The API defaults to `high` when no effort is sent: ```swift -ClaudeLanguageModel(name: .opus4_8, auth: auth, fixedEffort: .xhigh) +ClaudeLanguageModel(name: .opus5, auth: auth, fixedEffort: .xhigh) ``` The framework's reasoning levels map to effort per request: `.light` → `low`, `.moderate` → `medium`, `.deep` → `high`, and `.custom` accepts a Claude effort name directly (`"xhigh"`, `"max"`). Levels a model doesn't accept are dropped — a reasoning level is a hint, not a contract. diff --git a/Sources/ClaudeForFoundationModels/ClaudeLanguageModel.swift b/Sources/ClaudeForFoundationModels/ClaudeLanguageModel.swift index 83698e2..cc49c52 100644 --- a/Sources/ClaudeForFoundationModels/ClaudeLanguageModel.swift +++ b/Sources/ClaudeForFoundationModels/ClaudeLanguageModel.swift @@ -31,7 +31,7 @@ public struct ClaudeLanguageModel: Sendable { let authMode: AuthMode /// - Parameters: - /// - name: Claude model identifier. Use a constant (`.sonnet5`, `.opus4_8`, + /// - name: Claude model identifier. Use a constant (`.sonnet5`, `.opus5`, /// `.haiku4_5`), or construct a ``ClaudeModel`` with explicit capabilities /// for IDs not yet compiled in. /// - auth: Credential mode. `.apiKey` for prototyping; `.proxied` with a diff --git a/Sources/ClaudeForFoundationModels/ClaudeModel.swift b/Sources/ClaudeForFoundationModels/ClaudeModel.swift index 2850ea6..45eb003 100644 --- a/Sources/ClaudeForFoundationModels/ClaudeModel.swift +++ b/Sources/ClaudeForFoundationModels/ClaudeModel.swift @@ -68,7 +68,16 @@ public struct ClaudeModel: Sendable, Hashable { // Capability matrix per the Messages API docs: sampling params are rejected // on Sonnet 5 and Opus 4.7+ (Opus 4.6 still accepts them), `.xhigh` exists // only on Sonnet 5 and Opus 4.7+, and `.max` requires the 4.6 generation - // or newer. + // or newer. Opus 5 keeps the Opus 4.8 request surface. + public static let opus5 = ClaudeModel( + id: "claude-opus-5", + capabilities: .init( + effortLevels: [.low, .medium, .high, .xhigh, .max], + adaptiveThinking: true, + structuredOutput: true, + imageInput: true + ) + ) /// High-performance model for coding and agents. public static let sonnet5 = ClaudeModel( id: "claude-sonnet-5",