|
Download docs/providers.md from ctaxnagomi/Instruct-opencode_V2: direct link, hf CLI and curl.
- Browser
- Download file 1.63 kB
-
https://huggingface.co/datasets/ctaxnagomi/Instruct-opencode_V2/resolve/main/docs/providers.md
- Command line
-
hf download hf://datasets/ctaxnagomi/Instruct-opencode_V2/docs/providers.md
-
curl -L -o providers.md https://huggingface.co/datasets/ctaxnagomi/Instruct-opencode_V2/resolve/main/docs/providers.md
1.63 kB
| # Providers (OpenCode V2) | |
| OpenCode includes a provider and model catalog from models.dev. For most providers, connect an account first, then select a model. | |
| ## Setup | |
| Run /connect, choose a provider, and enter its credentials. Then run /models to select one of its models. | |
| ## Custom | |
| Add a provider when its API is not already in the catalog. This OpenAI-compatible example defines the credential, runtime package, endpoint, and first model together. | |
| Example: | |
| { | |
| "$schema": "https://opencode.ai/config.json", | |
| "providers": { | |
| "acme": { | |
| "name": "Acme", | |
| "env": ["ACME_API_KEY"], | |
| "package": "@opencode/ai/providers/openai-compatible", | |
| "settings": { "baseURL": "https://llm.acme.example/v1" }, | |
| "models": { "qwen3-coder": { "name": "Qwen 3 Coder" } } | |
| } | |
| } | |
| } | |
| The providers object is keyed by the provider ID used in model references, such as acme/qwen3-coder. | |
| Fields: name, env, package, canonical, compatibility, settings, headers, body, models. | |
| ## Endpoint | |
| Override settings.baseURL to send a catalog provider through a proxy or compatible endpoint. | |
| ## Packages | |
| Native package options include openai, openai-compatible, anthropic, google, azure, amazon-bedrock, openrouter, xai, etc. You can also use npm packages or file:// URLs. | |
| ## Errors | |
| - No model is available for session: no enabled model selectable. | |
| - Model unavailable: provider/model: provider inactive, model ID absent/disabled, or discovery no longer returns it. | |
| - Cannot initialize provider/model: a placeholder remains in baseURL. Set that variable on the OpenCode server or replace the template with a complete endpoint. | |