TalkCody

API Keys

Manage API keys for AI providers

API Keys Management

Configure API keys for AI providers to enable TalkCody's AI features. Securely store and manage credentials for multiple services.

Overview

TalkCody supports multiple AI providers, each requiring their own API key:

  • OpenAI - GPT models
  • Anthropic - Claude models
  • Google - Gemini models
  • OpenRouter - Multi-provider access
  • Alibaba Qwen - Qwen models
  • Zhipu AI - GLM models
  • Ollama - Local models (no key needed)

You need at least one API key configured to use TalkCody. Multiple keys allow you to use different models and providers.

Adding API Keys

Open Settings

  1. Launch TalkCody
  2. Open Settings (⌘ + , on Mac, Ctrl + , on Windows/Linux)
  3. Navigate to API Keys section

Select Provider

Choose the AI provider you want to configure:

  • Click + Add API Key
  • Select provider from dropdown

Enter API Key

  1. Paste your API key in the input field
  2. Optionally set a custom name (e.g., "Work OpenAI", "Personal Anthropic")
  3. Configure additional settings if needed

Test Connection

  1. Click Test Key to verify it works
  2. Check that the connection succeeds
  3. Save the configuration

Getting API Keys

OpenAI

  1. Visit platform.openai.com
  2. Sign up or log in
  3. Navigate to API Keys section
  4. Click Create new secret key
  5. Copy the key (you won't see it again)
  6. Add to TalkCody

API Key Format: sk-...

Pricing: Pay-as-you-go, based on tokens

  • GPT-4.1: ~$0.30-$1.20 per 1M tokens
  • Free tier: $5 credit for new accounts

Anthropic (Claude)

  1. Visit console.anthropic.com
  2. Create account or sign in
  3. Go to API Keys
  4. Generate new key
  5. Copy and add to TalkCody

API Key Format: sk-ant-...

Pricing: Pay-as-you-go

  • Claude 4.5 Sonnet: ~$3.00-$15.00 per 1M tokens
  • Free tier: Credits for new users

Google AI (Gemini)

  1. Visit aistudio.google.com
  2. Sign in with Google account
  3. Click Get API Key
  4. Create new API key
  5. Copy to TalkCody

API Key Format: AIza...

Pricing: Generous free tier

  • Free: 15 requests/minute, 1500 requests/day
  • Paid: From $0.35 per 1M tokens

OpenRouter

  1. Visit openrouter.ai
  2. Sign up or log in
  3. Go to API Keys
  4. Create new key
  5. Add to TalkCody

API Key Format: sk-or-v1-...

Benefits:

  • Access to 100+ models through one key
  • Some free models available
  • Unified billing
  • Fallback routing

Pricing: Varies by model

  • Free models: DeepSeek Chat, Gemini Flash
  • Paid: Route to any supported model

Alibaba Qwen

  1. Visit dashscope.aliyun.com
  2. Create account
  3. Get API key from console
  4. Add to TalkCody

API Key Format: sk-...

Pricing: Competitive rates for Qwen models

Zhipu AI (GLM)

  1. Visit open.bigmodel.cn
  2. Register account
  3. Navigate to API Keys
  4. Generate key
  5. Add to TalkCody

API Key Format: Varies

Pricing:

  • GLM-4.5 Air: Free tier available
  • Other models: Pay-as-you-go

Ollama (Local)

No API key needed!

  1. Install Ollama from ollama.com
  2. Download models: ollama pull llama2
  3. TalkCody auto-detects local Ollama
  4. Select Ollama models in model settings

Benefits:

  • Completely free
  • Full privacy
  • Works offline
  • No rate limits

Drawbacks:

  • Requires local compute resources
  • Smaller models, less capable
  • Slower than cloud APIs

Configuring API Keys

Basic Configuration

Required fields:

  • Provider: Which AI service
  • API Key: Your authentication credential

Optional fields:

  • Name: Custom identifier (e.g., "Work Account")
  • Base URL: Custom API endpoint (advanced)
  • Organization ID: For team accounts (OpenAI)

Advanced Configuration

Custom Base URLs

For OpenAI-compatible APIs or proxies:

Provider: OpenAI Compatible
API Key: your-key
Base URL: https://your-proxy.com/v1

Use cases:

  • Corporate proxies
  • Self-hosted models
  • Alternative providers
  • Regional endpoints

Request Headers

Add custom headers if needed:

{
  "X-Custom-Header": "value",
  "X-Organization": "org-id"
}

Timeout Settings

Configure request timeout (default: 120 seconds):

Timeout: 60000 (milliseconds)

Recommendations:

  • Fast models: 30-60 seconds
  • Complex queries: 120+ seconds
  • Streaming: 180+ seconds

Multiple Keys for Same Provider

You can configure multiple keys for one provider:

Example use cases:

  • Personal and work accounts
  • Different payment methods
  • Separate projects
  • Rate limit distribution
OpenAI (Personal) - sk-proj-personal...
OpenAI (Work) - sk-proj-work...

Select which key to use in model settings or per conversation.

Managing API Keys

Viewing Keys

In the API Keys settings:

  • See all configured providers
  • Check key status (active/inactive)
  • View last used timestamp
  • See usage statistics (if supported by provider)

Security: API keys are partially masked (e.g., sk-proj-***...abc123). Click "Show" to reveal full key.

Testing Keys

Test any configured key:

  1. Select the key
  2. Click Test Connection
  3. TalkCody makes a minimal API call
  4. Results show success or error

Common test failures:

  • Invalid key format
  • Key revoked or expired
  • Insufficient credits
  • Network issues
  • Rate limit exceeded

Updating Keys

To update an existing key:

  1. Select the key from list
  2. Click Edit
  3. Enter new API key
  4. Test and save

When to update:

  • Key rotation (security best practice)
  • Switching payment methods
  • Upgrading account tier

Deleting Keys

Remove keys you no longer need:

  1. Select key
  2. Click Delete
  3. Confirm deletion

Deleting a key doesn't delete past conversations that used it. They remain accessible but can't generate new responses with that key.

Security Best Practices

Key Storage

TalkCody stores API keys:

  • Encrypted on your local machine
  • Never transmitted except to the provider's API
  • Not backed up to cloud by default
  • OS-level security using native credential storage

Key Rotation

Rotate keys periodically:

  • Every 90 days for high-security environments
  • When team members leave
  • If key might be compromised
  • After major version updates

Access Control

Recommended practices:

  • Use separate keys for different projects
  • Limit key permissions at provider level
  • Monitor usage for anomalies
  • Set spending limits with providers

Environment Variables

For teams, use environment variables:

export OPENAI_API_KEY="sk-proj-..."
export ANTHROPIC_API_KEY="sk-ant-..."

TalkCody can read from environment variables (configure in settings).

Troubleshooting

"Invalid API Key" Error

Check:

  • Key is copied correctly (no extra spaces)
  • Key hasn't been revoked
  • Using correct provider
  • Key format matches provider

Fix:

  • Re-copy key from provider
  • Generate new key
  • Verify provider selection

"Quota Exceeded" Error

Meaning: You've hit rate or spending limits

Solutions:

  • Check provider dashboard for limits
  • Add payment method
  • Increase spending limits
  • Wait for quota reset
  • Use different model/provider

Connection Timeout

Causes:

  • Network issues
  • Provider outage
  • Firewall blocking requests

Solutions:

  • Check internet connection
  • Verify provider status page
  • Check firewall/proxy settings
  • Try different network

Key Works in Browser but Not TalkCody

Possible issues:

  • Firewall/proxy differences
  • TalkCody using wrong base URL
  • SSL certificate issues

Debug:

  • Check base URL setting
  • Temporarily disable firewall
  • Contact IT if on corporate network

Provider-Specific Tips

OpenAI

  • Organization ID: Add for team accounts
  • Project Keys: Use project-specific keys for better tracking
  • Rate Limits: Vary by account tier (free/pay-as-you-go/enterprise)

Anthropic

  • Workspaces: Can have multiple workspaces with separate keys
  • Claude Pro: Personal subscription doesn't provide API access
  • Rate Limits: Generous for paid accounts

Google AI

  • Free Tier: Very generous (1500 requests/day)
  • No Credit Card: Free tier doesn't require payment method
  • Quota: Refreshes daily

OpenRouter

  • Credits: Pre-purchase credits for better rates
  • Routing: Set preferences for model fallbacks
  • Free Models: Access free models even without credits

Monitoring Usage

In TalkCody

View usage statistics:

  • Settings → API Keys → Usage
  • See requests per provider
  • Approximate token counts
  • Estimated costs

Provider Dashboards

Check actual usage and billing:

Setting Budgets

At provider level:

  • Set monthly spending limits
  • Configure email alerts
  • Auto-stop when limit reached

In TalkCody (future feature):

  • Set per-key budgets
  • Track spending across providers
  • Alert on high usage

Next Steps

With API keys configured, you're ready to start using TalkCody's AI features!