LangSmith fleet usage API

The fleet usage API from LangSmith — 4 operation(s) for fleet usage.

OpenAPI Specification

langsmith-fleet-usage-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: LangSmith access_policies fleet usage API
  description: 'The LangSmith API is used to programmatically create and manage LangSmith resources.


    ## Host

    https://api.smith.langchain.com


    ## Authentication

    To authenticate with the LangSmith API, set the `X-Api-Key` header

    to a valid [LangSmith API key](https://docs.langchain.com/langsmith/create-account-api-key#create-an-api-key).


    '
  version: 0.1.0
servers:
- url: /
tags:
- name: fleet usage
paths:
  /v1/platform/fleet/usage/agents:
    get:
      security:
      - API Key: []
      - Tenant ID: []
      - Bearer Auth: []
      description: Returns the top agents in the workspace with cost data for the given time window. Defaults to sorting by cost descending; pass sort_by and sort_order to change. Data is sourced entirely from ClickHouse run metadata.
      tags:
      - fleet usage
      summary: List fleet agents with usage
      parameters:
      - description: Max results (max 100)
        name: limit
        in: query
        schema:
          type: integer
          default: 20
          title: Limit
      - description: Start of cost window (ISO8601)
        name: start_time
        in: query
        required: true
        schema:
          type: string
          title: Start Time
      - description: End of cost window (ISO8601)
        name: end_time
        in: query
        required: true
        schema:
          type: string
          title: End Time
      - description: Sort field (cost, runs, last_used, first_used)
        name: sort_by
        in: query
        schema:
          type: string
          default: cost
          title: Sort By
      - description: Sort direction (asc, desc)
        name: sort_order
        in: query
        schema:
          type: string
          default: desc
          title: Sort Order
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/usage.AgentUsageResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errutil.UserError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errutil.InternalError'
  /v1/platform/fleet/usage/models:
    get:
      security:
      - API Key: []
      - Tenant ID: []
      - Bearer Auth: []
      description: Returns the top models used in the workspace with aggregated cost and distinct run counts for the given time window. Defaults to sorting by cost descending; pass sort_by and sort_order to change.
      tags:
      - fleet usage
      summary: List fleet models with usage
      parameters:
      - description: Max results (max 100)
        name: limit
        in: query
        schema:
          type: integer
          default: 20
          title: Limit
      - description: Start of window (ISO8601)
        name: start_time
        in: query
        required: true
        schema:
          type: string
          title: Start Time
      - description: End of window (ISO8601)
        name: end_time
        in: query
        required: true
        schema:
          type: string
          title: End Time
      - description: Sort field (cost, runs, last_used)
        name: sort_by
        in: query
        schema:
          type: string
          default: cost
          title: Sort By
      - description: Sort direction (asc, desc)
        name: sort_order
        in: query
        schema:
          type: string
          default: desc
          title: Sort Order
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/usage.ModelUsageResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errutil.UserError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errutil.InternalError'
  /v1/platform/fleet/usage/tools:
    get:
      security:
      - API Key: []
      - Tenant ID: []
      - Bearer Auth: []
      description: Returns the top tools in the workspace with run counts, latency, and agent counts for the given time window. Defaults to sorting by runs descending; pass sort_by and sort_order to change.
      tags:
      - fleet usage
      summary: List fleet tools with usage
      parameters:
      - description: Max results (max 100)
        name: limit
        in: query
        schema:
          type: integer
          default: 20
          title: Limit
      - description: Start of window (ISO8601)
        name: start_time
        in: query
        required: true
        schema:
          type: string
          title: Start Time
      - description: End of window (ISO8601)
        name: end_time
        in: query
        required: true
        schema:
          type: string
          title: End Time
      - description: Sort field (runs, avg_latency_ms, agent_count, last_used)
        name: sort_by
        in: query
        schema:
          type: string
          default: runs
          title: Sort By
      - description: Sort direction (asc, desc)
        name: sort_order
        in: query
        schema:
          type: string
          default: desc
          title: Sort Order
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/usage.ToolUsageResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errutil.UserError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errutil.InternalError'
  /v1/platform/fleet/usage/users:
    get:
      security:
      - API Key: []
      - Tenant ID: []
      - Bearer Auth: []
      description: Returns the top users with aggregated cost data for the given time window. Defaults to sorting by cost descending; pass sort_by and sort_order to change.
      tags:
      - fleet usage
      summary: List fleet users with usage
      parameters:
      - description: Max results (max 100)
        name: limit
        in: query
        schema:
          type: integer
          default: 20
          title: Limit
      - description: Start of cost window (ISO8601)
        name: start_time
        in: query
        required: true
        schema:
          type: string
          title: Start Time
      - description: End of cost window (ISO8601)
        name: end_time
        in: query
        required: true
        schema:
          type: string
          title: End Time
      - description: Sort field (cost, runs, agent_count, last_used, first_used)
        name: sort_by
        in: query
        schema:
          type: string
          default: cost
          title: Sort By
      - description: Sort direction (asc, desc)
        name: sort_order
        in: query
        schema:
          type: string
          default: desc
          title: Sort Order
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/usage.UserUsageResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errutil.UserError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errutil.InternalError'
components:
  schemas:
    usage.UserUsage:
      type: object
      properties:
        agent_count:
          type: integer
        first_used:
          type: string
        last_used:
          type: string
        ls_user_id:
          type: string
        owner_email:
          type: string
        run_count:
          type: integer
        total_cost:
          type: number
    usage.ToolUsage:
      type: object
      properties:
        agent_count:
          type: integer
        avg_latency_ms:
          type: number
        last_used:
          type: string
        run_count:
          type: integer
        tool_name:
          type: string
    usage.ModelUsageResponse:
      type: object
      properties:
        models:
          type: array
          items:
            $ref: '#/components/schemas/usage.ModelUsage'
    errutil.UserError:
      type: object
    usage.ModelUsage:
      type: object
      properties:
        last_used:
          type: string
        model_name:
          type: string
        run_count:
          type: integer
        total_cost:
          type: number
    usage.ToolUsageResponse:
      type: object
      properties:
        tools:
          type: array
          items:
            $ref: '#/components/schemas/usage.ToolUsage'
    usage.AgentUsageResponse:
      type: object
      properties:
        agents:
          type: array
          items:
            $ref: '#/components/schemas/usage.AgentUsage'
    usage.AgentUsage:
      type: object
      properties:
        agent_name:
          type: string
        assistant_id:
          type: string
        first_used:
          type: string
        last_used:
          type: string
        model_name:
          type: string
        owner_email:
          type: string
        run_count:
          type: integer
        total_cost:
          type: number
    usage.UserUsageResponse:
      type: object
      properties:
        users:
          type: array
          items:
            $ref: '#/components/schemas/usage.UserUsage'
    errutil.InternalError:
      type: object
  securitySchemes:
    API Key:
      type: apiKey
      in: header
      name: X-API-Key
    Tenant ID:
      type: apiKey
      in: header
      name: X-Tenant-Id
    Bearer Auth:
      type: http
      description: Bearer tokens are used to authenticate from the UI. Must also specify x-tenant-id or x-organization-id (for org scoped apis).
      scheme: bearer
    Organization ID:
      type: apiKey
      in: header
      name: X-Organization-Id