> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognee.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

> Configure the @cognee/cognee-ts SDK through constructor settings, the c.config setters, and environment variables.

Settings resolve in three layers: compiled-in defaults, environment variables,
and anything you pass to the `Cognee` constructor or change later through
`c.config`. Constructor and `c.config` values win over the environment.

## Constructor

```ts theme={null}
const c = new Cognee(settings?)
```

`settings` is an optional object (or JSON string) that overrides env-derived
defaults. Keys are the canonical Settings field names (`llmModel`,
`embeddingProvider`, `vectorDbProvider`, etc.). Absent keys keep their
env-variable or compiled-in default.

## Config

Use `c.config` to change settings after construction. Granular setters are
synchronous and take effect immediately (the engines are lazily rebuilt on the
next pipeline call).

```ts theme={null}
c.config.setLlmModel("gpt-5");
c.config.setLlmApiKey(process.env.OPENAI_TOKEN!);
c.config.setEmbeddingProvider("openai");
c.config.setEmbeddingModel("text-embedding-3-small");

// Bulk setters (throw on unknown key or type mismatch) — one per subsystem:
c.config.setLlmConfig({ model: "gpt-5", temperature: 0.2 });
c.config.setEmbeddingConfig({ provider: "openai", model: "text-embedding-3-small" });
c.config.setVectorDbConfig({ provider: "brute-force" });
c.config.setGraphDbConfig({ provider: "kuzu" });

// Generic key-value setter:
c.config.set("llmModel", "gpt-5-mini");

// Read back the current config (secret fields are redacted):
const cfg = c.config.get();
console.log(cfg);
```

## Environment variables

| Variable                                                     | Purpose                                                             |
| ------------------------------------------------------------ | ------------------------------------------------------------------- |
| `OPENAI_URL`                                                 | LLM API base URL (OpenAI-compatible endpoint).                      |
| `OPENAI_TOKEN`                                               | LLM API key.                                                        |
| `OPENAI_MODEL`                                               | LLM model name (default: `gpt-4o-mini`).                            |
| `EMBEDDING_PROVIDER`                                         | Embedding provider: `openai`, `ollama`, `onnx`, `mock`.             |
| `EMBEDDING_MODEL`                                            | Embedding model name.                                               |
| `EMBEDDING_DIMENSIONS`                                       | Embedding vector dimensions.                                        |
| `EMBEDDING_ENDPOINT`                                         | Embedding API base URL (falls back to `OPENAI_URL`).                |
| `EMBEDDING_API_KEY`                                          | Embedding API key (falls back to `OPENAI_TOKEN`).                   |
| `MOCK_EMBEDDING`                                             | Set `true` to use zero-vector mock embeddings (no model download).  |
| `COGNEE_BINDING_SUPPRESS_LOGS`                               | Suppress the auto-installed stderr fmt subscriber.                  |
| `COGNEE_HOST_SDK`                                            | Suppress binding-armed analytics when the host is an embedding SDK. |
| `TELEMETRY_DISABLED`, `ENV`                                  | Standard analytics opt-outs for `setupTelemetryAnalytics()`.        |
| `RUST_LOG`, `LOG_LEVEL`                                      | `tracing-subscriber` env-filter level overrides.                    |
| `COGNEE_LOG_*`, `LOG_FILE_NAME`                              | Consumed by `setupLogging()`.                                       |
| `OTEL_EXPORTER_OTLP_ENDPOINT`, `OTEL_SERVICE_NAME`, `OTEL_*` | Consumed by `setupTelemetry()`.                                     |

The logging and telemetry variables are read by the setup functions described in
[Runtime and Observability](/typescript/runtime).
