Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ ANTHROPIC_API_KEY=<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

Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion Sources/ClaudeForFoundationModels/ClaudeModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down