Overview
Theauth command manages authentication with AI providers, supporting both OAuth flows and direct token authentication. It handles login, logout, status checking, and model listing for OAuth providers.
Usage
Subcommands
login
Authenticate with a provider using OAuth or token.Flags
Provider to authenticate with.Supported providers:
openai- OpenAI (OAuth or token)anthropic- Anthropic (token only)google-antigravity(orantigravity) - Google Cloud Code Assist (OAuth)
Use device code flow for OAuth (for headless/SSH environments).Only applicable for OAuth providers (OpenAI, Google Antigravity).
logout
Remove stored credentials for one or all providers.Flags
Provider to logout from. If omitted, logs out from all providers.
status
Show authentication status for all providers.- Authenticated providers
- Authentication method (oauth/token)
- Status (active/expired/needs refresh)
- Account details (email, account ID, project)
- Expiration times
models
Show available models for Google Antigravity.- Model ID
- Display name
- Quota status
Provider-Specific Flows
OpenAI (OAuth)
- Opens browser for OAuth authentication
- Log in with OpenAI account
- Grant permissions
- Credentials stored automatically
- Config updated to use OAuth
- Default model set to
gpt-5.2
Anthropic (Token)
- Prompts for API key
- You paste your Anthropic API key
- Credentials stored securely
- Config updated
- Default model set to
claude-sonnet-4.6
Google Antigravity (OAuth)
- Opens browser for Google OAuth
- Select Google account
- Grant Cloud Code Assist permissions
- Fetches project ID automatically
- Stores credentials
- Config updated
- Default model set to
gemini-flash
- Google Cloud project with Code Assist enabled
- Billing enabled (free tier available)
Examples
Login to OpenAI
Login to Anthropic with Token
Login to Google Antigravity
Headless Server Login
For SSH sessions without browser access:Check Authentication Status
List Available Models (Antigravity)
Logout from Specific Provider
Logout from All Providers
Authentication Storage
Credentials are stored securely in:- OAuth access tokens and refresh tokens
- Pasted API tokens
- Expiration times
- Account metadata
- File permissions are set to
0600(user read/write only) - Tokens are stored in plaintext (secure file permissions)
- Refresh tokens enable automatic token renewal
- OAuth tokens expire and are automatically refreshed
OAuth Token Lifecycle
Active
Token is valid and ready to use.Needs Refresh
Token is expiring soon. PicoClaw will automatically refresh it on next use.Expired
Token has expired. Need to re-authenticate:Automatic Refresh
OAuth tokens are automatically refreshed when:- Token expires within refresh window
- Refresh token is available
- Next API call is made
Configuration Updates
When logging in,config.yaml is automatically updated:
OpenAI Login
Anthropic Login
Troubleshooting
Browser Won’t Open
Problem: OAuth browser window doesn’t open Solution: Use device code flow:OAuth Permission Denied
Problem: “Access denied” during OAuth flow Solution:- Check you’re using the correct Google/OpenAI account
- Ensure account has necessary permissions
- For Antigravity, verify Cloud Code Assist is enabled
Token Invalid
Problem: “Invalid credentials” error Solution: Re-login:Expired OAuth Token
Problem: “Token expired” error Check status:Cannot Fetch Models
Problem:picoclaw auth models fails
Solution:
- Verify logged in:
picoclaw auth status - Check project has Code Assist enabled
- Verify billing is enabled
- Re-login if token expired
Config Not Updated
Problem: Login succeeds but config unchanged Solution: Check file permissions:Manual Token Configuration
Alternatively, you can manually add API keys toconfig.yaml:
Provider Comparison
| Provider | Auth Method | Browser Required | Headless Support | Auto-Refresh |
|---|---|---|---|---|
| OpenAI | OAuth | Yes (or device code) | Yes (device code) | Yes |
| Anthropic | Token | No | Yes | N/A |
| Google Antigravity | OAuth | Yes | No | Yes |
Security Best Practices
-
Logout When Done: On shared machines, logout after use
-
Protect Auth File: Ensure proper permissions
-
Rotate Tokens: Periodically re-authenticate
-
Monitor Usage: Check auth status regularly
Exit Codes
0: Success1: Error (invalid provider, authentication failed, network error)
See Also
- picoclaw status - Check authentication status
- picoclaw onboard - Initial setup
- Provider Configuration - Provider-specific setup guides
- OpenAI OAuth Setup
- Anthropic API Keys
- Google Cloud Code Assist