Skip to main content

Overview

Dakora uses two types of API keys:
  1. Dakora API Keys - Authenticate SDK requests to your project
  2. LLM Provider Keys - Execute prompts with AI models (OpenAI, Anthropic, etc.)

Dakora API Keys

Dakora API keys authenticate your SDK requests and scope them to a specific project.

Creating an API Key

  1. Sign in to app.dakora.io
  2. Navigate to Settings > API Keys
  3. Click Create API Key
  4. Give it a descriptive name (e.g., “Production Server”, “CI Pipeline”)
  5. Copy the key immediately - it’s only shown once
Create API Key dialog
Store your API key securely. If you lose it, you’ll need to create a new one.

Key Format

Dakora API keys use the prefix dkr_:
dkr_abc123xyz789...

Using the Key

Set the key as an environment variable:
export DAKORA_API_KEY="dkr_your_api_key_here"
The SDK automatically reads this variable:
from dakora import Dakora

client = Dakora()  # Uses DAKORA_API_KEY from environment
Or pass it explicitly:
client = Dakora(api_key="dkr_your_api_key_here")

Managing Keys

View and revoke keys in Settings > API Keys:
API Keys management page
  • Each project can have up to 10 API keys
  • Keys can be revoked at any time
  • Revoked keys stop working immediately

LLM Provider Keys

To execute prompts against AI models, configure your provider API keys.

Supported Providers

ProviderEnvironment VariableModels
OpenAIOPENAI_API_KEYgpt-4o, gpt-4, gpt-3.5-turbo
AnthropicANTHROPIC_API_KEYclaude-3-opus, claude-3-sonnet
GoogleGOOGLE_API_KEYgemini-pro, gemini-1.5-pro
Azure OpenAIAZURE_API_KEYazure/gpt-4, azure/gpt-35-turbo

Setting Provider Keys

Add to your environment or .env file:
# .env file
DAKORA_API_KEY="dkr_..."
OPENAI_API_KEY="sk-..."
ANTHROPIC_API_KEY="sk-ant-..."
Load with python-dotenv:
from dotenv import load_dotenv
load_dotenv()

from dakora import Dakora
client = Dakora()
Add .env to your .gitignore to avoid committing secrets.

Security Best Practices

Never hardcode API keys in your source code.
echo ".env" >> .gitignore
Create different keys for dev, staging, and production.
Rotate keys periodically and revoke old ones.
Check the Dakora dashboard for unusual activity.

Troubleshooting

Error: 401 UnauthorizedSolutions:
  • Verify your DAKORA_API_KEY is set correctly
  • Check the key hasn’t been revoked
  • Ensure the key belongs to the correct project
Error: API key not found for providerSolutions:
  • Check the environment variable name matches the provider
  • Restart your terminal after setting variables
  • Verify with echo $OPENAI_API_KEY
Solutions:
  • Install python-dotenv: pip install python-dotenv
  • Call load_dotenv() before importing Dakora
  • Ensure .env is in your working directory

Next Steps

Quick Start

Get up and running with Dakora

SDK Reference

Explore SDK methods