Documentation Index
Fetch the complete documentation index at: https://cognis.vasanth.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Client::from_env() reads a small set of environment variables to pick a provider, a key, and a default model. There are also a handful of runtime variables that affect behavior at a lower level. None are required if you build clients explicitly via Client::builder().
Provider selection
| Variable | Required | Notes |
|---|---|---|
COGNIS_PROVIDER | yes (for from_env) | One of openai, anthropic, google, ollama, azure, openrouter. |
Per-provider credentials and defaults
Substitute<PROVIDER> with OPENAI, ANTHROPIC, GOOGLE, OLLAMA, AZURE, or OPENROUTER.
| Variable | Default | Notes |
|---|---|---|
COGNIS_<PROVIDER>_API_KEY | — | Provider key. Not needed for Ollama. |
COGNIS_<PROVIDER>_MODEL | provider default | Default model name. Override per call via ChatOptions::model. |
COGNIS_<PROVIDER>_BASE_URL | provider default | Override the API base. Useful for self-hosted or proxied backends. |
Azure-specific
| Variable | Notes |
|---|---|
COGNIS_AZURE_API_KEY | Azure OpenAI key. |
COGNIS_AZURE_ENDPOINT | E.g. https://your-resource.openai.azure.com. |
COGNIS_AZURE_DEPLOYMENT | The deployment name (your custom alias). |
COGNIS_AZURE_API_VERSION | E.g. 2024-08-06. |
COGNIS_AZURE_MODEL | Optional model name (Azure typically uses deployment names). |
Langfuse (cognis-trace, feature langfuse)
LangfuseExporter::from_env() and LangfuseConfig::from_env() read these. Not prefixed with COGNIS_ to match Langfuse’s conventions.
| Variable | Required | Notes |
|---|---|---|
LANGFUSE_PUBLIC_KEY | yes | pk-lf-... |
LANGFUSE_SECRET_KEY | yes | sk-lf-... |
LANGFUSE_HOST | optional | Defaults to https://cloud.langfuse.com. Override for self-hosted. |
Examples
Runtime variables
Cognis honors the standardtracing env vars for log filtering:
tracing-subscriber’s filter directives.
What about .env files?
Cognis does not read .env files. Plain .env on disk is a security footgun (they ship to backups, logs, and screen-sharing surfaces). Recommended setup on macOS / Linux: direnv + envchain so the same shell-loaded vars are picked up automatically. See Installation → Set credentials.
For CI: set the same variables in your runner’s secret store.
See also
Installation
The full credentials setup.
Models and providers
Builder shapes when env vars aren’t enough.