Configuration

Context config, models, and limits.

Spectron has two configuration surfaces: server-wide settings (in the server binary or environment) and per-Context configuration (stored in the control plane and patchable at runtime).

Server configuration is provided via environment variables or a TOML configuration file passed at startup. These settings apply to all Contexts unless overridden at the Context level.

VariableTypeDefaultDescription
SPECTRON_BINDstring0.0.0.0:8080Listen address and port
SPECTRON_SURREALDB_URLstringSurrealDB connection URL (required)
SPECTRON_SURREALDB_USERstringSurrealDB username (required)
SPECTRON_SURREALDB_PASSstringSurrealDB password (required)
SPECTRON_OBJECT_STOREstringlocal://./dataObject store backend (see below)

These apply to all Contexts that do not override them:

VariableDefaultDescription
SPECTRON_MODEL_EXTRACTIONgpt-4o-miniLLM for experiential memory extraction (Stage 1 fast pass)
SPECTRON_MODEL_EXTRACTION_STRONGgpt-4oLLM for extraction Stage 2
SPECTRON_MODEL_QUERY_UNDERSTANDINGgpt-4o-miniLLM for query classification
SPECTRON_MODEL_RESPONSEgpt-4o-miniLLM for response synthesis
SPECTRON_MODEL_REFLECTIONgpt-4oLLM for reflection operations
SPECTRON_MODEL_BACKGROUNDgpt-4o-miniLLM for background reconciliation
SPECTRON_MODEL_EMBEDDINGtext-embedding-3-smallEmbedding model (must be 1536-dim)
VariableDescription
SPECTRON_OPENAI_API_KEYDefault OpenAI API key for all Contexts
SPECTRON_ANTHROPIC_API_KEYDefault Anthropic API key for all Contexts
BackendSPECTRON_OBJECT_STORE formatNotes
Local filesystemlocal:///path/to/dataDevelopment and single-node deployments
Amazon S3s3://bucket-name/prefixRequires AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY or instance role
Google Cloud Storagegcs://bucket-name/prefixRequires GOOGLE_APPLICATION_CREDENTIALS
Azure Blob Storageazure://container/prefixRequires AZURE_STORAGE_ACCOUNT + AZURE_STORAGE_ACCESS_KEY

Each Context stores a config object in the control plane. This is updated via PATCH /api/v1/contexts/{id} and applies immediately to new requests.

{
"config": {
"token_limit": 1000000,
"retention_days": 90,
"models": {
"extraction": "openai/gpt-4o-mini",
"extraction_strong": "openai/gpt-4o",
"query_understanding": "openai/gpt-4o-mini",
"response": "openai/gpt-4o-mini",
"reflection": "openai/gpt-4o",
"background": "openai/gpt-4o-mini",
"embedding": "openai/text-embedding-3-small"
},
"providers": {
"openai": "sk-...",
"anthropic": "sk-ant-..."
}
}
}
FieldTypeDescription
token_limitinteger (optional)Monthly token cap across all LLM + embedding calls. Enforced before each ingestion write. null = no limit.
retention_daysinteger (optional)Automatic expiry for context-category experiential memory data. null = no automatic expiry.
models.extractionstringModel for Stage 1 fast extraction. Format: provider/model-name.
models.extraction_strongstringModel for Stage 2 strong extraction.
models.query_understandingstringModel for classifying and expanding queries.
models.responsestringModel for synthesising formatted context responses.
models.reflectionstringModel for reflection operations (reflect endpoint).
models.backgroundstringModel for background reconciliation and cross-layer linking.
models.embeddingstringEmbedding model. Must produce 1536-dimension vectors in this release.
providers.openaistringOpenAI API key for this Context. Overrides the server-wide default.
providers.anthropicstringAnthropic API key for this Context.

Provider API keys are write-only on the API surface. The read projection for a Context replaces the key values with a providers_configured summary:

{
"config": {
"providers_configured": ["openai", "anthropic"]
}
}

The raw key values never appear in read responses.

Send only the fields you want to change. Unset fields are left unchanged (deep merge):

PATCH /api/v1/contexts/acme-prod
Content-Type: application/json
API-KEY: mgmt-...

{
"config": {
"token_limit": 2000000,
"models": {
"reflection": "anthropic/claude-opus-4-7"
}
}
}

Additional per-Context settings control extraction behaviour:

FieldTypeDefaultDescription
extraction.stage1_thresholdfloat0.7Confidence threshold below which Stage 2 runs
extraction.max_entities_per_turninteger20Maximum entities extracted per turn
extraction.ontology_strictbooleanfalseReject entities/attributes not in the ontology
FieldTypeDefaultDescription
cache.semantic_ttl_secondsinteger3600TTL for semantic response cache entries
cache.semantic_thresholdfloat0.97Cosine similarity threshold for cache hits
FieldTypeDefaultDescription
rate_limit.requests_per_minuteinteger600Maximum requests per minute per Context
rate_limit.tokens_per_minuteinteger100000Maximum tokens per minute per Context (LLM calls)

When a per-Context field is not set, the server-wide default applies. The effective configuration for a Context is always visible at:

GET /api/v1/contexts/{id}

The response includes the config object with all effective values merged – Context-level overrides where set, server-wide defaults elsewhere.

Was this page helpful?