docs/3-USER-GUIDE/api-configuration.md
Configure AI provider credentials through the Settings UI. No file editing required.
Credential System: Open Notebook uses encrypted credentials stored in the database. Each credential connects to a provider and allows you to discover, register, and test models.
Open Notebook manages AI provider access through a credential-based system:
Before storing credentials, you must configure an encryption key.
Add OPEN_NOTEBOOK_ENCRYPTION_KEY to your docker-compose.yml:
environment:
- OPEN_NOTEBOOK_ENCRYPTION_KEY=my-secret-passphrase
Any string works as a key — it will be securely derived via SHA-256 internally.
Warning: If you change or lose the encryption key, all stored credentials become unreadable. Back up your encryption key securely and separately from your database backups.
Both password and encryption key support Docker secrets:
# docker-compose.yml
services:
open_notebook:
environment:
- OPEN_NOTEBOOK_PASSWORD_FILE=/run/secrets/app_password
- OPEN_NOTEBOOK_ENCRYPTION_KEY_FILE=/run/secrets/encryption_key
secrets:
- app_password
- encryption_key
secrets:
app_password:
file: ./secrets/password.txt
encryption_key:
file: ./secrets/encryption_key.txt
API keys stored in the database are encrypted using Fernet (AES-128-CBC + HMAC-SHA256).
| Configuration | Behavior |
|---|---|
| Encryption key set | Keys encrypted with your key |
| No encryption key set | Storing credentials is disabled |
Navigation: Settings → API Keys
| Provider | Required Fields | Optional Fields |
|---|---|---|
| OpenAI | API Key | — |
| Anthropic | API Key | — |
| Google Gemini | API Key | — |
| Groq | API Key | — |
| Mistral | API Key | — |
| DeepSeek | API Key | — |
| xAI | API Key | — |
| OpenRouter | API Key | — |
| Voyage AI | API Key | — |
| ElevenLabs | API Key | — |
| Provider | Required Fields | Notes |
|---|---|---|
| Ollama | Base URL | Typically http://localhost:11434 or http://ollama:11434 |
| Provider | Required Fields | Optional Fields |
|---|---|---|
| Azure OpenAI | API Key, URL Base (Azure endpoint) | Service-specific endpoints (LLM, Embedding, STT, TTS) |
| OpenAI-Compatible | Base URL | API Key, Service-specific configs |
| Vertex AI | Project ID, Location, Credentials Path | — |
| Result | Meaning |
|---|---|
| Success | Key is valid, provider accessible |
| Invalid API key | Check key format and value |
| Connection failed | Check URL, network, firewall |
Each provider can have multiple credentials. This is useful when:
When you register models from a credential, those models are linked to that specific credential. This means:
Click Test Connection to verify your credential:
| Result | Meaning |
|---|---|
| Success | Key is valid, provider accessible |
| Invalid API key | Check key format and value |
| Connection failed | Check URL, network, firewall |
| Model not available | Key valid but model access restricted |
Test uses inexpensive models (e.g., gpt-3.5-turbo, claude-3-haiku) to minimize cost.
For OpenAI, Anthropic, Google, Groq, Mistral, DeepSeek, xAI, OpenRouter:
http://ollama:11434)Ollama allows localhost and private IPs since it runs locally.
https://myresource.openai.azure.com)The URL Base field is automatically mapped to the Azure endpoint. The API version defaults to 2024-10-21 if not set via environment variable.
For custom OpenAI-compatible servers (LM Studio, vLLM, etc.):
Supports separate configurations for:
Google Cloud's enterprise AI platform:
| Field | Example |
|---|---|
| Project ID | my-gcp-project |
| Location | us-central1 |
| Credentials Path | /path/to/service-account.json |
If you have existing API keys in environment variables (from a previous version):
| Scenario | Action |
|---|---|
| Key in env only | Migrated to database |
| Key in database only | No change |
| Key in both | Database version kept (skipped) |
OPEN_NOTEBOOK_ENCRYPTION_KEY — it's still requiredThe migration banner only appears when:
If you're upgrading from an older version that used the ProviderConfig system:
API keys stored in the database are encrypted using Fernet (AES-128-CBC + HMAC-SHA256).
| Configuration | Behavior |
|---|---|
| Encryption key set | Keys encrypted with your key |
| No encryption key set | Storing API keys in database is disabled |
| Setting | Default Value | Production Recommendation |
|---|---|---|
| Password | open-notebook-change-me | Set OPEN_NOTEBOOK_PASSWORD |
| Encryption Key | None (must be set) | Set OPEN_NOTEBOOK_ENCRYPTION_KEY to any secret string |
For production deployments, always set custom credentials.
| Symptom | Cause | Solution |
|---|---|---|
| Save button disabled | Empty or invalid input | Enter a valid key |
| Error on save | Encryption key not set | Set OPEN_NOTEBOOK_ENCRYPTION_KEY in docker-compose.yml |
| Error on save | Database connection issue | Check database status |
| Error | Cause | Solution |
|---|---|---|
| Invalid API key | Wrong key or format | Verify key from provider dashboard |
| Connection refused | Wrong URL | Check base URL format |
| Timeout | Network issue | Check firewall, proxy settings |
| 403 Forbidden | IP restriction | Whitelist your server IP |
| Problem | Solution |
|---|---|
| No migration banner | No env vars detected, or already migrated |
| Partial migration | Check error list, fix and retry |
| Keys not working after migration | Clear browser cache, restart services |
sk-proj- (project keys) or sk- (legacy)sk-ant-AIzaSyhttp://localhost:11434 (local) or http://ollama:11434 (Docker)https://{resource-name}.openai.azure.com)2024-10-21; override via AZURE_OPENAI_API_VERSION environment variable if needed