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
2 changes: 2 additions & 0 deletions packages/opencode/src/provider/models.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,7 @@ export namespace ModelsDev {
attachment: z.boolean(),
reasoning: z.boolean(),
temperature: z.boolean(),
tool_call: z.boolean(),
cost: z.object({
input: z.number(),
output: z.number(),
Expand All@@ -24,6 +25,7 @@ export namespace ModelsDev {
output: z.number(),
}),
id: z.string(),
options: z.record(z.any()),
})
.openapi({
ref: "Model.Info",
Expand Down
20 changes: 13 additions & 7 deletions packages/opencode/src/provider/provider.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -161,13 +161,19 @@ export namespace Provider {
attachment: model.attachment ?? existing?.attachment ?? false,
reasoning: model.reasoning ?? existing?.reasoning ?? false,
temperature: model.temperature ?? existing?.temperature ?? false,
cost: model.cost ??
existing?.cost ?? {
input: 0,
output: 0,
inputCached: 0,
outputCached: 0,
},
tool_call: model.tool_call ?? existing?.tool_call ?? true,
cost: {
...existing?.cost,
...model.cost,
input: 0,
output: 0,
cache_read: 0,
cache_write: 0,
},
options: {
...existing?.options,
...model.options,
},
limit: model.limit ??
existing?.limit ?? {
context: 0,
Expand Down
6 changes: 3 additions & 3 deletions packages/opencode/src/session/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -260,6 +260,7 @@ export namespace Session {
if (msgs.length === 0 && !session.parentID) {
generateText({
maxTokens: input.providerID === "google" ? 1024 : 20,
providerOptions: model.info.options,
messages: [
...SystemPrompt.title(input.providerID).map(
(x): CoreMessage => ({
Expand DownExpand Up@@ -512,6 +513,7 @@ export namespace Session {
toolCallStreaming: true,
abortSignal: abort.signal,
maxSteps: 1000,
providerOptions: model.info.options,
messages: [
...system.map(
(x, index): CoreMessage => ({
Expand All@@ -533,9 +535,7 @@ export namespace Session {
),
],
temperature: model.info.temperature ? 0 : undefined,
tools: {
...tools,
},
tools: model.info.tool_call === false ? undefined : tools,
model: model.language,
})
try {
Expand Down