Skip to content

Commit 0c93cc0

Browse files
authored
Merge pull request #1485 from anomalyco/more-extends-cases
migrate more providers to extends format
2 parents 17093e0 + 62e25b7 commit 0c93cc0

File tree

56 files changed

+163
-1211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+163
-1211
lines changed

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,31 @@ output = ["text"] # Supported output modalities
120120
field = "reasoning_content" # Name of the interleaved field "reasoning_content" or "reasoning_details"
121121
```
122122

123+
#### 3a. Reuse an Existing Model with `extends`
124+
125+
For wrapper providers that mirror a model from another provider, prefer reusing the canonical model definition instead of duplicating the whole file.
126+
127+
Use `extends` only for non-first-party wrappers and mirrors. Do not use it inside the actual lab provider directories that act as the canonical source for a model family, for example `providers/anthropic/`, `providers/openai/`, `providers/google/`, `providers/xai/`, `providers/minimax/`, or `providers/moonshot/`.
128+
129+
```toml
130+
[extends]
131+
from = "anthropic/claude-opus-4-6"
132+
omit = ["experimental.modes.fast"]
133+
134+
[provider]
135+
npm = "@ai-sdk/anthropic"
136+
```
137+
138+
Rules:
139+
140+
- `from` must point to another model using `<provider>/<model-id>`.
141+
- `omit` is optional and removes fields after the inherited model and local overrides are merged.
142+
- You can override any top-level model field locally.
143+
- If you override a nested table like `[cost]`, `[limit]`, or `[modalities]`, include the full values needed for that table.
144+
- `id` still comes from the filename; do not add it to the TOML.
145+
146+
Use `extends` when the wrapper model is materially the same as the source model and only differs by a small set of overrides or omitted fields.
147+
123148
#### 4. Submit a Pull Request
124149

125150
1. Fork this repo
@@ -136,9 +161,17 @@ There's a GitHub Action that will automatically validate your submission against
136161
- Values are within acceptable ranges
137162
- TOML syntax is valid
138163

164+
When converting existing wrapper models to `extends`, compare generated output before and after the change:
165+
166+
```bash
167+
bun run compare:migrations
168+
```
169+
170+
This prints a diff for each changed model TOML so you can confirm the generated JSON only changed where you intended.
171+
139172
### Schema Reference
140173

141-
Models must conform to the following schema, as defined in `app/schemas.ts`.
174+
Models must conform to the following schema, as defined in `packages/core/src/schema.ts`.
142175

143176
**Provider Schema:**
144177

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,2 @@
1-
name = "Claude Sonnet 3.5"
2-
family = "claude-sonnet"
3-
release_date = "2024-06-20"
4-
last_updated = "2024-06-20"
5-
attachment = true
6-
reasoning = false
7-
temperature = true
8-
knowledge = "2024-04"
9-
tool_call = true
10-
open_weights = false
11-
12-
[cost]
13-
input = 3.00
14-
output = 15.00
15-
cache_read = 0.30
16-
cache_write = 3.75
17-
18-
[limit]
19-
context = 200_000
20-
output = 8_192
21-
22-
[modalities]
23-
input = ["text", "image", "pdf"]
24-
output = ["text"]
1+
[extends]
2+
from = "anthropic/claude-3-5-sonnet-20240620"
Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,2 @@
1-
name = "Claude Opus 4.1"
2-
family = "claude-opus"
3-
release_date = "2025-08-05"
4-
last_updated = "2025-08-05"
5-
attachment = true
6-
reasoning = true
7-
temperature = true
8-
tool_call = true
9-
knowledge = "2025-03-31"
10-
open_weights = false
11-
12-
[cost]
13-
input = 15.00
14-
output = 75.00
15-
cache_read = 1.50
16-
cache_write = 18.75
17-
18-
[limit]
19-
context = 200_000
20-
output = 32_000
21-
22-
[modalities]
23-
input = ["text", "image", "pdf"]
24-
output = ["text"]
1+
[extends]
2+
from = "anthropic/claude-opus-4-1-20250805"
Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,2 @@
1-
name = "Claude Opus 4"
2-
family = "claude-opus"
3-
release_date = "2025-05-22"
4-
last_updated = "2025-05-22"
5-
attachment = true
6-
reasoning = true
7-
temperature = true
8-
knowledge = "2024-04"
9-
tool_call = true
10-
open_weights = false
11-
12-
[cost]
13-
input = 15.00
14-
output = 75.00
15-
cache_read = 1.50
16-
cache_write = 18.75
17-
18-
[limit]
19-
context = 200_000
20-
output = 32_000
21-
22-
[modalities]
23-
input = ["text", "image", "pdf"]
24-
output = ["text"]
1+
[extends]
2+
from = "anthropic/claude-opus-4-20250514"
Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,2 @@
1-
name = "Claude Sonnet 4"
2-
family = "claude-sonnet"
3-
release_date = "2025-05-22"
4-
last_updated = "2025-05-22"
5-
attachment = true
6-
reasoning = true
7-
temperature = true
8-
knowledge = "2024-04"
9-
tool_call = true
10-
open_weights = false
11-
12-
[cost]
13-
input = 3.00
14-
output = 15.00
15-
cache_read = 0.30
16-
cache_write = 3.75
17-
18-
[limit]
19-
context = 200_000
20-
output = 64_000
21-
22-
[modalities]
23-
input = ["text", "image", "pdf"]
24-
output = ["text"]
1+
[extends]
2+
from = "anthropic/claude-sonnet-4-20250514"
Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,2 @@
1-
name = "Claude Sonnet 4.6"
2-
family = "claude-sonnet"
3-
release_date = "2026-02-17"
4-
last_updated = "2026-03-18"
5-
attachment = true
6-
reasoning = true
7-
temperature = true
8-
tool_call = true
9-
knowledge = "2025-08-31"
10-
open_weights = false
11-
12-
[cost]
13-
input = 3.00
14-
output = 15.00
15-
cache_read = 0.30
16-
cache_write = 3.75
17-
18-
[limit]
19-
context = 1_000_000
20-
output = 64_000
21-
22-
[modalities]
23-
input = ["text", "image", "pdf"]
24-
output = ["text"]
1+
[extends]
2+
from = "anthropic/claude-sonnet-4-6"
Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,4 @@
11
name = "Claude Sonnet 4 (EU)"
2-
family = "claude-sonnet"
3-
release_date = "2025-05-22"
4-
last_updated = "2025-05-22"
5-
attachment = true
6-
reasoning = true
7-
temperature = true
8-
knowledge = "2024-04"
9-
tool_call = true
10-
open_weights = false
112

12-
[cost]
13-
input = 3.00
14-
output = 15.00
15-
cache_read = 0.30
16-
cache_write = 3.75
17-
18-
[limit]
19-
context = 200_000
20-
output = 64_000
21-
22-
[modalities]
23-
input = ["text", "image", "pdf"]
24-
output = ["text"]
3+
[extends]
4+
from = "anthropic/claude-sonnet-4-20250514"
Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,4 @@
11
name = "Claude Sonnet 4.6 (EU)"
2-
family = "claude-sonnet"
3-
release_date = "2026-02-17"
4-
last_updated = "2026-03-18"
5-
attachment = true
6-
reasoning = true
7-
temperature = true
8-
tool_call = true
9-
knowledge = "2025-08-31"
10-
open_weights = false
112

12-
[cost]
13-
input = 3.00
14-
output = 15.00
15-
cache_read = 0.30
16-
cache_write = 3.75
17-
18-
[limit]
19-
context = 1_000_000
20-
output = 64_000
21-
22-
[modalities]
23-
input = ["text", "image", "pdf"]
24-
output = ["text"]
3+
[extends]
4+
from = "anthropic/claude-sonnet-4-6"
Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,4 @@
11
name = "Claude Sonnet 4 (Global)"
2-
family = "claude-sonnet"
3-
release_date = "2025-05-22"
4-
last_updated = "2025-05-22"
5-
attachment = true
6-
reasoning = true
7-
temperature = true
8-
knowledge = "2024-04"
9-
tool_call = true
10-
open_weights = false
112

12-
[cost]
13-
input = 3.00
14-
output = 15.00
15-
cache_read = 0.30
16-
cache_write = 3.75
17-
18-
[limit]
19-
context = 200_000
20-
output = 64_000
21-
22-
[modalities]
23-
input = ["text", "image", "pdf"]
24-
output = ["text"]
3+
[extends]
4+
from = "anthropic/claude-sonnet-4-20250514"
Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,4 @@
11
name = "Claude Sonnet 4.6 (Global)"
2-
family = "claude-sonnet"
3-
release_date = "2026-02-17"
4-
last_updated = "2026-03-18"
5-
attachment = true
6-
reasoning = true
7-
temperature = true
8-
tool_call = true
9-
knowledge = "2025-08-31"
10-
open_weights = false
112

12-
[cost]
13-
input = 3.00
14-
output = 15.00
15-
cache_read = 0.30
16-
cache_write = 3.75
17-
18-
[limit]
19-
context = 1_000_000
20-
output = 64_000
21-
22-
[modalities]
23-
input = ["text", "image", "pdf"]
24-
output = ["text"]
3+
[extends]
4+
from = "anthropic/claude-sonnet-4-6"

0 commit comments

Comments
 (0)