DeepSeek Authentication Plugin for OpenCode

Authenticate the OpenCode CLI with your DeepSeek account credentials. This plugin enables
you to use your existing DeepSeek account directly within OpenCode, bypassing the need for separate API keys.
Prerequisites
- OpenCode CLI installed.
- A DeepSeek account with access to their service.
Installation
Add the plugin to your OpenCode configuration file
(~/.config/opencode/opencode.json or similar):
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-deepseek-auth@latest"]
}
Usage
-
Login: Run the authentication command in your terminal:
opencode auth login
-
Select Provider: Choose DeepSeek from the list.
-
Authenticate: Select Login with DeepSeek Account.
- Enter your email and password when prompted
- Your credentials will be stored securely for future use
Once authenticated, OpenCode will use your DeepSeek account for requests.
Configuration
Model list
Below are example model entries you can add under provider.deepseek.models in your
OpenCode config.
File: ~/.config/opencode/opencode.json
{
"provider": {
"deepseek": {
"models": {
"deepseek-chat": {
"displayName": "DeepSeek Chat",
"maxTokens": 8192
},
"deepseek-reasoner": {
"displayName": "DeepSeek Reasoner",
"maxTokens": 8192
}
}
}
}
}
Features
- Direct authentication using DeepSeek account credentials (email/password)
- Secure storage of credentials
- Automatic token refresh when expired
- Compatibility with OpenCode's authentication system
- Free usage through your existing DeepSeek account
How It Works
The plugin works by:
- Authenticating directly with DeepSeek's API using your email and password
- Obtaining an access token from DeepSeek
- Using this token to make authenticated requests to DeepSeek's API
- Managing token lifecycle and refreshing when needed
This approach bypasses the need for separate API keys, letting you use your existing DeepSeek account quota and features.
Troubleshooting
Credentials Not Working
- Verify that your email and password are correct
- Check that your account is active and not suspended
- Make sure you're not hitting rate limits
Token Expiration
The plugin handles token refresh automatically, but if you encounter authentication errors, you can re-authenticate with:
opencode auth login
Development
To develop on this plugin locally:
-
Clone:
git clone https://github.com/yourusername/opencode-deepseek-auth.git
cd opencode-deepseek-auth
npm install
npm run build
-
Link:
Update your OpenCode config to point to your local directory using a
file:// URL:
{
"plugin": ["file:///absolute/path/to/opencode-deepseek-auth"]
}
License
MIT