[Question] How to use Gitlab/Github runners with custom providers #1440

Open
opened 2026-02-16 17:30:58 -05:00 by yindo · 2 comments
Owner

Originally created by @co-esquie on GitHub (Aug 22, 2025).

Originally assigned to: @fwang on GitHub.

After looking at the documentation to Integrate with Github workflow, the documentation is quite clear about the usage with Anthropic

- name: Run opencode
  uses: sst/opencode/github@latest
  env:
    ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
  with:
    model: anthropic/claude-sonnet-4-20250514

but what about custom open AI providers? Locally you have to create an opencode configuration file inside the project folder, but i'm not sure what is the process and what environment variables should be used. I think we can create opencode.json at the project root location and use the env syntax in the json file?

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "myprovider": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "My AI ProviderDisplay Name",
      "options": {
        "baseURL": "https://api.myprovider.com/v1",
        "apiKey": "{env:MY_SECRET_VARFIABLE_NAME}"
      },
      "models": {
        "my-model-name": {
          "name": "My Model Display Name"
        }
      }
    }
  }

and use the provider/my-model-name in the github workflow? Let me know if I'm right and also if you are interested that I improve documentation on this part in a pull request.

Also, are we able to use custom modes like plan then build in the workflow?

Originally created by @co-esquie on GitHub (Aug 22, 2025). Originally assigned to: @fwang on GitHub. After looking at the documentation to [Integrate with Github workflow](https://opencode.ai/docs/github/), the documentation is quite clear about the usage with Anthropic ```yaml - name: Run opencode uses: sst/opencode/github@latest env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} with: model: anthropic/claude-sonnet-4-20250514 ``` but what about custom open AI providers? Locally you have to create an opencode configuration file inside the project folder, but i'm not sure what is the process and what environment variables should be used. I think we can create `opencode.json` at the project root location and use the env syntax in the json file? ```json { "$schema": "https://opencode.ai/config.json", "provider": { "myprovider": { "npm": "@ai-sdk/openai-compatible", "name": "My AI ProviderDisplay Name", "options": { "baseURL": "https://api.myprovider.com/v1", "apiKey": "{env:MY_SECRET_VARFIABLE_NAME}" }, "models": { "my-model-name": { "name": "My Model Display Name" } } } } ``` and use the `provider/my-model-name` in the github workflow? Let me know if I'm right and also if you are interested that I improve documentation on this part in a pull request. Also, are we able to use custom modes like plan then build in the workflow?
Author
Owner

@github-actions[bot] commented on GitHub (Aug 22, 2025):

This issue might be a duplicate of existing issues. Please check:

The configuration approach you've outlined appears to be correct based on issue #1555, and there's already an active PR (#1488) that addresses GitHub Actions with custom configurations as mentioned in issue #1489.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Aug 22, 2025): This issue might be a duplicate of existing issues. Please check: - #1489: [Feat: Allow github actions to use custom configuration](https://github.com/sst/opencode/issues/1489) - specifically addresses using custom configurations and environment variables in GitHub Actions, with an associated PR - #1555: [LM Studio Missing as Provider, custom provider for LM Studio non-functional](https://github.com/sst/opencode/issues/1555) - shows examples of configuring custom providers with environment variable syntax `{env:VARIABLE_NAME}` - #930: [Make using any model with any provider easier](https://github.com/sst/opencode/issues/930) - discusses difficulties with custom provider documentation and configuration - #187: [Add Ollama setup info in Readme.md](https://github.com/sst/opencode/issues/187) - requests better documentation for setting up custom providers globally The configuration approach you've outlined appears to be correct based on issue #1555, and there's already an active PR (#1488) that addresses GitHub Actions with custom configurations as mentioned in issue #1489. Feel free to ignore if none of these address your specific case.
Author
Owner

@nagyv commented on GitHub (Dec 12, 2025):

@co-esquie I released a GitLab + OpenCode CI component that works great with GitLab runners a few days ago: https://gitlab.com/explore/catalog/nagyv/gitlab-opencode

@nagyv commented on GitHub (Dec 12, 2025): @co-esquie I released a GitLab + OpenCode CI component that works great with GitLab runners a few days ago: https://gitlab.com/explore/catalog/nagyv/gitlab-opencode
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1440