api_key = os.getenv("LIVEKIT_API_KEY") api_sec...
# ask-ai
n
api_key = os.getenv("LIVEKIT_API_KEY") api_secret = os.getenv("LIVEKIT_API_SECRET") I have 3 api keys in my cloud account. Does this pick any one of them at random?
t
Thanks for reaching out, Hari. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding to your question about whether those lines pick one of your three account API keys at random. No —
os.getenv("LIVEKIT_API_KEY")
(and
LIVEKIT_API_SECRET
) return the single value set in your runtime environment. If you have three API keys in your LiveKit Cloud account, your app will use whichever key pair you have assigned to those environment variables — not a random one. If you want to use a different key, set `LIVEKIT_API_KEY`/`LIVEKIT_API_SECRET` to that key pair in your environment (or use a secret manager to inject the desired pair per environment). Sources: Custom agent deployments | LiveKit docs
n
which file contains the secrets while deploying
t
You're asking which file contains the secrets when deploying. That depends on how you deploy. Common options: • For local development:
.env
or
.env.local
typically hold
LIVEKIT_API_KEY
and
LIVEKIT_API_SECRET
. • With LiveKit CLI deployments: secrets are provided via the CLI flags (
--secrets-file
,
--secrets
, or
--secret-mount
) and uploaded/managed remotely — not baked into the image. • Docker: a
.env
referenced by
docker-compose
or Docker build args (but do not include
.env
in the image; add it to
.dockerignore
). • Kubernetes: secrets live in a Kubernetes Secret (often defined in a YAML
Secret
manifest) and mounted as env vars or files. • Helm: values containing secret references (ideally using external secret management) or templates that reference Kubernetes Secrets. Note:
livekit.toml
does not contain secrets; LiveKit Cloud may automatically inject
LIVEKIT_API_KEY
,
LIVEKIT_API_SECRET
, and
LIVEKIT_URL
at runtime. Which deployment method are you using (LiveKit Cloud, LiveKit CLI, Docker, Kubernetes, or something else)? I’ll give exact file/manifest examples for that setup. Sources: Custom agent deployments | LiveKit docs | Server-side | livekit/livekit_composite | DeepWiki | Agents (Python) | livekit/livekit_composite | DeepWiki | Deploying to production | LiveKit Docs | server-sdk-go | livekit/livekit_composite | DeepWiki