Buckets:
OpenCode
OpenCode is an AI coding agent built for the terminal that helps with code review, refactoring, testing, and general development tasks.
Overview
OpenCode natively supports Hugging Face Inference Providers, giving you access to open models from 17+ providers through a single interface.
Prerequisites
- OpenCode installed (installation guide)
- A Hugging Face account with API token (needs "Make calls to Inference Providers" permission)
Configuration
Quick Setup
Create a Hugging Face token with Inference Providers permissions at huggingface.co/settings/tokens
Run
opencode auth loginand select Hugging Face:
$ opencode auth login
┌ Add credential
│
◆ Select provider
│ ● Hugging Face
│ ...
└
- Enter your Hugging Face token when prompted:
┌ Add credential
│
◇ Select provider
│ Hugging Face
│
◇ Enter your API key
│ hf_...
└
- Run the
/modelscommand in OpenCode to select a model.
Once configured, OpenCode will use your selected model for all operations. You can switch models anytime using the /models command in the OpenCode TUI (Terminal User Interface).
Billing to an Organization
To bill inference usage to a Hugging Face organization instead of your personal account, add the X-HF-Bill-To header in your OpenCode config (~/.config/opencode/opencode.json):
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"huggingface": {
"options": {
"headers": {
"X-HF-Bill-To": "your-org-name"
}
}
}
}
}
Replace "your-org-name" with the name of the organization you want to bill to.
GitHub Actions Integration
OpenCode can also be used to run open models in GitHub Actions via Inference Providers. See our GitHub Actions guide for setting up automated PR reviews.
Resources
Xet Storage Details
- Size:
- 2.43 kB
- Xet hash:
- b0d5ee252a5b11bc91248ea4eefb59e41a207d77dd26906aa298d5af780e382b
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.