Repository navigation
feat: add OPENCODE_MODELS_URL so the models.dev domain configurable for offline environments - #9258
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
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: In your example |
Great! Thanks a lot~ |
|
can we make it OPENCODE_MODELS_URL instead? I think using OPENCODE_ prefix makes most sense when it's oc specific |
…variable's name the same
…dels-dev-configurable
Sounds better, I just renamed it. |
|
hi @bartbroere |
Not yet, but hopefully soon. You could check out my branch and run it though. |
|
Very useful PR. Please leave a message if this has been merged into the main branch. Thank you! |

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.jsonfile. 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 aMODELS_DEV_URLcould 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_URLenvironment variable tohttp://localhost:8000/, ranpython3 -m http.serverin a directory withapi.json, and tried to use a local model.Fixes: #7313