Command Palette

Search for a command to run...

Назад к скиллам
скилл № 54069

openai-assistants

Guide to OpenAI's Assistants API v2: stateful conversational AI with Code Interpreter, File Search and function calling, vector stores for RAG up to 10,000…

БесплатноБез исполняемых скриптов
jackspaceот jackspace★ 16 звёзд на GitHub15 установок в других каталогах

Установить openai-assistants в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

OpenAI Assistants API v2

Status: Production Ready (Deprecated H1 2026) Package: [email protected] Last Updated: 2025-10-25 v1 Deprecated: December 18, 2024 v2 Sunset: H1 2026 (migrate to Responses API)


⚠️ Important: Deprecation Notice

OpenAI announced that the Assistants API will be deprecated in favor of the Responses API.

Timeline:

  • ✅ Dec 18, 2024: Assistants API v1 deprecated
  • ⏳ H1 2026: Planned sunset of Assistants API v2
  • ✅ Now: Responses API available (recommended for new projects)

Should you still use this skill?

  • ✅ Yes, if: You have existing Assistants API code (12-18 month migration window)
  • ✅ Yes, if: You need to maintain legacy applications
  • ✅ Yes, if: Planning migration from Assistants → Responses
  • ❌ No, if: Starting a new project (use openai-responses skill instead)

Migration Path: See references/migration-to-responses.md for complete migration guide.


Table of Contents

  1. Quick Start
  2. Core Concepts
  3. Assistants
  4. Threads
  5. Messages
  6. Runs
  7. Streaming Runs
  8. Tools
  9. Vector Stores
  10. File Uploads
  11. Thread Lifecycle Management
  12. Error Handling
  13. Production Best Practices
  14. Relationship to Other Skills

Quick Start

Installation

npm install [email protected]

Environment Setup

export OPENAI_API_KEY="sk-..."

Basic Assistant (Node.js SDK)

import OpenAI from 'openai';

const openai = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
});

// 1. Create an assistant
const assistant = await openai.beta.assistants.create({
  name: "Math Tutor",
  instructions: "You are a personal math tutor. Write and run code to answer math questions.",
  tools: [{ type: "code_interpreter" }],
  model: "gpt-4o",
});

// 2. Create a thread
const thread = await openai.beta.threads.create();

// 3. Add a message to the thread
await openai.beta.threads.messages.create(thread.id, {
  role: "user",
  content: "I need to solve the equation `3x + 11 = 14`. Can you help me?",
});

// 4. Create a run
const run = await openai.beta.threads.runs.create(thread.id, {
  assistant_id: assistant.id,
});

// 5. Poll for completion
let runStatus = await openai.beta.threads.runs.retrieve(thread.id, run.id);

while (runStatus.status !== 'completed') {
  await new Promise(resolve => setTimeout(resolve, 1000));
  runStatus = await openai.beta.threads.runs.retrieve(thread.id, run.id);
}

// 6. Retrieve messages
const messages = await openai.beta.threads.messages.list(thread.id);
console.log(messages.data[0].content[0].text.value);

Basic Assistant (Fetch - Cloudflare Workers)

// 1. Create assistant
const assistant = await fetch('https://api.openai.com/v1/assistants', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${env.OPENAI_API_KEY}`,
    'Content-Type': 'application/json',
    'OpenAI-Beta': 'assistants=v2',
  },
  body: JSON.stringify({
    name: "Math Tutor",
    instructions: "You are a helpful math tutor.",
    model: "gpt-4o",
  }),
});

const assistantData = await assistant.json();

// 2. Create thread
const thread = await fetch('https://api.openai.com/v1/threads', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${env.OPENAI_API_KEY}`,
    'Content-Type': 'application/json',
    'OpenAI-Beta': 'assistants=v2',
  },
});

const threadData = await thread.json();

// 3. Add message and create run
const run = await fetch(`https://api.openai.com/v1/threads/${threadData.id}/runs`, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${env.OPENAI_API_KEY}`,
    'Content-Type': 'application/json',
    'OpenAI-Beta': 'assistants=v2',
  },
  body: JSON.stringify({
    assistant_id: assistantData.id,
    additional_messages: [{
      role: "user",
      content: "What is 3x + 11 = 14?",
    }],
  }),
});

// Poll for completion...

Core Concepts

The Assistants API uses four main objects:

1. Assistants

Configured AI entities with:

  • Instructions (system prompt, max 256k characters)
  • Model (gpt-4o, gpt-5, etc.)
  • Tools (Code Interpreter, File Search, Functions)
  • File attachments
  • Metadata

2. Threads

Conversation containers that:

  • Store message history
  • Persist across runs
  • Can have metadata
  • Support up to 100,000 messages

3. Messages

Individual messages in a thread:

  • User messages (input)
  • Assistant messages (output)
  • Can include file attachments
  • Support text and image content

4. Runs

Execution of an assistant on a thread:

  • Asynchronous processing
  • Multiple s
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • README.md
  • SKILL.json

FAQ

Что делает скилл openai-assistants?

Guide to OpenAI's Assistants API v2: stateful conversational AI with Code Interpreter, File Search and function calling, vector stores for RAG up to 10,000 files, thread and run lifecycle management, and streaming, using the Node.js SDK or plain fetch. Notes the planned H1 2026 sunset and the migration path to the Responses API. Use when building stateful OpenAI chatbots, implementing RAG with vector stores, running Python via Code Interpreter, doing document Q&A with file search, managing conversation threads and run polling, streaming assistant responses, maintaining legacy Assistants code, or debugging errors such as thread already has active run, run status polling timeouts, vector store indexing delays, and file upload failures.

Как установить скилл openai-assistants?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл openai-assistants запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить openai-assistants с