@frank_lee/oc-plugin
v0.1.0
Published
OpenCode plugin: dynamically load models from an OpenAI-compatible AIGW gateway, enriched with cost/reasoning from the models.opencode.ai catalog.
Downloads
35
Maintainers
Readme
@frank_lee/oc-plugin
OpenCode plugin that dynamically loads models from an OpenAI-compatible AIGW gateway and enriches them with cost / reasoning / capabilities from the models.opencode.ai catalog.
Install
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@frank_lee/oc-plugin"]
}Configuration
Set environment variables before starting opencode:
| Variable | Required | Description | Default |
| ------------------ | -------- | ------------------------------------ | ------------------------------ |
| AIGW_BASE_URL | No | Gateway base URL | http://192.168.1.137/aigw/v1 |
| AIGW_API_KEY | No* | API key for the gateway | none |
| AIGW_PROVIDER_ID | No | Provider id registered in opencode | aigw |
* The gateway returns 403 Forbidden when no API key is sent. Provide a key via the env var, or register one with /connect.
How it works
- At startup the
confighook fetchesGET {AIGW_BASE_URL}/models(5s timeout). - For each model, capability and cost data are looked up in the official catalog by model id (matching bare ids like
deepseek-v4-flashacross providers). - Results are cached to
.opencode/aigw-models.cache.jsonand reused if the gateway is unreachable. - A provider named
aigwis injected into the config, so models show up under/modelsasaigw/<model-id>.
No credentials are stored by the plugin.
