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

# Memory Usage

> Per-memID request counts, injected tokens, and last-used, plus embed cost.

MUST stay declared ABOVE `GET /{slug_or_id}` — FastAPI matches in
declaration order, so below it "usage" is read as a slug and this route is
unreachable (404, from a memory nobody owns).

Scoped to the CALLER'S OWN keys, not the whole org, and that is the honest
scope rather than a shortcut: injection is owner-scoped in the gateway, so a
colleague's memID cannot be attached by your keys at all. It also sidesteps a
real ambiguity — `memory_slugs` records slugs, and slugs are unique per
(owner, slug) rather than per org, so an org-wide aggregate would silently
merge two members' identically-named memories into one row.

Every token figure is OUR tokenizer's estimate of what the injected block
cost, not a provider-reported number: no upstream reports the split between
the memory block and the rest of the prompt. A request attaching several
memIDs logs ONE block size, which is split equally across them here — see
the subquery. Hence `injected_tokens_est`, and hence no derived dollar figure
beside it — see MemoryUsageRow.



## OpenAPI

````yaml /api/openapi.json get /v1/memories/usage
openapi: 3.1.0
info:
  title: MeshAPI
  description: One key, all AI models.
  version: 0.1.0
servers:
  - url: https://api.meshapi.ai
security:
  - BearerAuth: []
paths:
  /v1/memories/usage:
    get:
      tags:
        - Memory
      summary: Memory Usage
      description: >-
        Per-memID request counts, injected tokens, and last-used, plus embed
        cost.


        MUST stay declared ABOVE `GET /{slug_or_id}` — FastAPI matches in

        declaration order, so below it "usage" is read as a slug and this route
        is

        unreachable (404, from a memory nobody owns).


        Scoped to the CALLER'S OWN keys, not the whole org, and that is the
        honest

        scope rather than a shortcut: injection is owner-scoped in the gateway,
        so a

        colleague's memID cannot be attached by your keys at all. It also
        sidesteps a

        real ambiguity — `memory_slugs` records slugs, and slugs are unique per

        (owner, slug) rather than per org, so an org-wide aggregate would
        silently

        merge two members' identically-named memories into one row.


        Every token figure is OUR tokenizer's estimate of what the injected
        block

        cost, not a provider-reported number: no upstream reports the split
        between

        the memory block and the rest of the prompt. A request attaching several

        memIDs logs ONE block size, which is split equally across them here —
        see

        the subquery. Hence `injected_tokens_est`, and hence no derived dollar
        figure

        beside it — see MemoryUsageRow.
      operationId: memory_usage
      parameters:
        - name: window_days
          in: query
          required: false
          schema:
            type: integer
            maximum: 90
            minimum: 1
            default: 30
            title: Window Days
        - in: header
          name: X-Mesh-Version
          required: false
          schema:
            type: string
            enum:
              - 2026-08
            default: 2026-08
          example: 2026-08
          description: >-
            Dated version of the API contract to pin this request to. Omit it
            and the request is served under `2026-08` — the oldest supported
            version, so an existing integration is never moved by a release. A
            malformed or unsupported value is rejected with `400
            invalid_api_version` rather than falling back silently. The version
            actually served is echoed as `X-Mesh-Version` on every response,
            including errors.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemoryUsageResponse'
        '401':
          description: Missing or invalid credentials
        '422':
          description: window_days out of range
      security:
        - BearerAuth: []
components:
  schemas:
    MemoryUsageResponse:
      properties:
        window_days:
          type: integer
          title: Window Days
        tracked_since:
          anyOf:
            - type: string
            - type: 'null'
          title: Tracked Since
        memories:
          items:
            $ref: '#/components/schemas/MemoryUsageRow'
          type: array
          title: Memories
          default: []
        embed_requests:
          type: integer
          title: Embed Requests
          default: 0
        embed_cost_usd:
          type: string
          title: Embed Cost Usd
          default: '0'
      type: object
      required:
        - window_days
      title: MemoryUsageResponse
    MemoryUsageRow:
      properties:
        slug:
          type: string
          title: Slug
        requests:
          type: integer
          title: Requests
          default: 0
        injected_tokens_est:
          type: integer
          title: Injected Tokens Est
          default: 0
        last_used_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Used At
        per_key:
          items:
            $ref: '#/components/schemas/MemoryUsageKeyRow'
          type: array
          title: Per Key
          default: []
      type: object
      required:
        - slug
      title: MemoryUsageRow
      description: >-
        Usage for one memID, as used by the caller's own API keys.


        ``injected_tokens_est`` is doubly an estimate. It is OUR tokenizer's
        count of

        the block we prepended — no provider reports the split between that
        block and

        the rest of the prompt — AND, when a request attached several memIDs,
        this

        memory's equal share of that one block rather than its measured
        contribution.

        Which is why there is deliberately no dollar figure beside it: calling
        an

        estimate a charge on a billing-adjacent surface is how numbers get
        quoted

        back at you in a support ticket.
    MemoryUsageKeyRow:
      properties:
        key_id:
          type: string
          title: Key Id
        requests:
          type: integer
          title: Requests
        injected_tokens_est:
          type: integer
          title: Injected Tokens Est
      type: object
      required:
        - key_id
        - requests
        - injected_tokens_est
      title: MemoryUsageKeyRow
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Enter your MeshAPI key (`rsk_...`) — sent as `Authorization: Bearer
        <key>`.

````