happy connect command securely stores your AI vendor API keys in Happy cloud, enabling you to use AI services through Happy without exposing keys locally.
Syntax
Subcommands
codex
Connect your OpenAI account for Codex agent.claude
Connect your Anthropic account for enhanced Claude features.gemini
Connect your Google account for Gemini agent.status
Show connection status for all AI vendors.Description
Theconnect command provides secure OAuth-based authentication for AI vendors. Benefits include:
- Secure storage: API keys encrypted in Happy cloud
- OAuth flow: No manual API key copying
- Multi-device: Use same credentials across all your machines
- Token refresh: Automatic token refresh when needed
- Easy management: View and manage connections from mobile app
You must authenticate with Happy first using
happy auth login before connecting AI vendors.Examples
Connect OpenAI (Codex)
- Approve Happy’s access to OpenAI
- Return to terminal
- Connection confirmed
Connect Google (Gemini)
Gemini also updates your local
~/.gemini/oauth_creds.json file to keep tokens in sync.Connect Anthropic (Claude)
Check Connection Status
OAuth Flow
Connection Process
- Initiate: Run
happy connect <vendor> - Browser Opens: OAuth consent page opens in your default browser
- Authorize: Approve Happy’s access to the AI service
- Token Exchange: OAuth tokens securely transferred to Happy cloud
- Encryption: Tokens encrypted and stored
- Confirmation: Terminal confirms successful connection
What Happens Behind the Scenes
Token Management
Token Expiration
OAuth tokens have limited lifetimes:- Access tokens: Typically 1 hour
- Refresh tokens: Used to get new access tokens automatically
- ID tokens: Contain user information
Manual Token Refresh
If a token expires:Token Information
Tokens contain:access_token: Used for API authenticationrefresh_token: Used to obtain new access tokensid_token: JWT containing user email and infoexpires_at: Token expiration timestampscope: Permissions granted
Vendor-Specific Details
OpenAI (Codex)
Required for:happy codex
Scopes requested:
- OpenAI API access
- User profile information
Google (Gemini)
Required for:happy gemini
Scopes requested:
https://www.googleapis.com/auth/cloud-platform- User profile and email
~/.gemini/oauth_creds.json(synchronized with cloud)
Anthropic (Claude)
Required for: Enhanced Claude features (optional) Scopes requested:- Anthropic API access
- User profile information
Happy’s main
happy command uses Claude Code which has its own authentication. The happy connect claude command is for additional cloud features.Security
Encryption
All vendor tokens are:- Encrypted at rest in Happy cloud
- Encrypted in transit (HTTPS/WSS)
- Never logged or exposed
- Accessible only to your authenticated machines
Access Control
- Tokens can only be accessed by machines you’ve authenticated
- Each machine uses its own derived key for encryption
- Revoking machine access revokes token access
Token Scope
Tokens are limited to:- Specific API operations required by Happy
- Read-only access where possible
- User-approved scopes only
Troubleshooting
Not Authenticated
If you see “Not authenticated with Happy”:OAuth Flow Fails
If the browser doesn’t open or OAuth fails:- Check network: Ensure you can reach vendor’s OAuth servers
- Try again: Run the connect command again
- Check browser: Ensure default browser is working
- Firewall: Check if firewall is blocking OAuth redirect
Token Expired
If you see “expired” in status:Workspace Authentication Required
For Google Workspace accounts:Connection Shows But Agent Fails
Ifhappy connect status shows connected but agent fails:
View Full Error Details
Enable debug mode to see full error messages:Managing Connections
View from Mobile App
- Open Happy mobile app
- Go to Settings → API Connections
- See all connected vendors
- Revoke access if needed
Disconnect/Revoke
To revoke vendor access:- Open Happy mobile app
- Go to Settings → API Connections
- Tap the vendor
- Select “Revoke Access”
- Google: https://myaccount.google.com/permissions
- OpenAI: https://platform.openai.com/account/api-keys
- Anthropic: https://console.anthropic.com/settings/keys
Environment Variables
Override Happy server URL for token storage
Related Commands
- happy auth - Authenticate with Happy (required first)
- happy codex - Use OpenAI Codex agent
- happy gemini - Use Google Gemini agent
- happy doctor - Diagnostics and troubleshooting
API keys and OAuth tokens are stored securely in Happy cloud with end-to-end encryption. Only your authenticated machines can access them.