|
|
4 недель назад | |
|---|---|---|
| .gitignore | 2 недель назад | |
| LICENSE | 4 недель назад | |
| README.md | 2 недель назад | |
| fetch_models_for_opencode.go | 2 недель назад | |
| go.mod | 2 недель назад |
A small Go tool that fetches the model list from an OpenAI-compatible endpoint
(GET <baseurl>/models) and generates an opencode.jsonc config file for
OpenCode.
OpenCode only allows adding models manually via opencode.jsonc – there is no
way to import them automatically. This is tedious when your provider offers many
models.
Example: I run this tool against OmniRoute, a local AI gateway that exposes hundreds of models and combo models through a single OpenAI-compatible endpoint – exactly the models I want to use in OpenCode. Instead of writing every entry by hand, this tool generates the complete provider config in one go.
/models from the given base URL@ai-sdk/openai-compatible) with all modelsgo run . --provider Myprovider --baseurl http://localhost:8080/v1 --token sk-1234
| Flag | Default | Description |
|---|---|---|
-provider |
Myprovider |
Provider name |
-baseurl |
– (required) | Base URL, e.g. http://localhost:8080/v1 |
-output |
opencode.jsonc |
Output file |
-token |
– | API token sent as Authorization: Bearer |
go build -o fetch_models_for_opencode .