Categorise transactions in Actual Budget using AI.
100K+
This is a project that allows you to categorize uncategorized transactions for Actual Budget using OpenAI, Anthropic, Google Generative AI, Ollama or any other compatible API (including OpenRouter, Requesty and UberLLM).
The app sends requests to the LLM to classify transactions based on their description, amount, and notes.
When enabled, the LLM can suggest entirely new categories for transactions it cannot classify, and optionally create them automatically.
Using the ValueSerp API, the system can search the web for information about unfamiliar merchants to help the LLM make better categorization decisions.
Re-process transactions previously marked as unclassified.
Sample docker-compose.yml file:
services:
actual_server:
image: docker.io/actualbudget/actual-server:latest
ports:
- '5006:5006'
volumes:
- ./actual-data:/data
restart: unless-stopped
actual-ai:
image: docker.io/sakowicz/actual-ai:latest
restart: unless-stopped
depends_on:
actual_server:
condition: service_healthy
environment:
ACTUAL_SERVER_URL: http://actual_server:5006
ACTUAL_PASSWORD: your_actual_password # or ACTUAL_SESSION_TOKEN, see below
ACTUAL_BUDGET_ID: your_actual_budget_sync_id # This is the ID from Settings → Show advanced settings → Sync ID
CLASSIFICATION_SCHEDULE_CRON: 0 */4 * * * # How often to run classification.
LLM_PROVIDER: openai # Can be "openai", "openrouter", "requesty", "uberllm", "anthropic", "google-generative-ai", "ollama" or "groq"
FEATURES: '["classifyOnStartup", "syncAccountsBeforeClassify", "suggestNewCategories"]'
# TZ: America/New_York # optional. time zone for CLASSIFICATION_SCHEDULE_CRON, UTC if not set
# VALUESERP_API_KEY: your_valueserp_api_key # API key for ValueSerp, required if webSearch tool is enabled
# OPENAI_API_KEY: # optional. required if you want to use the OpenAI API
# OPENAI_MODEL: # optional. required if you want to use a specific model, default is "gpt-4.1-mini"
# OPENAI_BASE_URL: # optional. required if you don't want to use the OpenAI API but OpenAI compatible API, ex: "http://ollama:11434/v1"
# OPENROUTER_API_KEY: # optional. required if you want to use OpenRouter
# OPENROUTER_MODEL: # optional. default is "deepseek/deepseek-v3.2"
# OPENROUTER_BASE_URL: # optional. default: "https://openrouter.ai/api/v1"
# OPENROUTER_REFERRER: # optional but recommended by OpenRouter (or OPENROUTER_REFERER)
# OPENROUTER_TITLE: # optional. default: "actual-ai"
# REQUESTY_API_KEY: # optional. required if you want to use Requesty
# REQUESTY_MODEL: # optional. default is "openai/gpt-4o-mini"
# REQUESTY_BASE_URL: # optional. default: "https://router.requesty.ai/v1" (use "https://router.eu.requesty.ai/v1" for EU routing)
# REQUESTY_REFERRER: # optional. sent as HTTP-Referer for Requesty analytics
# REQUESTY_TITLE: # optional. default: "actual-ai"
# UBERLLM_API_KEY: # optional. required if you want to use UberLLM
# UBERLLM_MODEL: # optional. default is "openai/gpt-4o-mini"
# UBERLLM_BASE_URL: # optional. default: "https://api.uberllm.dev/v1"
# UBERLLM_REFERRER: # optional. sent as HTTP-Referer for UberLLM attribution
# UBERLLM_TITLE: # optional. default: "actual-ai"
# LLM_TIMEOUT_MS: # optional. request timeout in ms for LLM calls, default: 120000
# OPENROUTER_ENABLE_TOOL_CALLING: # optional. "true" to allow model tool-calling on openrouter, default: false
# REQUESTY_ENABLE_TOOL_CALLING: # optional. "true" to allow model tool-calling on requesty, default: false
# UBERLLM_ENABLE_TOOL_CALLING: # optional. "true" to allow model tool-calling on uberllm, default: false
# LLM_TEMPERATURE: # optional. temperature for LLM calls, e.g. 1 for models that reject other values, or "none" to leave it out for models that reject any value (e.g. Claude Opus 5.5)
# ANTHROPIC_API_KEY: # optional. required if you want to use the Anthropic API
# ANTHROPIC_MODEL: # optional. required if you want to use a specific model, default is "claude-3-5-sonnet-latest"
# ANTHROPIC_BASE_URL: # optional. default: "https://api.anthropic.com/v1"
# GOOGLE_GENERATIVE_AI_API_KEY: # optional. required if you want to use the Google Generative AI API
# GOOGLE_GENERATIVE_AI_MODEL: # optional. required if you want to use a specific model, default is "gemini-1.5-flash"
# GOOGLE_GENERATIVE_AI_BASE_URL: # optional. default: "https://generativelanguage.googleapis.com/v1beta"
# OLLAMA_MODEL: # optional. required if you want to use an Ollama specific model, default is "llama3.1"
# OLLAMA_BASE_URL: http://localhost:11434/api # optional. required for ollama provider
# GROQ_API_KEY: # optional. required if you want to use the Groq API
# GROQ_MODEL: # optional. required if you want to use a specific model, default is "llama-3.3-70b-versatile"
# GROQ_BASE_URL: # optional. default: "https://api.groq.com/openai/v1"
# ACTUAL_SESSION_TOKEN: # optional. use instead of ACTUAL_PASSWORD on OpenID servers, see "OpenID servers"
# ACTUAL_E2E_PASSWORD: # optional. required if you have E2E encryption
# NODE_TLS_REJECT_UNAUTHORIZED: 0 # optional. required if you have trouble connecting to Actual server
# NOT_GUESSED_TAG: '#actual-ai-miss' # optional. keep the quotes: YAML reads an unquoted # as a comment
# GUESSED_TAG: '#actual-ai' # optional. keep the quotes
If your Actual server only allows OpenID login, there is no password for ACTUAL_PASSWORD. Set
ACTUAL_SESSION_TOKEN instead. It takes precedence over ACTUAL_PASSWORD when both are set.
To get one, sign in to Actual in a browser, open DevTools, and go to Application → IndexedDB →
actual → asyncStorage. The value of the user-token key is your session token (a UUID). Close the
window without logging out: logging out deletes the session. Check it with
curl -H "X-ACTUAL-TOKEN: <token>" <server>/account/validate.
The token acts as your user, so treat it like a password. How long it stays valid depends on the
server's ACTUAL_TOKEN_EXPIRATION (default never). To revoke it, POST {"token": "<token>"} to
<server>/account/logout.
You can configure features using FEATURES (JSON array) or ENABLED_FEATURES (comma-separated list or JSON array):
The FEATURES environment variable accepts a JSON array of feature names to enable:
FEATURES='["suggestNewCategories", "classifyOnStartup", "syncAccountsBeforeClassify"]'
# Equivalent:
ENABLED_FEATURES='suggestNewCategories,classifyOnStartup,syncAccountsBeforeClassify'
Available features:
webSearch - Enable web search for merchant informationsuggestNewCategories - Allow suggesting new categories for transactionsclassifyOnStartup - Run classification when the application startssyncAccountsBeforeClassify - Sync accounts before running classificationdryRun - Run in dry run mode (off unless listed)rerunMissedTransactions - Re-process transactions previously marked as unclassifieddisableRateLimiter - Disable Rate LimiterWith CLASSIFICATION_SCHEDULE_CRON set, the container stays up and runs every scheduled
classification in a fresh child process. @actual-app/api keeps state in module-level singletons
that survive shutdown(), and in a container running for weeks that state drifts until incremental
sync reports no new messages and imports quietly stop. A new process per run keeps that state fresh
without needing a restart. Logs from the run appear as usual, and a schedule that fires while the
previous run is still going is skipped.
The schedule follows the container's clock, which is UTC unless you set TZ (for example
TZ: America/New_York). Without it, 0 6 * * * runs at 6 AM UTC, not 6 AM where you are.
Without a cron schedule, classifyOnStartup classifies once and the process exits — the right shape
when an external scheduler owns the timing.
By default each provider gets a conservative request/token-per-minute limit. You can override these per deployment with two environment variables — useful when your plan's actual limits differ from the built-in defaults (e.g. Google AI Free Tier sits well below the default 300 RPM):
REQUESTS_PER_MINUTE — proactive request-per-minute capTOKENS_PER_MINUTE — proactive token-per-minute capEach variable supports three states:
0 — disable that axis of proactive rate limiting (the provider's own 429 responses still drive reactive backoff)To turn off rate limiting entirely, add disableRateLimiter to your FEATURES array instead.
By default, model tool-calling is disabled when LLM_PROVIDER=openrouter because some gateway/model combinations can return unstable tool-call responses. You can re-enable it with:
OPENROUTER_ENABLE_TOOL_CALLING=true
The same applies to LLM_PROVIDER=requesty; re-enable it with:
REQUESTY_ENABLE_TOOL_CALLING=true
And to LLM_PROVIDER=uberllm; re-enable it with:
UBERLLM_ENABLE_TOOL_CALLING=true
To create a custom prompt, modify the PROMPT_TEMPLATE environment variable to include or exclude variables as needed.
Ensure that the Handlebars syntax is correctly used to handle conditional rendering and
loops.
categoryGroups: An array of category group objects. Each category group contains an array of categories.
categoryGroup is object with the following properties:
id: The ID of the category group.name: The name of the category group.categories: An array of category objects.
category is an object with the following properties:
id: The ID of the category.name: The name of the category.amount: The absolute value of the transaction amount, in Actual's integer format (cents, so 12.34 is 1234).type: The type of transaction, either 'Income' or 'Outcome'.description: The notes or description of the transaction. This is taken from transaction.notes.payee: The name of the payee associated with the transaction. This is found by matching the payee ID in the
transaction with the payee list.importedPayee: The imported payee name from the transaction. This is taken from transaction.imported_payee.date: The date of the transaction. This is taken from transaction.date.cleared: A boolean indicating if the transaction is cleared. This is taken from transaction.cleared.reconciled: A boolean indicating if the transaction is reconciled. This is taken from transaction.reconciled.rules: An array of your Actual rules that set a category.
rule is an object with the following properties:
ruleName: The rule's label: Rule 1, Rule 2 and so on, its number in the list. A rule reply only
counts when its ruleName is one of these labels; it then gets that rule's own category.categoryName: The name of the category the rule sets.categoryId: The ID of that category.conditions: An array of the rule's conditions, each with field, op, type and value. Payee IDs in
value are replaced by payee names.hasWebSearchTool: A boolean that is true when the webSearch feature is enabled.Besides the built-in Handlebars helpers, templates can use eq ({{#if (eq type "Income")}}) and incIndex
({{incIndex @index}} numbers a list from 1).
When suggestNewCategories feature is enabled, the system will:
dryRun is enabled), just log the suggestionsThis feature is particularly useful when you have transactions that don't fit your current category structure and you want the LLM to help expand your categories intelligently.
When the feature is off, a transaction the LLM wants a new category for gets the not-guessed tag (#actual-ai-miss), like any other transaction it can't classify, so it isn't sent to the LLM again on every run. Enable rerunMissedTransactions to retry those.
The system supports various tools that can be enabled to enhance the LLM's capabilities:
FEATURES arrayCurrently supported tools:
The webSearch tool uses the ValueSerp API to search for information about merchants that the LLM might not be familiar with, providing additional context for categorization decisions.
To use this tool:
webSearch in your FEATURES arrayVALUESERP_API_KEY (required)This is especially helpful for:
The search results are included in the prompts sent to the LLM, helping it make more accurate category assignments or suggestions.
The dryRun feature is off unless you add it to your FEATURES array. In this mode:
To perform actual changes:
dryRun from your FEATURES arraysuggestNewCategories is enabled if you want new category creationDry run messages will show:
docker pull sakowicz/actual-ai:latest