GET
/
v0
/
logs
/
metric
/
{default_metric}
curl --request GET \
  --url 'https://api.unify.ai/v0/logs/metric/<default_metric>?project=None' \
  --header "Authorization: Bearer $UNIFY_KEY"
  --header 'Content-Type: application/json' \
  --data '{}'
4.56
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:
    GET /logs/metric/mean?key=score
    
    Response:
    4.56
    
  2. Multiple keys, no grouping: Returns a dict mapping keys to metric values Example:
    GET /logs/metric/mean?key=["score","length"]
    
    Response:
    {"score": 4.56, "length": 120}
    
  3. With grouping: Returns metrics grouped by one or more fields Example:
    GET /logs/metric/mean with body {"key": "score", "group_by": "model"}
    
    Response:
    {"gpt-4": 4.56, "gpt-3.5": 3.78}
    
    For nested grouping, provide a list of fields: Example:
    GET /logs/metric/mean with body {"key": "score", "group_by": ["model", "temperature"]}
    
    Response:
    {"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.

Authorizations

Authorization
string
required
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

default_metric
string
required

Query Parameters

project
string
required

Body

key
string | array | null
Single key string or a list of keys.
metrics
object | null
Optional per-key metrics mapping. If provided, overrides the path metric for those keys.
filter_expr
string | object | null
Expression to filter logs (string or key->expr dict).
from_ids
string | object | null
Log IDs to include (string or key->IDs dict).
exclude_ids
string | object | null
Log IDs to exclude (string or key->IDs dict).
context
string | null
Context name (string).
group_by
string | array | null
Field(s) to group by when computing metrics. Can be a single field name or a list of field names for nested grouping.
curl --request GET \
  --url 'https://api.unify.ai/v0/logs/metric/<default_metric>?project=None' \
  --header "Authorization: Bearer $UNIFY_KEY"
  --header 'Content-Type: application/json' \
  --data '{}'
4.56