Overview
Type: Coding ToolPrimary Path: OpenAI-compatibleSupport Confidence: Supported path
Installation
- Install Script
- Homebrew
- Go
Configuration
Step 1: Set Environment Variables
~/.bashrc or ~/.zshrc:
Step 2: Configure OpenCode
OpenCode’s current docs recommend configuring providers throughopencode.json or opencode.jsonc. For LemonData, use a custom provider instead of overloading the built-in openai provider:
Use
@ai-sdk/openai-compatible for chat-completions style compatibility. If you specifically need a provider path built on /v1/responses, OpenCode’s provider docs recommend switching the package to @ai-sdk/openai.Basic Usage
Start interactive mode:Available Models
| Model | Best For |
|---|---|
gpt-5.4 | Complex tasks, code architecture |
gpt-5-mini | Quick fixes, simple queries |
claude-sonnet-4-6 | Code review, documentation |
claude-opus-4-6 | Complex reasoning |
gemini-2.5-flash | Fast responses |
deepseek-r1 | Algorithm design |
Common Commands
Analyze code:Interactive Commands
| Command | Description |
|---|---|
/help | Show available commands |
/model <name> | Switch to a different model |
/clear | Clear conversation history |
/exit | Exit OpenCode |
Troubleshooting
Connection Error
Connection Error
- Verify
options.baseURLis set tohttps://api.lemondata.cc/v1 - Check network connectivity
- Try
curl https://api.lemondata.cc/v1/modelsto test
Authentication Failed
Authentication Failed
- Verify
OPENAI_API_KEYenvironment variable is set - Verify
options.apiKeyreferences{env:OPENAI_API_KEY}or another valid secret source - Check that the key starts with
sk- - Ensure the key is active in LemonData dashboard
Model Not Found
Model Not Found
- Check model name in config matches exactly
- Verify model availability at lemondata.cc/en/models
Best Practices
Use project context
Use project context
Run OpenCode from your project root for better understanding of your codebase.
Choose appropriate models
Choose appropriate models
Use faster models (
gpt-5-mini) for simple tasks and stronger models (gpt-5.4, claude-sonnet-4-6) for complex ones.Review generated code
Review generated code
Always review AI-generated code before applying changes to your project.