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 — feat: Allow provider timeout override by egyptianbman · Pull Request #1982 · anomalyco/opencode

feat: Allow provider timeout override #1982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
thdxr merged 2 commits into anomalyco:dev from egyptianbman:dev
Aug 31, 2025

Uh oh!

There was an error while loading. Please reload this page.

Merged

feat: Allow provider timeout override #1982

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit Hold shift + click to select a range
8b76a0f
feat: Allow provider timeout override, defaulting to upstream's 5m
egyptianbman Aug 15, 2025
4424f4e
override for any, if configured
egyptianbman Aug 26, 2025
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Next Next commit
feat: Allow provider timeout override, defaulting to upstream's 5m
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@egyptianbman
egyptianbman committed Aug 26, 2025
commit 8b76a0f838d19d5acbe31cd5a8eb22f35bf2d9c2

There are no files selected for viewing

15 changes: 15 additions & 0 deletions 15 packages/opencode/src/config/config.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,21 @@ export namespace Config {
.object({
apiKey: z.string().optional(),
baseURL: z.string().optional(),
timeout: z
.union([
z
.number()
.int()
.positive()
.describe(
"Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.",
),
z.literal(false).describe("Disable timeout for this provider entirely."),
])
.optional()
.describe(
"Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.",
),
})
.catchall(z.any())
.optional(),
Expand Down
11 changes: 10 additions & 1 deletion 11 packages/opencode/src/provider/provider.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,18 @@ export namespace Provider {
const pkg = provider.npm ?? provider.id
const mod = await import(await BunProc.install(pkg, "latest"))
const fn = mod[Object.keys(mod).find((key) => key.startsWith("create"))!]
let options = { ...s.providers[provider.id]?.options }
// Inject custom fetch for local OpenAI-compatible providers
if ((provider.npm === "@ai-sdk/openai-compatible" || pkg === "@ai-sdk/openai-compatible") && options["baseURL"]) {
Comment thread
rekram1-node marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

// Always override fetch to set timeout (default: 5min = 300000ms, or user-configurable, or false for unlimited)
const userTimeout = options["timeout"] !== undefined ? options["timeout"] : 300000
options["fetch"] = async (input: any, init?: any) => {
return await fetch(input, { ...init, timeout: userTimeout })
}
}
const loaded = fn({
name: provider.id,
...s.providers[provider.id]?.options,
...options,
})
s.sdk.set(provider.id, loaded)
return loaded as SDK
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
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.