> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.meshapi.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.meshapi.ai/_mcp/server.

# Query Usage Summary

POST https://api.meshapi.ai/v1/usage
Content-Type: application/json

Aggregate usage stats for the authenticated caller.

Authenticate with an rsk_ API key. Results are scoped to that single key — any org_id / member filters in the body are ignored. API-key reads are computed fresh.

Reference: https://developers.meshapi.ai/api-reference/mesh-api/usage/query-usage-summary

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: openapi
  version: 1.0.0
paths:
  /v1/usage:
    post:
      operationId: query-usage-summary
      summary: Query Usage Summary
      description: >-
        Aggregate usage stats for the authenticated caller.


        Authenticate with an rsk_ API key. Results are scoped to that single key
        — any org_id / member filters in the body are ignored. API-key reads are
        computed fresh.
      tags:
        - usage
      parameters:
        - name: refresh
          in: query
          required: false
          schema:
            type: boolean
            default: false
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/app__usage__analytics__UsageSummary'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UsageFilter'
servers:
  - url: https://api.meshapi.ai
    description: Production Server
components:
  schemas:
    UsageFilter:
      type: object
      properties:
        since:
          type:
            - string
            - 'null'
        until:
          type:
            - string
            - 'null'
        model:
          type:
            - array
            - 'null'
          items:
            type: string
        status:
          type:
            - array
            - 'null'
          items:
            type: string
        key_id:
          type:
            - array
            - 'null'
          items:
            type: string
        org_id:
          type: string
        team_id:
          type:
            - string
            - 'null'
        member_user_id:
          type:
            - string
            - 'null'
        end_user_id:
          type:
            - string
            - 'null'
        limit:
          type:
            - integer
            - 'null'
          default: 50
        offset:
          type:
            - integer
            - 'null'
          default: 0
      required:
        - org_id
      title: UsageFilter
    ModelBreakdown:
      type: object
      properties:
        model:
          type: string
        requests:
          type: integer
        prompt_tokens:
          type:
            - integer
            - 'null'
        completion_tokens:
          type:
            - integer
            - 'null'
        total_tokens:
          type:
            - integer
            - 'null'
        cost_usd:
          type:
            - string
            - 'null'
        platform_fee_usd:
          type:
            - string
            - 'null'
      required:
        - model
        - requests
        - prompt_tokens
        - completion_tokens
        - total_tokens
        - cost_usd
      title: ModelBreakdown
    app__usage__analytics__UsageSummary:
      type: object
      properties:
        total_requests:
          type: integer
        successful_requests:
          type: integer
        error_requests:
          type: integer
        prompt_tokens:
          type:
            - integer
            - 'null'
        completion_tokens:
          type:
            - integer
            - 'null'
        total_tokens:
          type:
            - integer
            - 'null'
        total_cost_usd:
          type:
            - string
            - 'null'
        total_platform_fee_usd:
          type:
            - string
            - 'null'
        total_byok_platform_fee_usd:
          type:
            - string
            - 'null'
        total_byok_cost_usd:
          type:
            - string
            - 'null'
        total_byok_requests:
          type: integer
          default: 0
        total_platform_requests:
          type: integer
          default: 0
        total_byok_tokens:
          type: integer
          default: 0
        total_platform_tokens:
          type: integer
          default: 0
        by_model:
          type: array
          items:
            $ref: '#/components/schemas/ModelBreakdown'
        by_model_total:
          type: integer
          default: 0
        cached_at:
          type:
            - string
            - 'null'
      required:
        - total_requests
        - successful_requests
        - error_requests
        - prompt_tokens
        - completion_tokens
        - total_tokens
        - total_cost_usd
        - by_model
      title: app__usage__analytics__UsageSummary
    ValidationErrorLocItems:
      oneOf:
        - type: string
        - type: integer
      title: ValidationErrorLocItems
    ValidationErrorCtx:
      type: object
      properties: {}
      title: ValidationErrorCtx
    ValidationError:
      type: object
      properties:
        loc:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorLocItems'
        msg:
          type: string
        type:
          type: string
        input:
          description: Any type
        ctx:
          $ref: '#/components/schemas/ValidationErrorCtx'
      required:
        - loc
        - msg
        - type
      title: ValidationError
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
      title: HTTPValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

```

## Examples

### Example response



**Request**

```json
undefined
```

**Response**

```json
{
  "total_requests": 1284,
  "successful_requests": 1270,
  "error_requests": 14,
  "prompt_tokens": 482913,
  "completion_tokens": 197233,
  "total_tokens": 680146,
  "total_cost_usd": "12.4832100",
  "by_model": [
    {
      "model": "openai/gpt-4o-mini",
      "requests": 900,
      "prompt_tokens": 300000,
      "completion_tokens": 120000,
      "total_tokens": 420000,
      "cost_usd": "6.1200000",
      "platform_fee_usd": "0.3060000"
    },
    {
      "model": "anthropic/claude-haiku-4.5",
      "requests": 320,
      "prompt_tokens": 150000,
      "completion_tokens": 60000,
      "total_tokens": 210000,
      "cost_usd": "4.9000000",
      "platform_fee_usd": "0.2450000"
    },
    {
      "model": "openai/text-embedding-3-small",
      "requests": 64,
      "prompt_tokens": 32913,
      "completion_tokens": 0,
      "total_tokens": 32913,
      "cost_usd": "1.4632100",
      "platform_fee_usd": "0.0731600"
    }
  ],
  "total_platform_fee_usd": "0.6241600",
  "by_model_total": 3
}
```

**SDK Code**

```python Example response
import requests

