cognee.config
Static class for configuring Cognee’s runtime settings. All setters persist for the duration of the process (or until overridden).Configuration Types
LLM Configuration
LLM Configuration
set_llm_config() keys must match the internal attribute names on LLMConfig. The exact internal attributes name are displayed in the table below.Internal LLM Configuration attributes
Internal LLM Configuration attributes
| Key | Type | Default | Description |
|---|---|---|---|
llm_provider | str | "openai" | Provider: "openai", "anthropic", "ollama", "gemini", "mistral", "bedrock", "azure", "custom" |
llm_model | str | "openai/gpt-5-mini" | Model identifier |
llm_api_key | str | None | API key for the provider |
llm_endpoint | str | "" | Custom endpoint URL (required for Ollama, vLLM, etc.) |
llm_api_version | str | None | API version (required for Azure) |
llm_temperature | float | 0.0 | Response temperature (0.0–2.0) |
llm_streaming | bool | False | Enable streaming responses |
llm_max_completion_tokens | int | 16384 | Maximum tokens in the response |
llm_args | dict | {} | Arbitrary provider-specific kwargs merged into every LLM call. Set as a JSON string in .env (e.g. LLM_ARGS='{"top_p": 0.9}'). |
llm_rate_limit_enabled | bool | False | Enable client-side rate limiting for LLM calls |
llm_rate_limit_requests | int | 60 | Max LLM requests allowed per interval |
llm_rate_limit_interval | int | 60 | Duration of the rate limit window in seconds |
llm_rate_limit_tokens | int | 0 | Max tokens per interval (0 = disabled) |
Embedding Configuration
Embedding Configuration
Internal Embedding Configuration attributes
Internal Embedding Configuration attributes
| Key | Type | Default | Description |
|---|---|---|---|
embedding_provider | str | "openai" | Provider: "openai", "ollama", "fastembed", "gemini", "mistral", "bedrock", "custom" |
embedding_model | str | "openai/text-embedding-3-large" | Model identifier |
embedding_dimensions | int | 3072 | Vector dimension size (must match your vector store) |
embedding_api_key | str | None | API key (falls back to LLM_API_KEY if unset) |
embedding_endpoint | str | None | Custom endpoint URL |
embedding_api_version | str | None | API version |
embedding_max_completion_tokens | int | 8191 | Maximum tokens for embedding input |
embedding_batch_size | int | 36 | Batch size for embedding requests |
huggingface_tokenizer | str | None | HuggingFace Hub model ID for token counting with Ollama |
embedding_rate_limit_enabled | bool | False | Enable client-side rate limiting for embedding calls |
embedding_rate_limit_requests | int | 60 | Max embedding requests allowed per interval |
embedding_rate_limit_interval | int | 60 | Duration of the rate limit window in seconds |
embedding_rate_limit_tokens | int | 0 | Max tokens per interval (0 = disabled) |
Graph Database Configuration
Graph Database Configuration
Vector Database Configuration
Vector Database Configuration
Chunking Configuration
Chunking Configuration
Model Configuration
Model Configuration
Other Settings
Other Settings
All Configuration Methods
Configuration Methods
Configuration Methods
| Method | Description |
|---|---|
set_llm_provider(provider) | Set the LLM provider |
set_llm_model(model) | Set the LLM model name |
set_llm_api_key(key) | Set the LLM API key |
set_llm_endpoint(url) | Set a custom LLM endpoint |
set_llm_config(dict) | Set all LLM config at once |
set_embedding_provider(provider) | Set the embedding provider |
set_embedding_model(model) | Set the embedding model name |
set_embedding_dimensions(dimensions) | Set embedding vector dimensions |
set_embedding_endpoint(url) | Set a custom embedding endpoint |
set_embedding_api_key(key) | Set the embedding API key |
set_embedding_config(dict) | Set all embedding config at once |
set_graph_database_provider(provider) | Set the graph DB provider |
set_relational_db_config(dict) | Set relational DB config |
set_migration_db_config(dict) | Set migration DB config |
set_graph_db_config(dict) | Set all graph DB config |
set_vector_db_provider(provider) | Set the vector DB provider |
set_vector_db_url(url) | Set the vector DB URL |
set_vector_db_key(key) | Set the vector DB API key |
set_vector_db_config(dict) | Set all vector DB config |
set_chunk_size(size) | Set chunk size in tokens |
set_chunk_overlap(overlap) | Set chunk overlap |
set_chunk_strategy(strategy) | Set chunking strategy |
set_chunk_engine(engine) | Set chunking engine |
set_classification_model(model) | Set classification model |
set_summarization_model(model) | Set summarization model |
set_graph_model(model) | Set graph extraction model |
system_root_directory(path) | Set system root directory |
data_root_directory(path) | Set data root directory |
monitoring_tool(tool) | Set the monitoring tool |
set_translation_provider(provider) | Set translation provider |
set_translation_target_language(lang) | Set translation target language |
set_translation_config(dict) | Set translation config |
set(key, value) | Generic config setter |
Environment Variables
These environment variables are read at startup and can be overridden with the config methods above:| Variable | Default | Description |
|---|---|---|
LLM_API_KEY | — | (Required) API key for the LLM provider |
LLM_PROVIDER | "openai" | LLM provider name |
LLM_MODEL | "openai/gpt-5-mini" | LLM model identifier |
LLM_ENDPOINT | — | Custom LLM endpoint URL |
LLM_ARGS | "{}" | JSON string of extra kwargs merged into every LLM call (e.g. '{"top_p": 0.9}') |
LLM_RATE_LIMIT_ENABLED | false | Enable client-side rate limiting for LLM calls |
LLM_RATE_LIMIT_REQUESTS | 60 | Max LLM requests per interval |
LLM_RATE_LIMIT_INTERVAL | 60 | Rate limit window in seconds |
LLM_RATE_LIMIT_TOKENS | 0 | Max LLM tokens per interval (0 = disabled) |
EMBEDDING_RATE_LIMIT_ENABLED | false | Enable client-side rate limiting for embedding calls |
EMBEDDING_RATE_LIMIT_REQUESTS | 60 | Max embedding requests per interval |
EMBEDDING_RATE_LIMIT_INTERVAL | 60 | Rate limit window in seconds |
EMBEDDING_RATE_LIMIT_TOKENS | 0 | Max embedding tokens per interval (0 = disabled) |
GRAPH_DATABASE_PROVIDER | "kuzu" | Graph database provider |
VECTOR_DB_PROVIDER | "lancedb" | Vector database provider |
LOG_LEVEL | "INFO" | Logging level |