Implementation:Openai Openai node Skills Resource
| Knowledge Sources | |
|---|---|
| Domains | SDK, Skills |
| Last Updated | 2026-02-15 12:00 GMT |
Overview
The Skills class provides full CRUD operations for managing OpenAI Skills, which are reusable bundles of files that can be uploaded, versioned, and referenced by the API.
Description
The Skills class extends APIResource and exposes five methods for skill lifecycle management: create, retrieve, update, list, and delete. It also aggregates two sub-resources: content (for accessing skill content) and versions (for managing versioned snapshots of skills).
The create method accepts an optional files parameter that can be either an array of uploadable files (directory upload) or a single zip file, using multipart form encoding when files are provided. The retrieve method fetches a specific skill by ID. The update method sets the default version for a skill. The list method returns a cursor-paginated collection of skills with optional sort ordering. The delete method removes a skill and returns a DeletedSkill confirmation object.
Each skill has an id, name, description, created_at timestamp, a default_version, and a latest_version. The module also exports SkillList for the raw list envelope, and parameter interfaces for all operations.
Usage
Use this resource when building or managing custom skills for OpenAI. Skills enable packaging reusable file bundles that can be versioned and deployed across different contexts.
Code Reference
Source Location
- Repository: openai-node
- File: src/resources/skills/skills.ts
Signature
export class Skills extends APIResource {
content: Content;
versions: Versions;
create(body?: SkillCreateParams | null, options?: RequestOptions): APIPromise<Skill>;
retrieve(skillID: string, options?: RequestOptions): APIPromise<Skill>;
update(skillID: string, body: SkillUpdateParams, options?: RequestOptions): APIPromise<Skill>;
list(query?: SkillListParams | null, options?: RequestOptions): PagePromise<SkillsPage, Skill>;
delete(skillID: string, options?: RequestOptions): APIPromise<DeletedSkill>;
}
export interface Skill {
id: string;
created_at: number;
default_version: string;
description: string;
latest_version: string;
name: string;
object: 'skill';
}
export interface DeletedSkill {
id: string;
deleted: boolean;
object: 'skill.deleted';
}
Import
import OpenAI from 'openai';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| skillID | string |
Yes (retrieve/update/delete) | The unique identifier of the skill. |
| body.files | Uploadable | No (create) | Skill files to upload as directory contents or a single zip file. |
| body.default_version | string |
Yes (update) | The skill version number to set as the default. |
| query.after | string |
No (list) | Cursor for pagination. |
| query.limit | number |
No (list) | Maximum number of skills per page. |
| query.order | 'desc' | No (list) | Sort order by timestamp. |
| options | RequestOptions |
No | Additional request configuration. |
Outputs
| Name | Type | Description |
|---|---|---|
| id | string |
Unique skill identifier. |
| name | string |
Name of the skill. |
| description | string |
Description of the skill. |
| created_at | number |
Unix timestamp (seconds) when the skill was created. |
| default_version | string |
The currently active default version. |
| latest_version | string |
The most recently created version. |
| object | 'skill' |
Object type discriminator. |
Usage Examples
import OpenAI from 'openai';
import fs from 'fs';
const client = new OpenAI();
// Create a new skill with uploaded files
const skill = await client.skills.create({
files: fs.createReadStream('my-skill.zip'),
});
console.log(skill.id, skill.name);
// Retrieve a specific skill
const retrieved = await client.skills.retrieve('skill_abc123');
console.log(retrieved.default_version);
// Update the default version
const updated = await client.skills.update('skill_abc123', {
default_version: '2',
});
// List all skills
for await (const skill of client.skills.list({ order: 'desc' })) {
console.log(skill.name);
}
// Delete a skill
const deleted = await client.skills.delete('skill_abc123');
console.log(deleted.deleted); // true