CortexDB Docs
Docs for CortexDB 0.15.2, the version running on CortexDB Cloud (api.cortexdb.ai).
Operations

Cost Planning

What a self-hosted CortexDB costs to run in model spend — recommended models, per-event and per-answer costs, monthly estimates, and how to replace them with your own numbers.

CortexDB itself has no per-token charge: you pay your model provider for the lanes you turn on.

Bottom line. For a corpus of about 10,000 events, loading and enriching everything costs about $4 one time, and each answered question costs about 2 to 4 cents on the recommended model. At 10,000 questions a month that is roughly $220 to $400 a month in LLM spend; searches without a generated answer cost almost nothing. Question volume drives the cost, not corpus size.

RoleModelWhy
Embeddingstext-embedding-3-small$0.02 per million tokens; cost is negligible at any corpus size. On a high-end machine you can run embeddings locally instead (Embeddings).
Enrichment (facts and entities extracted from each event)gpt-4o-miniCheapest reliable extraction model; about $0.40 per 1,000 events.
Answersgpt-5.6-terraBest quality per dollar; about 2 to 4 cents per answer.
Answers, budget optiongpt-5.6-lunaAbout 0.2 to 0.4 cents per answer, for high-volume or simpler questions.
Answers, premium optiongpt-5.6-sol or gpt-6-astra4 to 7 cents or 11 to 18 cents per answer, only where answer quality is the product.

Terra, Luna and Sol all work as CORTEX_ANSWER_MODEL (CORTEX_ANSWER_PROVIDER=openai).

Use gpt-5.6-sol for premium answers

gpt-6-astra expects max_completion_tokens rather than the max_tokens CortexDB sends, so on the answer lane it answers ANSWER_PROVIDER_ERROR. Use gpt-5.6-sol for premium answers.

# Embeddings (the image default; only the key is needed)
CORTEX_EMBEDDING_API_KEY=sk-...

# Entity extraction lane
CORTEX_LLM_URL=https://api.openai.com/v1
CORTEX_LLM_MODEL=gpt-4o-mini
CORTEX_ENTITY_API_KEY=sk-...

# Enrichment (Facts, Beliefs, Understanding); DELAY_SECONDS is required to switch it on
CORTEX_ENRICHMENT_URL=https://api.openai.com/v1
CORTEX_ENRICHMENT_MODEL=gpt-4o-mini
CORTEX_ENRICHMENT_API_KEY=sk-...
CORTEX_ENRICHMENT_DELAY_SECONDS=5

# Answers
CORTEX_ANSWER_PROVIDER=openai
CORTEX_ANSWER_URL=https://api.openai.com/v1
CORTEX_ANSWER_MODEL=gpt-5.6-terra
CORTEX_ANSWER_API_KEY=sk-...

# Rates the built-in price book does not have (USD per million tokens, input/output); see below
CORTEX_MODEL_PRICES=gpt-5.6-terra=2/12,gpt-5.6-luna=0.2/1.2,gpt-5.6-sol=4/20,gpt-6-astra=10/50

The answer model is chosen per deployment by CORTEX_ANSWER_MODEL. A per-request answer_model on /v1/answer is only echoed in diagnostics.answer_model (the server calls the configured model), so to serve simple questions on Luna, run a second deployment (or a second answer service) whose lane is set to gpt-5.6-luna.

Estimate

ItemCost
Load and enrich 10,000 events (one time)about $4
Each additional 1,000 eventsabout $0.40
Each answered question, Terra$0.02 to $0.04
Each answered question, Luna$0.002 to $0.004
Each search without a generated answerunder $0.001
1,000 answers a month, Terra$22 to $40
10,000 answers a month, Terra$220 to $400
100,000 answers a month, Terra$2,200 to $4,000

The range on answers covers the model's reasoning tokens, which OpenAI bills as output. All rates are OpenAI list prices as of September 2026; multiply by your own negotiated rates if they differ.

Assumptions

Events average about 150 tokens (a chat turn or a short note); long documents cost more to enrich. Answers use the default context size, about 10,000 input tokens per question. The verifier lane is off in the configuration above (it switches on if OPENAI_API_KEY or CORTEX_VERIFIER_API_KEY is set, and then adds one gpt-4.1 call per verified answer).

CortexDB's built-in usage dashboard reports the actual tokens and spend per role, so these estimates can be replaced with measured numbers after the first week.

Reading your real numbers

GET /v1/admin/usage (and Observability → Tokens & cost in the Admin Console) reports exact tokens per role and model. Three things to know before you trust its dollar column:

Set CORTEX_MODEL_PRICES for GPT-5.6 and GPT-6 models

The price book has no rates for gpt-5.6-* or gpt-6-*. Instead of reporting those calls as unpriced, it bills gpt-5.6-terra at the gpt-5 rate ($1.25 / $10 per million), which understates Terra by about a third. Set CORTEX_MODEL_PRICES as in the configuration above. The override applies to calls made after it is set; calls already recorded keep the rate they were priced at, so re-price older windows yourself from the token columns.

  • The ledger records the model that was actually called. Because a per-request answer_model is not applied, answers requested with one appear (correctly) under the configured CORTEX_ANSWER_MODEL; diagnostics.answer_model on the response is the echoed request, not the model used.
  • Entity extraction is priced. Each entity call records its input and output tokens and its model, and the ledger shows it under entity_extraction, priced on CORTEX_LLM_MODEL (the enrichment model when that is unset). Usage recorded by older releases sits under __unknown__ with unpriced_calls: price those windows yourself at the extraction model's rates. If CORTEX_LLM_MODEL names a model the price book does not know, declare its rate in CORTEX_MODEL_PRICES.

Governed memory spend

Governed memory adds spend you control with caps:

SpendCap
Ongoing extraction under a derivation policyThe policy's budget_usd_per_day: once spent, its extraction waits for the next UTC midnight
Policy tests and re-extraction dry runsCORTEX_DERIVATION_BUDGET_USD per tenant per UTC day (default 5 US dollars); a test's own max_cost_usd (default 1)
A re-extraction jobThe cap_usd you approve, at most CORTEX_DERIVATION_BUDGET_MAX_USD (default 500)
An undo's re-extraction of what a rejection kept outThe daily extraction budget

A regate calls no model and costs nothing. A model a budget cannot price spends the whole day's budget, because no dollar cap can hold an unpriced model: declare its rate in CORTEX_MODEL_PRICES.

List prices

OpenAI list prices, September 2026, USD per million tokens (source):

ModelInputCached inputOutput
text-embedding-3-small0.02——
gpt-4o-mini0.150.0750.60
gpt-5.6-luna0.200.021.20
gpt-5.6-terra2.000.2012.00
gpt-5.6-sol4.000.4020.00 (promotional, at least through 21 November 2026)
gpt-6-astra10.001.0050.00

On this page