Skip to main content

NanoGPT Evals and Observability API

NanoGPT Evals lets you run durable prompt and model experiments, freeze datasets, version scorers, inspect traces, and aggregate latency, cost, token, error, and score trends. The API is available under /api/v1/evals/*. The same platform powers Prompt Lab at /prompt-lab.

Core Concepts

Projects

A project groups datasets, experiments, traces, and dashboard metrics. If an experiment is created without a project_id, NanoGPT uses a default Prompt Lab project for the authenticated user.

Datasets and Dataset Versions

A dataset is an editable set of eval rows. A dataset version is a frozen snapshot of the dataset at a point in time. Experiments should use dataset versions when reproducibility matters. Dataset rows support:

Scorers

A scorer grades candidate outputs. Scorers are versioned, so an experiment stores the exact scorer snapshot used at run time. Supported scorer types:
  • exact_match
  • contains
  • regex
  • json_schema
  • threshold
  • llm_judge
  • pairwise_llm
This version does not run arbitrary JavaScript or Python scorers.

Experiments

An experiment compares one or more candidates over a dataset or inline rows. Experiments are asynchronous and durable. Experiment statuses:
  • queued
  • in_progress
  • completed
  • failed
  • cancelled
Experiments store candidate prompt, model, and config snapshots, scorer snapshots, progress, traces, scores, errors, and cost and usage metadata.

Traces

A trace records a generation or scoring call. Traces store metadata, timings, usage, cost, status, and errors. Prompt and output content is not stored unless explicitly requested.

Privacy Defaults

By default, traces are metadata-only. NanoGPT stores prompt and output content only when:
  • a user explicitly saves Prompt Lab dataset or experiment content
  • an API caller passes a content-storage opt-in such as nanogpt_eval_store_content: true
Requested content storage can be suppressed when content is not safe or not available to store. When suppression happens, trace metadata includes content_suppressed_reason. Current suppression reasons include:

Authentication

Use the same authentication as the NanoGPT API. For API callers, pass your API key in the Authorization header:
All eval objects are scoped to the authenticated session, team, and API key context.

Limits

Current experiment limits:
  • up to 100 eval items per dataset or inline run
  • up to 5 candidates per experiment
  • up to 10 scorers per experiment
  • up to 100 generation and scoring work units per experiment
Work units are calculated as:
Eval run and item rate limits are applied to normal runs and reruns. Rate-limited responses return HTTP 429 with Retry-After.

Object Shapes

Project

Dataset Version

Scorer

Experiment

Trace

Quick Start

1. Create a dataset

2. Freeze a dataset version

3. Create a scorer

4. Create an async experiment

The response returns an experiment with status queued or in_progress. Poll the experiment until status is terminal.

5. Poll the experiment

6. Read output items

API Reference

Projects

List projects

Returns:

Create project

Body:

Get project

Update project

Body fields:

Delete project

Returns:

Datasets

List datasets

Create dataset

Body:
Custom dataset IDs must start with evaldataset_ and contain 6 to 80 letters, numbers, underscores, or dashes after the prefix.

Get dataset

Returns the dataset and its current items.

Delete dataset

Deletes the dataset by marking it deleted. Historical runs and versions keep their snapshots.

Dataset Versions

List dataset versions

Create dataset version

Freezes the current dataset rows into a new immutable version.

Scorers

List scorers

Includes built-in scorers, legacy custom evaluators, and versioned scorers.

Create scorer

Body:
For llm_judge, prompt is required. If both id and scorer_id are omitted, NanoGPT generates a scorer ID.

Get latest scorer

Delete scorer

Deletes all stored versions for the scorer ID.

Scorer Configuration

exact_match

Compares output to expected_output. Config:

contains

Checks whether output contains a configured value or expected_output. Config:

regex

Checks whether output matches a regular expression. Config:
If pattern is omitted, the scorer uses expected_output as the pattern.

json_schema

Parses output as JSON and validates a supported JSON-schema subset. Config:
Supported schema fields:
  • type
  • required
  • properties
  • items
  • enum
  • minimum
  • maximum
  • minLength
  • maxLength
Nested properties and items validation is capped at 10 levels.

threshold

Converts a value to a number and passes if it is greater than or equal to a threshold. Config:
Supported sources:
  • output
  • expected_output
  • metadata.score

llm_judge

Calls a judge model and expects JSON:
The score is clamped to 0..1. Prompt templates may reference:
  • {{input}}
  • {{output}}
  • {{expected_output}}
  • {{context}}
  • {{system}}
  • {{metadata.some_key}}

pairwise_llm

Compares a challenger candidate against a baseline candidate with an LLM judge. A score of 1 means the challenger is better, 0 means the baseline is better, and 0.5 means a tie. Config:
If no baseline is configured, the first candidate is used.

Experiments

List experiments

Query parameters:

Create experiment

Body:
Use one data source:
  • dataset_id
  • dataset_version_id
  • inline data or items
Do not pass both dataset_id and dataset_version_id. For inline experiments, content storage must be enabled because the experiment needs row snapshots to run asynchronously. Candidate fields: The endpoint returns 202 Accepted and an experiment object.

Get experiment

Use this endpoint to poll status and progress.

Cancel experiment

Only queued or in-progress experiments can be cancelled.

Rerun experiment

Creates a new experiment from the original experiment snapshot and schedules it asynchronously.

List experiment output items

Query parameters: Response:

Traces

List traces

Query parameters:

Get trace

Returns the trace plus attached scores.

Dashboard

Query parameters: Returns aggregate metrics:

Opt-in Chat Completion Tracing

Normal /v1/chat/completions requests do not create eval traces. To trace a normal API request, add metadata.nanogpt_eval_trace: true to the chat completion request. Example:
Supported eval metadata keys: NanoGPT strips only metadata.nanogpt_eval_* keys before provider dispatch. Other metadata keys remain untouched. If nanogpt_eval_store_content is omitted or false, the trace stores metadata, usage, cost, latency, status, and errors, but not prompt or output content. If nanogpt_eval_store_content is true but the request does not produce output text available to the trace recorder, NanoGPT keeps the trace metadata-only and records content_suppressed_reason: "output_content_unavailable" in trace metadata.

Legacy Evaluator Endpoints

The original evaluator API remains available for compatibility.

List legacy evaluators

Create legacy evaluator

Body:
Custom evaluator IDs must start with eval_ and contain 6 to 80 letters, numbers, underscores, or dashes after the prefix.

Run legacy evaluator

Body:
Use either dataset_id or inline data.

Get stored legacy run

Get stored legacy run output items

Retention

Default retention is 30 days. Trace records, stored trace content, jobs, and old experiment artifacts are cleaned up by the eval cleanup job. Projects, datasets, dataset versions, and scorers are durable until deleted.

Error Responses

Validation errors return HTTP 400:
Missing resources return HTTP 404:
Rate limits return HTTP 429:
Unexpected server failures return HTTP 500:

Operational Notes

The eval platform stores durable project, dataset, scorer, experiment, trace, and score records in dedicated tables, including:
  • eval_projects
  • eval_dataset_versions
  • eval_scorer_versions
  • eval_experiments
  • eval_experiment_items
  • eval_traces
  • eval_trace_scores
The migration also ensures the legacy eval tables exist. Async experiment execution uses NanoGPT’s background scheduler. Stale queued or in-progress experiments are retried, and the cleanup job removes expired legacy runs, traces, and experiments.