Last active
September 19, 2025 04:09
-
-
Save olafgeibig/925ed73f10a5b99d891c0185580f4e42 to your computer and use it in GitHub Desktop.
Revisions
-
olafgeibig revised this gist
Sep 10, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ # Z.ai subscription with opencode Now Z.ai has an official solution to use the package. See below. ## Create a custom provider First we need to create a custom provider for the Z.ai anthropic API. Follow the instructions for adding a [custom provider](https://opencode.ai/docs/providers/#custom-provider) to opencode. -
olafgeibig renamed this gist
Sep 10, 2025 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
olafgeibig renamed this gist
Sep 10, 2025 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
olafgeibig revised this gist
Sep 10, 2025 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ ## Official solution from Z.ai Now there is the official solution to support opencode and others. I switched and it works perfectly. Great job Z.ai. ```json { "$schema": "https://opencode.ai/config.json", "provider": { "zai": { "options": { "baseURL": "https://api.z.ai/api/coding/paas/v4" } } } } ``` -
olafgeibig revised this gist
Sep 3, 2025 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,8 @@ # Z.ai subscription with opencode I do not guarantee that this is actually billed on your subscription inclusive volume and not as API consumption. Since Z.ai has no near realtime API usage information, I could not check it. Update: after 2 days of using it, no extra money was decucted from my credits. Guess tht means it works. ## Create a custom provider First we need to create a custom provider for the Z.ai anthropic API. Follow the instructions for adding a [custom provider](https://opencode.ai/docs/providers/#custom-provider) to opencode. - Name it `zai-anthropic` - Enter your API-key -
olafgeibig revised this gist
Sep 2, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ I do not guarantee that this is actually billed on your subscription inclusive v ## Create a custom provider First we need to create a custom provider for the Z.ai anthropic api Follow the instructions for adding a [custom provider](https://opencode.ai/docs/providers/#custom-provider) to opencode. - Name it `zai-anthropic` - Enter your API-key -
olafgeibig revised this gist
Sep 2, 2025 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ # Z.ai subscription with opencode I do not guarantee that this is actually billed on your subscription inclusive volume and not as API consumption. Since Z.ai has no near realtime API usage information, I could not check it. ## Create a custom provider First we need to create a custom provider for the Z.ai anthropic api -
olafgeibig created this gist
Sep 2, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ # Z.ai subscription with opencode ## Create a custom provider First we need to create a custom provider for the Z.ai anthropic api Follow the instructions for adding a [custom provider](https://opencode.ai/docs/providers/#custom-provider) - Name it `zai-anthropic` - Enter your API-key ## Configure the custom-provider Edit opencode.json and add this: ```json "provider": { "zai-anthropic": { "npm": "@ai-sdk/anthropic", "options": { "baseURL": "https://api.z.ai/api/anthropic/v1" }, "models": { "glm-4.5": { "name": "glm-4.5" } } } ``` Make this model default if you wish: ```json "model": "zai-anthropic/glm-4.5", ```