# Kajiya documentation (full) > Every page of https://kajiya.app/docs as Markdown, in reading order. Each page starts with a comment naming its URL. # Kajiya documentation Kajiya runs your GitHub Actions jobs on fresh virtual machines in Seoul for $0.0045 per vCPU-hour, billed per started minute from prepaid compute packs. You keep your workflows and change one line: `runs-on: kajiya-2`. ## Start here 1. [Quickstart](/docs/quickstart)\ From sign-in to your first job on a Kajiya runner in about five minutes. 2. [Connect GitHub](/docs/connect-github)\ Install the Kajiya CI GitHub App, or connect repositories with a fine-grained token, and what each permission is for. 3. [Runners](/docs/runners)\ Labels, sizes, tiers, the VM image and what is installed, network rules and time limits. 4. [Billing](/docs/billing)\ Per-minute billing, sub-cent carry, the 10-minute gate, compute packs, expiry, refunds and tax. ## How a job flows 1. A workflow job with `runs-on: kajiya-2`, `kajiya-4` or `kajiya-8` is queued on GitHub. 2. Kajiya learns about it from a GitHub webhook within seconds (or from polling), checks your limits, caps and prepaid compute, and registers a one-time runner for your repository. 3. A fresh VM boots in Seoul, runs the job, powers off and is destroyed. You are billed for the VM's runtime, rounded up to whole minutes. 4. If the job cannot start yet, it stays queued on GitHub and Kajiya records why; it starts by itself when the reason clears. ## Get started - [Quickstart](/docs/quickstart)\ From sign-in to your first job on a Kajiya runner in about five minutes. - [Connect GitHub](/docs/connect-github)\ Install the Kajiya CI GitHub App, or connect repositories with a fine-grained token, and what each permission is for. ## Runners and billing - [Runners](/docs/runners)\ Labels, sizes, tiers, the VM image and what is installed, network rules and time limits. - [Billing](/docs/billing)\ Per-minute billing, sub-cent carry, the 10-minute gate, compute packs, expiry, refunds and tax. - [Queue and limits](/docs/queue-and-limits)\ Account concurrency, per-repository caps, pausing, and the seven reasons a job waits. - [Spend controls](/docs/spend-controls)\ Daily and monthly spend caps, the low-balance alert, and what happens to running jobs. - [Security](/docs/security)\ VM isolation, network rules, how tokens and secrets are stored, and public-repository advice. ## API and automation - [API overview](/docs/api)\ Base URL, API keys and scopes, rate limits, pagination, errors and CSV exports. - [API reference](/docs/api/reference)\ Every /api/v1 operation with parameters, request and response examples, and curl. - [Webhooks](/docs/webhooks)\ Signed job, balance and spend-cap events: payloads, headers, verification, retries. - [For agent fleets](/docs/agents)\ Operating Kajiya from a fleet of coding agents: keys, limits, waiting reasons, webhooks, cost, cancel. ## Guides - [All guides](/docs/guides)\ Task-focused guides for moving CI onto Kajiya and running it well. - [From GitHub-hosted runners](/docs/guides/migrate-from-github-hosted)\ Move workflows from ubuntu-latest to Kajiya, what differs, and how to roll out safely. - [From other runner vendors](/docs/guides/migrate-from-other-runners)\ Switch from Blacksmith, BuildJet, Namespace, Depot or similar runner services. - [Matrix builds and sharding](/docs/guides/matrix-and-sharding)\ Fan out test suites across many Kajiya runners without hitting your limits. - [Docker builds and caching](/docs/guides/docker-and-caching)\ Docker builds on fresh VMs: actions/cache, registry and GitHub Actions cache backends. - [Monorepos and per-repo caps](/docs/guides/monorepos)\ Keep one busy repository from starving the rest, and skip work that did not change. ## Help - [Troubleshooting](/docs/troubleshooting)\ Jobs that stay queued, token and webhook problems, billing surprises, and how to fix them. - [FAQ](/docs/faq)\ Short answers to common questions about Kajiya. - [Changelog](/docs/changelog)\ What changed in Kajiya, newest first. ## For agents Every page is also available as Markdown: add `.md` to its URL or send `Accept: text/markdown`. [/llms.txt](/llms.txt) lists them all, [/llms-full.txt](/llms-full.txt) is the whole documentation in one file, and the API is described in [OpenAPI 3.1](/api/v1/openapi.json). # Quickstart Run your first GitHub Actions job on a Kajiya runner in about five minutes. You need a GitHub account that is at least 24 hours old and has a verified primary email address, and admin access to the repository you want to run on. ## 1. Sign in with GitHub Open the [dashboard](/app) and choose **Continue with GitHub**. Your Kajiya account is created the first time you sign in. Signing in only reads your GitHub id, username, primary verified email address and account creation date. It gives Kajiya no access to your repositories, and Kajiya does not keep GitHub's access token. ## 2. Connect a repository Kajiya needs permission to see queued jobs in a repository and to register one-time runners there. Choose one of two ways: - **Install the Kajiya CI GitHub App (recommended).** In the dashboard, choose **Install GitHub App**; on GitHub the App is called **Kajiya CI**. GitHub asks where to install it (your account or an organization) and which repositories it may use, then asks you to authorize Kajiya so it can confirm the installation is yours. You come back to the dashboard with those repositories connected. - **Use a fine-grained token.** Create a fine-grained personal access token with *Administration: Read and write*, *Webhooks: Read and write* and *Actions: Read and write*, and paste it under **Repositories** in the dashboard. [Connect GitHub](/docs/connect-github) explains both, including what each permission is used for. ## 3. Buy a compute pack Open **Billing** in the dashboard and pick a pack. Packs start at $10 for 2,222 vCPU-hours and are paid by card through Paddle.com, our Merchant of Record. The pack is on your account as soon as the payment is confirmed. A repository has to be connected before you can buy. | Pack | vCPU-hours | kajiya-2 minutes | |---|--:|--:| | $10 | 2,222 | 66,660 | | $25 | 5,555 | 166,650 | | $50 | 11,111 | 333,330 | | $100 | 22,222 | 666,660 | | $250 | 55,555 | 1,666,650 | ## 4. Change one line In a workflow under `.github/workflows/`, set `runs-on` to a Kajiya label: ```yaml jobs: test: runs-on: kajiya-2 # was: ubuntu-latest steps: - uses: actions/checkout@v4 - run: make test ``` Use `kajiya-2`, `kajiya-4` or `kajiya-8` for 2, 4 or 8 vCPUs with 2 GB RAM per vCPU. Commit and push, or re-run a workflow. ## 5. See the job Kajiya notices the queued job within seconds through the GitHub App or the repository webhook, or on its next check if neither is set up, and boots a fresh VM for it (boot takes about 40 seconds). On GitHub the job runs on a runner named `kajiya-`. In the dashboard the job moves from *dispatched* to *running* to *done*, with its billed minutes and exact cost. From a terminal, with an [API key](/docs/api#authentication): ```bash curl -s "https://kajiya.app/api/v1/jobs?limit=1" -H "Authorization: Bearer $KAJIYA_API_KEY" ``` If the job stays queued, open the live queue in the dashboard or call `GET /api/v1/queue`: every waiting job is listed with the reason. See [Queue and limits](/docs/queue-and-limits#wait-reasons). ## See it running A public demo repository runs its workflows on Kajiya: [MovieHolic-Plex/kajiya-demo](https://github.com/MovieHolic-Plex/kajiya-demo). Its [Actions tab](https://github.com/MovieHolic-Plex/kajiya-demo/actions) shows real jobs, and the [status page](/status) shows live capacity. ## Next steps - [Runners](/docs/runners): what is installed on the VM, and the network and time limits. - [Billing](/docs/billing): how minutes become cents. - [Spend controls](/docs/spend-controls): set a daily cap before you move a busy repository. - [Migrate from GitHub-hosted runners](/docs/guides/migrate-from-github-hosted): roll out across many workflows safely. # Connect GitHub Kajiya needs two things in a repository: to see when a job with a Kajiya label is queued, and to register a one-time runner for that job. You can grant this with the **Kajiya CI** GitHub App (recommended) or with a fine-grained personal access token. | | GitHub App | Fine-grained token | |---|---|---| | Setup | One button in the dashboard; pick repositories on GitHub | Create a token on GitHub and paste it | | Repository list | Follows the installation: repositories you add or remove on GitHub are connected or disconnected | You connect each repository, a list or an organization | | Expiry | Does not expire; Kajiya uses short-lived installation tokens | Expires when you chose; you replace it | | How Kajiya hears about jobs | The App's `workflow_job` events, within seconds | A repository webhook if the token may create one, otherwise polling | ## Install the Kajiya CI GitHub App 1. In the [dashboard](/app), choose **Install GitHub App**. The App is called **Kajiya CI** ([github.com/apps/kajiya-ci](https://github.com/apps/kajiya-ci)); start from the dashboard so the installation is linked to your account. 2. GitHub asks where to install it: your personal account or an organization you own. Choose **All repositories** or **Only select repositories**. 3. GitHub asks you to authorize Kajiya. This lets Kajiya confirm, with GitHub, that your GitHub account can access the installation; Kajiya never trusts an installation id from a redirect alone. 4. You return to the dashboard. The repositories you selected appear under **Repositories**, already connected. If you are a member but not an owner of an organization, GitHub sends the owners an installation request instead. Once an owner approves it, open the dashboard and choose **Link an existing installation**. ### What the App can do | Permission | Access | What Kajiya uses it for | |---|---|---| | Administration | Read and write | Register a one-time (just-in-time) self-hosted runner for each job | | Actions | Read and write | Read queued workflow jobs; cancel a run when you cancel a job in Kajiya | | Metadata | Read | Required by GitHub for every App: repository names and basic information | The App receives three kinds of events: `workflow_job` (a job was queued or finished, so Kajiya can start it within seconds or release a runner it no longer needs), and `installation` and `installation_repositories` (so the connected repositories follow the installation). The App has no access to your code, issues, pull requests or secrets. Your workflow checks out code inside the job's VM with its own `GITHUB_TOKEN`, as on any runner. ### Change repositories or remove the App Repository access is managed on GitHub: **Settings → Applications → Installed GitHub Apps → Configure** for a personal account, or the organization's **Settings → GitHub Apps**. Repositories you add there are connected in Kajiya; repositories you remove are disconnected. Uninstalling or suspending the App disconnects all of its repositories at once. Job history stays in Kajiya. You can also unlink an installation in the dashboard. Kajiya then stops using it, but the App stays installed on GitHub until an owner removes it there. A repository connected with a token moves to the App when the App is installed on it, and Kajiya deletes the repository webhook it had created for the token. ## Connect with a fine-grained token 1. On GitHub, open **Settings → Developer settings → Personal access tokens → Fine-grained tokens → Generate new token**. 2. **Resource owner:** your account, or the organization that owns the repositories. Organizations can require an owner to approve fine-grained tokens before they work. 3. **Expiration:** your choice. When the token expires, Kajiya can no longer see the queue until you [replace it](#replace-an-expired-token). 4. **Repository access:** *Only select repositories* (recommended) or *All repositories*. 5. **Repository permissions:** set the three below. GitHub adds *Metadata: Read* by itself. 6. Generate the token, then paste it in the dashboard under **Repositories → Connect repositories**. | Permission | Needed | What Kajiya uses it for | Without it | |---|---|---|---| | Administration: Read and write | Required | Confirm you administer the repository, and register a one-time runner for each job | The repository cannot be connected | | Webhooks: Read and write | Recommended | Create a repository webhook for `workflow_job` events, so jobs start within seconds | Kajiya polls: every 10 s while the repository is busy, every 60 s when idle | | Actions: Read and write | Recommended | Read: list queued jobs (polling, and a safety-net check every 5 minutes on webhook repositories). Write: cancel runs from Kajiya | Jobs start only from webhook events, and cancelling from Kajiya fails | The token is stored encrypted on Kajiya's control server and is never sent to a job VM. Each VM only receives a one-time runner registration. ### Connect many repositories at once The dashboard's **Connect repositories** form has three modes: **One** repository, a **List** (one per line, up to 200), or an **Organization** (leave the name empty to connect everything the token administers). Through the API: ```bash # every repository of an organization that the token administers curl -X POST "https://kajiya.app/api/v1/repos" \ -H "Authorization: Bearer $KAJIYA_API_KEY" -H "Content-Type: application/json" \ -d '{"github_token": "github_pat_...", "owner": "acme"}' # an explicit list curl -X POST "https://kajiya.app/api/v1/repos" \ -H "Authorization: Bearer $KAJIYA_API_KEY" -H "Content-Type: application/json" \ -d '{"github_token": "github_pat_...", "repos": ["acme/api", "acme/web"]}' # everything the token administers curl -X POST "https://kajiya.app/api/v1/repos" \ -H "Authorization: Bearer $KAJIYA_API_KEY" -H "Content-Type: application/json" \ -d '{"github_token": "github_pat_...", "all": true}' ``` Each repository gets a result: `connected`, `updated` (it was already connected and now uses the new token), `skipped` (archived, or the token is not an admin there) or `error` with a message. Rules: - One request handles up to 200 repositories. When an organization has more, the response says so; connect the rest with a `repos` list. - `owner` is meant for organizations. For repositories of a personal account, send a `repos` list or `all: true`. - An account can have up to 500 connected repositories, and a repository belongs to one Kajiya account at a time. ### Replace an expired token Connect the same repositories again with the new token, the same way you connected them. Each comes back as `updated`, and Kajiya uses the new token from then on. To check right away instead of waiting for the next poll, call `POST /api/v1/repos/{id}/sync`. ### Revoke access - **Disconnect** a repository in the dashboard, or call `DELETE /api/v1/repos/{id}`. Kajiya stops using its token and deletes the webhook it created, if the token still allows that. Job history stays. - **Delete the token on GitHub** (Settings → Developer settings → Fine-grained tokens) to make sure it can never be used again. Organization owners can also revoke fine-grained tokens that have access to the organization. ## How Kajiya hears about jobs The `dispatch` field of `GET /api/v1/repos`, and the **Repositories** tab, show how each repository is watched: | `dispatch` | Meaning | |---|---| | `webhook` | GitHub delivers `workflow_job` events (through the App, or the repository webhook). Jobs start within seconds. Kajiya also checks the queue every 5 minutes as a safety net. | | `webhook_pending` | The webhook exists but GitHub has not delivered an event yet. It turns into `webhook` on the first delivery. | | `polling` | No webhook. Kajiya checks every 10 s while the repository had a job in the last 30 minutes, every 60 s otherwise, and every 10 s while any of its jobs is waiting. `dispatch_note` says why the webhook is missing. | If GitHub rate-limits Kajiya, polling for that repository backs off for 5 minutes. # Runners Every Kajiya job runs on its own freshly booted virtual machine in Seoul, South Korea, and the VM is destroyed when the job ends. This page lists the labels, what the VM contains, and the limits it runs under. ## Labels and sizes Set `runs-on` to one label. All sizes cost the same $0.0045 per vCPU-hour. | Label | vCPU | RAM | Disk | Per minute | Per hour | |---|--:|--:|--:|--:|--:| | `kajiya-2` | 2 | 4 GB | 30 GB | $0.00015 | $0.0090 | | `kajiya-4` | 4 | 8 GB | 30 GB | $0.00030 | $0.0180 | | `kajiya-8` | 8 | 16 GB | 30 GB | $0.00060 | $0.0360 | ```yaml jobs: build: runs-on: kajiya-4 ``` Use the Kajiya label on its own. Do not add `self-hosted`, `linux` or other labels: the one-time runner Kajiya registers carries the Kajiya label, and GitHub only assigns a job to a runner that has every label the job asks for. Labels are case-insensitive. Sizes other than 2, 4 and 8 (for example `kajiya-16`) are not Kajiya labels, so Kajiya ignores those jobs. ## Tier pins Machines in the fleet are graded into tiers by a single-thread benchmark (SHA-256 throughput on one core, in MB/s). Every tier costs the same. | Tier | Minimum single-thread score | Pin label (2 vCPU) | |---|--:|---| | S | 1,800 | `kajiya-2-s` | | A | 1,200 | `kajiya-2-a` | | B | 700 | `kajiya-2-b` | | C | none (every machine) | `kajiya-2-c` | Without a pin, a job goes to any machine with room, and Kajiya fills lower tiers first. To require a tier, add it to the label: `kajiya--`, for example `kajiya-4-s` or `kajiya-8-a`. A pinned job waits (reason `no_host`) for as long as no machine of that tier has room, so pin only jobs that need fast single cores. The set of tiers online changes with the fleet. ## The virtual machine - **Hypervisor:** KVM. The VM's CPU is passed through from the host (`host-passthrough`), so the guest sees the host's CPU model and instruction set extensions. The current fleet is AMD EPYC. - **Memory:** 2 GB per vCPU, not shared with other jobs. - **Disk:** a 30 GB virtual disk, copy-on-write over the base image. The operating system and tools take part of it. - **OS:** Ubuntu 24.04 LTS (x86_64) cloud image. - **User:** jobs run as `runner`, which has passwordless `sudo` and is in the `docker` group. You own the VM for the length of the job. - **Runner:** GitHub Actions runner 2.338.2 in `/opt/actions-runner`; the workspace is `/opt/actions-runner/_work`. - **Boot:** about 40 seconds from the start of the VM to the runner taking the job. Boot time is part of the billed time. Only Linux on x86_64 is available. There are no Windows, macOS or Arm runners. ## Preinstalled software The base image is the Ubuntu 24.04 cloud image plus these packages and nothing else: `git`, `curl`, `jq`, `unzip`, `zip`, `build-essential`, `docker.io`, `ca-certificates`, `python3`, `python3-pip`. The GitHub Actions runner and its dependencies are installed, and Docker Engine (Ubuntu's `docker.io`) starts at boot. This is a much smaller image than GitHub's `ubuntu-latest`. Install what else you need in the workflow: | You need | Do this | |---|---| | Node.js, Python, Go, Java, .NET, Ruby | `actions/setup-node`, `actions/setup-python`, `actions/setup-go`, `actions/setup-java`, `actions/setup-dotnet`, `ruby/setup-ruby` | | Docker Buildx | `docker/setup-buildx-action` | | Docker Compose | `sudo apt-get update && sudo apt-get install -y docker-compose-v2` | | GitHub CLI (`gh`) | `sudo apt-get update && sudo apt-get install -y gh` | | Other Ubuntu packages | `sudo apt-get update && sudo apt-get install -y ` | JavaScript actions (`uses: actions/...`) work without installing Node.js, because the runner brings its own. Container jobs (`container:`) and service containers (`services:`) run on the preinstalled Docker Engine. Ubuntu 24.04 marks the system Python as externally managed, so a bare `pip install` fails. Use `actions/setup-python`, or create a virtual environment with `python3 -m venv .venv`. ## Network - **Outbound:** the internet, over a shared uplink in Seoul under fair use. VMs have no public address; nothing can connect in. - **Blocked destinations:** private and internal ranges `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `100.64.0.0/10`, `169.254.0.0/16`, except DNS and DHCP from the VM's own gateway. A job cannot reach Kajiya's internal network, other job VMs, or overlay networks that use the `100.64.0.0/10` range (Tailscale, for example). - **Blocked ports:** outbound TCP to ports 3333, 4444, 5555, 7777, 8888, 9999, 14433, 14444, 45700 is dropped for every destination, because those are common cryptocurrency mining pool ports. A test that calls an outside service on one of these ports will time out. Traffic inside the VM (localhost, Docker networks) is not affected. - **Egress address:** jobs reach the internet from the address of the machine that runs them. Kajiya does not publish a fixed list of egress IP addresses. ## Time limits - **58-minute stop.** The runner is stopped after 58 minutes and the VM powers off, so the job does not complete on GitHub. The VM itself has a hard cap of 60 minutes. Split longer work into several jobs: see [Matrix builds and sharding](/docs/guides/matrix-and-sharding). - **4-minute idle stop.** A VM whose runner is not given a job within 4 minutes of starting stops itself and powers off. This happens when the job was cancelled on GitHub while its VM was booting, or when GitHub gave that job to another runner. The VM is billed for the minutes it ran, like any job. - **Queue time on GitHub.** GitHub fails a job that waits for a self-hosted runner for more than 24 hours. Jobs that wait for Kajiya (see [wait reasons](/docs/queue-and-limits#wait-reasons)) are subject to that GitHub limit. ## One VM per job 1. A job with a Kajiya label is queued on GitHub. 2. Kajiya checks your limits, caps and prepaid compute, picks a machine, and asks GitHub for a just-in-time runner registration named `kajiya-` (`-2`, `-3` and so on are added if the job has to be dispatched again because its first machine never started it). The registration works once. 3. The machine boots a new VM from the base image with a fresh copy-on-write disk and hands the registration to the runner. 4. The runner takes one job, runs it, and the VM powers off. 5. The VM and its disk are destroyed. Nothing is reused by the next job, yours or anyone else's. GitHub assigns queued jobs to runners by label. When several jobs with the same label are queued in one repository, the runner Kajiya started for one of them may run another; every queued job still gets its own VM. ### Job states in Kajiya | State | Meaning | Billed | |---|---|---| | `reserved` | A machine was chosen and Kajiya is registering the runner with GitHub | No | | `dispatched` | The runner is registered and the machine is starting the VM | No | | `running` | The VM is running; the billing clock started when it booted | Yes, from VM start | | `done` | The VM powered off and the job was billed | Yes | | `failed` | The VM never started, or the job was released before a machine took it | No | `done` means the VM finished, not that your workflow succeeded: the result of the job is on GitHub. # Billing Kajiya charges $0.0045 per vCPU-hour for every size and tier, billed per started minute, from compute packs you buy in advance. There is no monthly plan, no seat fee and no minimum spend. ## What a job costs A job is billed for its VM's runtime: from the moment the VM starts until it powers off, including boot (about 40 seconds) and shutdown. The runtime is rounded up to whole minutes, with a minimum of one minute per job, like GitHub-hosted runners. > cost = vCPUs × billed minutes × $0.0045 ÷ 60 | Job | Billed | Cost | |---|---|---| | `kajiya-2`, 40 seconds | 1 minute | $0.00015 | | `kajiya-2`, 9 min 10 s | 10 minutes | $0.0015 | | `kajiya-4`, 9 min 10 s | 10 minutes | $0.003 | | `kajiya-8`, 29 min 5 s | 30 minutes | $0.018 | Not billed: - A VM that fails to start. - A job that was released before any machine received it, for example because it was cancelled on GitHub or through Kajiya while it was still waiting for a VM. Such jobs show `not_billed: true`. Billed runtime is capped at 60 minutes per job (jobs are [stopped after 58 minutes](/docs/runners#time-limits)). ## Exact to the micro-dollar Each job's cost is computed exactly and shown in `cost_usd` to the micro-dollar. Your balance is kept as whole cents plus an exact remainder: a job's cost is added to the remainder, whole cents are deducted, and what is left of a cent carries over to the next job. Nothing is rounded up to a cent, so a thousand one-minute `kajiya-2` jobs cost exactly a thousand times $0.00015. `GET /api/v1/account` returns the remaining balance as `balance_usd` and as `vcpu_hours_left`. ## The 10-minute gate A job only starts when your remaining compute covers 10 minutes of it at its size, after setting aside the same 10 minutes for every job that is already starting or running. Each reservation is rounded up to a whole cent. This is a check, not a charge: you pay for the minutes the job actually runs. If the gate fails, the job waits on GitHub with reason `no_credit` and starts as soon as you buy a pack. A job that is already running always finishes, even if it uses more than the balance; the balance can then end slightly below zero and the next pack covers it. ## Compute packs A compute pack is a quantity of prepaid runner time, shown in vCPU-hours. It is not a deposit or stored money: it is non-transferable and has no cash value. | Pack | vCPU-hours | kajiya-2 minutes | |---|--:|--:| | $10 | 2,222 | 66,660 | | $25 | 5,555 | 166,650 | | $50 | 11,111 | 333,330 | | $100 | 22,222 | 666,660 | | $250 | 55,555 | 1,666,650 | - Buy packs in the dashboard under **Billing**, by card. A GitHub repository must be connected first. - Payments are processed by Paddle.com, our Merchant of Record. The pack is added as soon as Paddle confirms the payment. - **Purchase limit:** a new account can buy up to $50 of packs per 24 hours, an established account up to $500 (see [Queue and limits](/docs/queue-and-limits#account-limits) for what makes an account established). A checkout you started counts toward the limit until it is paid or replaced: starting a new checkout cancels the ones you did not finish. The limit is checked again when a payment completes; a payment over it is still credited, but flagged for review and it does not count toward becoming established. - `GET /api/v1/payments` lists your purchases and refunds. ## Expiry Unused compute expires 12 months after your most recent pack purchase. Buying any pack restarts the clock for your whole balance. Compute never expires while one of your jobs is running. ## Refunds - **Unused compute** is refundable within 14 days of purchase. Email hello@vetter-ai.com from your account email with the purchase date and amount; we refund the unused part of that purchase. - **Used compute** is not refundable, including jobs that failed inside your workflow. - Card refunds go back to the original payment method through Paddle. A disputed or charged-back payment removes the same amount of compute from your account. The full terms are in the [refund policy](/refund). ## Taxes, receipts and invoices Paddle.com is the Merchant of Record for every purchase: Paddle sells you the pack, charges your card and issues the receipt or invoice by email. Prices are in US dollars. Paddle adds sales tax, VAT or GST at checkout where it applies to your location, and businesses can enter a tax ID there. Your account is credited with the pack's listed price; tax is not credited as compute. ## Does GitHub charge too? Kajiya runners register with GitHub as self-hosted runners, and GitHub does not bill Actions minutes for jobs on self-hosted runners. GitHub has announced a per-minute platform charge for self-hosted runners and then postponed it; if GitHub introduces it, GitHub would bill it to your GitHub account directly. ## Where to see what you spent - The dashboard's **Jobs** and **Usage** tabs: every job's runtime, billed minutes and cost, and totals by day, repository or label. - `GET /api/v1/usage?group_by=repo` and `GET /api/v1/jobs?format=csv`: see the [API reference](/docs/api/reference#usage). - To stop spend from running away, set [spend caps](/docs/spend-controls). # Queue and limits When a job cannot start yet, Kajiya leaves it queued on GitHub, records why, and starts it as soon as the reason clears. Nothing is dropped and nothing needs to be re-run. This page explains the limits that can hold a job and what to do about each. ## How waiting works - A job that cannot start stays in GitHub's queue. Kajiya lists it with a reason in the dashboard's live queue, in `GET /api/v1/queue`, and sends a `job.waiting` [webhook](/docs/webhooks) when the job first waits or its reason changes. - Kajiya re-checks every repository with waiting jobs every 10 seconds, whether it uses webhooks or polling. - Jobs start in the order Kajiya checks them; there is no priority between repositories. - GitHub fails a job that waits for a self-hosted runner for more than 24 hours. Kajiya cannot extend that. ## Account limits Every account has a concurrency limit, counted in vCPUs of jobs that are starting or running, and a limit on compute packs bought per 24 hours. | | New account | Established account | |---|--:|--:| | vCPUs at once | 4 | 32 | | Compute packs per 24 hours | $50 | $500 | An account is established when all of these are true: - a GitHub repository is connected, - your first paid pack is at least 7 days old (a pack that was refunded in full, charged back, or bought over the purchase limit does not count), - no card payment of the account is charged back, and - your GitHub account is at least 30 days old. With a limit of 4 vCPUs, a new account runs two `kajiya-2` jobs or one `kajiya-4` job at a time, and cannot run `kajiya-8` at all: those jobs wait with reason `limit` until the account is established. `GET /api/v1/account` shows `limits.established` and `concurrency.limit_vcpu`. Need more than 32 vCPUs at once? Email hello@vetter-ai.com; the limit can be raised per account. ## Per-repository caps A repository cap limits how many vCPUs one repository may use at once, so a busy monorepo cannot take your whole account limit. Set **Max vCPU** on the repository in the dashboard, or: ```bash curl -X PATCH "https://kajiya.app/api/v1/repos/3" \ -H "Authorization: Bearer $KAJIYA_API_KEY" -H "Content-Type: application/json" \ -d '{"max_vcpu": 16}' ``` The cap is an integer of at least 2, or `null` for no cap. Keep it at least as large as the biggest job in that repository: with `max_vcpu: 2`, `kajiya-4` jobs of that repository never start. ## Pausing a repository A paused repository starts no new jobs; jobs that are already running finish. New jobs wait with reason `paused` and start when you resume. Pause in the dashboard, or send `{"paused": true}` (and later `{"paused": false}`) to `PATCH /api/v1/repos/{id}`. ## Wait reasons Kajiya checks these in order and reports the first one that holds the job. | Reason | What it means | What to do | |---|---|---| | `paused` | The repository is paused in Kajiya. | Resume it. | | `limit` | Your running jobs plus this one would exceed the account's vCPU limit. | Nothing: the job starts when running jobs finish. On a new account, `kajiya-8` waits until the account is established. | | `repo_limit` | This repository's running jobs plus this one would exceed its `max_vcpu` cap. | Wait, or raise the cap. Make sure the cap is not smaller than the job's size. | | `no_credit` | Your remaining compute does not cover 10 minutes of this job after the jobs in flight ([the gate](/docs/billing#the-10-minute-gate)). | Buy a compute pack. | | `daily_cap` | Starting the job could exceed your daily spend cap. | Wait for the next UTC day, or raise the cap. | | `monthly_cap` | Starting the job could exceed your monthly spend cap. | Wait for the next UTC month, or raise the cap. | | `no_host` | No machine has free room for this size (or for the pinned tier). | Nothing: the job starts when capacity frees up. Remove a tier pin if you do not need it. | ## Seeing the queue ```bash curl -s "https://kajiya.app/api/v1/queue" -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ```json { "limit_vcpu": 32, "in_use_vcpu": 6, "fleet": { "sellable_vcpu": 96, "free_vcpu": 40 }, "active": [ { "id": 1290, "repo": "acme/api", "name": "build", "label": "kajiya-4", "state": "running", "created_at": "2026-12-04T09:20:01.000Z", "started_at": "2026-12-04T09:20:07.000Z", "github_url": "https://github.com/acme/api/actions/runs/12045570001/job/33861290001" }, { "id": 1291, "repo": "acme/web", "name": "lint", "label": "kajiya-2", "state": "dispatched", "created_at": "2026-12-04T09:20:12.000Z", "started_at": null, "github_url": "https://github.com/acme/web/actions/runs/12045571234/job/33861299870" } ], "waiting": [ { "repo": "acme/web", "name": "e2e (1)", "label": "kajiya-8", "reason": "repo_limit", "message": "This repository's concurrency cap is reached; starts when its running jobs finish.", "waiting_since": "2026-12-04T09:20:15.000Z", "last_checked": "2026-12-04T09:21:05.000Z", "github_url": "https://github.com/acme/web/actions/runs/12045571234/job/33861299871" } ] } ``` `fleet.free_vcpu` is the free capacity across all Kajiya machines right now; the [status page](/status) shows the same number. ## Other limits | Limit | Value | |---|---| | Job runtime | stopped after 58 minutes | | API requests | 1,200 per minute per account | | API keys | 100 active keys per account | | Connected repositories | 500 per account | | Repositories per bulk connect request | 200 | | Waiting time on GitHub | 24 hours (GitHub's limit for self-hosted runners) | # Spend controls Prepaid packs already bound what you can spend. Spend caps and the low-balance alert let you bound it per day and per month, and hear about it before compute runs out. Set them in the dashboard under **Limits & alerts**, or with `PATCH /api/v1/settings` and an `admin` key. ## Daily and monthly caps A cap is a dollar amount per UTC day (`daily_cap_usd`) or per UTC calendar month (`monthly_cap_usd`). Before a job starts, Kajiya adds up: 1. the cost of your jobs that finished since the start of the day or month, 2. 10 minutes at their size for every job that is starting or running, and 3. 10 minutes of the new job. If the sum is above the cap, the job waits on GitHub with reason `daily_cap` or `monthly_cap` and starts by itself when the next UTC day or month begins, or as soon as you raise the cap. A cap decides whether jobs start; it does not stop jobs that are running. A running job can run longer than its 10-minute reservation, so a day's spend can end above the cap by up to what the jobs running at that moment cost. - `0` holds every new job: an emergency stop that leaves running jobs alone. - `null` (an empty field in the dashboard) removes the cap. - Amounts can be from 0 to 1,000,000 dollars. ```bash # a $25 daily and $400 monthly cap curl -X PATCH "https://kajiya.app/api/v1/settings" \ -H "Authorization: Bearer $KAJIYA_ADMIN_KEY" -H "Content-Type: application/json" \ -d '{"daily_cap_usd": 25, "monthly_cap_usd": 400}' # stop new jobs now curl -X PATCH "https://kajiya.app/api/v1/settings" \ -H "Authorization: Bearer $KAJIYA_ADMIN_KEY" -H "Content-Type: application/json" \ -d '{"daily_cap_usd": 0}' # remove the daily cap again curl -X PATCH "https://kajiya.app/api/v1/settings" \ -H "Authorization: Bearer $KAJIYA_ADMIN_KEY" -H "Content-Type: application/json" \ -d '{"daily_cap_usd": null}' ``` When a cap first holds a job in a day or month, Kajiya sends one `spend_cap.reached` [webhook](/docs/webhooks) for it, plus a `job.waiting` event for each job it holds. Changing a cap re-arms the `spend_cap.reached` event, and waiting jobs are re-checked within 10 seconds. ## Low-balance alert Set `low_balance_usd` (dashboard: **Low-balance alert below**) to get a `balance.low` webhook when your remaining compute drops below that amount. Kajiya checks after each job finishes and sends the event once; it is sent again only after you buy a pack and the balance drops below the threshold again. Changing the threshold re-arms it. Kajiya does not send email. To be alerted, set a [webhook URL](/docs/webhooks) and forward `balance.low` and `spend_cap.reached` to your chat or paging tool. The dashboard also warns when, at your 7-day average, the balance lasts less than three days. ## What happens to running jobs Nothing stops a job that is already running except its own end, the [58-minute limit](/docs/runners#time-limits), or a cancel: not a cap, not an empty balance, not pausing the repository, not a lower concurrency limit. These only hold new jobs. To stop running work, cancel its run in the dashboard, on GitHub, or with `POST /api/v1/jobs/{id}/cancel`. ## Watching spend ```bash curl -s "https://kajiya.app/api/v1/account" -H "Authorization: Bearer $KAJIYA_API_KEY" | jq '{balance_usd, spend, caps}' ``` `spend.today_usd` and `spend.month_usd` use the same UTC periods as the caps. `spend.est_days_left` divides the balance by the average daily spend of the last 7 days. # Security How Kajiya keeps jobs apart, what it stores, and what you should configure on your side. ## One VM per job - Every job runs in its own KVM virtual machine, booted fresh from a read-only base image with a new copy-on-write disk. - When the job ends the VM is powered off and destroyed together with its disk. Nothing is reused: no workspace, cache, disk or memory is carried to another job, yours or another customer's. - Each VM gets 2 GB of memory per vCPU that no other VM uses. - Kajiya installs no SSH keys and runs no agent of its own inside job VMs; the VM runs the GitHub Actions runner and your job. ## Network isolation Job VMs reach the internet only. Outbound traffic to private and internal ranges (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `100.64.0.0/10`, `169.254.0.0/16`) is dropped, so a job cannot reach Kajiya's own network or another job's VM. Outbound TCP to common mining pool ports (3333, 4444, 5555, 7777, 8888, 9999, 14433, 14444, 45700) is dropped too. Nothing can connect into a job VM from outside. See [Runners → Network](/docs/runners#network). ## Credentials | What | Where it lives | Protection | |---|---|---| | GitHub App access | GitHub issues Kajiya installation tokens that expire after an hour; they stay on the control server | Never sent to a job VM | | Fine-grained GitHub tokens | Kajiya's control server | Encrypted at rest (AES-256-GCM); never sent to a job VM | | Runner registration | The job's VM | A just-in-time registration that works once, for one runner | | Kajiya API keys | Shown to you once | Only a SHA-256 hash is stored; scoped; revocable; optional expiry | | Dashboard sessions | Your browser's local storage | Only a hash is stored on the server; a session expires after 90 days; signing out ends it, and `DELETE /api/v1/sessions` ends all of them | | Webhook signing secret | Kajiya's control server | Encrypted at rest; shown once; rotatable | Signing in with GitHub uses the `read:user` and `user:email` scopes, reads your profile once, and discards GitHub's access token. ## Secrets in your workflows GitHub delivers your repository and organization secrets to the runner inside the job's VM, the same way as on GitHub-hosted runners. They exist only in that VM, which is destroyed when the job ends; Kajiya's control server never receives them. As with any hosted runner, Kajiya operates the hardware your VM runs on. Use the least-privileged secrets a job needs, and prefer short-lived credentials (for example OpenID Connect to your cloud provider) over long-lived keys. ## Public repositories and forks On a public repository, anyone can open a pull request whose workflow runs on your runners, and on your compute packs. Each job still runs in a throwaway VM, but you should decide who may run code there: - In the repository's or organization's **Settings → Actions → General**, require approval before fork pull request workflows run (for example, for all external contributors). - Do not run untrusted pull request code in `pull_request_target` workflows, which have access to secrets. - Set a [daily spend cap](/docs/spend-controls) so a burst of unexpected runs cannot exhaust your balance. ## Outbound webhooks Kajiya only sends webhooks to public `https` URLs and resolves the host again right before each delivery, refusing private and internal addresses. Every delivery is signed with HMAC-SHA256 and a timestamp; see [verifying signatures](/docs/webhooks#verifying-signatures). ## Where data is Machines and the control server are in the Republic of Korea. Kajiya stores account details, repository names, job metadata (names, sizes, times, costs) and payment records; job contents exist only inside the job's VM. Card details are handled by Paddle. The [privacy policy](/privacy) lists processors and retention. ## Acceptable use Kajiya is for continuous integration and build jobs. Cryptocurrency mining and proof-of-work, password cracking, attacks or stress tests against third parties, and persistent servers are prohibited ([terms](/terms#acceptable-use)). ## Reporting a vulnerability Email hello@vetter-ai.com with the details. We reply within 2 business days. # API overview Everything the dashboard does is available over a JSON API, for scripts, CI tooling and fleets of coding agents. This page covers the conventions; the [API reference](/docs/api/reference) lists every operation, and the [OpenAPI 3.1 description](/api/v1/openapi.json) is machine-readable. ## Base URL ```text https://kajiya.app/api/v1 ``` Requests and responses are JSON (`Content-Type: application/json` on requests with a body). A few list endpoints can also return CSV. ## Authentication Send an API key as a bearer token with every request: ```bash curl -s "https://kajiya.app/api/v1/account" -H "Authorization: Bearer $KAJIYA_API_KEY" ``` Create keys in the dashboard under **API keys**, or with `POST /api/v1/keys` and an existing `admin` key. A key starts with `kjk_` and is shown once, when it is created; Kajiya only stores a hash of it. The dashboard's own session token also works as a bearer token, with `admin` scope. `DELETE /api/v1/sessions` signs out every browser session of the account at once. Accounts that were given an account token (`kjt_...`) can replace it with `POST /api/v1/account/token` or revoke it with `DELETE /api/v1/account/token`, called with a session or an `admin` key. | Key field | Notes | |---|---| | `name` | Required, up to 80 characters. Name the agent, script or machine that uses it. | | `scope` | `read`, `write` or `admin` (below). | | `expires_in_days` | Optional, 1 to 3650. Without it the key does not expire. | | `prefix` | The first 12 characters, shown in lists so you can tell keys apart. | | `last_used_at` | Updated at most once a minute. | An account can have up to 100 active keys. Revoke a key in the dashboard or with `DELETE /api/v1/keys/{id}`; it stops working immediately. A key cannot revoke itself. ## Scopes Each scope includes the ones before it. | Scope | Allows | |---|---| | `read` | Account, queue, jobs, usage, repositories, settings, webhook deliveries, payments | | `write` | Also: connect, disconnect, pause, cap and sync repositories; cancel jobs | | `admin` | Also: create, list and revoke API keys; change spend caps, the low-balance alert and the webhook URL; rotate the webhook secret; send test events | Give each agent or machine its own key with the smallest scope it needs. A key with too small a scope gets `403` with a message naming the scope it needs. ## Rate limit Each account may make 1,200 requests per minute, shared by all of its keys and the dashboard. The window is the calendar minute. Over the limit, Kajiya answers `429` with a `Retry-After` header: the number of seconds until the next minute starts. ```bash status=$(curl -s -o body.json -w '%{http_code}' -D headers.txt "https://kajiya.app/api/v1/queue" -H "Authorization: Bearer $KAJIYA_API_KEY") if [ "$status" = 429 ]; then sleep "$(grep -i '^retry-after:' headers.txt | tr -dc '0-9')"; fi ``` ## Errors Errors are JSON with one human-readable `error` string, and the status code tells you the kind: ```json { "error": "This API key has the \"read\" scope; this action needs \"write\"." } ``` | Status | Meaning | |---|---| | `400` | A parameter or the body is invalid. The message names the field. | | `401` | Missing, unknown, revoked or expired key. | | `403` | The key's scope is too small. | | `404` | No such object on your account (or no such endpoint). | | `409` | The object is in a state that does not allow this, for example cancelling a job that already finished. | | `429` | Rate limit; wait `Retry-After` seconds. | | `502` | GitHub could not be reached or refused the call Kajiya made for you. | | `500` | Something went wrong on Kajiya's side. Retrying later is safe for reads. | ## Data formats - **Times** are ISO 8601 in UTC, for example `2026-12-04T09:12:09.000Z`. Query parameters such as `since` and `until` accept `YYYY-MM-DD` (UTC midnight) or a full ISO timestamp. - **Money** is US dollars as a JSON number, exact to the micro-dollar (`0.0021`), never cents. - **Ids** are integers. `github_run_id` and `github_job_id` are GitHub's ids, and `github_url` links to the job on GitHub. - New fields may be added to responses. Ignore fields you do not know. ## Pagination `GET /api/v1/jobs` returns the newest jobs first, `limit` at a time (default 50, at most 500), and a `next_before` cursor. Pass it as `before` to get the next, older page; it is `null` on the last page. ```bash before="" while :; do page=$(curl -s "https://kajiya.app/api/v1/jobs?limit=500&since=2026-12-01${before:+&before=$before}" \ -H "Authorization: Bearer $KAJIYA_API_KEY") echo "$page" | jq -c '.jobs[]' before=$(echo "$page" | jq -r '.next_before // empty') [ -z "$before" ] && break done ``` ## CSV exports Add `format=csv` to `GET /api/v1/jobs` (up to 10,000 rows per request) or `GET /api/v1/usage` to get a CSV file. Cells that a spreadsheet would treat as a formula are prefixed with `'`. ```bash curl -s "https://kajiya.app/api/v1/usage?group_by=repo&since=2026-12-01&format=csv" \ -H "Authorization: Bearer $KAJIYA_API_KEY" -o kajiya-usage.csv ``` ## Retrying safely - Every `GET` is safe to repeat. - `POST /api/v1/repos` is safe to repeat: a repository that is already connected comes back as `updated`. - `POST /api/v1/jobs/{id}/cancel` answers `409` once the job is finished, so a repeated cancel does no harm. - Changing settings with `PATCH` sets values; repeating it gives the same result. ## A minimal TypeScript client ```ts const BASE = "https://kajiya.app/api/v1"; export async function kajiya(path: string, init: RequestInit = {}): Promise { for (;;) { const res = await fetch(BASE + path, { ...init, headers: { authorization: `Bearer ${process.env.KAJIYA_API_KEY}`, ...(init.body ? { "content-type": "application/json" } : {}), ...init.headers, }, }); if (res.status === 429) { await new Promise((r) => setTimeout(r, Number(res.headers.get("retry-after") ?? 5) * 1000)); continue; } const body = await res.json(); if (!res.ok) throw new Error(`Kajiya ${res.status}: ${body.error}`); return body as T; } } const account = await kajiya<{ balance_usd: number; concurrency: { limit_vcpu: number } }>("/account"); console.log(account.balance_usd, account.concurrency.limit_vcpu); ``` CSV responses are text, so read them with `res.text()` instead of this helper. # API reference Every operation of the Kajiya API, generated from the [OpenAPI 3.1 description](/api/v1/openapi.json). Base URL `https://kajiya.app`. Send `Authorization: Bearer ` with every request; the scope each operation needs is listed with it. Read the [API overview](/docs/api) first for keys, rate limits, pagination and errors. | Method | Path | Scope | Summary | |---|---|---|---| | GET | [`/api/v1/account`](#get-api-v1-account) | `read` | Balance, spend, concurrency, caps | | GET | [`/api/v1/queue`](#get-api-v1-queue) | `read` | Running jobs and jobs waiting to start, with the reason | | GET | [`/api/v1/jobs`](#get-api-v1-jobs) | `read` | List jobs (newest first) | | GET | [`/api/v1/jobs/{id}`](#get-api-v1-jobs-id) | `read` | One job | | POST | [`/api/v1/jobs/{id}/cancel`](#post-api-v1-jobs-id-cancel) | `write` | Cancel a job's workflow run on GitHub | | GET | [`/api/v1/usage`](#get-api-v1-usage) | `read` | Usage and cost, grouped by day, repository or label | | GET | [`/api/v1/repos`](#get-api-v1-repos) | `read` | Connected repositories with dispatch mode, caps and 30-day cost | | POST | [`/api/v1/repos`](#post-api-v1-repos) | `write` | Connect one, many, or all repositories with one GitHub token | | PATCH | [`/api/v1/repos/{id}`](#patch-api-v1-repos-id) | `write` | Pause/resume or cap a repository's concurrent vCPUs | | DELETE | [`/api/v1/repos/{id}`](#delete-api-v1-repos-id) | `write` | Disconnect a repository (history is kept) | | POST | [`/api/v1/repos/{id}/sync`](#post-api-v1-repos-id-sync) | `write` | Check GitHub for queued jobs now | | GET | [`/api/v1/keys`](#get-api-v1-keys) | `admin` | List active API keys | | POST | [`/api/v1/keys`](#post-api-v1-keys) | `admin` | Create an API key (returned once) | | DELETE | [`/api/v1/keys/{id}`](#delete-api-v1-keys-id) | `admin` | Revoke an API key | | GET | [`/api/v1/settings`](#get-api-v1-settings) | `read` | Spend caps, low-balance threshold, webhook URL | | PATCH | [`/api/v1/settings`](#patch-api-v1-settings) | `admin` | Update spend caps, low-balance threshold or webhook URL | | POST | [`/api/v1/webhook/rotate-secret`](#post-api-v1-webhook-rotate-secret) | `admin` | Issue a new webhook signing secret (returned once) | | POST | [`/api/v1/webhook/test`](#post-api-v1-webhook-test) | `admin` | Queue a `test` event to your webhook | | GET | [`/api/v1/webhook/deliveries`](#get-api-v1-webhook-deliveries) | `read` | Last 50 webhook deliveries with status and errors | | GET | [`/api/v1/payments`](#get-api-v1-payments) | `read` | Compute pack purchases | | GET | [`/api/v1/usage/daily`](#get-api-v1-usage-daily) | `read` | Cost per UTC day, split by repository or label | | GET | [`/api/v1/concurrency`](#get-api-v1-concurrency) | `read` | vCPUs in use over the last hours | | GET | [`/api/v1/activity`](#get-api-v1-activity) | `read` | Recent job events and current waits | | GET | [`/api/v1/repos/{id}/workflows`](#get-api-v1-repos-id-workflows) | `read` | The repository's workflow files, with links to edit them on GitHub | | GET | [`/api/v1/github/installations`](#get-api-v1-github-installations) | `read` | GitHub App installations linked to your account | | DELETE | [`/api/v1/github/installations/{id}`](#delete-api-v1-github-installations-id) | `write` | Stop using a GitHub App installation | | POST | [`/api/v1/github/installations/{id}/sync`](#post-api-v1-github-installations-id-sync) | `write` | Re-read an installation's repositories from GitHub now | | DELETE | [`/api/v1/sessions`](#delete-api-v1-sessions) | `admin` | Sign out everywhere | | POST | [`/api/v1/account/token`](#post-api-v1-account-token) | `admin` | Replace the legacy account token (returned once) | | DELETE | [`/api/v1/account/token`](#delete-api-v1-account-token) | `admin` | Revoke the legacy account token | ## Account Balance, spend, limits and the live queue. ### GET /api/v1/account **Balance, spend, concurrency, caps.** Scope: `read`. One call that tells a script or agent how much it may run: balance, the concurrency limit and what is in use, spend so far and the caps. #### Response 200 Account. ```json { "id": 42, "email": "dev@acme.dev", "github_login": "acme-dev", "balance_usd": 18.734512, "vcpu_hours_left": 4163.22, "rate_per_vcpu_hour_usd": 0.0045, "spend": { "today_usd": 0.4215, "month_usd": 6.2655, "last_7d_usd": 3.1185, "last_30d_usd": 6.2655, "avg_daily_7d_usd": 0.4455, "est_days_left": 42 }, "concurrency": { "limit_vcpu": 32, "in_use_vcpu": 6, "active_jobs": 2, "waiting_jobs": 1 }, "limits": { "max_vcpu": 32, "daily_pack_usd": 500, "established": true, "has_repo": true }, "caps": { "daily_usd": 25, "monthly_usd": 400, "low_balance_usd": 5 }, "auth": { "via": "key", "scope": "read" } } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/account" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### GET /api/v1/queue **Running jobs and jobs waiting to start, with the reason.** Scope: `read`. Use this to see why a job is not starting (concurrency limit, repository cap, paused repository, prepaid compute, spend cap, or no free runner). Waiting jobs stay queued on GitHub and start by themselves when the reason clears. #### Response 200 Queue. ```json { "limit_vcpu": 32, "in_use_vcpu": 6, "fleet": { "sellable_vcpu": 96, "free_vcpu": 40 }, "active": [ { "id": 1290, "repo": "acme/api", "name": "build", "label": "kajiya-4", "state": "running", "created_at": "2026-12-04T09:20:01.000Z", "started_at": "2026-12-04T09:20:07.000Z", "github_url": "https://github.com/acme/api/actions/runs/12045570001/job/33861290001" }, { "id": 1291, "repo": "acme/web", "name": "lint", "label": "kajiya-2", "state": "dispatched", "created_at": "2026-12-04T09:20:12.000Z", "started_at": null, "github_url": "https://github.com/acme/web/actions/runs/12045571234/job/33861299870" } ], "waiting": [ { "repo": "acme/web", "name": "e2e (1)", "label": "kajiya-8", "reason": "repo_limit", "message": "This repository's concurrency cap is reached; starts when its running jobs finish.", "waiting_since": "2026-12-04T09:20:15.000Z", "last_checked": "2026-12-04T09:21:05.000Z", "github_url": "https://github.com/acme/web/actions/runs/12045571234/job/33861299871" } ] } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/queue" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### GET /api/v1/concurrency **vCPUs in use over the last hours.** Scope: `read`. Average number of vCPUs running in each time bucket (about 120 buckets, at least one minute each). Running jobs count up to now. #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `hours` | query | integer | no | Default `6` | #### Response 200 Concurrency. ```json { "since": "2026-12-04T03:21:00.000Z", "until": "2026-12-04T09:21:40.000Z", "step_seconds": 180, "limit_vcpu": 32, "running_vcpu": 6, "points": [ { "t": "2026-12-04T09:15:00.000Z", "vcpu": 4.5 }, { "t": "2026-12-04T09:18:00.000Z", "vcpu": 6 } ] } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/concurrency" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ## Jobs Jobs Kajiya ran or is running, and cancelling them. ### GET /api/v1/jobs **List jobs (newest first).** Scope: `read`. Cursor pagination: pass `next_before` from a page as `before` to get the next (older) page; it is null on the last page. #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `state` | query | string | no | `active` (reserved, dispatched, running), or a comma list of reserved, dispatched, running, done, failed | | `repo` | query | string | no | Only this repository, `owner/name` (case-insensitive) | | `since` | query | string | no | Created at or after: `YYYY-MM-DD` (UTC midnight) or an ISO timestamp | | `until` | query | string | no | Created before: `YYYY-MM-DD` or an ISO timestamp | | `limit` | query | integer | no | Page size (JSON). With format=csv: up to 10,000, default 10,000. Default `50` | | `before` | query | integer | no | Cursor: only jobs with a smaller id; pass `next_before` from the previous page | | `format` | query | `json`, `csv` | no | `csv` returns a file with one row per job. Default `json` | #### Response 200 Jobs. ```json { "jobs": [ { "id": 1287, "repo": "acme/api", "name": "test (3)", "label": "kajiya-4", "vcpu": 4, "state": "done", "runtime_seconds": 412, "billed_seconds": 420, "cost_usd": 0.0021, "not_billed": false, "created_at": "2026-12-04T09:12:03.000Z", "started_at": "2026-12-04T09:12:09.000Z", "finished_at": "2026-12-04T09:19:01.000Z", "github_run_id": 12045567890, "github_job_id": 33861234567, "github_url": "https://github.com/acme/api/actions/runs/12045567890/job/33861234567" } ], "next_before": 1286 } ``` With `format=csv` (`text/csv`): ```csv id,created_at,finished_at,repo,name,label,state,runtime_seconds,billed_seconds,cost_usd,not_billed,github_url 1287,2026-12-04T09:12:03.000Z,2026-12-04T09:19:01.000Z,acme/api,test (3),kajiya-4,done,412,420,0.0021,false,https://github.com/acme/api/actions/runs/12045567890/job/33861234567 ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/jobs?state=done%2Cfailed&repo=acme%2Fapi&since=2026-12-01" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### GET /api/v1/jobs/{id} **One job.** Scope: `read`. #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `id` | path | integer | yes | Job id | #### Response 200 Job. ```json { "id": 1287, "repo": "acme/api", "name": "test (3)", "label": "kajiya-4", "vcpu": 4, "state": "done", "runtime_seconds": 412, "billed_seconds": 420, "cost_usd": 0.0021, "not_billed": false, "created_at": "2026-12-04T09:12:03.000Z", "started_at": "2026-12-04T09:12:09.000Z", "finished_at": "2026-12-04T09:19:01.000Z", "github_run_id": 12045567890, "github_job_id": 33861234567, "github_url": "https://github.com/acme/api/actions/runs/12045567890/job/33861234567" } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `404` No such object on this account - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/jobs/1287" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### POST /api/v1/jobs/{id}/cancel **Cancel a job's workflow run on GitHub.** Scope: `write`. GitHub cancels the whole workflow run (GitHub has no per-job cancel). A job no runner machine has received yet is released and never billed (`billed: false`); otherwise the VM is billed for the minutes it ran. Needs the repository token to have Actions: Read and write (or the GitHub App installation). #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `id` | path | integer | yes | Job id | #### Response 200 Cancelled. ```json { "ok": true, "cancelled_run_id": 12045570001, "billed": false, "note": "GitHub cancels the whole workflow run. This job had not reached a machine and is not billed." } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `404` No such object on this account - `409` The object is in a state that does not allow this - `429` Too many requests this minute - `502` GitHub could not be reached or refused the call #### Example ```bash curl -X POST "https://kajiya.app/api/v1/jobs/1287/cancel" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### GET /api/v1/activity **Recent job events and current waits.** Scope: `read`. Newest first: `job.dispatched`, `job.started`, `job.finished` (with runtime and cost) for your latest 500 jobs, and `job.waiting` for jobs that wait right now (with the reason). #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `limit` | query | integer | no | Default `30` | #### Response 200 Activity. ```json { "events": [ { "type": "job.finished", "at": "2026-12-04T09:19:01.000Z", "job_id": 1042, "repo": "acme/api", "name": "test (3)", "label": "kajiya-4", "state": "done", "runtime_seconds": 402, "cost_usd": 0.0021, "not_billed": false, "github_url": "https://github.com/acme/api/actions/runs/7001/job/9001" }, { "type": "job.waiting", "at": "2026-12-04T09:18:40.000Z", "job_id": null, "repo": "acme/web", "name": "e2e", "label": "kajiya-8", "state": "waiting", "reason": "limit", "message": "Account concurrency limit reached; starts when your running jobs finish.", "github_url": "https://github.com/acme/web/actions/runs/7002/job/9002" } ] } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/activity" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ## Usage Usage and cost reports. ### GET /api/v1/usage **Usage and cost, grouped by day, repository or label.** Scope: `read`. Counts jobs that finished in [since, until). The range can be at most 400 days. Rows are sorted by day, or by cost (highest first) for repo and label. #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `since` | query | string | no | `YYYY-MM-DD` or ISO time. Default: 30 days before `until` | | `until` | query | string | no | `YYYY-MM-DD` or ISO time (exclusive). Default: end of today (UTC) | | `group_by` | query | `day`, `repo`, `label` | no | Row key: UTC day, `owner/name`, or `kajiya-N`. Default `day` | | `format` | query | `json`, `csv` | no | `csv` returns the rows (no total) as a file. Default `json` | #### Response 200 Usage. ```json { "since": "2026-11-04T00:00:00.000Z", "until": "2026-12-05T00:00:00.000Z", "group_by": "repo", "rows": [ { "key": "acme/api", "jobs": 412, "failed_jobs": 1, "billed_minutes": 3120, "vcpu_hours": 208, "cost_usd": 0.936 }, { "key": "acme/web", "jobs": 160, "failed_jobs": 0, "billed_minutes": 900, "vcpu_hours": 30, "cost_usd": 0.135 } ], "total": { "jobs": 572, "failed_jobs": 1, "billed_minutes": 4020, "vcpu_hours": 238, "cost_usd": 1.071 } } ``` With `format=csv` (`text/csv`): ```csv key,jobs,failed_jobs,billed_minutes,vcpu_hours,cost_usd acme/api,412,1,3120,208,0.936 acme/web,160,0,900,30,0.135 ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/usage?since=2026-11-01" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### GET /api/v1/usage/daily **Cost per UTC day, split by repository or label.** Scope: `read`. One row per day of the range (days without jobs included, with zeros), each with the cost per repository or label in `by`. `keys` lists every repository or label of the range, most expensive first. Only finished jobs count. #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `days` | query | integer | no | Days up to and including today (UTC). Default `30` | | `group_by` | query | `repo`, `label` | no | Default `repo` | #### Response 200 Daily usage. ```json { "since": "2026-12-03T00:00:00.000Z", "until": "2026-12-05T00:00:00.000Z", "group_by": "repo", "keys": [ { "key": "acme/api", "cost_usd": 0.4185 }, { "key": "acme/web", "cost_usd": 0.072 } ], "days": [ { "day": "2026-12-03", "jobs": 31, "vcpu_hours": 52, "cost_usd": 0.234, "by": { "acme/api": 0.198, "acme/web": 0.036 } }, { "day": "2026-12-04", "jobs": 27, "vcpu_hours": 57, "cost_usd": 0.2565, "by": { "acme/api": 0.2205, "acme/web": 0.036 } } ], "total_usd": 0.4905 } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/usage/daily" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ## Repositories Connected repositories, caps and pausing. ### GET /api/v1/repos **Connected repositories with dispatch mode, caps and 30-day cost.** Scope: `read`. #### Response 200 Repositories. ```json { "repos": [ { "id": 3, "full_name": "acme/api", "dispatch": "webhook", "dispatch_note": null, "paused": false, "max_vcpu": 16, "running_vcpu": 4, "waiting_jobs": 0, "jobs_30d": 412, "cost_30d_usd": 0.936, "last_event_at": "2026-12-04T09:20:01.000Z", "last_polled_at": "2026-12-04T09:17:44.000Z", "last_error": null, "connected_at": "2026-11-02T03:15:22.000Z" } ] } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/repos" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### POST /api/v1/repos **Connect one, many, or all repositories with one GitHub token.** Scope: `write`. Send `github_token` and exactly one of `repo`, `repos` (up to 200), `owner` (every repository of an organization the token administers) or `all: true` (everything the token administers). The token needs Administration: Read and write (to register one-time runners); with Webhooks: Read and write Kajiya also installs a workflow_job webhook so jobs start within seconds. Re-sending a connected repository updates its token. Status: 201 when at least one repository was connected or updated, 400 when the single `repo` failed, otherwise 200 with per-repository results. #### Request body | Field | Type | Required | Description | |---|---|---|---| | `github_token` | string | yes | Fine-grained personal access token (github_pat_...) | | `repo` | string | no | One repository, owner/name | | `repos` | array of string | no | A list of owner/name. up to 200 items | | `owner` | string | no | Every repository of this organization the token administers | | `all` | boolean | no | Every repository the token administers | ```json { "github_token": "github_pat_11ABCDEFG0123456789_abcdefghijklmnopqrstuvwxyz", "owner": "acme" } ``` #### Response 200 Nothing connected; see results. ```json { "summary": { "connected": 0, "updated": 0, "skipped": 1, "error": 1 }, "results": [ { "repo": "acme/docs", "status": "skipped", "message": "Token has no admin permission here." }, { "repo": "acme/private", "status": "error", "message": "GitHub 404: Not Found" } ] } ``` #### Response 201 At least one connected or updated. ```json { "summary": { "connected": 2, "updated": 0, "skipped": 2, "error": 0 }, "results": [ { "repo": "acme/api", "status": "connected", "id": 3, "dispatch": "webhook" }, { "repo": "acme/web", "status": "connected", "id": 4, "dispatch": "webhook" }, { "repo": "acme/docs", "status": "skipped", "message": "Token has no admin permission here." }, { "repo": "acme/legacy", "status": "skipped", "message": "Archived." } ] } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute - `502` GitHub could not be reached or refused the call #### Example ```bash curl -X POST "https://kajiya.app/api/v1/repos" \ -H "Authorization: Bearer $KAJIYA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"github_token":"github_pat_11ABCDEFG0123456789_abcdefghijklmnopqrstuvwxyz","owner":"acme"}' ``` ### PATCH /api/v1/repos/{id} **Pause/resume or cap a repository's concurrent vCPUs.** Scope: `write`. Send either field or both. `max_vcpu: null` removes the cap. Waiting jobs are re-checked on the next poll. #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `id` | path | integer | yes | Repository id | #### Request body | Field | Type | Required | Description | |---|---|---|---| | `paused` | boolean | no | | | `max_vcpu` | integer or null | no | min 2, max 10000 | ```json { "max_vcpu": 16 } ``` #### Response 200 Updated. ```json { "id": 3, "full_name": "acme/api", "paused": false, "max_vcpu": 16 } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `404` No such object on this account - `429` Too many requests this minute #### Example ```bash curl -X PATCH "https://kajiya.app/api/v1/repos/3" \ -H "Authorization: Bearer $KAJIYA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"max_vcpu":16}' ``` ### DELETE /api/v1/repos/{id} **Disconnect a repository (history is kept).** Scope: `write`. Stops dispatching for the repository and deletes the webhook Kajiya created on it, when the token still allows that. Job history stays. #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `id` | path | integer | yes | Repository id | #### Response 200 Removed. ```json { "ok": true } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `404` No such object on this account - `429` Too many requests this minute #### Example ```bash curl -X DELETE "https://kajiya.app/api/v1/repos/3" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### POST /api/v1/repos/{id}/sync **Check GitHub for queued jobs now.** Scope: `write`. Polls this repository immediately instead of waiting for the next scheduled check, for example after replacing its token. #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `id` | path | integer | yes | Repository id | #### Response 200 Polled. ```json { "dispatched": 1, "last_error": null } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `404` No such object on this account - `429` Too many requests this minute #### Example ```bash curl -X POST "https://kajiya.app/api/v1/repos/3/sync" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### GET /api/v1/repos/{id}/workflows **The repository's workflow files, with links to edit them on GitHub.** Scope: `read`. Use the links to change `runs-on` to a Kajiya label. When the repository has no workflow yet, `new_workflow_url` opens GitHub's editor with a starter workflow. If GitHub cannot be reached, `workflows` is empty and `error` says why. #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `id` | path | integer | yes | Repository id | #### Response 200 Workflows. ```json { "repo": "acme/api", "workflows": [ { "name": "CI", "path": ".github/workflows/ci.yml", "html_url": "https://github.com/acme/api/blob/main/.github/workflows/ci.yml", "edit_url": "https://github.com/acme/api/edit/main/.github/workflows/ci.yml" } ], "new_workflow_url": null, "actions_url": "https://github.com/acme/api/actions" } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `404` No such object on this account - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/repos/3/workflows" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### GET /api/v1/github/installations **GitHub App installations linked to your account.** Scope: `read`. Installations of the Kajiya CI GitHub App that this account uses, with how many repositories each connects. `app.enabled` is false when the server has no GitHub App; connect with a token then. #### Response 200 Installations. ```json { "app": { "enabled": true, "slug": "kajiya-ci", "url": "https://github.com/apps/kajiya-ci" }, "installations": [ { "id": 58123401, "account_login": "acme", "account_type": "Organization", "repository_selection": "selected", "suspended": false, "repos": 12, "linked_at": "2026-12-04T08:02:11.000Z", "manage_url": "https://github.com/organizations/acme/settings/installations/58123401" } ] } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/github/installations" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### DELETE /api/v1/github/installations/{id} **Stop using a GitHub App installation.** Scope: `write`. Disconnects the installation's repositories from this account (job history stays). The app stays installed on GitHub until its owner uninstalls it there. #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `id` | path | integer | yes | Installation id | #### Response 200 Unlinked. ```json { "ok": true, "disconnected": [ "acme/api", "acme/web" ] } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `404` No such object on this account - `429` Too many requests this minute #### Example ```bash curl -X DELETE "https://kajiya.app/api/v1/github/installations/3" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### POST /api/v1/github/installations/{id}/sync **Re-read an installation's repositories from GitHub now.** Scope: `write`. Kajiya follows installation changes from GitHub's events; use this if a repository you just granted is missing. #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `id` | path | integer | yes | Installation id | #### Response 200 Synced. ```json { "installation": 58123401, "account": "acme", "connected": [ "acme/api", "acme/web" ], "skipped": [ { "repo": "acme/legacy", "reason": "Archived." } ], "removed": [] } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `404` No such object on this account - `429` Too many requests this minute #### Example ```bash curl -X POST "https://kajiya.app/api/v1/github/installations/3/sync" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ## API keys Named, scoped keys for scripts and agents. ### GET /api/v1/keys **List active API keys.** Scope: `admin`. #### Response 200 Keys. ```json { "keys": [ { "id": 7, "name": "agent-07", "prefix": "kjk_Zp3LqA9x", "scope": "write", "created_at": "2026-12-04T08:00:00.000Z", "last_used_at": "2026-12-04T09:21:40.000Z", "expires_at": null } ] } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/keys" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### POST /api/v1/keys **Create an API key (returned once).** Scope: `admin`. Give every agent or machine its own named key so you can see its last use and revoke it alone. At most 100 active keys per account. The secret `key` is in this response only. #### Request body | Field | Type | Required | Description | |---|---|---|---| | `name` | string | yes | Who uses the key, e.g. the agent or machine. up to 80 characters | | `scope` | `read`, `write`, `admin` | yes | | | `expires_in_days` | integer | no | Omit for a key that does not expire. min 1, max 3650 | ```json { "name": "agent-07", "scope": "write", "expires_in_days": 90 } ``` #### Response 201 Key with secret. ```json { "id": 7, "name": "agent-07", "prefix": "kjk_Zp3LqA9x", "scope": "write", "created_at": "2026-12-04T08:00:00.000Z", "last_used_at": null, "expires_at": "2027-03-04T08:00:00.000Z", "key": "kjk_Zp3LqA9xR2mT7vW1cN8bY4kH6sJ0dF5gQ3eU9iO2aL7", "note": "Store the key now; it is shown only once." } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `409` The object is in a state that does not allow this - `429` Too many requests this minute #### Example ```bash curl -X POST "https://kajiya.app/api/v1/keys" \ -H "Authorization: Bearer $KAJIYA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"name":"agent-07","scope":"write","expires_in_days":90}' ``` ### DELETE /api/v1/keys/{id} **Revoke an API key.** Scope: `admin`. Takes effect immediately. A key cannot revoke itself (409); use another admin key or the dashboard. #### Parameters | Name | In | Type | Required | Description | |---|---|---|---|---| | `id` | path | integer | yes | API key id | #### Response 200 Revoked. ```json { "ok": true } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `404` No such object on this account - `409` The object is in a state that does not allow this - `429` Too many requests this minute #### Example ```bash curl -X DELETE "https://kajiya.app/api/v1/keys/7" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### DELETE /api/v1/sessions **Sign out everywhere.** Scope: `admin`. Ends every browser session of the account, including the one making the call. API keys and the account token keep working; revoke those separately. #### Response 200 Signed out. ```json { "ok": true, "sessions_ended": 3 } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl -X DELETE "https://kajiya.app/api/v1/sessions" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### POST /api/v1/account/token **Replace the legacy account token (returned once).** Scope: `admin`. Issues a new `kjt_...` account token; the previous one stops working at once. Call it with a browser session or an admin API key: the account token cannot replace itself (409). #### Response 200 New token. ```json { "token": "kjt_Q7wE2rT9yU4iO1pA6sD3fG8hJ5kL0zX2cV7bN4mQ9wE", "note": "Store the token now; it is shown only once. The previous account token no longer works." } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `409` The object is in a state that does not allow this - `429` Too many requests this minute #### Example ```bash curl -X POST "https://kajiya.app/api/v1/account/token" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### DELETE /api/v1/account/token **Revoke the legacy account token.** Scope: `admin`. The account token stops working at once. Call it with a browser session or an admin API key: the account token cannot revoke itself (409). #### Response 200 Revoked. ```json { "ok": true } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `409` The object is in a state that does not allow this - `429` Too many requests this minute #### Example ```bash curl -X DELETE "https://kajiya.app/api/v1/account/token" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ## Settings Spend caps, low-balance alert and webhook URL. ### GET /api/v1/settings **Spend caps, low-balance threshold, webhook URL.** Scope: `read`. #### Response 200 Settings. ```json { "daily_cap_usd": 25, "monthly_cap_usd": 400, "low_balance_usd": 5, "webhook_url": "https://ci.acme.dev/kajiya", "webhook_secret_set": true } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/settings" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### PATCH /api/v1/settings **Update spend caps, low-balance threshold or webhook URL.** Scope: `admin`. Dollar amounts from 0 to 1,000,000; null removes a cap or the threshold, and a cap of 0 holds every new job. When a cap would be exceeded new jobs wait (reason daily_cap / monthly_cap); running jobs finish. The webhook URL must be public https. Setting a webhook URL when none was set before returns its signing secret once (`webhook_secret`). Unknown fields are rejected. #### Request body | Field | Type | Required | Description | |---|---|---|---| | `daily_cap_usd` | number or null | no | Per UTC day. min 0, max 1000000 | | `monthly_cap_usd` | number or null | no | Per UTC calendar month. min 0, max 1000000 | | `low_balance_usd` | number or null | no | Send balance.low when the balance drops below this. min 0, max 1000000 | | `webhook_url` | string or null | no | Public https URL; null or empty removes it | ```json { "daily_cap_usd": 25, "monthly_cap_usd": 400, "low_balance_usd": 5, "webhook_url": "https://ci.acme.dev/kajiya" } ``` #### Response 200 Settings. ```json { "daily_cap_usd": 25, "monthly_cap_usd": 400, "low_balance_usd": 5, "webhook_url": "https://ci.acme.dev/kajiya", "webhook_secret_set": true, "webhook_secret": "whsec_7Hc2pQx9LmV4tRb8NwZ1sKd6Fy3Ja0Ue5Go2Mi7Xq4", "note": "Store the webhook secret now; it is shown only once." } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl -X PATCH "https://kajiya.app/api/v1/settings" \ -H "Authorization: Bearer $KAJIYA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"daily_cap_usd":25,"monthly_cap_usd":400,"low_balance_usd":5,"webhook_url":"https://ci.acme.dev/kajiya"}' ``` ## Webhooks Webhook secret, test events and delivery log. ### POST /api/v1/webhook/rotate-secret **Issue a new webhook signing secret (returned once).** Scope: `admin`. The old secret stops working at once: every delivery from now on, including retries, is signed with the new one. #### Response 200 Secret. ```json { "webhook_secret": "whsec_7Hc2pQx9LmV4tRb8NwZ1sKd6Fy3Ja0Ue5Go2Mi7Xq4", "note": "Store the webhook secret now; it is shown only once." } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl -X POST "https://kajiya.app/api/v1/webhook/rotate-secret" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### POST /api/v1/webhook/test **Queue a `test` event to your webhook.** Scope: `admin`. #### Response 202 Queued. ```json { "queued": true, "event_id": "evt_Ck5Nw0Ef3Gh8Jq2Lr6Ts9Vx1Yz" } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `409` The object is in a state that does not allow this - `429` Too many requests this minute #### Example ```bash curl -X POST "https://kajiya.app/api/v1/webhook/test" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ### GET /api/v1/webhook/deliveries **Last 50 webhook deliveries with status and errors.** Scope: `read`. Deliveries are kept for 7 days. #### Response 200 Deliveries. ```json { "deliveries": [ { "event_id": "evt_9bXr5MtA2qWc7UeLs0DkHy3vNj", "type": "job.finished", "status": "delivered", "attempts": 1, "last_status": 200, "last_error": null, "created_at": "2026-12-04T09:19:01.000Z", "delivered_at": "2026-12-04T09:19:01.000Z", "next_attempt_at": null }, { "event_id": "evt_Pz6Fs1oKa8GmV3xQe5TcLw0rYd", "type": "job.waiting", "status": "pending", "attempts": 2, "last_status": 502, "last_error": "HTTP 502", "created_at": "2026-12-04T09:20:15.000Z", "delivered_at": null, "next_attempt_at": "2026-12-04T09:22:46.000Z" } ] } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/webhook/deliveries" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ## Payments Compute pack purchases. ### GET /api/v1/payments **Compute pack purchases.** Scope: `read`. Completed and refunded purchases, newest first. Receipts and invoices come from Paddle by email. #### Response 200 Payments. ```json { "payments": [ { "method": "card", "reference": "txn_01jeh7q4x0k9m2c8v5b3n6r1t", "usd": 100, "refunded_usd": 0, "status": "completed", "paid_at": "2026-11-02T03:20:10.000Z" } ] } ``` #### Errors - `400` Invalid parameter or body - `401` Missing, unknown, revoked or expired key - `403` The key's scope is too small - `429` Too many requests this minute #### Example ```bash curl "https://kajiya.app/api/v1/payments" \ -H "Authorization: Bearer $KAJIYA_API_KEY" ``` ## Error responses Every error is a JSON object with one `error` string, and the HTTP status tells you the kind: - **BadRequest**: Invalid parameter or body. Example: `{"error":"limit must be an integer from 1 to 500."}` - **Unauthorized**: Missing, unknown, revoked or expired key. Example: `{"error":"Invalid token."}` - **Forbidden**: The key's scope is too small. Example: `{"error":"This API key has the \"read\" scope; this action needs \"write\"."}` - **NotFound**: No such object on this account. Example: `{"error":"Job not found."}` - **Conflict**: The object is in a state that does not allow this. Example: `{"error":"Job is already done."}` - **RateLimited**: Too many requests this minute. Example: `{"error":"Rate limit: 1,200 requests per minute per account."}` - **BadGateway**: GitHub could not be reached or refused the call. Example: `{"error":"Marked as cancelled in Kajiya, but GitHub did not cancel the run: GitHub 403: Resource not accessible by personal access token"}` ## Webhook events Kajiya also calls you: see [Webhooks](/docs/webhooks) for every event with a full sample payload, the headers and signature verification. # Webhooks Kajiya can call an HTTPS endpoint of yours when a job is dispatched, starts, finishes or has to wait, when your balance runs low, and when a spend cap holds jobs. Every delivery is signed so you can check that it came from Kajiya. ## Set up 1. In the dashboard, open **Limits & alerts**, enter your endpoint URL and save. 2. The first time a URL is saved, Kajiya creates a signing secret (`whsec_...`) and shows it once. Store it with your receiver. 3. Choose **Send test event** and check that a `test` event arrives. With the API (needs an `admin` key): ```bash curl -X PATCH "https://kajiya.app/api/v1/settings" \ -H "Authorization: Bearer $KAJIYA_ADMIN_KEY" -H "Content-Type: application/json" \ -d '{"webhook_url": "https://ci.example.com/kajiya"}' # -> { ..., "webhook_secret": "whsec_...", "note": "Store the webhook secret now; it is shown only once." } curl -X POST "https://kajiya.app/api/v1/webhook/test" -H "Authorization: Bearer $KAJIYA_ADMIN_KEY" ``` The URL must use `https`, point to a public host (not `localhost`, a private or internal address, or a name that resolves to one), have no user name or password in it, and be at most 500 characters. Send `"webhook_url": null` to stop deliveries. ## Events | Type | Sent when | `data` | |---|---|---| | `job.dispatched` | Kajiya registered a runner for a job and picked a machine | The job | | `job.started` | The job's VM started (billing starts) | The job | | `job.finished` | The VM powered off (`state: "done"`, with cost) or failed to start (`state: "failed"`, not billed) | The job | | `job.waiting` | A job first had to wait, or its wait reason changed | Repository, job name, label, `reason`, `message` | | `balance.low` | Your balance dropped below the low-balance threshold after a job finished | `balance_usd`, `threshold_usd` | | `spend_cap.reached` | A spend cap held a job for the first time in that day or month | `cap` (`daily` or `monthly`), `message` | | `test` | You asked for a test event | `message` | Every event has the same envelope: `id` (the same value as the `Kajiya-Delivery` header), `type`, `created_at` and `data`. In job events, `runtime_seconds`, `billed_seconds` and `cost_usd` are `null` until the job has finished. ### job.dispatched ```json { "id": "evt_3vQm8KcR0yJb1TfWzAa9sLx2pN", "type": "job.dispatched", "created_at": "2026-12-04T09:12:04.000Z", "data": { "id": 1287, "repo": "acme/api", "name": "test (3)", "label": "kajiya-4", "vcpu": 4, "state": "dispatched", "github_run_id": 12045567890, "github_job_id": 33861234567, "github_url": "https://github.com/acme/api/actions/runs/12045567890/job/33861234567", "runtime_seconds": null, "billed_seconds": null, "cost_usd": null } } ``` ### job.started ```json { "id": "evt_Hq2LwZ7nVd4cEo8RkT1mYb6uSa", "type": "job.started", "created_at": "2026-12-04T09:12:09.000Z", "data": { "id": 1287, "repo": "acme/api", "name": "test (3)", "label": "kajiya-4", "vcpu": 4, "state": "running", "github_run_id": 12045567890, "github_job_id": 33861234567, "github_url": "https://github.com/acme/api/actions/runs/12045567890/job/33861234567", "runtime_seconds": null, "billed_seconds": null, "cost_usd": null } } ``` ### job.finished ```json { "id": "evt_9bXr5MtA2qWc7UeLs0DkHy3vNj", "type": "job.finished", "created_at": "2026-12-04T09:19:01.000Z", "data": { "id": 1287, "repo": "acme/api", "name": "test (3)", "label": "kajiya-4", "vcpu": 4, "state": "done", "github_run_id": 12045567890, "github_job_id": 33861234567, "github_url": "https://github.com/acme/api/actions/runs/12045567890/job/33861234567", "runtime_seconds": 412, "billed_seconds": 420, "cost_usd": 0.0021 } } ``` ### job.waiting `reason` is one of `limit`, `repo_limit`, `paused`, `no_credit`, `daily_cap`, `monthly_cap` or `no_host`; see [wait reasons](/docs/queue-and-limits#wait-reasons). ```json { "id": "evt_Pz6Fs1oKa8GmV3xQe5TcLw0rYd", "type": "job.waiting", "created_at": "2026-12-04T09:20:15.000Z", "data": { "repo": "acme/web", "name": "e2e (1)", "label": "kajiya-8", "github_run_id": 12045571234, "github_job_id": 33861299871, "reason": "repo_limit", "message": "This repository's concurrency cap is reached; starts when its running jobs finish." } } ``` ### balance.low ```json { "id": "evt_Lm4Tq9Wz2Xc6Va1Rb8Nd3Ke7Ys", "type": "balance.low", "created_at": "2026-12-04T11:02:47.000Z", "data": { "balance_usd": 4.93, "threshold_usd": 5 } } ``` ### spend_cap.reached ```json { "id": "evt_Ry1Ud7Bk4Wq9Zs2Xm6Lc8Pv3Ta", "type": "spend_cap.reached", "created_at": "2026-12-04T17:45:30.000Z", "data": { "cap": "daily", "message": "Your daily spend cap is reached. Raise it in Settings or wait for the next UTC day." } } ``` ### test ```json { "id": "evt_Ck5Nw0Ef3Gh8Jq2Lr6Ts9Vx1Yz", "type": "test", "created_at": "2026-12-04T10:00:00.000Z", "data": { "message": "Test event from Kajiya." } } ``` ## Headers | Header | Value | |---|---| | `Content-Type` | `application/json` | | `User-Agent` | `Kajiya-Webhooks/1` | | `Kajiya-Event` | The event type, for example `job.finished` | | `Kajiya-Delivery` | The event id. Retries of the same event reuse it. | | `Kajiya-Signature` | `t=,v1=` | ## Verifying signatures `v1` is the lowercase hex HMAC-SHA256 of the string `.`, keyed with your signing secret (the whole `whsec_...` string). To verify a delivery: 1. Read the **raw** request body. Parsing and re-serializing the JSON changes the bytes and breaks the signature. 2. Split the header on `,` and `=` to get `t` and `v1`. 3. Reject the delivery if `t` is more than 300 seconds away from your clock. 4. Compute the HMAC of `t + "." + body` and compare it with `v1` in constant time. Each attempt, including a retry, is signed when it is sent, with the current time and the current secret. ### Node.js ```js import { createHmac, timingSafeEqual } from "node:crypto"; import { createServer } from "node:http"; export function verifyKajiya(rawBody, header, secret, toleranceS = 300) { const parts = Object.fromEntries(String(header).split(",").map((p) => p.split("=", 2))); const t = Number(parts.t); if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > toleranceS) return false; const want = createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex"); const got = String(parts.v1 ?? ""); return got.length === want.length && timingSafeEqual(Buffer.from(got), Buffer.from(want)); } createServer((req, res) => { const chunks = []; req.on("data", (c) => chunks.push(c)); req.on("end", () => { const raw = Buffer.concat(chunks).toString("utf8"); if (!verifyKajiya(raw, req.headers["kajiya-signature"], process.env.KAJIYA_WEBHOOK_SECRET)) { res.writeHead(401).end("bad signature"); return; } const event = JSON.parse(raw); console.log(event.type, event.data); res.writeHead(200).end("ok"); }); }).listen(8080); ``` ### Python ```python import hashlib import hmac import time def verify_kajiya(raw_body: bytes, header: str, secret: str, tolerance_s: int = 300) -> bool: parts = dict(p.split("=", 1) for p in header.split(",") if "=" in p) try: t = int(parts["t"]) except (KeyError, ValueError): return False if abs(time.time() - t) > tolerance_s: return False want = hmac.new(secret.encode(), parts["t"].encode() + b"." + raw_body, hashlib.sha256).hexdigest() return hmac.compare_digest(want, parts.get("v1", "")) # Flask: verify_kajiya(request.get_data(), request.headers.get("Kajiya-Signature", ""), secret) ``` ### Go ```go package kajiya import ( "crypto/hmac" "crypto/sha256" "encoding/hex" "strconv" "strings" "time" ) // Verify checks a Kajiya-Signature header against the raw request body. func Verify(rawBody []byte, header, secret string, tolerance time.Duration) bool { var ts, sig string for _, part := range strings.Split(header, ",") { k, v, ok := strings.Cut(part, "=") if !ok { continue } switch k { case "t": ts = v case "v1": sig = v } } t, err := strconv.ParseInt(ts, 10, 64) if err != nil { return false } if d := time.Since(time.Unix(t, 0)); d > tolerance || d < -tolerance { return false } mac := hmac.New(sha256.New, []byte(secret)) mac.Write([]byte(ts + ".")) mac.Write(rawBody) want := hex.EncodeToString(mac.Sum(nil)) return hmac.Equal([]byte(want), []byte(sig)) } ``` Call it with `kajiya.Verify(body, r.Header.Get("Kajiya-Signature"), secret, 5*time.Minute)` after reading the body with `io.ReadAll(r.Body)`. ## Responding and retries - Answer with any `2xx` status within 10 seconds. Do slow work after you answer. - Anything else counts as a failure: another status code, a timeout, a connection error, or a redirect (Kajiya does not follow redirects). - A failed delivery is retried after 30 s, 2 min, 10 min, 1 h, 6 h: 6 attempts over about 7 hours, after which it is marked `failed`. - Up to 8 deliveries are sent at a time, so events can arrive out of order. Use `created_at` and the job's `state` rather than arrival order. ## Idempotency The same event can arrive more than once, for example when your endpoint processed it but the answer timed out. Store the `Kajiya-Delivery` id of every event you have handled for at least a day and skip ids you have already seen. ## Delivery log The dashboard shows recent deliveries under **Limits & alerts**, and `GET /api/v1/webhook/deliveries` returns the last 50 with their status, attempt count, last HTTP status and error. Deliveries are kept for 7 days. ## Rotating the secret `POST /api/v1/webhook/rotate-secret` (or **Rotate secret** in the dashboard) returns a new secret once. The old one stops working at once: every delivery from then on, including retries of earlier events, is signed with the new secret. Update your receiver right after rotating; deliveries that fail in between are retried with the new signature. ## Testing locally Kajiya only delivers to public `https` URLs. To receive events on your laptop, expose your local server through a tunnel service that gives you a public `https` address, set that address as the webhook URL, and send a test event. # For agent fleets When many coding agents open pull requests at once, CI is where their work queues up. This page is for the person running such a fleet, and for the agents themselves: how to give each agent access, size its fan-out, understand why a job waits, follow jobs without polling, attribute cost, and cancel work. Agents can read this documentation as Markdown: every page has a `.md` twin, [/llms.txt](/llms.txt) indexes them, and [/llms-full.txt](/llms-full.txt) is the whole set in one file. ## Rules to give your agents Paste this into your agents' instructions (for example `AGENTS.md`): ```markdown ## CI on Kajiya - CI jobs run on Kajiya runners: `runs-on: kajiya-2` (or kajiya-4, kajiya-8). Do not change runs-on to other labels. - API: https://kajiya.app/api/v1, header `Authorization: Bearer $KAJIYA_API_KEY`. Docs: https://kajiya.app/llms.txt - Before triggering many jobs: GET /api/v1/account. Free vCPUs = concurrency.limit_vcpu - concurrency.in_use_vcpu. Do not queue more jobs than that at once. - A job that does not start is waiting, not lost. GET /api/v1/queue and read waiting[].reason. Do not re-run it. no_credit, paused, daily_cap, monthly_cap: stop and tell a human. limit, repo_limit, no_host: wait. - Never retry faster than once every 10 seconds. On HTTP 429 wait Retry-After seconds. - To stop a run: POST /api/v1/jobs/{id}/cancel (cancels the whole GitHub workflow run). ``` ## One key per agent Give every agent its own named key, so you can see when it last used the API and revoke it without touching the others. Use the smallest scope that works: | Agent does | Scope | |---|---| | Reads status, queue, jobs and cost | `read` | | Also cancels runs, pauses or caps repositories | `write` | | Manages keys, caps and webhooks (keep this for the orchestrator or a human) | `admin` | An orchestrator holding an `admin` key can issue keys as it starts agents: ```bash curl -s -X POST "https://kajiya.app/api/v1/keys" \ -H "Authorization: Bearer $KAJIYA_ADMIN_KEY" -H "Content-Type: application/json" \ -d '{"name": "agent-07", "scope": "read", "expires_in_days": 7}' | jq -r .key ``` Revoke a key with `DELETE /api/v1/keys/{id}` when its agent is retired. Keys expire on their own if you set `expires_in_days`. An account can have up to 100 active keys, and all keys share the account's rate limit of 1,200 requests per minute. ## Read your limits before fanning out Jobs beyond your concurrency limit wait on GitHub instead of failing, but they occupy GitHub's queue and finish later. Read the room first: ```bash curl -s "https://kajiya.app/api/v1/account" -H "Authorization: Bearer $KAJIYA_API_KEY" \ | jq '{free_vcpu: (.concurrency.limit_vcpu - .concurrency.in_use_vcpu), balance_usd, caps, established: .limits.established}' ``` - **Free vCPUs** divided by the vCPUs per job is how many jobs can start now. A new account has a limit of 4 vCPUs, so it cannot run `kajiya-8` at all ([account limits](/docs/queue-and-limits#account-limits)). - **Balance:** each job needs 10 minutes of prepaid compute set aside to start ([the gate](/docs/billing#the-10-minute-gate)). - **Caps:** a daily or monthly cap can hold jobs even when vCPUs are free. - **Fleet:** `GET /api/v1/queue` also returns `fleet.free_vcpu`, the free capacity across all of Kajiya. ## When a job does not start Read the reason instead of re-running: ```bash curl -s "https://kajiya.app/api/v1/queue" -H "Authorization: Bearer $KAJIYA_API_KEY" \ | jq -r '.waiting[] | "\(.repo) \(.name) \(.label) \(.reason) \(.message)"' ``` | Reason | What an agent should do | |---|---| | `limit` | Wait. It starts when one of your running jobs finishes. Queue fewer jobs at once. | | `repo_limit` | Wait. The repository's own cap is full. | | `no_host` | Wait. Kajiya's machines are busy; capacity frees up as jobs finish. | | `paused` | Stop and tell a human: someone paused the repository on purpose. | | `no_credit` | Stop and tell a human: compute packs are bought by a person in the dashboard. | | `daily_cap`, `monthly_cap` | Stop and tell a human, or wait for the next UTC day or month. | Re-running a waiting job on GitHub does not make it start sooner; it only adds another job to the queue. ## Webhooks instead of polling Polling `/queue` or `/jobs` from every agent uses up the shared rate limit. Point a [webhook](/docs/webhooks) at your orchestrator instead and route events to agents by `data.repo` and `data.github_run_id`: - `job.started`: the job has a VM. - `job.finished`: the VM is gone; `cost_usd` is final. The job's result (passed or failed) is on GitHub. - `job.waiting`: the job waits; `reason` tells you whether to wait or escalate. - `spend_cap.reached` and `balance.low`: escalate to a human. If you do poll, poll one endpoint for the whole fleet, no more often than every 10 seconds. ## Cost per repository, label or run ```bash # this month by repository curl -s "https://kajiya.app/api/v1/usage?group_by=repo&since=2026-12-01" -H "Authorization: Bearer $KAJIYA_API_KEY" | jq '.rows' # every job of one workflow run, with its cost curl -s "https://kajiya.app/api/v1/jobs?repo=acme/api&since=2026-12-04&limit=500" -H "Authorization: Bearer $KAJIYA_API_KEY" \ | jq --argjson run 12045567890 '[.jobs[] | select(.github_run_id == $run)] | {jobs: length, cost_usd: (map(.cost_usd // 0) | add)}' ``` In TypeScript, using the client from the [API overview](/docs/api#a-minimal-typescript-client): ```ts type Job = { id: number; repo: string; state: string; github_run_id: number; cost_usd: number | null }; /** Total cost of one GitHub workflow run, following pagination. */ export async function runCost(repo: string, runId: number, since: string): Promise { let total = 0; let before: number | null = null; do { const q = new URLSearchParams({ repo, since, limit: "500", ...(before ? { before: String(before) } : {}) }); const page = await kajiya<{ jobs: Job[]; next_before: number | null }>(`/jobs?${q}`); for (const j of page.jobs) if (j.github_run_id === runId) total += j.cost_usd ?? 0; before = page.next_before; } while (before); return Math.round(total * 1e6) / 1e6; } ``` ## Cancelling work `POST /api/v1/jobs/{id}/cancel` cancels the job's whole workflow run on GitHub (GitHub has no per-job cancel). A job that no machine has received yet is released and never billed; a running job is billed for the minutes its VM ran. ```bash # cancel every active job of one run curl -s "https://kajiya.app/api/v1/jobs?state=active&repo=acme/api" -H "Authorization: Bearer $KAJIYA_API_KEY" \ | jq -r --argjson run 12045567890 '.jobs[] | select(.github_run_id == $run) | .id' | head -n 1 \ | xargs -I{} curl -s -X POST "https://kajiya.app/api/v1/jobs/{}/cancel" -H "Authorization: Bearer $KAJIYA_API_KEY" ``` One cancel is enough per run, since it cancels the whole run. The key needs `write` scope, and the repository's GitHub access needs *Actions: Read and write*. Cancelling on GitHub directly (`gh run cancel`) works too; prefer the Kajiya call for repositories that are polled rather than connected by webhook or the GitHub App, because Kajiya then releases jobs it had not started yet at once. ## Planning a large batch ```ts type Account = { balance_usd: number; concurrency: { limit_vcpu: number; in_use_vcpu: number } }; /** How many jobs of `vcpu` vCPUs can start right now. */ export async function startableJobs(vcpu: 2 | 4 | 8): Promise { const a = await kajiya("/account"); const free = Math.max(0, a.concurrency.limit_vcpu - a.concurrency.in_use_vcpu); return Math.floor(free / vcpu); } ``` Use it to size a GitHub Actions matrix (`strategy.max-parallel`) or the number of pull requests your agents push at once. [Matrix builds and sharding](/docs/guides/matrix-and-sharding) shows the workflow side. # Guides Task-focused guides for moving CI onto Kajiya and running it well. - [Migrate from GitHub-hosted runners](/docs/guides/migrate-from-github-hosted): switch from `ubuntu-latest`, what differs on a Kajiya VM, and how to roll out with an easy way back. - [Migrate from other runner vendors](/docs/guides/migrate-from-other-runners): map Blacksmith, BuildJet, Depot, Namespace or Ubicloud labels and cache actions to Kajiya. - [Matrix builds and test sharding](/docs/guides/matrix-and-sharding): split a slow suite across many runners and keep the fan-out within your limits. - [Docker builds and caching](/docs/guides/docker-and-caching): what caching works on fresh VMs: `actions/cache`, registry cache and the GitHub Actions cache backend. - [Monorepos and per-repo caps](/docs/guides/monorepos): keep one busy repository from starving the rest, and run only what changed. # Migrate from GitHub-hosted runners Moving a workflow from `ubuntu-latest` to Kajiya is a one-line change. This guide covers what else differs, how to pick sizes, and how to roll out so you can switch back in seconds. ## What stays the same - Your workflows, actions, secrets, environments and `GITHUB_TOKEN` work as before. Kajiya runners are GitHub self-hosted runners, so GitHub schedules jobs and shows logs as usual. - Every job gets a fresh machine, as on GitHub-hosted runners: Kajiya boots a new VM per job and destroys it afterwards. - `actions/cache`, `actions/upload-artifact` and the other GitHub actions keep using GitHub's storage. - Container jobs and service containers work: Docker Engine is installed. ## What is different | | GitHub-hosted `ubuntu-latest` | Kajiya | |---|---|---| | Price | $0.18 per vCPU-hour ($0.006 per minute for 2 vCPUs) on private repositories; standard runners are free on public ones | $0.0045 per vCPU-hour | | Memory | 7 GB for the 2-core runner of private repositories | 2 GB per vCPU: 4 GB on `kajiya-2`, 8 GB on `kajiya-4` | | Image | Large image with many languages and tools | Ubuntu 24.04 with a short list of packages ([what is installed](/docs/runners#preinstalled-software)) | | Longest job | 6 hours | 58 minutes | | Location | Azure regions | Seoul, South Korea | | Operating systems | Linux, Windows, macOS | Linux x86_64 only | ## Step by step 1. **Connect the repositories** with the [GitHub App or a token](/docs/connect-github), and buy a compute pack. 2. **Set a daily cap** under **Limits & alerts** so a mistake cannot burn through the pack ([spend controls](/docs/spend-controls)). 3. **Pick one workflow** that runs often, and change its `runs-on`: ```yaml jobs: test: runs-on: kajiya-2 # was: ubuntu-latest ``` 4. **Add the tools the job assumed.** On GitHub-hosted runners many tools are preinstalled. If the job fails with `command not found`, add the matching setup step: ```yaml steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 - run: npm ci && npm test ``` Common ones: `actions/setup-node`, `actions/setup-python`, `actions/setup-go`, `actions/setup-java`, `docker/setup-buildx-action`. The GitHub CLI and Docker Compose come from apt: `sudo apt-get update && sudo apt-get install -y gh docker-compose-v2`. 5. **Compare** run time and cost in the dashboard's **Jobs** tab with the same workflow's history on GitHub. 6. **Roll out** to the remaining workflows. ## Keep a way back: a variable for `runs-on` Read the label from a repository or organization variable, with Kajiya as the default: ```yaml jobs: test: runs-on: ${{ vars.CI_RUNNER || 'kajiya-2' }} ``` Setting the variable `CI_RUNNER` to `ubuntu-latest` (repository or organization **Settings → Secrets and variables → Actions → Variables**) moves every workflow back without a commit; deleting it moves them to Kajiya again. ## Choosing sizes Kajiya charges per vCPU, so a job costs the same whether it runs on 2 vCPUs for 10 minutes or 4 vCPUs for 5 minutes. Pick the size by what the job needs: - **Memory-bound jobs** (large TypeScript projects, JVM builds, big test suites): start with `kajiya-4` for 8 GB, more than GitHub's 2-core runner has. - **Parallel builds and test runners** that use every core: `kajiya-8` often finishes in a fraction of the time at a similar cost. New accounts can run `kajiya-8` once they are [established](/docs/queue-and-limits#account-limits). - **Short jobs** (lint, small checks): `kajiya-2`. Every job is billed at least one minute, and boot is part of it. ## Things to check - **Jobs longer than 58 minutes** have to be split: see [matrix builds and sharding](/docs/guides/matrix-and-sharding). - **Downloads from far away.** Package registries and caches outside Asia take longer to reach from Seoul than from a runner next to them. Keep `actions/cache` entries small and cache what you download repeatedly. - **Network rules.** Private address ranges and a few outbound ports are blocked; see [Runners → Network](/docs/runners#network). - **Concurrency.** A new account runs 4 vCPUs at once. Jobs beyond that wait on GitHub and start in turn. - **Public repositories:** require approval for fork pull request workflows ([security](/docs/security#public-repositories-and-forks)). # Migrate from other runner vendors If you use a third-party runner service such as Blacksmith, BuildJet, Depot, Namespace or Ubicloud, moving to Kajiya means changing labels, replacing vendor-specific actions, and removing the old vendor's access. ## Map the labels Most vendors encode the vCPU count in the label. Use the Kajiya label with the same number of vCPUs, or the nearest one: | vCPUs in the old label | Kajiya label | Memory on Kajiya | |---|---|---| | 2 | `kajiya-2` | 2 GB per vCPU, 4 GB | | 4 | `kajiya-4` | 8 GB | | 8 | `kajiya-8` | 16 GB | | 16 or more | `kajiya-8`, or split the job | 16 GB | For example, `runs-on: blacksmith-4vcpu-ubuntu-2404` or `runs-on: buildjet-4vcpu-ubuntu-2204` becomes `runs-on: kajiya-4`. Arm, Windows and macOS labels have no Kajiya equivalent; keep those jobs where they are. Kajiya runs Ubuntu 24.04 with a small set of packages. If your old labels pinned Ubuntu 22.04 or relied on a large preinstalled image, add setup steps for the tools your jobs use ([what is installed](/docs/runners#preinstalled-software)). ## Replace vendor-specific actions | You used | On Kajiya | |---|---| | A vendor cache action (a drop-in for `actions/cache`) | `actions/cache` | | A vendor `setup-*` fork | The official `actions/setup-*` | | Persistent Docker layer caches or sticky disks | Registry or GitHub Actions cache with Buildx: see [Docker builds and caching](/docs/guides/docker-and-caching) | | A vendor's remote Docker builder | `docker/setup-buildx-action` and `docker/build-push-action` on the runner itself | Kajiya keeps nothing between jobs: every job starts on a fresh VM. Caching across jobs goes through `actions/cache` or a registry. ## Roll out 1. Connect the repositories with the [GitHub App or a token](/docs/connect-github) and buy a compute pack. 2. Change the labels in one workflow and compare times and cost in the **Jobs** tab. 3. Use a variable to switch the rest in one place, as in [the GitHub-hosted guide](/docs/guides/migrate-from-github-hosted#keep-a-way-back-a-variable-for-runs-on). 4. When nothing uses the old labels any more, uninstall the old vendor's GitHub App (organization **Settings → GitHub Apps**) and remove any runner groups it created. ## Differences to plan for - **Time limit:** Kajiya stops jobs after 58 minutes. - **Sizes:** at most 8 vCPUs per job. Split larger jobs with a matrix ([sharding guide](/docs/guides/matrix-and-sharding)). - **Concurrency:** new accounts start at 4 vCPUs at once and 32 once established ([account limits](/docs/queue-and-limits#account-limits)). - **Billing:** per started minute at $0.0045 per vCPU-hour from prepaid packs; no monthly plan ([billing](/docs/billing)). # Matrix builds and test sharding A slow test suite finishes sooner when it is split across several runners. On Kajiya every shard is its own VM, billed per started minute, so sharding mostly buys time, not extra cost. This guide shows how to shard, and how to size the fan-out to your limits. ## Shard a test suite Run the same job N times with a matrix, and give each copy its shard number: ```yaml jobs: test: runs-on: kajiya-4 strategy: fail-fast: false max-parallel: 4 matrix: shard: [1, 2, 3, 4] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 cache: npm - run: npm ci - run: npx playwright test --shard=${{ matrix.shard }}/4 ``` Most test runners can split a suite themselves: | Runner | Flag | |---|---| | Playwright | `--shard=${{ matrix.shard }}/4` | | Jest | `--shard=${{ matrix.shard }}/4` | | Vitest | `--shard=${{ matrix.shard }}/4` | | Bun | `bun test --shard=${{ matrix.shard }}/4` | | Go | `go test` a different package list per shard, for example from `go list ./...` split with `split -n r/${{ matrix.shard }}/4` | ## Size the fan-out to your limits Jobs beyond your concurrency limit do not fail; they wait on GitHub (reason `limit`) and start as others finish. They still make the whole run take longer, so match the matrix to what can run at once: - `concurrency.limit_vcpu` from `GET /api/v1/account` divided by the vCPUs per job is how many shards can run together: with 32 vCPUs, eight `kajiya-4` shards; with 4 (a new account), one. - `strategy.max-parallel` caps how many matrix jobs GitHub starts at once, so one workflow cannot take the whole limit from the others. - A [per-repository cap](/docs/queue-and-limits#per-repository-caps) does the same for a whole repository. ## What sharding costs Each shard pays for its own boot (about 40 seconds) and its last started minute. Four shards of a 20-minute `kajiya-4` suite cost about as much as one 20-minute run, plus up to a few minutes of boot and rounding, and finish four times sooner. For a suite that already takes two minutes, sharding adds overhead without saving much time. | Plan | Wall time | Billed vCPU-minutes | |---|---|---| | 1 × `kajiya-4`, 20 minutes | 20 min | 80 | | 4 × `kajiya-4`, 5 min 10 s each | about 5 min | 4 × 6 × 4 = 96 | | 2 × `kajiya-8`, 5 min 10 s each (if the suite uses 8 cores) | about 5 min | 2 × 6 × 8 = 96 | ## Jobs longer than 58 minutes Kajiya stops a job after 58 minutes. Shard anything that comes close, so each shard stays well under the limit even on a slow day. ## Collect the results Each shard runs on its own VM, so pass results between jobs through artifacts, not the file system: ```yaml - uses: actions/upload-artifact@v4 if: always() with: name: results-${{ matrix.shard }} path: test-results/ report: needs: test if: always() runs-on: kajiya-2 steps: - uses: actions/download-artifact@v4 with: pattern: results-* merge-multiple: true path: test-results/ - run: ls test-results/ ``` # Docker builds and caching Every Kajiya job starts on a fresh VM with an empty Docker cache and an empty workspace. Nothing from the previous job is on the disk, which keeps jobs isolated and reproducible. Speed comes from caches you restore explicitly, as on GitHub-hosted runners. ## Dependency caches with `actions/cache` `actions/cache` and the `cache:` option of the setup actions work unchanged. The cache is stored in GitHub's cache storage, so restoring it is a download from GitHub to Seoul. Keep entries small and specific: ```yaml - uses: actions/setup-node@v4 with: node-version: 22 cache: npm # caches ~/.npm, keyed on package-lock.json - run: npm ci ``` ```yaml - uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git target key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }} restore-keys: cargo-${{ runner.os }}- ``` Cache what you download repeatedly (package manager caches, toolchains), not what is fast to rebuild. ## Docker images: cache layers in a registry or in GitHub Docker Engine is installed and the `runner` user may use it. Buildx is not preinstalled; `docker/setup-buildx-action` sets it up. Because the local layer cache starts empty on every job, export the cache somewhere and import it on the next build. ### Registry cache Store the layer cache next to the image, for example in GitHub Container Registry: ```yaml jobs: image: runs-on: kajiya-4 permissions: contents: read packages: write steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - uses: docker/build-push-action@v6 with: context: . push: true tags: ghcr.io/${{ github.repository }}:${{ github.sha }} cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache,mode=max ``` ### GitHub Actions cache backend Without a registry, Buildx can keep layers in the GitHub Actions cache: ```yaml - uses: docker/setup-buildx-action@v3 - uses: docker/build-push-action@v6 with: context: . push: false cache-from: type=gha cache-to: type=gha,mode=max ``` The Actions cache has a per-repository size limit set by GitHub, and big layer caches evict other entries. Prefer the registry cache for large images. ## Docker Compose and service containers - `services:` in a job works as on GitHub-hosted runners. - Docker Compose is not preinstalled. Install the plugin first: `sudo apt-get update && sudo apt-get install -y docker-compose-v2`, then use `docker compose up -d`. ## Docker Hub pull limits Docker Hub limits anonymous pulls per IP address. Kajiya jobs share the egress addresses of the machines they run on, so log in before pulling from Docker Hub, or pull from another registry: ```yaml - uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USER }} password: ${{ secrets.DOCKERHUB_TOKEN }} ``` ## Disk space Each VM has a 30 GB disk, part of which is used by the operating system. Large images and caches count against it. Because the disk is discarded after every job, there is nothing to clean up between jobs. # Monorepos and per-repo caps A monorepo can queue dozens of jobs per push. On a shared account that can take every vCPU and leave other repositories waiting. Kajiya's per-repository caps keep that in check, and GitHub's path filters and concurrency groups keep the job count down. ## Cap the repository Set a **Max vCPU** for the monorepo under **Repositories** in the dashboard, or with the API: ```bash curl -X PATCH "https://kajiya.app/api/v1/repos/3" \ -H "Authorization: Bearer $KAJIYA_API_KEY" -H "Content-Type: application/json" \ -d '{"max_vcpu": 16}' ``` With an account limit of 32 vCPUs and a cap of 16 on the monorepo, at least 16 vCPUs stay available for everything else. Jobs over the cap wait with reason `repo_limit` and start as the monorepo's own jobs finish. Keep the cap at least as large as the biggest job in the repository, or that job never starts. To hold a repository entirely, for example during an incident, pause it: `{"paused": true}`. Running jobs finish; new ones wait until you resume. ## Run only what changed Skip workflows when their part of the tree did not change: ```yaml on: pull_request: paths: - "services/api/**" - "packages/shared/**" ``` Or decide per job with a paths filter step and `if:` conditions, so one workflow can test only the packages a change touches. ## Cancel superseded runs When a branch gets a new push, the previous run of the same workflow is usually useless. A concurrency group cancels it: ```yaml concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true ``` Jobs of the cancelled run that had not reached a machine yet are released and not billed when the repository is connected through the GitHub App or a repository webhook. Jobs that were already running are billed for the minutes they ran. ## Size each job Put each job on the smallest label that does not slow it down: lint and small checks on `kajiya-2`, builds and big test suites on `kajiya-4` or `kajiya-8`. Usage by label shows where the vCPU-hours go: ```bash curl -s "https://kajiya.app/api/v1/usage?group_by=label&since=2026-12-01" -H "Authorization: Bearer $KAJIYA_API_KEY" | jq '.rows' ``` ## See the cost per repository `GET /api/v1/repos` returns `cost_30d_usd` and `jobs_30d` for every repository, and `GET /api/v1/usage?group_by=repo` covers any period up to 400 days. # Troubleshooting Start with the symptom. Most answers come from two calls: `GET /api/v1/queue` (why a job waits) and `GET /api/v1/repos` (`last_error` and `dispatch` for each repository). ## A job stays "Queued" on GitHub ### Kajiya lists it as waiting `GET /api/v1/queue` (or the dashboard's live queue) shows the job with a `reason`. Each reason and its fix are in [wait reasons](/docs/queue-and-limits#wait-reasons). The ones that do not clear by themselves: - `paused`: the repository is paused in Kajiya. Resume it. - `no_credit`: buy a compute pack. - `limit` on a `kajiya-8` job of a new account: new accounts run at most 4 vCPUs at once, so `kajiya-8` waits until the account is [established](/docs/queue-and-limits#account-limits). Use `kajiya-4` until then. - `repo_limit` that never clears: the repository's `max_vcpu` cap is smaller than the job. Raise the cap. - `no_host` on a tier-pinned label (`kajiya-4-s`): no machine of that tier has room. Remove the pin. ### Kajiya does not list it at all Kajiya has not seen the job, or it does not look like a Kajiya job: 1. **The label.** `runs-on` must be exactly `kajiya-2`, `kajiya-4` or `kajiya-8`, optionally with a tier (`kajiya-4-s`). Other sizes such as `kajiya-16` are ignored. If `runs-on` is a list, GitHub needs a runner with every label in it, so use the Kajiya label alone. 2. **The repository is connected.** It must be listed in `GET /api/v1/repos` (or **Repositories** in the dashboard), not paused, and connected to the account you are looking at. 3. **`last_error` on the repository.** An expired or revoked token shows up here, for example `GitHub 401: Bad credentials`. Connect the repository again with a new token ([replace an expired token](/docs/connect-github#replace-an-expired-token)). 4. **Polling delay.** A repository in `polling` mode is checked every 60 seconds when it has been idle. Call `POST /api/v1/repos/{id}/sync` to check now, and give the token *Webhooks: Read and write* (or use the GitHub App) so jobs are seen within seconds. ### Kajiya dispatched it, but it never ran If the machine that took the job goes offline before the VM starts, Kajiya marks the job `failed` (not billed) after about two minutes. It does not dispatch the same GitHub job again, so the job stays queued on GitHub: re-run it. A re-run creates a new job, which Kajiya dispatches normally. ## The webhook is not active `dispatch` in `GET /api/v1/repos` tells you how Kajiya watches each repository. - **`polling` with "Token cannot manage webhooks"**: the token lacks *Webhooks: Read and write*. Add the permission (or create a new token) and connect the repository again. - **`polling` with "GitHub rate limit while installing the webhook"**: connect the repository again later. - **`webhook_pending` that stays pending**: GitHub has not delivered any event to Kajiya yet. On GitHub, open the repository's **Settings → Webhooks**, select the Kajiya webhook and check **Recent Deliveries** for errors; **Redeliver** the ping. Polling still dispatches jobs, only more slowly. ## Token and connection errors | Message | Cause and fix | |---|---| | `Token has no admin permission on this repository (needs Administration: read/write).` | Give the fine-grained token *Administration: Read and write*, and make sure your GitHub user administers the repository. | | `GitHub 401: Bad credentials` | The token expired or was revoked. Connect the repositories again with a new one. | | `GitHub 404: Not Found` | The token cannot see the repository: it is not among the token's selected repositories, the resource owner is wrong, or the organization has not approved the token. | | `GitHub 403: Resource not accessible by personal access token` | A permission is missing for that call, typically *Actions: Read and write* when cancelling. | | `This repository is connected to another Kajiya account.` | Each repository belongs to one Kajiya account. Disconnect it there first. | | `Repository must look like owner/name.` | Send `acme/api`, not a URL. | | Skipped: `Token has no admin permission here.` / `Archived.` | Bulk connect skips repositories the token does not administer and archived ones. | ## A cancelled job was billed - **The job was already running.** A running VM is billed for the minutes it ran, as on GitHub-hosted runners. - **The VM was booting when the job was cancelled.** Its runner then has no job to take, so the VM stops itself after 4 minutes ([idle stop](/docs/runners#time-limits)) and is billed for those minutes. If the repository is connected through the GitHub App or a repository webhook, Kajiya releases jobs that no machine had taken yet and they are not billed; with polling, Kajiya does not learn about a cancel on GitHub in time. Cancel through Kajiya (`POST /api/v1/jobs/{id}/cancel`) to release such jobs, or use the App. ## A job was stopped after 58 minutes Jobs are stopped after 58 minutes of runtime. Split long work into several jobs ([matrix builds and sharding](/docs/guides/matrix-and-sharding)). ## The bill is higher than the job's runtime - Every job is billed in whole minutes, at least one, and the time includes the VM's boot and shutdown. - Runtime is measured per VM: a matrix of 20 one-minute jobs is 20 billed minutes. - VMs that stopped after the idle timeout are billed (see above). Every job's `runtime_seconds`, `billed_seconds` and `cost_usd` are in `GET /api/v1/jobs` and the **Jobs** tab. ## Commands or tools are missing | Error | Fix | |---|---| | `node: command not found` (and other languages) | Add `actions/setup-node` (or the matching `setup-*` action). | | `docker: 'compose' is not a docker command` | `sudo apt-get update && sudo apt-get install -y docker-compose-v2` | | `gh: command not found` | `sudo apt-get update && sudo apt-get install -y gh` | | `error: externally-managed-environment` from `pip install` | Use `actions/setup-python`, or `python3 -m venv .venv` and install into it. | | `ERROR: docker buildx` not available | Add `docker/setup-buildx-action`. | [What is installed](/docs/runners#preinstalled-software) lists the base image. ## Network calls time out - Outbound TCP to ports 3333, 4444, 5555, 7777, 8888, 9999, 14433, 14444, 45700 is blocked everywhere. Use another port for that service. - Private ranges (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `100.64.0.0/10`, `169.254.0.0/16`) are unreachable, so a job cannot reach services on your private network or a Tailscale network. - Docker Hub may rate-limit anonymous pulls from shared addresses; log in first ([Docker guide](/docs/guides/docker-and-caching#docker-hub-pull-limits)). ## API errors | Status | Fix | |---|---| | `401 Invalid token.` | The key is wrong, revoked or expired. `This API key was revoked.` and `This API key has expired.` say which. | | `403 ... this action needs "write"` | Create a key with a larger scope. | | `429 Rate limit` | Wait `Retry-After` seconds. The 1,200-per-minute limit is shared by all keys of the account. | | `502` | GitHub refused or could not be reached; the message includes GitHub's answer. | ## Webhook deliveries fail Check `GET /api/v1/webhook/deliveries` for `last_status` and `last_error`: - **`HTTP 3xx`**: Kajiya does not follow redirects. Use the final URL. - **Timeouts**: answer within 10 seconds and do slow work afterwards. - **`webhook host resolves to a private address`**: the URL must resolve to a public address. - **Your endpoint rejects the signature**: verify against the raw body, use the current secret (rotating replaces it at once), and check that your server's clock is correct. See [verifying signatures](/docs/webhooks#verifying-signatures). ## Buying a pack fails - `Connect a GitHub repository before buying a compute pack.`: connect one first. - `Purchase limit: ...`: new accounts can buy $50 of packs per 24 hours, established ones $500. A checkout you started but did not finish counts until you start a new one, which cancels it; if it still counts, close the old checkout window and try again. ## Signing in fails - **Account too new**: GitHub accounts must be at least 24 hours old. - **Verified email needed**: verify a primary email address in your GitHub settings. - **This email is already linked to a different GitHub account**: sign in with the GitHub account you used before. ## Still stuck Email hello@vetter-ai.com with the repository, the GitHub run URL and the time. We reply within 2 business days. # FAQ Short answers. Each links to the page with the details. ### What is Kajiya? GitHub Actions runners in Seoul for $0.0045 per vCPU-hour, billed per started minute from prepaid compute packs. You change `runs-on` to `kajiya-2`, `kajiya-4` or `kajiya-8`, and each job runs on a fresh VM. See the [quickstart](/docs/quickstart). ### How much cheaper is it than GitHub-hosted runners? GitHub charges $0.18 per vCPU-hour for its standard Linux runners on private repositories, about 40 times Kajiya's $0.0045. Both bill per started minute. See [billing](/docs/billing). ### Does GitHub also charge me for jobs on Kajiya? GitHub does not bill Actions minutes for self-hosted runners, which is what Kajiya's runners are to GitHub. GitHub has announced and then postponed a per-minute platform charge for self-hosted runners; if it comes, GitHub bills it to you directly. ### Which operating systems and architectures? Ubuntu 24.04 on x86_64 only. No Windows, macOS or Arm. See [runners](/docs/runners). ### What is preinstalled? A short list: git, curl, jq, zip, build tools, Docker Engine, Python 3 and the GitHub Actions runner. Add languages with the `setup-*` actions. See [preinstalled software](/docs/runners#preinstalled-software). ### How long can a job run? 58 minutes. Split longer work into several jobs. ### Where do my jobs run, and is anything shared between them? On machines Kajiya operates in Seoul, South Korea. Each job gets its own VM, destroyed with its disk when the job ends. Nothing is shared between jobs. See [security](/docs/security). ### Can I use secrets? Yes. GitHub delivers them to the runner inside your job's VM, as on GitHub-hosted runners; Kajiya's servers never receive them. ### What happens when my compute runs out? A running job finishes. New jobs wait on GitHub with reason `no_credit` and start when you buy a pack. Set a [low-balance alert](/docs/spend-controls#low-balance-alert) to hear about it first. ### Can I cap my spending? Yes: daily and monthly caps, and a cap of 0 stops new jobs at once. See [spend controls](/docs/spend-controls). ### How many jobs can run at once? New accounts: 4 vCPUs at once. Established accounts: 32. Ask for more by email. See [queue and limits](/docs/queue-and-limits). ### Do unused packs expire? Can I get a refund? Unused compute expires 12 months after your most recent purchase. Unused packs are refundable within 14 days of purchase. See [billing](/docs/billing#refunds). ### Who processes payments? Paddle.com, our Merchant of Record. Paddle charges your card, handles sales tax or VAT, and emails the receipt. ### Is there an API? Yes, for everything in the dashboard: [API overview](/docs/api) and the [OpenAPI description](/api/v1/openapi.json). There are also signed [webhooks](/docs/webhooks). ### Can my coding agents use Kajiya directly? Yes. Give each agent its own scoped API key and point it at [/llms.txt](/llms.txt). See [for agent fleets](/docs/agents). ### Do I need to give Kajiya access to my code? No. The GitHub App and the token only need to register runners and read and cancel Actions jobs. Your workflow checks out the code inside the job's VM. See [connect GitHub](/docs/connect-github). ### How do I contact support? Email hello@vetter-ai.com. We reply within 2 business days. # Changelog What changed in Kajiya, newest first. ## 4 December 2026 ### One-click GitHub connection - **Kajiya CI GitHub App.** Install it from the dashboard to connect repositories without creating a token. Jobs start from the App's webhook within seconds, repositories follow the installation, and the App uses short-lived installation tokens. Tokens still work. See [Connect GitHub](/docs/connect-github). - **Dashboard.** A guided first run, 30-day spend and live vCPU charts, running jobs with timers and a cost estimate, and an activity feed. ### For teams running CI at scale - **API keys.** Named keys with a `read`, `write` or `admin` scope and an optional expiry, for scripts and agents. Create and revoke them in the dashboard or through the API. See [API overview](/docs/api#authentication). - **API v1.** `/api/v1` covers the account, live queue, jobs, usage, repositories, keys, settings, webhooks and payments, with CSV exports and an [OpenAPI 3.1 description](/api/v1/openapi.json). See the [API reference](/docs/api/reference). - **Webhooks.** Signed `job.dispatched`, `job.started`, `job.finished`, `job.waiting`, `balance.low` and `spend_cap.reached` events with retries. See [webhooks](/docs/webhooks). - **Spend caps and low-balance alert.** Daily and monthly caps hold new jobs without stopping running ones. See [spend controls](/docs/spend-controls). - **Live queue with wait reasons.** Every job that cannot start yet is listed with one of seven reasons. See [queue and limits](/docs/queue-and-limits). - **Per-repository caps and pause.** Limit how many vCPUs one repository may use at once, or hold it. - **Bulk connect.** Connect a list of repositories, a whole organization, or everything a token administers, with one token. See [connect GitHub](/docs/connect-github#connect-many-repositories-at-once). - **Webhook dispatch.** With *Webhooks: Read and write*, Kajiya subscribes to `workflow_job` events and starts jobs within seconds instead of on the next poll. - **Idle stop.** A runner VM that is not given a job within 4 minutes, for example because its job was cancelled while it booted, stops itself instead of idling until the time limit. - **Documentation.** This documentation site, with every page also available as Markdown, plus [/llms.txt](/llms.txt) and [/llms-full.txt](/llms-full.txt) for coding agents. ## Launch - `kajiya-2`, `kajiya-4` and `kajiya-8` runners in Seoul at $0.0045 per vCPU-hour, billed per started minute with exact sub-cent accounting. - One fresh VM per job, destroyed after the job. - Sign in with GitHub; connect repositories with a fine-grained token. - Prepaid compute packs from $10, paid by card through Paddle.