GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pass through model.options properly without having to nest it under p… · mmacia/opencode@86d5b25

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • opencode.json
  • packages
    • opencode/src
      • provider
        • provider.ts
      • session
        • index.ts
    • web/src/content/docs/docs
      • models.mdx
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎opencode.json‎

Copy file name to clipboardExpand all lines: opencode.json
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
{
22
"$schema": "https://opencode.ai/config.json",
3+
"provider": {
4+
"openrouter": {
5+
"models": {
6+
"moonshotai/kimi-k2": {
7+
"options": {
8+
"provider": {
9+
"order": ["baseten"],
10+
"allow_fallbacks": false
11+
}
12+
}
13+
}
14+
}
15+
}
16+
},
317
"mcp": {
418
"weather": {
519
"type": "local",
Collapse file

‎packages/opencode/src/provider/provider.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/provider/provider.ts
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,10 @@ export namespace Provider {
367367
const pkg = provider.npm ?? provider.id
368368
const mod = await import(await BunProc.install(pkg, "beta"))
369369
const fn = mod[Object.keys(mod).find((key) => key.startsWith("create"))!]
370-
const loaded = fn(s.providers[provider.id]?.options)
370+
const loaded = fn({
371+
name: provider.id,
372+
...s.providers[provider.id]?.options,
373+
})
371374
s.sdk.set(provider.id, loaded)
372375
return loaded as SDK
373376
})().catch((e) => {
Collapse file

‎packages/opencode/src/session/index.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/session/index.ts
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,9 @@ export namespace Session {
540540
const small = (await Provider.getSmallModel(input.providerID)) ?? model
541541
generateText({
542542
maxOutputTokens: input.providerID === "google" ? 1024 : 20,
543-
providerOptions: small.info.options,
543+
providerOptions: {
544+
[input.providerID]: small.info.options,
545+
},
544546
messages: [
545547
...SystemPrompt.title(input.providerID).map(
546548
(x): ModelMessage => ({
@@ -685,7 +687,9 @@ export namespace Session {
685687
maxOutputTokens: outputLimit,
686688
abortSignal: abort.signal,
687689
stopWhen: stepCountIs(1000),
688-
providerOptions: model.info.options,
690+
providerOptions: {
691+
[input.providerID]: model.info.options,
692+
},
689693
messages: [
690694
...system.map(
691695
(x): ModelMessage => ({
Collapse file

‎packages/web/src/content/docs/docs/models.mdx‎

Copy file name to clipboardExpand all lines: packages/web/src/content/docs/docs/models.mdx
+42Lines changed: 42 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,48 @@ You can customize the base URL for any provider by setting the `baseURL` option.
6161

6262
---
6363

64+
### OpenRouter
65+
66+
Many OpenRouter models are preloaded by default - you can customize these or add your own.
67+
68+
Here's an example of specifying a provider
69+
70+
```json title="opencode.json"
71+
{
72+
"$schema": "https://opencode.ai/config.json",
73+
"provider": {
74+
"openrouter": {
75+
"models": {
76+
"moonshotai/kimi-k2": {
77+
"options": {
78+
"provider": {
79+
"order": ["baseten"],
80+
"allow_fallbacks": false
81+
}
82+
}
83+
}
84+
}
85+
}
86+
}
87+
}
88+
```
89+
90+
You can also add additional models
91+
92+
```json title="opencode.json"
93+
{
94+
"$schema": "https://opencode.ai/config.json",
95+
"provider": {
96+
"openrouter": {
97+
"models": {
98+
"somecoolnewmodel": {},
99+
}
100+
}
101+
}
102+
}
103+
104+
---
105+
64106
### Local
65107

66108
You can configure local model like ones served through LM Studio or Ollama. To

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.