Hacker News 熱門50

Claude Opus 5.5

· 21天前
跳到正文

正文

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ ANTHROPIC_API_KEY=<key> swift run ClaudeExample --search "Top spaceflight news t
8282
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)):
8383

8484
```swift
85-
ClaudeLanguageModel(name: .opus5, auth: auth)
85+
ClaudeLanguageModel(name: .opus5_5, auth: auth)
8686
```
8787

88-
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.
88+
Constants mirror API model IDs (`.opus5_5` is `claude-opus-5-5`) and carry each model's capabilities. New models ship as new constants in package releases.
8989

90-
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.
90+
Dateless model IDs like `claude-opus-5-5` (the 4.6 generation onward) are pinned snapshots, not evergreen pointers — the model behind an ID doesn't change underneath you.
9191

9292
### Capabilities
9393

@@ -106,7 +106,7 @@ ClaudeLanguageModel(name: model, auth: auth)
106106
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:
107107

108108
```swift
109-
ClaudeLanguageModel(name: .opus5, auth: auth, fixedEffort: .xhigh)
109+
ClaudeLanguageModel(name: .opus5_5, auth: auth, fixedEffort: .xhigh)
110110
```
111111

112112
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.
@@ -118,7 +118,7 @@ The level must be one the model accepts — each model declares which of the fiv
118118
Some models decline requests in certain policy areas, such as cybersecurity or biology. Name fallback models with `fallbacks:`, and the API retries a declined request on them, in order, within the same request:
119119

120120
```swift
121-
ClaudeLanguageModel(name: .opus5, auth: auth, fallbacks: [.opus4_8])
121+
ClaudeLanguageModel(name: .opus5_5, auth: auth, fallbacks: [.opus4_8])
122122
```
123123

124124
You can name up to three fallbacks, and each one must be a model that the requested model allows as a fallback. To use the requested model's default fallback configuration instead, pass `fallbacks: .serverDefault`. The API then picks the fallback that's recommended for the policy area of the refusal, and for an area with no recommended fallback, the refusal stands.
@@ -201,7 +201,7 @@ Credentials are device-bound and never sync or back up.
201201
If your app makes requests on behalf of its users, attribute each request to that user's profile. Your backend creates one profile per user with the API's user profiles endpoints (`/v1/user_profiles`). It stores the profile's ID with the user, and passes that ID to the app. The app then passes the ID when it creates the model:
202202

203203
```swift
204-
ClaudeLanguageModel(name: .opus5, auth: auth, userProfileID: profileID)
204+
ClaudeLanguageModel(name: .opus5_5, auth: auth, userProfileID: profileID)
205205
```
206206

207207
The bridge sends the ID in the `anthropic-user-profile-id` header on every request, along with the `user-profiles-2026-08-18` beta. The API checks the ID, so an unknown ID fails the request. With `.proxied`, the relay has to forward both headers.
Collapse file

‎Sources/ClaudeForFoundationModels/ClaudeFallbacks.swift‎

Copy file name to clipboardExpand all lines: Sources/ClaudeForFoundationModels/ClaudeFallbacks.swift
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import FoundationModels
1212
/// request on a substitute model, within the same request:
1313
///
1414
/// ```swift
15-
/// ClaudeLanguageModel(name: .opus5, auth: auth, fallbacks: [.opus4_8])
15+
/// ClaudeLanguageModel(name: .opus5_5, auth: auth, fallbacks: [.opus4_8])
1616
/// ```
1717
///
1818
/// A model can decline after it has started to answer. The fallback model
Collapse file

‎Sources/ClaudeForFoundationModels/ClaudeLanguageModel.swift‎

Copy file name to clipboardExpand all lines: Sources/ClaudeForFoundationModels/ClaudeLanguageModel.swift
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public struct ClaudeLanguageModel: Sendable {
3333
let authMode: AuthMode
3434

3535
/// - Parameters:
36-
/// - name: Claude model identifier. Use a constant (`.sonnet5`, `.opus5`,
36+
/// - name: Claude model identifier. Use a constant (`.sonnet5`, `.opus5_5`,
3737
/// `.haiku4_5`), or construct a ``ClaudeModel`` with explicit capabilities
3838
/// for IDs not yet compiled in.
3939
/// - auth: Credential mode. `.apiKey` for prototyping; `.proxied` with a
Collapse file

‎Sources/ClaudeForFoundationModels/ClaudeModel.swift‎

Copy file name to clipboardExpand all lines: Sources/ClaudeForFoundationModels/ClaudeModel.swift
+12-3Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,18 @@ public struct ClaudeModel: Sendable, Hashable {
6969
// on Sonnet 5 and Opus 4.7+ (Opus 4.6 still accepts them), `.xhigh` exists
7070
// only on Sonnet 5 and Opus 4.7+, and `.max` requires the 4.6 generation
7171
// or newer. Opus 5 and Fable 5 keep the Opus 4.8 request surface. Fable 5.1
72-
// keeps it too, except that it also rejects forced tool use (`tool_choice`
73-
// `any` / `tool`) — a `.required` tool-calling mode is a contract, so it is
74-
// sent as-is and the API error names the field.
72+
// and Opus 5.5 keep it too, except that they also reject forced tool use
73+
// (`tool_choice` `any` / `tool`) — a `.required` tool-calling mode is a
74+
// contract, so it is sent as-is and the API error names the field.
75+
public static let opus5_5 = ClaudeModel(
76+
id: "claude-opus-5-5",
77+
capabilities: .init(
78+
effortLevels: [.low, .medium, .high, .xhigh, .max],
79+
adaptiveThinking: true,
80+
structuredOutput: true,
81+
imageInput: true
82+
)
83+
)
7584
public static let fable5_1 = ClaudeModel(
7685
id: "claude-fable-5-1",
7786
capabilities: .init(
Collapse file

‎Tests/ClaudeForFoundationModelsTests/RequestBuilderTests.swift‎

Copy file name to clipboardExpand all lines: Tests/ClaudeForFoundationModelsTests/RequestBuilderTests.swift
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ import Testing
240240
.prompt(.init(segments: [.text(.init(content: "Hi"))]))
241241
])
242242
)
243-
for model: ClaudeModel in [.sonnet5, .opus4_8, .opus4_7, .sonnet4_6, .opus4_6] {
243+
for model: ClaudeModel in [.opus5_5, .sonnet5, .opus4_8, .opus4_7, .sonnet4_6, .opus4_6] {
244244
let built = try RequestBuilder.build(from: request, model: model)
245245
#expect(built.request.thinking == .adaptive(display: .summarized))
246246
}

0 commit comments

Comments
0 (0)
查看原文(Hacker News 熱門)