Skip to content

Provider Key Management ​

AgentGazer supports two authentication methods for LLM providers:

  • API Key — Traditional API key authentication (most providers)
  • OAuth — Browser-based login for subscription services (OpenAI Codex, Zhipu Coding Plan)

Supported Providers ​

ProviderAuth MethodEndpoint
OpenAIAPI Keyapi.openai.com
OpenAI CodexOAuthapi.openai.com
AnthropicAPI Keyapi.anthropic.com
Google (Gemini)API Keygenerativelanguage.googleapis.com
MistralAPI Keyapi.mistral.ai
CohereAPI Keyapi.cohere.com
DeepSeekAPI Keyapi.deepseek.com
MoonshotAPI Keyapi.moonshot.cn
Zhipu (GLM-4)API Keyapi.z.ai
Zhipu Coding PlanOAuthapi.z.ai
MiniMaxAPI Keyapi.minimax.chat
MiniMax Coding PlanOAuthapi.minimax.chat
BaichuanAPI Keyapi.baichuan-ai.com
YiAPI Keyapi.lingyiwanwu.com

OAuth Authentication ​

For subscription-based providers (OpenAI Codex, Zhipu Coding Plan), use OAuth login:

bash
# Login via browser (recommended)
agentgazer login openai-oauth

# Or use device code flow (for headless servers)
agentgazer login openai-oauth --device

# Check login status
agentgazer providers list

# Logout
agentgazer logout openai-oauth

How OAuth Works ​

  1. Browser Flow: Opens your browser to the provider's login page
  2. PKCE Security: Uses Proof Key for Code Exchange for secure token retrieval
  3. Auto Refresh: Tokens are automatically refreshed before expiry
  4. Secure Storage: OAuth tokens stored in the same secure keystore as API keys

Available OAuth Providers ​

ProviderCommandDescription
OpenAI Codexagentgazer login openai-oauthOpenAI subscription (ChatGPT Plus/Pro)
Zhipu Coding Planagentgazer login zhipu-coding-planZhipu GLM subscription
MiniMax Coding Planagentgazer login minimax-oauthMiniMax subscription service

OS-Level Secure Storage ​

Provider API keys are never stored in plaintext. AgentGazer uses OS-level secure storage backends:

PlatformStorage BackendSecurity
macOSKeychainHardware-backed encryption via Secure Enclave
Linux (desktop)libsecret / GNOME KeyringSession-locked encryption
Linux (headless)AES-256-GCM encrypted fileMachine-specific key derivation

Keys are encrypted at rest and only decrypted in memory when needed for API calls.

Storage and Management ​

bash
# Store OpenAI API Key (securely encrypted)
agentgazer providers set openai sk-xxxxxxxxxxxxx

# Store Anthropic API Key
agentgazer providers set anthropic sk-ant-xxxxxxxxxxxxx

# List configured Providers
agentgazer providers list

# Remove a Provider
agentgazer providers remove openai

Keystore Backends ​

AgentGazer supports multiple keystore backends, automatically detected in the following priority order:

PriorityBackendDescription
1macOS KeychainAutomatically used on macOS with a GUI session
2Linux libsecretAutomatically used on Linux desktop
3MachineKeyStore (default)AES-256-GCM encryption based on machine-id + username

Manual Backend Override ​

To override auto-detection, set the environment variable:

bash
export AGENTGAZER_SECRET_BACKEND=machine

Valid values:

  • keychain — Force macOS Keychain
  • libsecret — Force Linux libsecret
  • machine — Force AES-256-GCM encrypted file

Automatic Migration ​

If legacy plaintext API keys exist in config.json, AgentGazer will automatically migrate them to the encrypted keystore on startup.

Secure Injection Mechanism ​

When the Proxy forwards requests, it only injects API keys when the hostname matches a known Provider. This prevents key leakage to unknown third-party services.