Authentication
RestFlow supports multiple authentication providers for AI services. This guide covers how to configure and manage authentication profiles.
Providers
Section titled “Providers”| Provider | Description | Token Format | Use Case |
|---|---|---|---|
claude-code | Claude Code CLI OAuth | sk-ant-oat01-... | restflow claude command |
anthropic | Anthropic API | sk-ant-api03-... | Direct API calls |
openai | OpenAI API | sk-... | OpenAI models |
google | Google Gemini API | API key | Gemini models |
Commands
Section titled “Commands”List Profiles
Section titled “List Profiles”restflow auth listExample output:
+----------+-------------------+------------+-------------+---------+-----------+| ID | Name | Provider | Source | Health | Available |+===============================================================================+| 207a9150 | Claude Code OAuth | ClaudeCode | Manual | Healthy | yes || ff2717f1 | $OPENAI_API_KEY | OpenAI | Environment | Unknown | yes |+----------+-------------------+------------+-------------+---------+-----------+Add Profile
Section titled “Add Profile”restflow auth add --provider <PROVIDER> --key <KEY> [--name <NAME>]Options:
| Option | Description | Required |
|---|---|---|
--provider | Provider type (see table above) | Yes |
--key | API key or OAuth token | Yes |
--name | Display name for the profile | No |
Show Profile
Section titled “Show Profile”restflow auth show <ID>Remove Profile
Section titled “Remove Profile”restflow auth remove <ID>Check Status
Section titled “Check Status”restflow auth statusDiscover Credentials
Section titled “Discover Credentials”Automatically discover credentials from environment variables and other sources:
restflow auth discoverSetting Up Claude Code
Section titled “Setting Up Claude Code”Step 1: Get OAuth Token
Section titled “Step 1: Get OAuth Token”Run the Claude Code setup command to generate an OAuth token:
claude setup-tokenThis will:
- Open your browser for authentication
- Generate a long-lived OAuth token (valid for 1 year)
- Display the token:
sk-ant-oat01-...
Step 2: Add to RestFlow
Section titled “Step 2: Add to RestFlow”restflow auth add \ --provider claude-code \ --key "sk-ant-oat01-YOUR_TOKEN_HERE" \ --name "My Claude Code"Step 3: Verify
Section titled “Step 3: Verify”# Check profile is availablerestflow auth list
# Test with claude commandrestflow claude -p "Say hello"Setting Up Anthropic API
Section titled “Setting Up Anthropic API”For direct API access (not Claude Code CLI):
restflow auth add \ --provider anthropic \ --key "sk-ant-api03-YOUR_API_KEY" \ --name "My Anthropic API"Setting Up OpenAI
Section titled “Setting Up OpenAI”restflow auth add \ --provider openai \ --key "sk-YOUR_OPENAI_KEY" \ --name "My OpenAI"Or set via environment variable (auto-discovered):
export OPENAI_API_KEY="sk-YOUR_OPENAI_KEY"restflow auth discoverEnvironment Variables
Section titled “Environment Variables”RestFlow automatically discovers credentials from these environment variables:
| Variable | Provider |
|---|---|
OPENAI_API_KEY | OpenAI |
ANTHROPIC_API_KEY | Anthropic |
GOOGLE_API_KEY |
Profile Health
Section titled “Profile Health”Profiles track health status for automatic failover:
| Status | Description |
|---|---|
Healthy | Working correctly |
Unknown | Not yet tested |
Cooldown | Temporarily unavailable (rate limited) |
Disabled | Permanently disabled |
Troubleshooting
Section titled “Troubleshooting””No available ClaudeCode auth profile found”
Section titled “”No available ClaudeCode auth profile found””You need to add a Claude Code profile:
# First, get a tokenclaude setup-token
# Then add it to RestFlowrestflow auth add --provider claude-code --key "sk-ant-oat01-..." --name "Claude Code"“Invalid API key”
Section titled ““Invalid API key””Make sure you’re using the correct token type:
- Claude Code CLI: Use
sk-ant-oat01-...(OAuth token) with--provider claude-code - Anthropic API: Use
sk-ant-api03-...(API key) with--provider anthropic
Profile Not Available
Section titled “Profile Not Available”Check profile status:
restflow auth show <ID>If in cooldown, wait for the cooldown period to expire, or manually enable:
# The profile may need to be re-added if disabledrestflow auth remove <ID>restflow auth add --provider ... --key ...