> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nasiko.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent and workflow cost attribution, sorted and paginated on the server.



## OpenAPI

````yaml /api-reference/openapi.json get /api/observability/finops/attributions
openapi: 3.1.0
info:
  title: Nasiko API
  description: >-
    HTTP API for the Nasiko OpenRuntime: agents, coding harnesses, TokenOps,
    routing, MCP, and secrets. Spec is generated from annotated routes; some
    surfaces are documented on the hand-written pages alongside this file.
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://free.app.nasiko.com
    description: Nasiko Cloud Free
  - url: https://{workspace}.app.nasiko.com
    description: Nasiko Cloud paid workspace
    variables:
      workspace:
        default: your-workspace
        description: >-
          Your workspace's subdomain, as shown in the connect command on the
          dashboard's Nasiko CLI page
security:
  - bearer_auth: []
tags:
  - name: secrets
    description: Encrypted per-user agent secrets
  - name: catalog
    description: >-
      Agent catalog: registration, discovery, versions, per-agent secrets, and
      source import
  - name: agents
    description: >-
      Agent lifecycle: deployments, LLM routing config, update/rollback,
      upload-and-deploy
  - name: orchestrator
    description: >-
      A2A dispatch: routing-engine/ReAct orchestrator and direct agent chat,
      plus routing stats
  - name: users
    description: >-
      User management: CRUD, roles, credentials, accessible agents
      (superuser-only)
  - name: usage
    description: Per-user token usage and cost reporting
  - name: observability
    description: Sessions, traces, spans, agent logs, and FinOps reporting
  - name: llm-router
    description: LLM routing presets, provider/model catalog, and tier→model registry
  - name: context-selection
    description: >-
      Per-user chat-history selection preferences: strategy, PACMS budget tier,
      the on/off switch, a dry-run preview, and settings-change history
  - name: coding-agents
    description: >-
      The progress local clients report while they bring in the caller's coding
      agents
  - name: settings
    description: >-
      Workspace-wide settings, including the Optimization tiers a user's PACMS
      budget level resolves against
  - name: mcp
    description: >-
      MCP gateway: agent-facing JSON-RPC tool calls, connector
      registration/upload/sharing, credentials & OAuth, and per-agent tool
      permissions
paths:
  /api/observability/finops/attributions:
    get:
      tags:
        - observability
      summary: Agent and workflow cost attribution, sorted and paginated on the server.
      operationId: get_finops_attributions
      parameters:
        - name: start_time
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: end_time
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: range
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: agent_id
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: model
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: provider
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: view
          in: query
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: sort_by
          in: query
          description: >-
            "cost" | "tokens" | "operations" | "avg_latency" | "container_hours"
            | "sandbox_minutes" | "name"
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: sort_dir
          in: query
          description: '"asc" | "desc" (default "desc")'
          required: false
          schema:
            type:
              - string
              - 'null'
        - name: limit
          in: query
          required: false
          schema:
            type:
              - integer
              - 'null'
            format: int64
        - name: offset
          in: query
          required: false
          schema:
            type:
              - integer
              - 'null'
            format: int64
        - name: user_id
          in: query
          description: >-
            One user's usage only (a user UUID). An admin may name anyone;
            anyone else only

            themselves (403 otherwise).
          required: false
          schema:
            type:
              - string
              - 'null'
      responses:
        '200':
          description: Attribution rows
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FinopsAttributionsResponse'
        '400':
          description: Malformed filter
