Skip to content
Open
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
6 changes: 5 additions & 1 deletion packages/core/src/models-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ export const Model = Schema.Struct({
),
status: Schema.optional(CatalogModelStatus),
provider: Schema.optional(
Schema.Struct({ npm: Schema.optional(Schema.String), api: Schema.optional(Schema.String) }),
Schema.Struct({
npm: Schema.optional(Schema.String),
api: Schema.optional(Schema.String),
shape: Schema.optional(Schema.Literals(["responses", "completions"])),
}),
),
})
export type Model = Schema.Schema.Type<typeof Model>
Expand Down
34 changes: 21 additions & 13 deletions packages/core/src/plugin/models-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,27 @@ function applyModel(
) {
draft.name = input.name ?? model.name
draft.family = model.family
draft.api = model.provider?.npm
? {
id: model.id,
type: "aisdk",
package: model.provider.npm,
url: model.provider.api,
}
: {
id: model.id,
type: "native",
url: model.provider?.api,
settings: {},
}
draft.api =
model.provider?.shape === "responses"
? {
id: model.id,
type: "aisdk",
package: "@ai-sdk/openai",
url: model.provider.api ?? draft.api.url,
}
: model.provider?.npm
? {
id: model.id,
type: "aisdk",
package: model.provider.npm,
url: model.provider.api,
}
: {
id: model.id,
type: "native",
url: model.provider?.api,
settings: {},
}
draft.capabilities = {
tools: model.tool_call,
input: [...(model.modalities?.input ?? [])],
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/v1/config/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ export const Model = Schema.Struct({
experimental: Schema.optional(Schema.Boolean),
status: Schema.optional(ModelStatus),
provider: Schema.optional(
Schema.Struct({ npm: Schema.optional(Schema.String), api: Schema.optional(Schema.String) }),
Schema.Struct({
npm: Schema.optional(Schema.String),
api: Schema.optional(Schema.String),
shape: Schema.optional(Schema.Literals(["responses", "completions"])),
}),
),
options: Schema.optional(Schema.Record(Schema.String, Schema.Any)),
headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),
Expand Down
18 changes: 18 additions & 0 deletions packages/core/test/plugin/models-dev.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ describe("ModelsDevPlugin", () => {
},
},
},
"deepseek-v4-flash": {
id: "deepseek-v4-flash",
name: "DeepSeek V4 Flash",
release_date: "2026-07-31",
attachment: false,
reasoning: true,
temperature: true,
tool_call: true,
provider: { shape: "responses" },
limit: { context: 1_000_000, output: 384_000 },
},
},
},
} satisfies Record<string, ModelsDev.Provider>),
Expand All @@ -92,6 +103,7 @@ describe("ModelsDevPlugin", () => {
const providerID = ProviderV2.ID.make("acme")
const base = yield* catalog.model.get(providerID, ModelV2.ID.make("gpt-5.4"))
const fast = yield* catalog.model.get(providerID, ModelV2.ID.make("gpt-5.4-fast"))
const deepseek = yield* catalog.model.get(providerID, ModelV2.ID.make("deepseek-v4-flash"))

expect(base?.variants).toEqual([])
expect(base?.request.body).toEqual({})
Expand Down Expand Up @@ -121,6 +133,12 @@ describe("ModelsDevPlugin", () => {
cache: { read: 0.5, write: 0 },
},
])
expect(deepseek?.api).toMatchObject({
id: "deepseek-v4-flash",
type: "aisdk",
package: "@ai-sdk/openai",
url: "https://api.acme.test/v1",
})
}),
)

