Every API here is available over the APIs.io API and to AI agents over MCP.
MCP server
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
Tools for apis
7 MCP tools reach this
find_apisBrowse and filter every API in the catalog.
get_api_artifactsOne API's artifacts, grouped by type.
get_openapiThe primary OpenAPI for this API.
find_similar_apisAPIs that look like this one.
apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
resolveTurn a domain, URL or GitHub org into the provider it belongs to.
find_cohortsEvery scored population of providers in the catalog.
All 92 tools →
Call it yourself
curl for this page
This API
curl "https://apis.io/api/v1/apis/bernstein-run:bernstein-run-metrics-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Bernstein Task Server Metrics API
description: 'Bernstein REST API - the open-source governance layer for AI agents, one git worktree per task.
## Authentication
Authentication is ENABLED by default. Include a Bearer token in all requests:
```
Authorization: Bearer
```
To run without auth (development only), set `BERNSTEIN_AUTH_DISABLED=1` - this logs a loud warning and passes every request through.
Public endpoints (no auth required): `/health`, `/health/ready`, `/health/live`, `/ready`, `/alive`, `/.well-known/agent.json`, `/docs`, `/openapi.json`, and the auth-flow endpoints (`/auth/login`, `/auth/oidc/callback`, etc.).
Webhook and hook endpoints (`/webhook`, `/webhooks/*`, `/hooks/{session_id}`) authenticate via HMAC-SHA256 signatures - they do NOT accept Bearer tokens.
## Base URL
Default: `http://127.0.0.1:8052`. Override with env vars `BERNSTEIN_HOST` and `BERNSTEIN_PORT`.
## Error Format
All errors return JSON with a `detail` field:
```json
{"detail": "Task not found: task-xyz"}
```
| Status | Meaning |
|--------|---------|
| 400 | Bad request (validation error) |
| 401 | Unauthorized (missing/invalid token) |
| 403 | Forbidden (IP not in allowlist) |
| 404 | Resource not found |
| 409 | Conflict (task already in terminal state) |
| 429 | Rate limited - respect the `Retry-After` header |
| 500 | Internal server error |'
version: 3.22.0
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
contact:
name: Alex Chernysh
url: https://github.com/sipyourdrink-ltd/bernstein
servers:
- url: http://{host}:{port}
description: Task server started by the Bernstein CLI on the operator's own machine. There is no hosted instance; substitute the host and port of your install.
variables:
host:
default: 127.0.0.1
description: Interface the task server binds to. Loopback by default.
port:
default: '8052'
description: Task server port. Override with BERNSTEIN_PORT.
tags:
- name: Metrics
paths:
/metrics:
get:
summary: Metrics Endpoint
description: 'Prometheus metrics scrape endpoint.
Updates all gauges from the current task store state, then
returns the full metric exposition in Prometheus text format.'
operationId: metrics_endpoint_metrics_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Metrics
/metrics/custom:
get:
summary: Get Custom Metrics
description: 'Evaluate all configured custom metrics and return current values.
Returns an object with a ``metrics`` list. Each entry contains:
- ``name``: metric name
- ``value``: computed float value
- ``unit``: display unit (e.g. ``"lines/$"``)
- ``description``: optional human-readable description
- ``error``: present only when evaluation failed
Returns 200 with an empty list if no custom metrics are configured.'
operationId: get_custom_metrics_metrics_custom_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Metrics
/metrics/custom/schema:
get:
summary: Get Custom Metrics Schema
description: 'Return the configured custom metric definitions (formulas and units).
Returns the schema without evaluating - useful for documentation and
formula validation checks.'
operationId: get_custom_metrics_schema_metrics_custom_schema_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Metrics
/metrics/provider-latency:
get:
summary: Provider Latency Current
description: 'Return current p50/p95/p99 latency percentiles for all tracked providers.
Each entry in the response includes a ``baseline_p99_ms`` derived from the
past 7 days of data. When ``p99_ms`` exceeds ``baseline_p99_ms x 2``, the
entry carries ``"degraded": true``.'
operationId: provider_latency_current_metrics_provider_latency_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Metrics
/metrics/provider-latency/history:
get:
summary: Provider Latency History
description: 'Return raw latency samples for time-series charting.
Each sample has: ``timestamp``, ``provider``, ``model``, ``latency_ms``.
Samples are ordered chronologically. Use ``hours`` to control the lookback
window (default 24h, max 7 days).'
operationId: provider_latency_history_metrics_provider_latency_history_get
parameters:
- name: provider
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: Filter by provider name
title: Provider
description: Filter by provider name
- name: model
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: Filter by model identifier
title: Model
description: Filter by model identifier
- name: hours
in: query
required: false
schema:
type: integer
maximum: 168
minimum: 1
description: Hours of history to return (1-168)
default: 24
title: Hours
description: Hours of history to return (1-168)
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Metrics
/metrics/predictions:
get:
summary: Get Predictions
description: 'Evaluate all predictive forecasts and return active alerts.
Checks three forecast dimensions:
- **Budget exhaustion**: At current spend velocity, when will the
budget cap be reached?
- **Completion rate decline**: Is the task completion rate trending
downward, indicating the run will take longer than expected?
- **Run duration overrun**: Based on current throughput, will the run
exceed the configured time window?
Use ``budget_cap`` to enable the budget forecast. The run duration
forecast requires at least one completed task.
Both numeric parameters are echoed back in the response body, so both
refuse non-finite values with a 422 instead of admitting them: a range
bound alone does not exclude them (``inf >= 0.0`` is true, and every
comparison against ``NaN`` is false), and the JSON renderer cannot
serialise either one.
The budget forecast is scoped to ``tenant_id``: the spend series it is
built from is narrowed to cost points recorded for the caller''s tenant,
the same way the rest of the cost surface is (see
``load_cost_history``). Cost points written before per-tenant
attribution existed are treated as the default tenant''s spend, so a
legacy single-tenant install keeps its existing numbers.
Returns a list of ``alerts`` ordered by severity (critical first).
Each alert has: ``kind``, ``severity``, ``message``,
``minutes_until_impact``, ``confidence``.'
operationId: get_predictions_metrics_predictions_get
parameters:
- name: budget_cap
in: query
required: false
schema:
type: number
minimum: 0
description: Budget ceiling in USD (0 = skip budget forecast)
default: 0
title: Budget Cap
description: Budget ceiling in USD (0 = skip budget forecast)
- name: window_hours
in: query
required: false
schema:
type: number
maximum: 72
minimum: 0.1
description: Configured run window in hours (default 4)
default: 4
title: Window Hours
description: Configured run window in hours (default 4)
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Metrics
/api/v1/metrics:
get:
summary: Metrics Endpoint
description: 'Prometheus metrics scrape endpoint.
Updates all gauges from the current task store state, then
returns the full metric exposition in Prometheus text format.'
operationId: metrics_endpoint_api_v1_metrics_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Metrics
/api/v1/metrics/custom:
get:
summary: Get Custom Metrics
description: 'Evaluate all configured custom metrics and return current values.
Returns an object with a ``metrics`` list. Each entry contains:
- ``name``: metric name
- ``value``: computed float value
- ``unit``: display unit (e.g. ``"lines/$"``)
- ``description``: optional human-readable description
- ``error``: present only when evaluation failed
Returns 200 with an empty list if no custom metrics are configured.'
operationId: get_custom_metrics_api_v1_metrics_custom_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Metrics
/api/v1/metrics/custom/schema:
get:
summary: Get Custom Metrics Schema
description: 'Return the configured custom metric definitions (formulas and units).
Returns the schema without evaluating - useful for documentation and
formula validation checks.'
operationId: get_custom_metrics_schema_api_v1_metrics_custom_schema_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Metrics
/api/v1/metrics/provider-latency:
get:
summary: Provider Latency Current
description: 'Return current p50/p95/p99 latency percentiles for all tracked providers.
Each entry in the response includes a ``baseline_p99_ms`` derived from the
past 7 days of data. When ``p99_ms`` exceeds ``baseline_p99_ms x 2``, the
entry carries ``"degraded": true``.'
operationId: provider_latency_current_api_v1_metrics_provider_latency_get
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
tags:
- Metrics
/api/v1/metrics/provider-latency/history:
get:
summary: Provider Latency History
description: 'Return raw latency samples for time-series charting.
Each sample has: ``timestamp``, ``provider``, ``model``, ``latency_ms``.
Samples are ordered chronologically. Use ``hours`` to control the lookback
window (default 24h, max 7 days).'
operationId: provider_latency_history_api_v1_metrics_provider_latency_history_get
parameters:
- name: provider
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: Filter by provider name
title: Provider
description: Filter by provider name
- name: model
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: Filter by model identifier
title: Model
description: Filter by model identifier
- name: hours
in: query
required: false
schema:
type: integer
maximum: 168
minimum: 1
description: Hours of history to return (1-168)
default: 24
title: Hours
description: Hours of history to return (1-168)
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Metrics
/api/v1/metrics/predictions:
get:
summary: Get Predictions
description: 'Evaluate all predictive forecasts and return active alerts.
Checks three forecast dimensions:
- **Budget exhaustion**: At current spend velocity, when will the
budget cap be reached?
- **Completion rate decline**: Is the task completion rate trending
downward, indicating the run will take longer than expected?
- **Run duration overrun**: Based on current throughput, will the run
exceed the configured time window?
Use ``budget_cap`` to enable the budget forecast. The run duration
forecast requires at least one completed task.
Both numeric parameters are echoed back in the response body, so both
refuse non-finite values with a 422 instead of admitting them: a range
bound alone does not exclude them (``inf >= 0.0`` is true, and every
comparison against ``NaN`` is false), and the JSON renderer cannot
serialise either one.
The budget forecast is scoped to ``tenant_id``: the spend series it is
built from is narrowed to cost points recorded for the caller''s tenant,
the same way the rest of the cost surface is (see
``load_cost_history``). Cost points written before per-tenant
attribution existed are treated as the default tenant''s spend, so a
legacy single-tenant install keeps its existing numbers.
Returns a list of ``alerts`` ordered by severity (critical first).
Each alert has: ``kind``, ``severity``, ``message``,
``minutes_until_impact``, ``confidence``.'
operationId: get_predictions_api_v1_metrics_predictions_get
parameters:
- name: budget_cap
in: query
required: false
schema:
type: number
minimum: 0
description: Budget ceiling in USD (0 = skip budget forecast)
default: 0
title: Budget Cap
description: Budget ceiling in USD (0 = skip budget forecast)
- name: window_hours
in: query
required: false
schema:
type: number
maximum: 72
minimum: 0.1
description: Configured run window in hours (default 4)
default: 4
title: Window Hours
description: Configured run window in hours (default 4)
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
tags:
- Metrics
components:
schemas:
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError