Skip to content

feat: add OPENCODE_MODELS_URL so the models.dev domain configurable for offline environments - #9258

Merged
rekram1-node merged 7 commits into
anomalyco:devfrom
bartbroere:models-dev-configurable
Jan 21, 2026
Merged

rekram1-node merged 7 commits into
anomalyco:devfrom
bartbroere:models-dev-configurable

Conversation

@bartbroere

@bartbroere bartbroere commented Jan 18, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

There are several issues and pull requests (#8860 #4959 #8830 #8814 #8642 #7313) that discuss the issue that the models.dev domain can't be reached in offline environments. Even if you would use a local Ollama instance, the project tries to fetch https://models.dev/api.json.

The solution I propose is making the models.dev URL configurable, so you can use something in your local network to host the api.json file. A typical corporate environment might have products like Sonatype Nexus Repository that allow for proxying of specific files on the internet. It would be nice if a MODELS_DEV_URL could be configured to contain the path to an internal host with the right files.

How did you verify your code works?

I put my computer in airplane mode, configured the MODELS_DEV_URL environment variable to http://localhost:8000/, ran python3 -m http.server in a directory with api.json, and tried to use a local model.

Fixes: #7313

@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title Make the models.dev domain configurable for offline environments doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@bartbroere bartbroere changed the title Make the models.dev domain configurable for offline environments FEAT: Make the models.dev domain configurable for offline environments Jan 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@bartbroere bartbroere changed the title FEAT: Make the models.dev domain configurable for offline environments feat: Make the models.dev domain configurable for offline environments Jan 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@Moler1995

Copy link
Copy Markdown

Would it be possible to support file:///path/to/api.json? So I can download or define my own api.json file.

@bartbroere

Copy link
Copy Markdown
Contributor Author

Would it be possible to support file:///path/to/api.json? So I can download or define my own api.json file.

I think that is supported by bun, but I'll try to figure out if it actually works:
https://bun.com/docs/runtime/networking/fetch#file-urls-file://

In your example MODELS_DEV_URL would be file:///path/to/

@Moler1995

Copy link
Copy Markdown

Would it be possible to support file:///path/to/api.json? So I can download or define my own api.json file.

I think that is supported by bun, but I'll try to figure out if it actually works: https://bun.com/docs/runtime/networking/fetch#file-urls-file://

In your example MODELS_DEV_URL would be file:///path/to/

Great! Thanks a lot~

@rekram1-node

Copy link
Copy Markdown
Contributor

can we make it OPENCODE_MODELS_URL instead?

I think using OPENCODE_ prefix makes most sense when it's oc specific

@bartbroere

Copy link
Copy Markdown
Contributor Author

can we make it OPENCODE_MODELS_URL instead?

I think using OPENCODE_ prefix makes most sense when it's oc specific

Sounds better, I just renamed it.

@junmediatek

Copy link
Copy Markdown
Contributor

hi @bartbroere
This PR has been merged?

@bartbroere

Copy link
Copy Markdown
Contributor Author

hi @bartbroere This PR has been merged?

Not yet, but hopefully soon. You could check out my branch and run it though.

@Zanry

Zanry commented Jan 21, 2026

Copy link
Copy Markdown

Very useful PR. Please leave a message if this has been merged into the main branch. Thank you!

@rekram1-node rekram1-node changed the title feat: Make the models.dev domain configurable for offline environments feat: add OPENCODE_MODELS_URL so the models.dev domain configurable for offline environments Jan 21, 2026
@rekram1-node
rekram1-node merged commit 8df09ab into anomalyco:dev Jan 21, 2026
3 checks passed
@qweered qweered mentioned this pull request Jan 22, 2026
3 of 13 tasks
@cravenceiling

Copy link
Copy Markdown
Contributor
image

AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 2026
meSingh pushed a commit to meSingh/opencode that referenced this pull request Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Does OpenCode Require Internet APIs?

6 participants