Implementation:Openai Openai node Skill Versions
| Knowledge Sources | |
|---|---|
| Domains | SDK, Skills |
| Last Updated | 2026-02-15 12:00 GMT |
Overview
The Versions class provides CRUD operations for managing individual versions of an OpenAI Skill, enabling version-controlled skill deployment.
Description
The Versions class extends APIResource and exposes four methods for managing skill versions: create, retrieve, list, and delete. It also aggregates a content sub-resource for accessing the content of a specific version.
The create method creates a new version for a given skill, accepting an optional files parameter (array of uploadable files or a single zip) and a default boolean flag to set the new version as the skill's default. The retrieve method fetches a specific version by version identifier and skill ID. The list method returns cursor-paginated versions for a skill with optional sort ordering by version number. The delete method removes a specific version and returns a DeletedSkillVersion confirmation.
Each SkillVersion object includes an id, skill_id, version number, name, description, created_at timestamp, and an object type discriminator. The versioning model allows teams to iterate on skill content while maintaining the ability to roll back or pin specific versions.
Usage
Use this resource to create new versions of a skill, inspect version history, retrieve a specific version's metadata, or clean up obsolete versions. This is essential for teams practicing versioned deployment of skill content.
Code Reference
Source Location
- Repository: openai-node
- File: src/resources/skills/versions/versions.ts
Signature
export class Versions extends APIResource {
content: Content;
create(skillID: string, body?: VersionCreateParams | null, options?: RequestOptions): APIPromise<SkillVersion>;
retrieve(version: string, params: VersionRetrieveParams, options?: RequestOptions): APIPromise<SkillVersion>;
list(skillID: string, query?: VersionListParams | null, options?: RequestOptions): PagePromise<SkillVersionsPage, SkillVersion>;
delete(version: string, params: VersionDeleteParams, options?: RequestOptions): APIPromise<DeletedSkillVersion>;
}
export interface SkillVersion {
id: string;
created_at: number;
description: string;
name: string;
object: 'skill.version';
skill_id: string;
version: string;
}
export interface DeletedSkillVersion {
id: string;
deleted: boolean;
object: 'skill.version.deleted';
version: string;
}
Import
import OpenAI from 'openai';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| skillID | string |
Yes (create/list) | The identifier of the parent skill. |
| version | string |
Yes (retrieve/delete) | The version identifier to act upon. |
| params.skill_id | string |
Yes (retrieve/delete) | The identifier of the skill (passed in params object). |
| body.files | Uploadable | No (create) | Skill files to upload for this version. |
| body.default | boolean |
No (create) | Whether to set this version as the default. |
| query.after | string |
No (list) | Cursor for pagination. |
| query.limit | number |
No (list) | Maximum number of versions per page. |
| query.order | 'desc' | No (list) | Sort order by version number. |
| options | RequestOptions |
No | Additional request configuration. |
Outputs
| Name | Type | Description |
|---|---|---|
| id | string |
Unique identifier for the skill version. |
| skill_id | string |
Identifier of the parent skill. |
| version | string |
Version number string. |
| name | string |
Name of the skill version. |
| description | string |
Description of the skill version. |
| created_at | number |
Unix timestamp (seconds) when the version was created. |
| object | 'skill.version' |
Object type discriminator. |
Usage Examples
import OpenAI from 'openai';
import fs from 'fs';
const client = new OpenAI();
// Create a new version for a skill
const version = await client.skills.versions.create('skill_abc123', {
files: fs.createReadStream('updated-skill.zip'),
default: true,
});
console.log(version.version, version.name);
// Retrieve a specific version
const v = await client.skills.versions.retrieve('2', {
skill_id: 'skill_abc123',
});
console.log(v.description);
// List all versions of a skill
for await (const ver of client.skills.versions.list('skill_abc123', { order: 'desc' })) {
console.log(`Version ${ver.version}: ${ver.name}`);
}
// Delete a specific version
const deleted = await client.skills.versions.delete('1', {
skill_id: 'skill_abc123',
});
console.log(deleted.deleted); // true