Skip to navigation

OpenCode

OpenCode is an open-source coding agent for the terminal, desktop and IDEs. Add Flow AI as an OpenAI-compatible provider and pick its models with /models.

1

Install OpenCode

curl -fsSL https://opencode.ai/install | bash

See OpenCode’s install guide for other options.

2

Set your key

export HYPERFLOW_API_KEY="sk-..."
3

Add Flow AI as a provider

Add this to ~/.config/opencode/opencode.json:

opencode.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"flow": {
"npm": "@ai-sdk/openai-compatible",
"name": "Flow AI",
"options": {
"baseURL": "https://ai.hyperflow.fun/v1",
"apiKey": "{env:HYPERFLOW_API_KEY}"
},
"models": {
"openai/gpt-6-luna": {
"name": "GPT-6 Luna"
}
}
}
}
}

Add every Flow AI model you want under models, keyed by its id from the Models page.

4

Start OpenCode

cd /path/to/your/project
opencode

Run /models and pick a Flow AI model.

To keep the key out of the config file, leave out apiKey, run /connect inside OpenCode, choose Flow AI and paste your key. OpenCode stores it in ~/.local/share/opencode/auth.json.

Troubleshooting

  • Authentication errors: check HYPERFLOW_API_KEY is set in the shell that starts OpenCode, or run /connect again.
  • Model not found: the key under models must match the model id exactly, such as openai/gpt-6-luna.
  • The agent doesn’t edit files: pick a model with tool calling.