components:
  schemas:
    FinopsAttributionsResponse:
      type: object
      required:
        - data
        - status_code
        - message
      properties:
        data:
          $ref: '#/components/schemas/FinopsAttributions'
        message:
          type: string
        status_code:
          type: integer
          format: int32
          minimum: 0
    FinopsAttributions:
      oneOf:
        - type: object
          required:
            - rows
            - view
          properties:
            rows:
              type: array
              items:
                $ref: '#/components/schemas/AgentFinopsRow'
            view:
              type: string
              enum:
                - agent
        - type: object
          required:
            - rows
            - view
          properties:
            rows:
              type: array
              items:
                $ref: '#/components/schemas/WorkflowFinopsRow'
            view:
              type: string
              enum:
                - workflow
    AgentFinopsRow:
      type: object
      required:
        - agent_id
        - agent_name
        - total_cost
        - operations
        - is_capped
        - avg_cost_per_operation
        - prompt_tokens
        - completion_tokens
        - cache_read_tokens
        - cache_creation_tokens
        - total_tokens
        - tool_call_count
        - container_hours
        - sandbox_minutes
      properties:
        agent_id:
          type: string
        agent_name:
          type: string
        avg_cost_per_operation:
          type: number
          format: double
        avg_latency_ms:
          type:
            - number
            - 'null'
          format: double
          description: p50 trace-level latency for this agent in the window.
        avg_latency_p95_ms:
          type:
            - number
            - 'null'
          format: double
        avg_latency_p99_ms:
          type:
            - number
            - 'null'
          format: double
        cache_creation_tokens:
          type: integer
          format: int64
          description: Prompt tokens written to provider cache (Anthropic cache creation).
          minimum: 0
        cache_read_tokens:
          type: integer
          format: int64
          description: >-
            Prompt tokens served from provider cache (OpenAI cached / Anthropic
            cache read).
          minimum: 0
        completion_tokens:
          type: integer
          format: int64
          minimum: 0
        container_hours:
          type: number
          format: double
          description: Replica-hours this agent consumed in the dashboard window.
        is_capped:
          type: boolean
          description: |-
            True when `operations` was capped by the token-aggregation trace
            limit — the token/cost fields below undercount the real total.
        operations:
          type: integer
          minimum: 0
        previous:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/AgentFinopsPrevious'
              description: >-
                This agent's figures for the preceding window of the same
                length, present

                only with `compare=previous`.


                The previous window is already queried on every dashboard call
                (the KPI

                strip's `change_pct` needs it) and was simply discarded per
                agent, so a

                caller that wanted per-agent comparison had to issue a second
                whole

                dashboard request for the earlier window. Omitted by default so
                the

                default payload is byte-identical to before.
        prompt_tokens:
          type: integer
          format: int64
          minimum: 0
        sandbox_minutes:
          type: number
          format: double
          description: Sandbox-minutes this agent consumed in the dashboard window.
        tool_call_count:
          type: integer
          format: int64
          minimum: 0
        total_cost:
          type: number
          format: double
        total_tokens:
          type: integer
          format: int64
          minimum: 0
        version:
          type:
            - string
            - 'null'
    WorkflowFinopsRow:
      type: object
      required:
        - maf_id
        - workflow_name
        - total_cost
        - executions
        - avg_cost_per_execution
        - prompt_tokens
        - completion_tokens
        - cache_read_tokens
        - cache_creation_tokens
        - total_tokens
      properties:
        avg_cost_per_execution:
          type: number
          format: double
        avg_latency_ms:
          type:
            - number
            - 'null'
          format: double
        cache_creation_tokens:
          type: integer
          format: int64
          description: Prompt tokens written to provider cache (Anthropic cache creation).
          minimum: 0
        cache_read_tokens:
          type: integer
          format: int64
          description: >-
            Prompt tokens served from provider cache (OpenAI cached / Anthropic
            cache read).
          minimum: 0
        completion_tokens:
          type: integer
          format: int64
          minimum: 0
        executions:
          type: integer
          minimum: 0
        maf_id:
          type: string
        prompt_tokens:
          type: integer
          format: int64
          minimum: 0
        total_cost:
          type: number
          format: double
        total_tokens:
          type: integer
          format: int64
          minimum: 0
        workflow_name:
          type: string
    AgentFinopsPrevious:
      type: object
      description: >-
        One agent's preceding-window totals. Deliberately a subset: enough to
        compute

        a delta, not a second full row.
      required:
        - total_cost
        - operations
        - total_tokens
        - tool_call_count
      properties:
        avg_latency_ms:
          type:
            - number
            - 'null'
          format: double
        operations:
          type: integer
          minimum: 0
        tool_call_count:
          type: integer
          format: int64
          minimum: 0
        total_cost:
          type: number
          format: double
        total_tokens:
          type: integer
          format: int64
          minimum: 0
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Session JWT. After `nasiko auth login`, print it with `jq -r
        '.clusters[.active].token' ~/.nasiko/config.json`. API keys aren't
        supported.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.