auth command manages API tokens for AI providers and sets default models for extraction. Tokens are stored securely in macOS Keychain (when available) or in ~/.config/struktur/tokens.json with strict file permissions.
Subcommands
auth set
Store an API token for a provider.Provider name:
openai, anthropic, google, opencode, or openrouterAPI token value (prefer
--token-stdin for security)Read token from stdin to avoid shell history
Storage backend:
auto, keychain, or file. Auto uses macOS Keychain when available, otherwise falls back to file.Set the cheapest model from this provider as the default
auth default
Set the default model for extraction.Provider name (positional). Sets the cheapest model from this provider as default.
Explicit model identifier in format
provider/modelauth get
Retrieve a stored token (masked by default).Provider name
Print full token without masking
auth delete
Remove a stored token.Provider name
auth list
List all stored providers.Supported providers
openai- OpenAI (GPT models)anthropic- Anthropic (Claude models)google- Google Generative AI (Gemini models)opencode- OpenCode Zen (multi-provider)openrouter- OpenRouter (multi-provider)
Storage backends
macOS Keychain
On macOS, tokens are stored in the system Keychain by default:- Service:
struktur(or$STRUKTUR_KEYCHAIN_SERVICE) - Account: provider name
- Requires
/usr/bin/securitybinary
File storage
Tokens are stored at~/.config/struktur/tokens.json with:
- Directory permissions:
0700 - File permissions:
0600
Environment variables
Override config directory (default:
~/.config/struktur)Force file storage even on macOS
macOS Keychain service name
Token precedence
- Stored tokens (via
auth set) - Environment variables (
OPENAI_API_KEY, etc.)