Skip to main content

Models & Data Structures

User

Built-in model managed by the auth system. Not configurable via the schema engine.

FieldTypeRequiredNotes
idstring (UUID)AutoPrimary key
emailstringYesUnique
display_namestringNo
rolestringYes"user" or "admin"
password_hashstringInternalbcrypt hash — never returned by API
created_atstring (ISO 8601)Auto
updated_atstring (ISO 8601)Auto

_files (File Metadata)

Internal table managed by StorageManager. Not in schema.json.

FieldTypeNotes
idstring (UUID)Primary key
original_namestringOriginal filename from upload
stored_namestring<uuid>.<ext> — actual filename on disk
mime_typestringe.g. image/jpeg
size_bytesintegerFile size in bytes
visibilitystring"public" or "private"
uploader_idstringUUID of the uploading user
created_atstring (ISO 8601)

Custom Models (schema.json)

All custom models automatically receive id, created_at, and updated_at.

Example schema.json:

{
"Product": {
"fields": {
"name": { "type": "string", "required": true },
"price": "number",
"in_stock": "boolean",
"sku": { "type": "string", "unique": true }
}
},
"Order": {
"fields": {
"product_id": { "type": "string", "required": true },
"quantity": { "type": "integer", "required": true },
"status": { "type": "string", "default": "pending" }
}
}
}

Resulting routes:

  • Product → table products/api/products, /api/products/:id
  • Order → table orders/api/orders, /api/orders/:id

Agent

Stored in agents.config.json.

FieldTypeDefaultDescription
idstring (UUID)Auto
namestringDisplay name
descriptionstring""Human-readable description
providerstringopenai, anthropic, gemini, or ollama
modelstringModel ID
systemPromptstring""Agent's system instruction
toolsstring[][]List of tool names to enable
temperaturenumber0.7Sampling temperature
maxTokensinteger2048Max tokens per LLM call
maxIterationsinteger10Max tool-call loop iterations
createdAtstring (ISO 8601)Auto
updatedAtstring (ISO 8601)Auto

AI Provider (ai.config.json)

FieldTypeDescription
labelstringDisplay name
apiKeystringAPI key (empty string if not set)
enabledbooleanWhether the provider is active
modelsstring[]Available model IDs
defaultModelstringDefault model ID
baseUrlstringOnly for Ollama — local server URL

Token Usage (ai.usage.json)

{
"totalRequests": 150,
"totalInputTokens": 55000,
"totalOutputTokens": 14000,
"byProvider": {
"openai": {
"requests": 100,
"inputTokens": 40000,
"outputTokens": 10000
},
"anthropic": {
"requests": 50,
"inputTokens": 15000,
"outputTokens": 4000
}
}
}