Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Openai Openai node FineTuning Checkpoints

From Leeroopedia
Knowledge Sources
Domains SDK, Fine-Tuning
Last Updated 2026-02-15 12:00 GMT

Overview

The Checkpoints class provides a paginated listing endpoint for fine-tuning job checkpoints, which represent intermediate model snapshots produced during a fine-tuning run.

Description

The Checkpoints class extends APIResource and exposes a single list method that retrieves all checkpoints associated with a given fine-tuning job. Each checkpoint captures a model snapshot at a particular training step, along with metrics such as training loss, validation loss, and mean token accuracy. Checkpoints are usable as models in other API endpoints.

The method returns a PagePromise wrapping a CursorPage of FineTuningJobCheckpoint objects, enabling automatic cursor-based pagination via for await loops. The module also exports the FineTuningJobCheckpoint interface describing the checkpoint object shape, including a nested Metrics interface that captures training and validation statistics at each step.

The pagination parameters follow the standard CursorPageParams pattern used throughout the SDK, accepting optional after and limit fields.

Usage

Use this resource when you need to inspect the intermediate training progress of a fine-tuning job, compare metrics across training steps, or select a specific checkpoint model for inference rather than the final model.

Code Reference

Source Location

Signature

export class Checkpoints extends APIResource {
  list(
    fineTuningJobID: string,
    query?: CheckpointListParams | null | undefined,
    options?: RequestOptions,
  ): PagePromise<FineTuningJobCheckpointsPage, FineTuningJobCheckpoint>;
}

export interface FineTuningJobCheckpoint {
  id: string;
  created_at: number;
  fine_tuned_model_checkpoint: string;
  fine_tuning_job_id: string;
  metrics: FineTuningJobCheckpoint.Metrics;
  object: 'fine_tuning.job.checkpoint';
  step_number: number;
}

export namespace FineTuningJobCheckpoint {
  export interface Metrics {
    full_valid_loss?: number;
    full_valid_mean_token_accuracy?: number;
    step?: number;
    train_loss?: number;
    train_mean_token_accuracy?: number;
    valid_loss?: number;
    valid_mean_token_accuracy?: number;
  }
}

Import

import OpenAI from 'openai';

I/O Contract

Inputs

Name Type Required Description
fineTuningJobID string Yes The identifier of the fine-tuning job whose checkpoints to list.
query.after string No Cursor for pagination; return results after this checkpoint ID.
query.limit number No Maximum number of checkpoints to return per page.
options RequestOptions No Additional request configuration (headers, timeout, etc.).

Outputs

Name Type Description
id string Unique checkpoint identifier, usable as a model reference.
created_at number Unix timestamp (seconds) when the checkpoint was created.
fine_tuned_model_checkpoint string Name of the fine-tuned checkpoint model.
fine_tuning_job_id string ID of the parent fine-tuning job.
metrics Metrics Training and validation metrics at this step (loss, accuracy).
object 'fine_tuning.job.checkpoint' Object type discriminator.
step_number number The training step at which the checkpoint was saved.

Usage Examples

import OpenAI from 'openai';

const client = new OpenAI();

// Automatically fetches more pages as needed.
for await (const checkpoint of client.fineTuning.jobs.checkpoints.list(
  'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
)) {
  console.log(`Step ${checkpoint.step_number}: loss=${checkpoint.metrics.train_loss}`);
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment