kosa8 docs

Guides / kosa8 Cloud

kosa8 Cloud

The same sealed sandboxes, running on kosa8's hosts instead of your own machine. Nothing to install: sign in at cloud.kosa8.com, make an API key, and create a sandbox from code in about a second.

Create your organization

Open cloud.kosa8.com. Under New to kosa8 Cloud? enter an organization name, your email and a password, and press Create organization. From then on you sign in with that email and password; Email me a link to set it on the sign-in page resets a forgotten one.

You also get the organization's first admin API key (it starts k8c_live_). It is shown once, so put it in your password manager before you continue.

Add a payment method

A new organization runs nothing until a payment method is on file. Go to Usage and press Add payment method; checkout is through Polar. Once it is added, a one-off $50 signup credit lands on the account and pays for your first usage.

Make an API key for your code

In API keys, create a key for each app or agent, so you can revoke one without the others. The SDKs read it from KOSA8_API_KEY:

$ export KOSA8_API_KEY=k8c_live_…

Create a sandbox and run something

Python (pip install kosa8):

from kosa8 import Kosa8Cloud

cloud = Kosa8Cloud()  # reads KOSA8_API_KEY

box = cloud.sandboxes.create(template="python", sleep_after_s=600)
r = box.exec(["python3", "-c", "print(6 * 7)"])
print(r.exit_code, r.stdout)    # 0 42
box.sleep()                     # costs only snapshot storage while asleep
box.exec("ls /workspace")       # wakes it, files and all
box.delete()

JavaScript and TypeScript (npm install @kosa8/sdk):

import { Kosa8Cloud } from '@kosa8/sdk';

const cloud = new Kosa8Cloud(); // reads KOSA8_API_KEY

const box = await cloud.sandboxes.create({ template: 'python' });
const r = await box.exec(['python3', '-c', 'print(6 * 7)']);
console.log(r.exitCode, r.stdout); // 0 "42\n"
await box.delete();

Go, Ruby and Java have the same Kosa8Cloud client; see each SDK's README under For developers.

Plain HTTP

The API is at https://api.kosa8.com. Send the key as a bearer token:

curl -s -X POST https://api.kosa8.com/v1/sandboxes \
  -H "Authorization: Bearer $KOSA8_API_KEY" -H 'Content-Type: application/json' \
  -d '{"template":"python"}'
# {"sandbox":{"id":"sbx_…","state":"running","template":"python","region":"eu-hel1",…}}

curl -s -X POST https://api.kosa8.com/v1/sandboxes/sbx_…/exec \
  -H "Authorization: Bearer $KOSA8_API_KEY" -H 'Content-Type: application/json' \
  -d '{"cmd":["python3","-c","print(6 * 7)"]}'
# {"exit":0,"stdout":"42\n","stderr":""}

curl -s -X DELETE https://api.kosa8.com/v1/sandboxes/sbx_… \
  -H "Authorization: Bearer $KOSA8_API_KEY"

Other routes: GET /v1/sandboxes, GET /v1/sandboxes/{id}, POST /v1/sandboxes/{id}/sleep and /wake. Errors are JSON with a stable code; before a payment method is added, creating a sandbox answers 402 with payment_required.

Templates and regions

TemplateWhat is in it
baseAlpine Linux (the default)
pythonPython 3.12 on Alpine
nodeNode.js 22 on Alpine

Sandboxes are kept warm, so creating one takes about a second. They run in the EU (eu-hel1, Helsinki) today; more regions follow.

What it costs

Billed per second while a sandbox runs: $0.048 per vCPU-hour and $0.0154 per GB of RAM per hour in the EU (1.2× in the US and Asia-Pacific). An idle sandbox goes to sleep and then costs only $0.08 per GB-month for its snapshot; the next command wakes it. Sandboxes on your own hosts carry no compute charge. Usage in the dashboard shows the month so far, and Settings has a spending cap.

The dashboard

TabFor
SandboxesWhat is running, asleep or stopped, and what each has cost.
FunctionsDeploy a handler and call it; each call runs in its own sandbox.
API keysMake and revoke keys. A leaked key: revoke it here first.
Own hostsRun sandboxes on your own servers, managed from the same dashboard.
Team & SSOInvite people, or connect Okta, Entra ID or Google Workspace.
Settings / UsageDefault template and region, sleep timer, spending cap, the bill.

Cloud or your own machine?

kosa8 on your own computer (Install) is the same sandbox with no network hop and nothing leaving the machine. Use the cloud when your code runs somewhere without kosa8 installed (a server, a CI job, a hosted agent), or when you want many sandboxes at once without a big machine of your own.