summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGabriel Garrett <[email protected]>2025-07-10 12:29:30 -0500
committerGitHub <[email protected]>2025-07-10 13:29:30 -0400
commitb56e49c5dc08338979130cefb412f5cac2a1e9f9 (patch)
tree632f4d87a0b5b77bd4089caa754ec3c3370b5ba1
parent8b2a909e1f29b7c024d70b6eb5da7d73e9307941 (diff)
downloadopencode-b56e49c5dc08338979130cefb412f5cac2a1e9f9.tar.gz
opencode-b56e49c5dc08338979130cefb412f5cac2a1e9f9.zip
Adds real example in docs of how to configure custom provider (#840)
-rw-r--r--packages/web/src/content/docs/docs/config.mdx36
1 files changed, 36 insertions, 0 deletions
diff --git a/packages/web/src/content/docs/docs/config.mdx b/packages/web/src/content/docs/docs/config.mdx
index 21efd01f4..7e0399fce 100644
--- a/packages/web/src/content/docs/docs/config.mdx
+++ b/packages/web/src/content/docs/docs/config.mdx
@@ -97,6 +97,42 @@ You can configure the providers and models you want to use in your opencode conf
[Learn more here](/docs/models).
+#### Custom Providers
+
+You can also define custom providers in your configuration. This is useful for connecting to services that are not natively supported but are OpenAI API-compatible, such as local models served through LM Studio or Ollama.
+
+Here's an example of how to configure a local on-device model from LM Studio:
+
+```json title="opencode.json"
+{
+ "$schema": "https://opencode.ai/config.json",
+ "model": "lmstudio/google/gemma-3n-e4b",
+ "provider": {
+ "lmstudio": {
+ "npm": "@ai-sdk/openai-compatible",
+ "name": "LM Studio (local)",
+ "options": {
+ "baseURL": "http://127.0.0.1:1234/v1"
+ },
+ "models": {
+ "google/gemma-3n-e4b": {
+ "name": "Gemma 3n-e4b (local)"
+ }
+ }
+ }
+ }
+}
+```
+
+In this example:
+
+- `lmstudio` is the custom provider ID.
+- `npm` specifies the package to use for this provider. `@ai-sdk/openai-compatible` is used for any OpenAI-compatible API.
+- `name` is the display name for the provider in the UI.
+- `options.baseURL` is the endpoint for the local server.
+- `models` is a map of model IDs to their configurations. The model name will be displayed in the model selection list.
+- The `model` key at the root is set to the full ID of the model you want to use, which is `provider_id/model_id`.
+
---
### Themes