openai-responses
БесплатноЗапускает вложенные скриптыНе проверенBuild agentic AI applications with OpenAI's Responses API - the stateful successor to Chat Completions. Preserves reasoning across turns for 5% better…
Об этом скилле
OpenAI Responses API
Status: Production Ready Last Updated: 2025-10-25 API Launch: March 2025 Dependencies: [email protected]+ (Node.js) or fetch API (Cloudflare Workers)
What Is the Responses API?
The Responses API (/v1/responses) is OpenAI's unified interface for building agentic applications, launched in March 2025. It fundamentally changes how you interact with OpenAI models by providing stateful conversations and a structured loop for reasoning and acting.
Key Innovation: Preserved Reasoning State
Unlike Chat Completions where reasoning is discarded between turns, Responses keeps the notebook open. The model's step-by-step thought processes survive into the next turn, improving performance by approximately 5% on TAUBench and enabling better multi-turn interactions.
Why Use Responses Over Chat Completions?
| Feature | Chat Completions | Responses API | Benefit |
|---|---|---|---|
| State Management | Manual (you track history) | Automatic (conversation IDs) | Simpler code, less error-prone |
| Reasoning | Dropped between turns | Preserved across turns | Better multi-turn performance |
| Tools | Client-side round trips | Server-side hosted | Lower latency, simpler code |
| Output Format | Single message | Polymorphic (messages, reasoning, tool calls) | Richer debugging, better UX |
| Cache Utilization | Baseline | 40-80% better | Lower costs, faster responses |
| MCP Support | Manual integration | Built-in | Easy external tool connections |
Quick Start (5 Minutes)
1. Get API Key
# Sign up at https://platform.openai.com/
# Navigate to API Keys section
# Create new key and save securely
export OPENAI_API_KEY="sk-proj-..."
Why this matters:
- API key required for all requests
- Keep secure (never commit to git)
- Use environment variables
2. Install SDK (Node.js)
npm install openai
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
});
const response = await openai.responses.create({
model: 'gpt-5',
input: 'What are the 5 Ds of dodgeball?',
});
console.log(response.output_text);
CRITICAL:
- Always use server-side (never expose API key in client code)
- Model defaults to
gpt-5(can usegpt-5-mini,gpt-4o, etc.) inputcan be string or array of messages
3. Or Use Direct API (Cloudflare Workers)
// No SDK needed - use fetch()
const response = await fetch('https://api.openai.com/v1/responses', {
method: 'POST',
headers: {
'Authorization': `Bearer ${env.OPENAI_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'gpt-5',
input: 'Hello, world!',
}),
});
const data = await response.json();
console.log(data.output_text);
Why fetch?
- No dependencies in edge environments
- Full control over request/response
- Works in Cloudflare Workers, Deno, Bun
Responses vs Chat Completions: Complete Comparison
When to Use Each
Use Responses API when:
- ✅ Building agentic applications (reasoning + actions)
- ✅ Need preserved reasoning state across turns
- ✅ Want built-in tools (Code Interpreter, File Search, Web Search)
- ✅ Using MCP servers for external integrations
- ✅ Implementing conversational AI with automatic state management
- ✅ Background processing for long-running tasks
- ✅ Need polymorphic outputs (messages, reasoning, tool calls)
Use Chat Completions when:
- ✅ Simple one-off text generation
- ✅ Fully stateless interactions (no conversation continuity needed)
- ✅ Legacy integrations (existing Chat Completions code)
- ✅ Very simple use cases without tools
Architecture Differences
Chat Completions Flow:
User Input → Model → Single Message → Done
(Reasoning discarded, state lost)
Responses API Flow:
User Input → Model (preserved reasoning) → Polymorphic Outputs
↓ (server-side tools)
Tool Call → Tool Result → Model → Final Response
(Reasoning preserved, state maintained)
Performance Benefits
Cache Utilization:
- Chat Completions: Baseline performance
- Responses API: 40-80% better cache utilization
- Result: Lower latency + reduced costs
Reasoning Performance:
- Chat Completions: Reasoning dropped between turns
- Responses API: Reasoning preserved across turns
- Result: 5% better on TAUBench (GPT-5 with Responses vs Chat Completions)
Stateful Conversations
Automatic State Management
The Responses API can automatically manage conversation state using conversation IDs.
Creating a Conversation
// Create conversation with initial message
const conversation = await openai.conversations.create({
metadata: { user_id: 'user_123' },
items: [
{
type: 'message',
role: 'user',
content: 'Hello!',
},
],
});
console.log(conversation.id); // "con
Установить openai-responses в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл openai-responses?
Build agentic AI applications with OpenAI's Responses API - the stateful successor to Chat Completions. Preserves reasoning across turns for 5% better multi-turn performance and 40-80% improved cache utilization. Use when: building AI agents with persistent reasoning, integrating MCP servers for external tools, using built-in Code Interpreter/File Search/Web Search, managing stateful conversations, implementing background processing for long tasks, or migrating from Chat Completions to gain polymorphic outputs and server-side tools.
Как установить скилл openai-responses?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл openai-responses запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic