ctaxnagomi commited on
Commit
a0764ea
·
verified ·
1 Parent(s): 1c081c4

Add providers doc

Browse files
Files changed (1) hide show
  1. docs/providers.md +38 -0
docs/providers.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Providers (OpenCode V2)
2
+
3
+ OpenCode includes a provider and model catalog from models.dev. For most providers, connect an account first, then select a model.
4
+
5
+ ## Setup
6
+ Run /connect, choose a provider, and enter its credentials. Then run /models to select one of its models.
7
+
8
+ ## Custom
9
+ 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.
10
+
11
+ Example:
12
+ {
13
+ "$schema": "https://opencode.ai/config.json",
14
+ "providers": {
15
+ "acme": {
16
+ "name": "Acme",
17
+ "env": ["ACME_API_KEY"],
18
+ "package": "@opencode/ai/providers/openai-compatible",
19
+ "settings": { "baseURL": "https://llm.acme.example/v1" },
20
+ "models": { "qwen3-coder": { "name": "Qwen 3 Coder" } }
21
+ }
22
+ }
23
+ }
24
+
25
+ The providers object is keyed by the provider ID used in model references, such as acme/qwen3-coder.
26
+
27
+ Fields: name, env, package, canonical, compatibility, settings, headers, body, models.
28
+
29
+ ## Endpoint
30
+ Override settings.baseURL to send a catalog provider through a proxy or compatible endpoint.
31
+
32
+ ## Packages
33
+ Native package options include openai, openai-compatible, anthropic, google, azure, amazon-bedrock, openrouter, xai, etc. You can also use npm packages or file:// URLs.
34
+
35
+ ## Errors
36
+ - No model is available for session: no enabled model selectable.
37
+ - Model unavailable: provider/model: provider inactive, model ID absent/disabled, or discovery no longer returns it.
38
+ - Cannot initialize provider/model: a placeholder remains in baseURL. Set that variable on the OpenCode server or replace the template with a complete endpoint.