Installation & Setup
Install and configure Struktur.
Install
npm install -g @struktur/clibun install -g @struktur/cliVerify:
struktur --helpConfigure a provider (required)
Store your API key securely with the CLI:
echo "$OPENAI_API_KEY" | struktur config providers add openai --token-stdinOn macOS, tokens are stored in Keychain. On other platforms, ~/.config/struktur/tokens.json (chmod 600).
Quick setup with --default
echo "$OPENAI_API_KEY" | struktur config providers add openai --token-stdin --defaultThe --default flag automatically queries the provider API and sets the cheapest available model as default. One command, fully ready.
Set a default model
# Set explicitly
struktur config models use openai/gpt-4o-mini
# Or store a shortcut alias first
struktur config models alias set fast openai/gpt-4.1-mini
struktur config models use fastOnce set, --model is optional in extract commands.
Environment variables
You can set provider API keys as environment variables. Use this method for CI/CD pipelines and Docker containers. Environment variables override stored tokens. For regular use, stored tokens are recommended.
Provider API keys
| Variable | Provider |
|---|---|
OPENAI_API_KEY | OpenAI |
ANTHROPIC_API_KEY | Anthropic |
GOOGLE_GENERATIVE_AI_API_KEY | |
OPENCODE_API_KEY | OpenCode |
OPENROUTER_API_KEY | OpenRouter |
Local providers
| Variable | Provider |
|---|---|
OLLAMA_BASE_URL | Ollama (default: http://localhost:11434/api) |
Custom endpoints
You can override the default API endpoint for OpenAI and Anthropic. Use custom endpoints for proxy servers and local models.
| Variable | Provider |
|---|---|
OPENAI_BASE_URL | OpenAI |
ANTHROPIC_BASE_URL | Anthropic |
Configuration
| Variable | Purpose |
|---|---|
STRUKTUR_CONFIG_DIR | Override the config directory (default: ~/.config/struktur) |
STRUKTUR_DISABLE_KEYCHAIN | Set to any value to force file-based token storage on macOS |
STRUKTUR_KEYCHAIN_SERVICE | Override the Keychain service name |
Debug and output
| Variable | Effect |
|---|---|
NO_COLOR | Set to any value to disable colored output |
CI | Set to any value to disable colored output (same effect as NO_COLOR) |
DEBUG | Set to any value to show debug messages |
AI_SDK_LOG_WARNINGS | Set to true to show AI SDK warnings |