url = "https://api.meshapi.ai/v1/usage"

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Example response
const url = 'https://api.meshapi.ai/v1/usage';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: undefined
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Example response
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.meshapi.ai/v1/usage"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Example response
require 'uri'
require 'net/http'

url = URI("https://api.meshapi.ai/v1/usage")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body
```

```java Example response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.meshapi.ai/v1/usage")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Example response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.meshapi.ai/v1/usage', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Example response
using RestSharp;

var client = new RestClient("https://api.meshapi.ai/v1/usage");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Example response
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.meshapi.ai/v1/usage")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Example request



**Request**

```json
{
  "org_id": "0190a1b2-3c4d-7e8f-9012-3456789abcde",
  "since": "2026-07-01",
  "until": "2026-07-14",
  "limit": 10
}
```

**Response**

```json
{
  "total_requests": 1284,
  "successful_requests": 1270,
  "error_requests": 14,
  "prompt_tokens": 482913,
  "completion_tokens": 197233,
  "total_tokens": 680146,
  "total_cost_usd": "12.4832100",
  "by_model": [
    {
      "model": "openai/gpt-4o-mini",
      "requests": 900,
      "prompt_tokens": 300000,
      "completion_tokens": 120000,
      "total_tokens": 420000,
      "cost_usd": "6.1200000",
      "platform_fee_usd": "0.3060000"
    },
    {
      "model": "anthropic/claude-haiku-4.5",
      "requests": 320,
      "prompt_tokens": 150000,
      "completion_tokens": 60000,
      "total_tokens": 210000,
      "cost_usd": "4.9000000",
      "platform_fee_usd": "0.2450000"
    },
    {
      "model": "openai/text-embedding-3-small",
      "requests": 64,
      "prompt_tokens": 32913,
      "completion_tokens": 0,
      "total_tokens": 32913,
      "cost_usd": "1.4632100",
      "platform_fee_usd": "0.0731600"
    }
  ],
  "total_platform_fee_usd": "0.6241600",
  "by_model_total": 3
}
```

**SDK Code**

```python Example request
import requests

url = "https://api.meshapi.ai/v1/usage"

payload = {
    "org_id": "0190a1b2-3c4d-7e8f-9012-3456789abcde",
    "since": "2026-07-01",
    "until": "2026-07-14",
    "limit": 10
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Example request
const url = 'https://api.meshapi.ai/v1/usage';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"org_id":"0190a1b2-3c4d-7e8f-9012-3456789abcde","since":"2026-07-01","until":"2026-07-14","limit":10}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Example request
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.meshapi.ai/v1/usage"

	payload := strings.NewReader("{\n  \"org_id\": \"0190a1b2-3c4d-7e8f-9012-3456789abcde\",\n  \"since\": \"2026-07-01\",\n  \"until\": \"2026-07-14\",\n  \"limit\": 10\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Example request
require 'uri'
require 'net/http'

url = URI("https://api.meshapi.ai/v1/usage")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"org_id\": \"0190a1b2-3c4d-7e8f-9012-3456789abcde\",\n  \"since\": \"2026-07-01\",\n  \"until\": \"2026-07-14\",\n  \"limit\": 10\n}"

response = http.request(request)
puts response.read_body
```

```java Example request
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.meshapi.ai/v1/usage")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"org_id\": \"0190a1b2-3c4d-7e8f-9012-3456789abcde\",\n  \"since\": \"2026-07-01\",\n  \"until\": \"2026-07-14\",\n  \"limit\": 10\n}")
  .asString();
```

```php Example request
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.meshapi.ai/v1/usage', [
  'body' => '{
  "org_id": "0190a1b2-3c4d-7e8f-9012-3456789abcde",
  "since": "2026-07-01",
  "until": "2026-07-14",
  "limit": 10
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Example request
using RestSharp;

var client = new RestClient("https://api.meshapi.ai/v1/usage");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"org_id\": \"0190a1b2-3c4d-7e8f-9012-3456789abcde\",\n  \"since\": \"2026-07-01\",\n  \"until\": \"2026-07-14\",\n  \"limit\": 10\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Example request
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "org_id": "0190a1b2-3c4d-7e8f-9012-3456789abcde",
  "since": "2026-07-01",
  "until": "2026-07-14",
  "limit": 10
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.meshapi.ai/v1/usage")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```