Expand Down
17 changes: 11 additions & 6 deletions packages/opencode/src/provider/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,10 @@ function fromModelsDevModel(provider: ModelsDev.Provider, model: ModelsDev.Model
api: {
id: model.id,
url: model.provider?.api ?? provider.api ?? "",
npm: model.provider?.npm ?? provider.npm ?? "@ai-sdk/openai-compatible",
npm:
model.provider?.shape === "responses"
? "@ai-sdk/openai"
: (model.provider?.npm ?? provider.npm ?? "@ai-sdk/openai-compatible"),
},
status: model.status ?? "active",
headers: {},
Expand Down Expand Up @@ -1437,11 +1440,13 @@ const layer = Layer.effect(
const existingModel = parsed.models[model.id ?? modelID]
const apiID = model.id ?? existingModel?.api.id ?? modelID
const apiNpm =
model.provider?.npm ??
provider.npm ??
existingModel?.api.npm ??
modelsDev[providerID]?.npm ??
"@ai-sdk/openai-compatible"
model.provider?.shape === "responses"
? "@ai-sdk/openai"
: (model.provider?.npm ??
provider.npm ??
existingModel?.api.npm ??
modelsDev[providerID]?.npm ??
"@ai-sdk/openai-compatible")
const name = iife(() => {
if (model.name) return model.name
if (model.id && model.id !== modelID) return modelID
Expand Down
30 changes: 30 additions & 0 deletions packages/opencode/test/provider/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,36 @@ test("models.dev normalization fills required response fields", () => {
expect(model.release_date).toBe("")
})

test("models.dev response-shaped models use the OpenAI Responses provider", () => {
const provider = {
id: "deepseek",
name: "DeepSeek",
env: [],
npm: "@ai-sdk/openai-compatible",
api: "https://api.deepseek.com",
models: {
"deepseek-v4-flash": {
id: "deepseek-v4-flash",
name: "DeepSeek V4 Flash",
provider: { shape: "responses" },
limit: { context: 1_000_000, output: 384_000 },
},
"deepseek-v4-pro": {
id: "deepseek-v4-pro",
name: "DeepSeek V4 Pro",
limit: { context: 1_000_000, output: 384_000 },
},
},
} as unknown as ModelsDev.Provider

const models = Provider.fromModelsDevProvider(provider).models
expect(models["deepseek-v4-flash"].api).toMatchObject({
npm: "@ai-sdk/openai",
url: "https://api.deepseek.com",
})
expect(models["deepseek-v4-pro"].api.npm).toBe("@ai-sdk/openai-compatible")
})

test("models.dev reasoning options replace generated variants and unsupported toggles fall back", () => {
const provider = {
id: "reasoning",
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/content/docs/ar/go.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ OpenCode Go هو اشتراك منخفض التكلفة — **$5 للشهر ال
| Kimi K2.7 Code | kimi-k2.7-code | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| Kimi K2.6 | kimi-k2.6 | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Pro | deepseek-v4-pro | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/go/v1/responses` | `@ai-sdk/openai` |
| MiMo-V2.5 | mimo-v2.5 | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiMo-V2.5-Pro | mimo-v2.5-pro | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiniMax M3 | minimax-m3 | `https://opencode.ai/zen/go/v1/messages` | `@ai-sdk/anthropic` |
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/content/docs/ar/zen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ OpenCode Zen هي بوابة AI تتيح لك الوصول إلى هذه الن
| Qwen3.6 Plus | qwen3.6-plus | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
| Qwen3.5 Plus | qwen3.5-plus | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
| DeepSeek V4 Pro | deepseek-v4-pro | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
| MiniMax M3 | minimax-m3 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiniMax M2.7 | minimax-m2.7 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiniMax M2.5 | minimax-m2.5 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
Expand All @@ -114,7 +114,7 @@ OpenCode Zen هي بوابة AI تتيح لك الوصول إلى هذه الن
| Ling-3.0-flash Free | ling-3.0-flash-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| North Mini Code Free | north-mini-code-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| Nemotron 3 Ultra Free | nemotron-3-ultra-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash Free | deepseek-v4-flash-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash Free | deepseek-v4-flash-free | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |

يستخدم [معرّف النموذج](/docs/config/#models) في إعدادات OpenCode الصيغة `opencode/<model-id>`. على سبيل المثال، بالنسبة إلى GPT 5.5، ستستخدم `opencode/gpt-5.5` في إعداداتك.

Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/content/docs/bs/go.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ Također možete pristupiti Go modelima putem sljedećih API endpointa.
| Kimi K2.7 Code | kimi-k2.7-code | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| Kimi K2.6 | kimi-k2.6 | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Pro | deepseek-v4-pro | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/go/v1/responses` | `@ai-sdk/openai` |
| MiMo-V2.5 | mimo-v2.5 | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiMo-V2.5-Pro | mimo-v2.5-pro | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiniMax M3 | minimax-m3 | `https://opencode.ai/zen/go/v1/messages` | `@ai-sdk/anthropic` |
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/content/docs/bs/zen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Našim modelima možete pristupiti i preko sljedećih API endpointa.
| Qwen3.6 Plus | qwen3.6-plus | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
| Qwen3.5 Plus | qwen3.5-plus | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
| DeepSeek V4 Pro | deepseek-v4-pro | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
| MiniMax M3 | minimax-m3 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiniMax M2.7 | minimax-m2.7 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiniMax M2.5 | minimax-m2.5 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
Expand All @@ -119,7 +119,7 @@ Našim modelima možete pristupiti i preko sljedećih API endpointa.
| Ling-3.0-flash Free | ling-3.0-flash-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| North Mini Code Free | north-mini-code-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| Nemotron 3 Ultra Free | nemotron-3-ultra-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash Free | deepseek-v4-flash-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash Free | deepseek-v4-flash-free | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |

[model id](/docs/config/#models) u vašoj OpenCode konfiguraciji koristi format
`opencode/<model-id>`. Na primjer, za GPT 5.5 u konfiguraciji biste
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/content/docs/da/go.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ Du kan også få adgang til Go-modeller gennem følgende API-endpoints.
| Kimi K2.7 Code | kimi-k2.7-code | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| Kimi K2.6 | kimi-k2.6 | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Pro | deepseek-v4-pro | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/go/v1/responses` | `@ai-sdk/openai` |
| MiMo-V2.5 | mimo-v2.5 | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiMo-V2.5-Pro | mimo-v2.5-pro | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiniMax M3 | minimax-m3 | `https://opencode.ai/zen/go/v1/messages` | `@ai-sdk/anthropic` |
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/content/docs/da/zen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Du kan også få adgang til vores modeller gennem følgende API-endpoints.
| Qwen3.6 Plus | qwen3.6-plus | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
| Qwen3.5 Plus | qwen3.5-plus | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
| DeepSeek V4 Pro | deepseek-v4-pro | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
| MiniMax M3 | minimax-m3 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiniMax M2.7 | minimax-m2.7 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiniMax M2.5 | minimax-m2.5 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
Expand All @@ -119,7 +119,7 @@ Du kan også få adgang til vores modeller gennem følgende API-endpoints.
| Ling-3.0-flash Free | ling-3.0-flash-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| North Mini Code Free | north-mini-code-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| Nemotron 3 Ultra Free | nemotron-3-ultra-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash Free | deepseek-v4-flash-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash Free | deepseek-v4-flash-free | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |

[model id](/docs/config/#models) i din OpenCode-konfiguration
bruger formatet `opencode/<model-id>`. For eksempel ville du for GPT 5.5
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/content/docs/de/go.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Du kannst auf die Go-Modelle auch über die folgenden API-Endpunkte zugreifen.
| Kimi K2.7 Code | kimi-k2.7-code | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| Kimi K2.6 | kimi-k2.6 | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Pro | deepseek-v4-pro | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/go/v1/responses` | `@ai-sdk/openai` |
| MiMo-V2.5 | mimo-v2.5 | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiMo-V2.5-Pro | mimo-v2.5-pro | `https://opencode.ai/zen/go/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiniMax M3 | minimax-m3 | `https://opencode.ai/zen/go/v1/messages` | `@ai-sdk/anthropic` |
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/content/docs/de/zen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Du kannst auch über die folgenden API-Endpunkte auf unsere Modelle zugreifen.
| Qwen3.6 Plus | qwen3.6-plus | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
| Qwen3.5 Plus | qwen3.5-plus | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
| DeepSeek V4 Pro | deepseek-v4-pro | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash | deepseek-v4-flash | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
| MiniMax M3 | minimax-m3 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiniMax M2.7 | minimax-m2.7 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| MiniMax M2.5 | minimax-m2.5 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
Expand All @@ -110,7 +110,7 @@ Du kannst auch über die folgenden API-Endpunkte auf unsere Modelle zugreifen.
| Ling-3.0-flash Free | ling-3.0-flash-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| North Mini Code Free | north-mini-code-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| Nemotron 3 Ultra Free | nemotron-3-ultra-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash Free | deepseek-v4-flash-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
| DeepSeek V4 Flash Free | deepseek-v4-flash-free | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |

Die [Model-ID](/docs/config/#models) in deiner OpenCode-Konfiguration verwendet das Format `opencode/<model-id>`. Für GPT 5.5 würdest du zum Beispiel `opencode/gpt-5.5` in deiner Konfiguration verwenden.

Expand Down
Loading
Loading