On this page

MIOSA uses a credit-based billing system. Credits are consumed for compute time and AI API calls.

Base path: /api/v1/credits


Get Balance

GET /api/v1/credits/balance

Returns the current credit balance for your tenant.

Response - 200 OK

{
  "tenant_id": "550e8400-e29b-41d4-a716-446655440000",
  "balance_credits": 850,
  "lifetime_earned": 1000,
  "lifetime_spent": 150,
  "credit_expiry_at": "2026-10-08T00:00:00Z",
  "updated_at": "2026-04-11T15:00:00Z"
}

Response Fields

FieldTypeDescription
tenant_idUUIDYour tenant ID
balance_creditsintegerCurrent available credits
lifetime_earnedintegerTotal credits ever earned (purchases + promos)
lifetime_spentintegerTotal credits ever spent
credit_expiry_atISO 8601When current credits expire (180 days from purchase)
updated_atISO 8601Last balance change

If no credit balance record exists yet, returns zeros:

{
  "tenant_id": "...",
  "balance_credits": 0,
  "lifetime_earned": 0,
  "lifetime_spent": 0,
  "credit_expiry_at": null,
  "updated_at": null
}
curl https://api.miosa.ai/api/v1/credits/balance 
  -H "Authorization: Bearer $MIOSA_API_KEY"

Get Transactions

GET /api/v1/credits/transactions

Returns paginated credit transaction history.

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number (1-based)
page_sizeinteger20Items per page (max: 100)

Response - 200 OK

{
  "transactions": [
    {
      "id": "uuid",
      "tenant_id": "uuid",
      "user_id": "uuid",
      "computer_id": "uuid",
      "type": "spend",
      "amount_credits": -5,
      "description": "LLM API call",
      "provider": "ollama",
      "model": "nemotron-3-super",
      "input_tokens": 1500,
      "output_tokens": 500,
      "cost_usd_micros": 250,
      "inserted_at": "2026-04-11T15:00:00Z"
    },
    {
      "id": "uuid",
      "tenant_id": "uuid",
      "user_id": "uuid",
      "computer_id": null,
      "type": "earn",
      "amount_credits": 1000,
      "description": "Starter plan monthly credits",
      "provider": null,
      "model": null,
      "input_tokens": null,
      "output_tokens": null,
      "cost_usd_micros": null,
      "inserted_at": "2026-04-01T00:00:00Z"
    }
  ],
  "total": 47,
  "page": 1,
  "page_size": 20
}

Transaction Fields

FieldTypeDescription
idUUIDTransaction ID
tenant_idUUIDTenant ID
user_idUUIDUser who triggered the transaction
computer_idUUIDAssociated computer (if applicable)
typestring"earn" or "spend"
amount_creditsintegerCredits (positive = earned, negative = spent)
descriptionstringHuman-readable description
providerstringLLM provider (for AI transactions)
modelstringModel name (for AI transactions)
input_tokensintegerInput tokens used (for AI transactions)
output_tokensintegerOutput tokens generated (for AI transactions)
cost_usd_microsintegerCost in microdollars (1/1,000,000 USD)
inserted_atISO 8601Transaction timestamp
curl "https://api.miosa.ai/api/v1/credits/transactions?page=1&page_size=50" 
  -H "Authorization: Bearer $MIOSA_API_KEY"

Get Usage Summary

GET /api/v1/credits/usage

Returns daily usage rollups grouped by provider and model.

Query Parameters

ParameterTypeDefaultDescription
fromISO 860130 days agoStart of date range
toISO 8601NowEnd of date range

Response - 200 OK

{
  "usage": [
    {
      "day": "2026-04-11T00:00:00Z",
      "provider": "ollama",
      "model": "nemotron-3-super",
      "credits_spent": 45,
      "input_tokens": 15000,
      "output_tokens": 5000,
      "cost_usd_micros": 2250,
      "call_count": 12
    },
    {
      "day": "2026-04-10T00:00:00Z",
      "provider": "ollama",
      "model": "nemotron-3-super",
      "credits_spent": 30,
      "input_tokens": 10000,
      "output_tokens": 3000,
      "cost_usd_micros": 1500,
      "call_count": 8
    }
  ],
  "from": "2026-03-12T00:00:00Z",
  "to": "2026-04-11T15:00:00Z"
}

Usage Entry Fields

FieldTypeDescription
dayISO 8601Date (truncated to day)
providerstringLLM provider
modelstringModel name
credits_spentintegerTotal credits spent that day
input_tokensintegerTotal input tokens
output_tokensintegerTotal output tokens
cost_usd_microsintegerTotal cost in microdollars
call_countintegerNumber of API calls

Errors

StatusErrorCause
400invalid 'from' timestampNot valid RFC 3339
400invalid 'to' timestampNot valid RFC 3339
400'from' must be before 'to'Invalid date range
curl "https://api.miosa.ai/api/v1/credits/usage?from=2026-04-01T00:00:00Z&to=2026-04-11T23:59:59Z" 
  -H "Authorization: Bearer $MIOSA_API_KEY"

Credit Pricing

Compute Credits

SizeCredits/hour
Small (4GB/1CPU)3
Medium (8GB/2CPU)6
Large (16GB/4CPU)12

AI Credits (per 1M tokens)

TierInputOutput
Standard models1020
Advanced models60100

Plans

PlanPrice/monthCredits
Free$0100
Starter$291,000
Pro$793,000
Scale$19910,000

Credits expire 180 days from purchase. Unused plan credits do not roll over.


See also

Was this helpful?