Celeste AICeleste AI
Guides

Authentication

Configure API keys and OAuth for Celeste providers.

Authentication

Celeste supports two authentication methods: API keys for most providers, and OAuth for Google Cloud APIs.

API Keys (Most Providers)

Environment Variables

Set your API key as an environment variable:

export OPENAI_API_KEY="sk-..."

Or use a .env file:

.env
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-...

Provider Reference

ProviderEnvironment Variable
OpenAIOPENAI_API_KEY
AnthropicANTHROPIC_API_KEY
Google (Gemini)GOOGLE_API_KEY
MistralMISTRAL_API_KEY
CohereCOHERE_API_KEY
ElevenLabsELEVENLABS_API_KEY
GroqGROQ_API_KEY
BFLBFL_API_KEY
DeepSeekDEEPSEEK_API_KEY
xAIXAI_API_KEY

Google Cloud (OAuth)

Google Cloud APIs (like Cloud TTS with Gemini voices) require OAuth authentication instead of API keys.

Setup

  1. Install the gcloud CLI

  2. Login with Application Default Credentials:

gcloud auth application-default login
  1. Set your project (for billing/quota):
gcloud config set project YOUR_PROJECT_ID

Usage

import celeste

# No API key needed - uses OAuth automatically
response = await celeste.audio.speak(
    model="gemini-2.5-flash-tts",
    provider="google",
    text="Hello from Google Cloud",
)

Troubleshooting

ErrorSolution
RefreshError: Reauthentication is neededRun gcloud auth application-default login
Quota/project errorsRun gcloud config set project YOUR_PROJECT_ID

Explicit Authentication

Override environment variables by passing api_key directly:

import celeste

response = await celeste.text.generate(
    model="gpt-4o",
    api_key="sk-...",
    prompt="Hello",
)

Advanced: custom auth headers

For custom headers, use create_client with the auth parameter:

import celeste
from celeste import APIKey

client = celeste.create_client(
    modality="text",
    auth=APIKey(
        key="sk-...",
        header="X-Custom-Header",
    ),
)