---
title: "Cost Query"
method: POST
path: "/cost/query"
tags: ["Costs"]
---

# Cost Query

`POST /cost/query`

## Request body

- CostQueryReq
  - `project_id` string, required
  - `fields` string[], nullable
  - `query` Query
    - `$expr` union, required
      - AndOperation — Logical AND. All conditions must evaluate to true. Example:
        - `$and` union[], required
          - union
            - unknown
            - unknown
            - unknown
            - AndOperation — recursive
            - unknown
            - unknown
            - unknown
            - unknown
            - unknown
            - unknown
            - unknown
            - unknown
            - unknown
      - unknown
      - unknown
      - unknown
      - unknown
      - unknown
      - unknown
      - unknown
      - unknown
      - unknown
  - `sort_by` SortBy[], nullable
    - `field` string, required
    - `direction` 'asc' | 'desc', required
  - `limit` integer, nullable
  - `offset` integer, nullable

## Response `200`

Successful Response

- CostQueryRes
  - `results` CostQueryOutput[], required
    - `id` string, nullable
    - `llm_id` string, nullable
    - `prompt_token_cost` number, nullable
    - `completion_token_cost` number, nullable
    - `prompt_token_cost_unit` string, nullable
    - `completion_token_cost_unit` string, nullable
    - `effective_date` string, date-time, nullable
    - `provider_id` string, nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/wandb/apis/serverless-training.md) · [All operations](https://skmtc.net/wandb/apis/serverless-training/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/wandb/serverless-training/revisions/8d8d96fc0fd3/schema)
