Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Openai Openai node Jobs Create

From Leeroopedia
Knowledge Sources
Domains Fine_Tuning, Model_Training
Last Updated 2026-02-15 00:00 GMT

Overview

Concrete tool for creating fine-tuning jobs on the OpenAI platform provided by the openai-node SDK.

Description

The Jobs.create() method sends a POST to /fine_tuning/jobs to initiate model training. It accepts a JobCreateParams object specifying the training file, base model, optional validation file, training method (supervised, DPO, or reinforcement), and hyperparameters.

Usage

Call this after uploading and verifying training data. The returned job object contains an ID for monitoring progress.

Code Reference

Source Location

  • Repository: openai-node
  • File: src/resources/fine-tuning/jobs/jobs.ts
  • Lines: L38-40 (create method), L429-620 (JobCreateParams)

Signature

class Jobs extends APIResource {
  create(
    body: JobCreateParams,
    options?: RequestOptions,
  ): APIPromise<FineTuningJob>;
}

interface JobCreateParams {
  model: string;               // Base model (e.g., 'gpt-4o-mini')
  training_file: string;       // File ID from upload
  validation_file?: string;    // Optional validation file ID
  suffix?: string;             // Model name suffix
  seed?: number;               // Reproducibility seed
  method?: {
    type: 'supervised' | 'dpo' | 'reinforcement';
    supervised?: SupervisedMethod;
    dpo?: DpoMethod;
    reinforcement?: ReinforcementMethod;
  };
}

Import

import OpenAI from 'openai';
// Access via: client.fineTuning.jobs.create(...)

I/O Contract

Inputs

Name Type Required Description
model string Yes Base model to fine-tune
training_file string Yes Training file ID
validation_file string No Validation file ID for eval metrics
suffix string No Custom suffix for fine-tuned model name
method object No Training method (supervised, dpo, reinforcement) with hyperparameters
seed number No Random seed for reproducibility

Outputs

Name Type Description
job FineTuningJob Job object with id, model, status, training_file, created_at, fine_tuned_model (null until complete)

Usage Examples

import OpenAI from 'openai';

const client = new OpenAI();

const job = await client.fineTuning.jobs.create({
  model: 'gpt-4o-mini-2024-07-18',
  training_file: 'file-abc123',
  suffix: 'my-custom-model',
  method: {
    type: 'supervised',
    supervised: {
      hyperparameters: {
        n_epochs: 3,
      },
    },
  },
});

console.log('Job ID:', job.id);
console.log('Status:', job.status);

Related Pages

Implements Principle

Requires Environment

Page Connections

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