Stay updated — Join the build list for tutorials and AI insights. No spam.

Adding API Keys

Configure LLM API keys for full graph semantic extraction of markdown, docs PDFs, and images.

Adding API Keys

Configure LLM API keys to enable semantic extraction of markdown, documentation, PDFs, and images for the full graph.

🔑 Supported Providers

ProviderEnvironment VariableModel (default)Free Tier
Google GeminiGEMINI_API_KEY or GOOGLE_API_KEYgemini-1.5-flash60 req/min, 1M tokens/day
OpenAIOPENAI_API_KEYgpt-4o-mini$5 credit new accounts
AnthropicANTHROPIC_API_KEYclaude-3.5-sonnetNone
Moonshot (Kimi)MOONSHOT_API_KEYkimi-k2Generous
DeepSeekDEEPSEEK_API_KEYdeepseek-chatGenerous

⚙️ Configuration Methods

1# Add to ~/.bashrc, ~/.zshrc, or ~/.profile
2export GEMINI_API_KEY="your-api-key-here"
3
4# Reload
5source ~/.bashrc
6
7# Verify
8echo $GEMINI_API_KEY

Method 2: Project .env File (Per-Project)

1# In project root
2cat > .env << 'EOF'
3GEMINI_API_KEY=your-api-key-here
4EOF
5
6# Or use .env.local for secrets (gitignored)
7echo "GEMINI_API_KEY=your-api-key-here" > .env.local

Graphify auto-loads .env, .env.local, .env.*.local from project root.

Method 3: Per-Command (Temporary)

1GEMINI_API_KEY="your-key" graphify .
2GEMINI_API_KEY="your-key" graphify update .

Method 4: Graphify Config File

1# ~/.config/graphify/config.yaml
2llm:
3  provider: gemini
4  api_key_env: GEMINI_API_KEY
5  model: gemini-1.5-flash

🔐 Getting API Keys

  1. Go to Google AI Studio
  2. Sign in with Google account
  3. Click “Create API Key”
  4. Copy key (starts with AIza...)
1export GEMINI_API_KEY="AIza..."

OpenAI

  1. Go to OpenAI Platform
  2. Sign in / create account
  3. Click “Create new secret key”
  4. Copy key (starts with sk-...)
1export OPENAI_API_KEY="sk-..."

Anthropic

  1. Go to Anthropic Console
  2. Sign in / create account
  3. Click “Create Key”
  4. Copy key (starts with sk-ant-...)
1export ANTHROPIC_API_KEY="sk-ant-..."

✅ Verification

1# Test the key works
2graphify query "test connection" --backend=gemini --model=gemini-1.5-flash
3
4# Should return a response (uses 1 API call)
5
6# Or test with explicit provider
7graphify query "test" --backend=openai --model=gpt-4o-mini

🔄 Using with Full Graph

 1# 1. Set key (any method above)
 2export GEMINI_API_KEY="your-key"
 3
 4# 2. Build full graph
 5mkdir -p graphify-out && touch graphify-out/.graphify-activity
 6graphify .
 7
 8# 3. Query docs + code
 9graphify query "what does the youtube-content skill do?"
10
11# 4. Rebuild when docs change
12graphify update .

🚨 Troubleshooting

IssueSolution
no LLM API key foundCheck env var name: GEMINI_API_KEY (not GEMINI_KEY)
Invalid API keyRegenerate key; check no extra spaces/newlines
Quota exceededWait for reset; switch provider; use --code-only
Model not foundUse supported model name (see table above)
Rate limitedAdd delay; use --code-only for interim work

💡 Best Practices

  1. Use Gemini — Best free tier (1M tokens/day)
  2. Use .env.local — Gitignored, per-project, not committed
  3. Rotate keys periodically — Especially if committed accidentally
  4. Monitor usage — Check provider dashboard
  5. Fallback to code-only — When quota exhausted

Next Steps