OpenCode is an AI coding agent that runs in your terminal and can work with open models via Hugging Face Inference Providers.
You can also install OpenCode as a GitHub App to help automate GitHub workflows!
In less than 5 minutes, you can set it up to respond to issues and pull requests using powerful open source language models.

This guide shows you how to use Hugging Face Inference Providers with OpenCode to power GitHub automation. You’ll be able to triage issues, implement features, and review code using models like DeepSeek, GLM-4.5, and Kimi K2.
This guide assumes you have a Hugging Face account and a GitHub repository. You can create a free Hugging Face account at huggingface.co.
Once set up, OpenCode will respond to /oc or /opencode commands in GitHub issues and pull requests:
The entire workflow runs securely in your GitHub Actions runners, and you maintain full control over which repositories you install the OpenCode GitHub app on.
First, install OpenCode on your local machine following the installation instructions.
Navigate to your local clone of your GitHub repository and run the setup command:
cd your-repository
opencode github installThis triggers an interactive setup process that will guide you through:
.github/workflows/opencode.yml automaticallyOnce the .github/workflows/opencode.yml file is created, you’ll need to commit and push it to your repository:
git add .github/workflows/opencode.yml
git commit -m "Add OpenCode workflow"
git pushAfter the setup completes, you’ll need to add your Hugging Face token as a repository secret:
Make calls to Inference Providers.HF_TOKEN and paste your tokenMake sure your Hugging Face token has Inference Providers permissions enabled. We recommend creating a separate token specifically for OpenCode usage.
Once your workflow is set up and your token is configured, test it by commenting on any issue:
/oc summarizeOpenCode will analyze the issue and provide a summary. Here are other commands you can try:
Explain an issue:
/opencode explain this issueImplement a fix:
OpenCode creates a new branch, implements the changes, and opens a pull request.
Request changes on a PR:
/oc please add error handlingUse
/oc(short) or/opencode(long) to trigger commands. OpenCode understands natural language, so feel free to be specific about what you need.
On public repositories, anyone can trigger the bot by commenting
/ocor/opencode. This could lead to unexpected inference costs or unwanted PRs. Consider:
- Using a separate Hugging Face token specifically for OpenCode (not your main token), so you can revoke it if needed without affecting other services
- Monitoring your Hugging Face usage to track costs
- Adding workflow conditions to restrict who can trigger the bot (e.g., only repository collaborators)
- Starting with a private repository or test repo to control access
Here’s a real example from a fork of the Hugging Face datasets repository. The issue requests adding uv installation support:

When someone comments /oc fix this, OpenCode analyzes the issue, creates a new branch, implements the changes, and opens a pull request:

The PR includes all the necessary changes:

Different models offer different trade-offs between speed, cost, and capability. You can experiment with various models by editing the workflow file.
Edit .github/workflows/opencode.yml and update the model parameter:
with:
model: huggingface/deepseek-ai/DeepSeek-V3 # Powerful reasoning
# or
model: huggingface/zai-org/GLM-4.5-Air # Balanced performanceCommit and push the changes:
git add .github/workflows/opencode.yml
git commit -m "Switch to the DeepSeek model"
git pushThe setup wizard generates .github/workflows/opencode.yml, which defines when and how OpenCode runs:
name: opencode
on:
issue_comment:
types: [created] # Trigger on new comments
jobs:
opencode:
# Only run if comment contains /oc or /opencode
if: |
contains(github.event.comment.body, ' /oc') ||
startsWith(github.event.comment.body, '/oc') ||
contains(github.event.comment.body, ' /opencode') ||
startsWith(github.event.comment.body, '/opencode')
runs-on: ubuntu-latest
permissions:
id-token: write # Required for OpenCode authentication
contents: read # Read repository contents
pull-requests: read # Access PR information
issues: read # Access issue information
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run opencode
uses: sst/opencode/github@latest
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }} # Your Hugging Face token
with:
model: huggingface/zai-org/GLM-4.5-Air # The model to useThe workflow triggers whenever someone comments on an issue or PR with /oc or /opencode, checks out your repository code, and runs OpenCode with your chosen model from Hugging Face Inference Providers.