Casama AI Runs API

The runs API from Casama AI, for runs.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 4

GET /v1/runs/{id} Get run #
GET /v1/runs/{id}/usage What a run and its subruns cost, broken down by what was metered #
POST /v1/runs/{id}/cancel Cancel a run and its subruns #
GET /v1/runs/{id}/events Events after a seq. #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/casama-ai:casama-ai-runs-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

casama-ai-runs-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Casama Runs API
  version: 0.1.0
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: http://api.casama.ai
tags:
- name: Runs
paths:
  /v1/runs/{id}:
    get:
      operationId: getRun
      tags:
      - Runs
      security:
      - bearerAuth: []
      parameters:
      - schema:
          type: string
          format: uuid
        required: true
        name: id
        in: path
      responses:
        '200':
          description: Run
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Run'
        '401':
          description: Not authenticated
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '404':
          description: Not found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      summary: Get run
      x-summary-source: derived
  /v1/runs/{id}/usage:
    get:
      operationId: getRunUsage
      tags:
      - Runs
      security:
      - bearerAuth: []
      summary: What a run and its subruns cost, broken down by what was metered
      parameters:
      - schema:
          type: string
          format: uuid
        required: true
        name: id
        in: path
      responses:
        '200':
          description: Run usage
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunUsage'
        '401':
          description: Not authenticated
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '404':
          description: Not found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
  /v1/runs/{id}/cancel:
    post:
      operationId: cancelRun
      tags:
      - Runs
      security:
      - bearerAuth: []
      summary: Cancel a run and its subruns
      parameters:
      - schema:
          type: string
          format: uuid
        required: true
        name: id
        in: path
      responses:
        '202':
          description: Cancellation requested
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Run'
        '401':
          description: Not authenticated
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '404':
          description: Not found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '409':
          description: Conflict
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
  /v1/runs/{id}/events:
    get:
      operationId: listRunEvents
      tags:
      - Runs
      security:
      - bearerAuth: []
      summary: Events after a seq.
      parameters:
      - schema:
          type: string
          format: uuid
        required: true
        name: id
        in: path
      - schema:
          type:
          - integer
          - 'null'
          minimum: 0
        required: false
        name: after_seq
        in: query
      - schema:
          type: integer
          minimum: 1
          maximum: 1000
        required: false
        name: limit
        in: query
      responses:
        '200':
          description: Events in seq order (JSON), or a server-sent event stream
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunEventsPage'
            text/event-stream:
              schema:
                type: string
                description: 'event: run_event, data: RunEventEnvelope'
        '401':
          description: Not authenticated
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
        '404':
          description: Not found
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
components:
  schemas:
    RunUsage:
      type: object
      properties:
        run_id:
          type: string
          format: uuid
        status:
          $ref: '#/components/schemas/RunStatus'
        cost_usd:
          type: number
          description: Everything metered, including your own keys
        charged_usd:
          type: number
          description: The part taken from Casama credits (1 credit = $1)
        upstream_cost_usd:
          type:
          - number
          - 'null'
          description: 'Instance owner only (D-395): what the server paid its providers for this usage, fees included. Absent for everyone else; null when nothing ran on the server''s keys'
        tokens_in:
          type: integer
        tokens_out:
          type: integer
        duration_ms:
          type:
          - integer
          - 'null'
        tool_calls:
          type: integer
        subruns:
          type: integer
        items:
          type: array
          items:
            type: object
            properties:
              kind:
                type: string
              model:
                type:
                - string
                - 'null'
              source:
                type: string
                enum:
                - key
                - chatgpt_plan
              billable:
                type: boolean
              quantity:
                type: number
              cost_usd:
                type: number
              upstream_cost_usd:
                type:
                - number
                - 'null'
                description: Instance owner only, like the total
            required:
            - kind
            - model
            - source
            - billable
            - quantity
            - cost_usd
      required:
      - run_id
      - status
      - cost_usd
      - charged_usd
      - tokens_in
      - tokens_out
      - duration_ms
      - tool_calls
      - subruns
      - items
    Run:
      type: object
      properties:
        id:
          type: string
          format: uuid
        bot_id:
          type: string
          format: uuid
        conversation_id:
          type:
          - string
          - 'null'
          format: uuid
        parent_run_id:
          type:
          - string
          - 'null'
          format: uuid
        trigger:
          type: string
        status:
          $ref: '#/components/schemas/RunStatus'
        tokens_in:
          type: integer
        tokens_out:
          type: integer
        cost_usd:
          type: number
        last_seq:
          type: integer
        started_at:
          type:
          - string
          - 'null'
          format: date-time
        ended_at:
          type:
          - string
          - 'null'
          format: date-time
        error:
          type:
          - object
          - 'null'
          properties:
            code:
              type: string
            message:
              type: string
          required:
          - code
          - message
        trace_id:
          type:
          - string
          - 'null'
          description: OpenTelemetry trace of this run
        created_at:
          type: string
          format: date-time
      required:
      - id
      - bot_id
      - conversation_id
      - parent_run_id
      - trigger
      - status
      - tokens_in
      - tokens_out
      - cost_usd
      - last_seq
      - started_at
      - ended_at
      - error
      - trace_id
      - created_at
    RunStatus:
      type: string
      enum:
      - queued
      - running
      - waiting_approval
      - waiting_takeover
      - completed
      - failed
      - cancelled
    RunEventEnvelope:
      type: object
      properties:
        v:
          type: integer
          minimum: 1
          description: Protocol version, currently 1
        run_id:
          type: string
          format: uuid
        seq:
          type: integer
          exclusiveMinimum: 0
        ts:
          type: string
          format: date-time
        bot_id:
          type: string
          format: uuid
        type:
          type: string
        payload:
          type: object
          additionalProperties: {}
      required:
      - v
      - run_id
      - seq
      - ts
      - bot_id
      - type
      - payload
    Problem:
      type: object
      properties:
        type:
          type: string
          example: https://casama.ai/problems/not_found
        title:
          type: string
        status:
          type: integer
        code:
          type: string
          description: Stable error code
          example: not_found
        detail:
          type: string
        instance:
          type: string
        errors:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
              message:
                type: string
            required:
            - path
            - message
          description: Field errors for validation_failed
      required:
      - type
      - title
      - status
      - code
    RunEventsPage:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/RunEventEnvelope'
        run_status:
          $ref: '#/components/schemas/RunStatus'
      required:
      - items
      - run_status
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Supabase access token