---
title: "Get Logs Metric"
method: GET
path: "/v0/logs/metric/{default_metric}"
tags: ["Logs"]
---

# Get Logs Metric

`GET /v0/logs/metric/{default_metric}`

Returns the reduction metric for filtered values (base + derived) for one or more keys from a project.

This endpoint supports three modes of operation:

1. Single key, no grouping: Returns a single metric value
   Example:
   ```bash
   GET /logs/metric/mean?key=score
   ```
   Response:
   ```json
   4.56
   ```

2. Multiple keys, no grouping: Returns a dict mapping keys to metric values
   Example:
   ```bash
   GET /logs/metric/mean?key=["score","length"]
   ```
   Response:
   ```json
   {"score": 4.56, "length": 120}
   ```

3. With grouping: Returns metrics grouped by one or more fields
   Example:
   ```bash
   GET /logs/metric/mean with body {"key": "score", "group_by": "model"}
   ```
   Response:
   ```json
   {"gpt-4": 4.56, "gpt-3.5": 3.78}
   ```

   For nested grouping, provide a list of fields:
   Example:
   ```bash
   GET /logs/metric/mean with body {"key": "score", "group_by": ["model", "temperature"]}
   ```
   Response:
   ```json
   {"gpt-4": {"0.7": 4.56, "0.9": 4.23}, "gpt-3.5": {"0.7": 3.78, "0.9": 3.45}}
   ```

The group_by parameter can be a string for single-level grouping or a list of strings for
nested grouping. Each group_by field can be prefixed with "params/" to indicate it's a parameter.

## Path parameters

- `default_metric` string, required

## Query parameters

- `project_name` string, required

## Request body

- GetLogsMetricRequest
  - `key` union — Single key string or a list of keys.
    - string
    - string[]
  - `metrics` object, nullable — Optional per-key metrics mapping. If provided, overrides the path metric for those keys.
  - `filter_expr` union — Expression to filter logs (string or key->expr dict).
    - string
    - object
  - `from_ids` union — Log IDs to include (string or key->IDs dict).
    - string
    - object
  - `exclude_ids` union — Log IDs to exclude (string or key->IDs dict).
    - string
    - object
  - `context` string, nullable — Context name (string).
  - `group_by` union — Field(s) to group by when computing metrics. Can be a single field name or a list of field names for nested grouping.
    - string
    - string[]

## Response `200`

Successful Response

- union
  - object
  - number
  - integer
  - boolean
  - string

## Other responses

- `404` — Project Not Found
- `422` — Validation Error

---

[API](https://skmtc.net/unify/apis/unifyai-http-api-reference.md) · [All operations](https://skmtc.net/unify/apis/unifyai-http-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/unify/unifyai-http-api-reference/revisions/900377f918b6/schema)
