On this page

Agent credit metering

Credits are the business model for agent work on MIOSA. A user does not buy “a sandbox” or “a model call” in isolation. They buy credits that power agents doing useful work on devices.

credits = model usage + device runtime + tools + storage + deployments

Use this page when building billing, quotas, usage pages, workspace budgets, or white-label credit systems.


Metered surfaces

SurfaceExamplesWhen charged
Model/runtimeOSA, Codex, Claude Code, Hermes, custom model callsDuring agent reasoning and tool planning
Sandbox runtimeCPU/RAM while sandbox is runningWhile executing, previewing, installing, building
Computer runtimeCloud desktop/browser timeWhile browser/desktop session is active
Local relaySecure relay, streaming, tunnel, control channelWhile paired local device is connected through MIOSA
Tool callsBrowser actions, web search, Refero, connector token requestsPer call or per run allocation
StorageSnapshots, artifacts, logs, persistent filesBy size and retention
Deploy hostingMIOSA Deploy, App Engine, domains, always-on app runtimeWhile deployed or always-on

Ledger shape

credit_ledger
  id
  tenant_id
  workspace_id
  project_id
  user_id
  agent_id
  run_id
  device_type
  device_id
  category
  units
  unit_price_credits
  credits
  metadata_json
  created_at

Recommended categories:

model
device_runtime
tool
connector
storage
deployment
network
adjustment
grant
refund

Each ledger entry should be traceable to a run, request id, or lifecycle event.


Run-level cost model

Every agent run should expose:

FieldPurpose
estimated_creditsShow before high-cost work starts
reserved_creditsPrevent a run from exceeding budget mid-flight
credits_usedFinal charge
credit_breakdownExplain model/device/tool/storage/deploy split
budget_remainingLet UI warn before next action

Simple examples

One-shot health check

User runs: miosa run "check preview"

Charges:
  model: small
  device_runtime: seconds
  storage: none
  deploy: none

Sandbox app generation

User asks: "Build a Next.js marketing page."

Charges:
  model: planning and code generation
  sandbox_runtime: install, build, preview
  storage: files, logs, snapshot
  deployment: only if user publishes

Browser automation

User asks: "Log in and test checkout."

Charges:
  model: browser planning
  computer_runtime: browser session
  tool: screenshots and browser actions
  storage: screenshots/report artifact

Agent-company workflow

User asks: "Launch this company campaign."

Charges:
  parent model run
  child model runs
  multiple sandboxes/computers
  connectors
  artifacts
  optional deployment

Budget policies

Workspace owners should be able to set:

  • monthly credit budget
  • per-run max credits
  • per-agent daily budget
  • max concurrent sandboxes
  • max concurrent computers
  • max child agents
  • max connector spend
  • approval threshold
  • hard stop threshold

Recommended approval gates:

ActionGate
Use more than run budgetAsk approval
Create many child devicesAsk approval
Start always-on deploymentAsk approval
Use paid connectorAsk approval or preconfigured policy
Send external messagesAsk approval
Delete snapshots/artifactsAsk approval

Credits in white-label products

White-label products can expose credits in two ways:

ModelMeaning
Pass-throughEnd customer sees MIOSA credit usage directly
WrappedYour product shows its own units, while backend maps to MIOSA credits

For ClinicIQ-style products, the backend should store both:

customer_usage_events
  external_workspace_id
  external_user_id
  external_project_id
  miosa_run_id
  miosa_credits
  customer_units

This lets your app show the product-specific balance while still reconciling to MIOSA billing.


Credit events

Emit events so the UI can update live:

EventWhen
credits.estimatedBefore a run, publish, or expensive connector action
credits.reservedBudget held for a run
credits.chargedLedger entry committed
credits.refundedFailed or cancelled work refunded
credits.low_balanceWorkspace balance below threshold
credits.limit_reachedRun blocked by plan or budget

The CLI should report the same data:

miosa credits balance
miosa credits usage --workspace <id>
miosa credits runs <run-id>
miosa whoami --json

Failure handling

Billing should be conservative and explainable.

FailureExpected billing behavior
Run rejected before startNo charge
Device created but agent failed before workCharge minimal device time or refund per policy
Upload/import failed after resource creationReturn partial resource id and recovery command
User cancelsCharge work already performed, stop future charging
Platform errorRefund affected usage where possible
Connector/provider errorCharge only completed provider work

Always include request ids and run ids in billing-support views.


See also

Was this helpful?