selfhostedaiagents.com
What self-hosted open-source AI agents cost to run
Self-hosting an AI agent drops the subscription and keeps three costs: the server, the model calls, and the hours someone spends keeping the instance alive. Kortix is the open-source AI Operating System, and every number in that bill has a source.
The five lines that set the server floor
MIN_DISK_MB="${KORTIX_MIN_FREE_DISK_MB:-2048}" # 2048 + 2048 + 512 + 1280 = 5888MB of container limits, plus the host. if [ "${mem_mb:-0}" -ge 7500 ]; then ok "memory: ${mem_mb}MB" elif [ "${mem_mb:-0}" -ge 6000 ]; thenThe published container limits add up to 5,888MB, so preflight calls 6GB a failure and 7.5GB the first size with headroom.
The platform line goes to zero
Run it on Kortix Cloud, in your VPC, or on your own on-prem network. Self-host is free. A self-hosted instance runs with billing off by default (KORTIX_BILLING_INTERNAL_ENABLED=false), and it has no credits, no plan limits and no managed models. Nothing on that server sends Kortix a monthly invoice.
It helps to know what the managed account charges, because that is the number the decision usually turns on. Free is $0 with 500 credits per month, every feature and 1 project, on the user's own provider keys or ChatGPT subscription. The paid plan is credits: 25 tiers from $50 a month (5,000 credits) to $50,000 a month (5,000,000 credits), at 100 credits per dollar. Managed models are on the Credits plan only. Nothing on a self-hosted instance bills that way, which makes the managed line the one self-hosting deletes.
The server is the first line you add
A self-hosted instance is one Docker Compose stack on a Linux server with a public IP and ports 80 and 443 open. The published container limits are kortix-api 2048m, llm-gateway 2048m, frontend 512m and Postgres at a fixed 1280m. Add them and you get 5,888MB before the host itself needs anything. The preflight in the operator kit fails below 6,000MB, warns up to 7,500MB and passes above, so a 4GB machine stops there, before init writes a file.
Disk has a floor of its own. kortix-updater stops below KORTIX_MIN_FREE_DISK_MB, 2,048MB by default, and the instance keeps one previous release for rollback. A 6GB server clears the failure and sits in the warning band; 8GB clears both. Your provider sets the price of that machine, and no number here changes it.
Keep the split in view while you size it. The server holds the control plane, Postgres and the stored files. Sessions do not run there. kortix-api creates each one on a Platinum sandbox with your PLATINUM_API_KEY, and the sandbox calls back to the instance's public URL, so the machine you rent is sized for the stack and its database. The checks page shows what each record buys you.
The model line is your provider's invoice
A self-hosted instance has no managed models, so model calls go to the providers your projects connect. Any model provider with your own keys. Or the ChatGPT plan you already pay for. You add the key in the web app after the first sign-in, and each project keeps its own, which is why this line is however many provider accounts you choose to hold.
With billing off, the model line arrives as the provider's own invoice and nothing else. The managed plans are on Kortix.
The hours line is the one nobody quotes
Four jobs recur, and each one has a command in the kit.
./bin/backup.shbefore every update and everyenvchange. It stops the stack, archives the instance directory, and writes a sha256 plus a key fingerprint..envholdsAPI_KEY_SECRET, which decrypts every stored secret, so an archive without it restores a stack that serves pages and cannot read its own credentials../bin/doctor.shbefore anyone signs in and after each update. Seven checks, and six of seven is the usual first result.- The daily update window, 02:00 in
America/New_Yorkunless you change it. A failed migration swaps nothing and the old version keeps answering, so the cost is usually a morning rather than an outage. - A restore drill on a spare instance.
restore.shrefuses a key that does not match, and that refusal is better met on a calm day than during a recovery.
verify-all.sh in cron reruns sign-up, doctor, update status and backup age in one pass, and exits 1 when a person is needed. That is the schedule; the minutes are yours. A worked example with stated inputs: 15 minutes a week for the pass is 13 hours a year, and at $60 an hour the line is $780 before any restore drill. Put your own minutes and rate in and the number moves.
What the total is not
The subscription is the number everyone compares, and it is the one self-hosting removes. The three that stay are a server sized to a container floor, model calls priced by a provider, and recurring hours of someone's attention. Where model spend is small and nobody's hour is charged to anything, self-hosting lands close to free. Where a team's hours are real money, the monthly plan can be the cheaper invoice even though it is the only one with a price printed on it.
Before you size the machine, run the preflight. What the stack installs follows the same commands in order, and Read the docs for every variable the instance takes.
What the bill comes to
- How much does it cost to have your own AI agent?
- Nothing for the platform if you self-host Kortix, which is free. The bill is a server that meets the 5,888MB container floor, model calls on your own provider keys, and the hours spent on backups, updates and checks.
- How much does it cost to host an AI server?
- A Kortix server needs about 6GB of RAM to pass preflight and 2,048MB of free disk, so the monthly price is whatever your provider charges for that machine. Sessions run on Platinum sandboxes outside it, and model calls go to your provider.
- How much does an open AI agent cost?
- Nothing for the software: an open-source agent you self-host carries no platform fee, and Kortix self-host is free. You still pay for the machine it runs on, the models it calls and the time someone spends operating it, and those three are the rest of the bill.
Self-host is free. Size the server before you start.
The preflight names the missing memory, disk or DNS record before anything is written.