libs/ needs a provider API key, and all of them resolve keys the same
way. This page covers the resolution order, the two ways to supply credentials, and how
keys reach functions running on Modal.
Two ways to provide keys
- API-key flags work without any vault. Commands that call a provider accept an
override flag (
--exa-api-key,--attio-api-key,--apollo-api-key, …) that is forwarded to the deployed Modal function for that single invocation. - Infisical is the zero-flags path: the CLI ships your Infisical bootstrap credentials to the Modal function, which fetches the keys it needs at entry.
Key resolution inside libs/
Each adapter’s client resolves its key in a fixed order, documented in the client module
(for example libs/exa/client.py):
- An explicit
api_key=argument — used by tests and one-off scripts. - The contextvar bound by
api_key_scope(...)— opened by webhook handlers and Modal functions after fetching the key from Infisical. - The adapter’s environment variable (for example
EXA_API_KEY) — the fallback for plain-environment setups.
The contextvar scope exists for concurrency: multiple Modal inputs can run in the same
container, and a contextvar keeps keys from leaking between requests. Prefer
api_key_scope over mutating os.environ in long-lived processes.The .env.local bootstrap (Infisical)
.env.local holds only the credentials that get you into the vault — every provider
secret lives in Infisical itself, never in the file:
There is no
.infisical.json in the repo, so the infisical CLI does not auto-detect
the project — always pass --projectId, --token, and --env explicitly, as shown in
every example on this site.
Keys at runtime on Modal
Keyed CLI commands do not call providers from your laptop — they invoke functions deployed on Modal (see the CLI contract). Keys reach those functions through a bootstrap pattern insrc/secrets_bootstrap.py:
- Each function is declared with
@with_secrets("<X>_API_KEY")andsecrets=[bootstrap_secret()]. bootstrap_secret()captures yourINFISICAL_*credentials from the deploy-time shell and ships them to Modal as a server-side secret — they never appear in image layers or build logs.- At function entry, the wrapper fetches each declared key from Infisical and opens the
matching
api_key_scopefor the duration of the call.
KEY_SCOPES in src/secrets_bootstrap.py:
APOLLO_API_KEY, ATTIO_API_KEY, CALCOM_API_KEY, EXA_API_KEY, LINEAR_API_KEY,
PARALLEL_API_KEY, and SLACK_BOT_TOKEN.
Environment variable reference
Provider keys, one per adapter:
Telemetry has its own set of producer- and collector-side variables — see the
telemetry overview.