Token导航 LogoToken导航TokenDH.com
研究检索external-servicegithub未标认证来源可访问clear审计异常

openai-responsesOpenAI responses 搜索

Agent Skill

openai-responses 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

8,171

周安装

351

GitHub Stars

750

下载量

2,864
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:openai-responses(OpenAI responses 搜索)
来源仓库:https://github.com/jezweb/claude-skills
仓库路径:skills/openai-responses
安装命令:
npx skills add https://github.com/jezweb/claude-skills --skill openai-responses
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/jezweb/claude-skills --skill openai-responses

简介

具有保留推理、服务器端工具和自动状态管理的状态代理对话。

  • 保留跨回合的模型推理(TAUBench 上的性能提高 5%),消除手动历史跟踪并改进多回合交互
  • 内置服务器端工具:代码解释器、文件搜索、Web 搜索、DALL-E 和 MCP 集成,无需后端往返
  • 自动会话状态管理,有效期为 90 天;缓存利用率比聊天完成提高 40-80%
  • 具有 8 种项目类型的多态输出(消息、推理、代码执行、工具调用、网络搜索结果);后台模式支持长达 10 分钟的超时
  • 防止 11 个已记录的错误,包括 Zod v4 不兼容、MCP 连接失败和流模式限制;助理 API 日落日期 2026 年 8 月 26 日

SKILL.md

OpenAI Responses API

Status: Production Ready Last Updated: 2026-01-21 API Launch: March 2025 Dependencies: openai@6.16.0 (Node.js) or fetch API (Cloudflare Workers)


What Is the Responses API?

OpenAI's unified interface for agentic applications, launched March 2025. Provides stateful conversations with preserved reasoning state across turns.

Key Innovation: Unlike Chat Completions (reasoning discarded between turns), Responses preserves the model's reasoning notebook, improving performance by 5% on TAUBench and enabling better multi-turn interactions.

vs Chat Completions:

FeatureChat CompletionsResponses API
StateManual history trackingAutomatic (conversation IDs)
ReasoningDropped between turnsPreserved across turns (+5% TAUBench)
ToolsClient-side round tripsServer-side hosted
OutputSingle messagePolymorphic (8 types)
CacheBaseline40-80% better utilization
MCPManualBuilt-in

Quick Start

npm install openai@6.16.0
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);

Key differences from Chat Completions:

  • Endpoint: /v1/responses (not /v1/chat/completions)
  • Parameter: input (not messages)
  • Role: developer (not system)
  • Output: response.output_text (not choices[0].message.content)

When to Use Responses vs Chat Completions

Use Responses:

  • Agentic applications (reasoning + actions)
  • Multi-turn conversations (preserved reasoning = +5% TAUBench)
  • Built-in tools (Code Interpreter, File Search, Web Search, MCP)
  • Background processing (60s standard, 10min extended timeout)

Use Chat Completions:

  • Simple one-off generation
  • Fully stateless interactions
  • Legacy integrations

Stateful Conversations

Automatic State Management using conversation IDs:

// Create conversation
const conv = await openai.conversations.create({
  metadata: { user_id: 'user_123' },
});

// First turn
const response1 = await openai.responses.create({
  model: 'gpt-5',
  conversation: conv.id,
  input: 'What are the 5 Ds of dodgeball?',
});

// Second turn - model remembers context + reasoning
const response2 = await openai.responses.create({
  model: 'gpt-5',
  conversation: conv.id,
  input: 'Tell me more about the first one',
});

Benefits: No manual history tracking, reasoning preserved, 40-80% better cache utilization

Conversation Limits: 90-day expiration


Built-in Tools (Server-Side)

Server-side hosted tools eliminate backend round trips:

ToolPurposeNotes
code_interpreterExecute Python codeSandboxed, 30s timeout (use background: true for longer)
file_searchRAG without vector storesMax 512MB per file, supports PDF/Word/Markdown/HTML/code
web_searchReal-time web informationAutomatic source citations
image_generationDALL-E integrationDALL-E 3 default
mcpConnect external toolsOAuth supported, tokens NOT stored

Usage:

const response = await openai.responses.create({
  model: 'gpt-5',
  input: 'Calculate mean of: 10, 20, 30, 40, 50',
  tools: [{ type: 'code_interpreter' }],
});

Web Search TypeScript Note

TypeScript Limitation: The web_search tool's external_web_access option is missing from SDK types (as of v6.16.0).

Workaround:

const response = await openai.responses.create({
  model: 'gpt-5',
  input: 'Search for recent news',
  tools: [{
    type: 'web_search',
    external_web_access: true,
  } as any],  // ✅ Type assertion to suppress error
});

Source: GitHub Issue #1716


MCP Server Integration

Built-in support for Model Context Protocol (MCP) servers to connect external tools (Stripe, databases, custom APIs).

User Approval Requirement

By default, explicit user approval is required before any data is shared with a remote MCP server (security feature).

Handling Approval:

const response = await openai.responses.create({
  model: 'gpt-5',
  input: 'Get my Stripe balance',
  tools: [{
    type: 'mcp',
    server_label: 'stripe',
    server_url: 'https://mcp.stripe.com',
    authorization: process.env.STRIPE_TOKEN,
  }],
});

if (response.status === 'requires_approval') {
  // Show user: "This action requires sharing data with Stripe. Approve?"
  // After user approves, retry with approval token
}

Alternative: Pre-approve MCP servers in OpenAI dashboard (users configure trusted servers via settings)

Source: Official MCP Guide

Basic MCP Usage

const response = await openai.responses.create({
  model: 'gpt-5',
  input: 'Roll 2d6 dice',
  tools: [{
    type: 'mcp',
    server_label: 'dice',
    server_url: 'https://example.com/mcp',
    authorization: process.env.TOKEN, // ⚠️ NOT stored, required each request
  }],
});

MCP Output Types:

  • mcp_list_tools - Tools discovered on server
  • mcp_call - Tool invocation + result
  • message - Final response

Reasoning Preservation

Key Innovation: Model's internal reasoning state survives across turns (unlike Chat Completions which discards it).

Visual Analogy:

  • Chat Completions: Model tears out scratchpad page before responding
  • Responses API: Scratchpad stays open for next turn

Performance: +5% on TAUBench (GPT-5) purely from preserved reasoning

Reasoning Summaries (free):

response.output.forEach(item => {
  if (item.type === 'reasoning') console.log(item.summary[0].text);
  if (item.type === 'message') console.log(item.content[0].text);
});

Important: Reasoning Traces Privacy

What You Get: Reasoning summaries (not full internal traces) What OpenAI Keeps: Full chain-of-thought reasoning (proprietary, for security/privacy)

For GPT-5-Thinking models:

  • OpenAI preserves reasoning internally in their backend
  • This preserved reasoning improves multi-turn performance (+5% TAUBench)
  • But developers only receive summaries, not the actual chain-of-thought
  • Full reasoning traces are not exposed (OpenAI's IP protection)

Source: Sean Goedecke Analysis


Background Mode

For long-running tasks, use background: true:

const response = await openai.responses.create({
  model: 'gpt-5',
  input: 'Analyze 500-page document',
  background: true,
  tools: [{ type: 'file_search', file_ids: [fileId] }],
});

// Poll for completion (check every 5s)
const result = await openai.responses.retrieve(response.id);
if (result.status === 'completed') console.log(result.output_text);

Timeout Limits:

  • Standard: 60 seconds
  • Background: 10 minutes

Performance Considerations

Time-to-First-Token (TTFT) Latency: Background mode currently has higher TTFT compared to synchronous responses. OpenAI is working to reduce this gap.

Recommendation:

  • For user-facing real-time responses, use sync mode (lower latency)
  • For long-running async tasks, use background mode (latency acceptable)

Source: OpenAI Background Mode Docs


Data Retention and Privacy

Default Retention: 30 days when store: true (default) Zero Data Retention (ZDR): Organizations with ZDR automatically enforce store: false Background Mode: NOT ZDR compatible (stores data ~10 minutes for polling)

Timeline:

  • September 26, 2025: OpenAI court-ordered retention ended
  • Current: 30-day default retention with store: true

Control Storage:

// Disable storage (no retention)
const response = await openai.responses.create({
  model: 'gpt-5',
  input: 'Hello!',
  store: false,  // ✅ No retention
});

// ZDR organizations: store always treated as false
const response = await openai.responses.create({
  model: 'gpt-5',
  input: 'Hello!',
  store: true,  // ⚠️ Ignored by OpenAI for ZDR orgs, treated as false
});

ZDR Compliance:

  • Avoid background mode (requires temporary storage)
  • Explicitly set store: false for clarity
  • Note: 60s timeout applies in sync mode

Source: OpenAI Data Controls


Polymorphic Outputs

Returns 8 output types instead of single message:

TypeExample
messageFinal answer, explanation
reasoningStep-by-step thought process (free!)
code_interpreter_callPython code + results
mcp_callTool name, args, output
mcp_list_toolsTool definitions from MCP server
file_search_callMatched chunks, citations
web_search_callURLs, snippets
image_generation_callImage URL

Processing:

response.output.forEach(item => {
  if (item.type === 'reasoning') console.log(item.summary[0].text);
  if (item.type === 'web_search_call') console.log(item.results);
  if (item.type === 'message') console.log(item.content[0].text);
});

// Or use helper for text-only
console.log(response.output_text);

Migration from Chat Completions

Breaking Changes:

FeatureChat CompletionsResponses API
Endpoint/v1/chat/completions/v1/responses
Parametermessagesinput
Rolesystemdeveloper
Outputchoices[0].message.contentoutput_text
StateManual arrayAutomatic (conversation ID)
Streamingdata: {"choices":[...]}SSE with 8 item types

Example:

// Before
const response = await openai.chat.completions.create({
  model: 'gpt-5',
  messages: [
    { role: 'system', content: 'You are a helpful assistant.' },
    { role: 'user', content: 'Hello!' },
  ],
});
console.log(response.choices[0].message.content);

// After
const response = await openai.responses.create({
  model: 'gpt-5',
  input: [
    { role: 'developer', content: 'You are a helpful assistant.' },
    { role: 'user', content: 'Hello!' },
  ],
});
console.log(response.output_text);

Migration from Assistants API

CRITICAL: Assistants API Sunset Timeline

  • August 26, 2025: Assistants API officially deprecated
  • 2025-2026: OpenAI providing migration utilities
  • August 26, 2026: Assistants API sunset (stops working)

Migrate before August 26, 2026 to avoid breaking changes.

Source: Assistants API Sunset Announcement

Key Breaking Changes:

Assistants APIResponses API
Assistants (created via API)Prompts (created in dashboard)
ThreadsConversations (store items, not just messages)
Runs (server-side lifecycle)Responses (stateless calls)
Run-StepsItems (polymorphic outputs)

Migration Example:

// Before (Assistants API - deprecated)
const assistant = await openai.beta.assistants.create({
  model: 'gpt-4',
  instructions: 'You are helpful.',
});

const thread = await openai.beta.threads.create();

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

// After (Responses API - current)
const conversation = await openai.conversations.create({
  metadata: { purpose: 'customer_support' },
});

const response = await openai.responses.create({
  model: 'gpt-5',
  conversation: conversation.id,
  input: [
    { role: 'developer', content: 'You are helpful.' },
    { role: 'user', content: 'Hello!' },
  ],
});

Migration Guide: Official Assistants Migration Docs


Known Issues Prevention

This skill prevents 11 documented errors:

1. Session State Not Persisting

  • Cause: Not using conversation IDs or using different IDs per turn
  • Fix: Create conversation once (const conv = await openai.conversations.create()), reuse conv.id for all turns

2. MCP Server Connection Failed (mcp_connection_error)

  • Causes: Invalid URL, missing/expired auth token, server down
  • Fix: Verify URL is correct, test manually with fetch(), check token expiration

3. Code Interpreter Timeout (code_interpreter_timeout)

  • Cause: Code runs longer than 30 seconds
  • Fix: Use background: true for extended timeout (up to 10 min)

4. Image Generation Rate Limit (rate_limit_error)

  • Cause: Too many DALL-E requests
  • Fix: Implement exponential backoff retry (1s, 2s, 3s delays)

5. File Search Relevance Issues

  • Cause: Vague queries return irrelevant results
  • Fix: Use specific queries ("pricing in Q4 2024" not "find pricing"), filter by chunk.score > 0.7

6. Cost Tracking Confusion

  • Cause: Responses bills for input + output + tools + stored conversations (vs Chat Completions: input + output only)
  • Fix: Set store: false if not needed, monitor response.usage.tool_tokens

7. Conversation Not Found (invalid_request_error)

  • Causes: ID typo, conversation deleted, or expired (90-day limit)
  • Fix: Verify exists with openai.conversations.list() before using

8. Tool Output Parsing Failed

  • Cause: Accessing wrong output structure
  • Fix: Use response.output_text helper or iterate response.output.forEach(item =>...) checking item.type

9. Zod v4 Incompatibility with Structured Outputs

  • Error: Invalid schema for response_format 'name': schema must be a JSON Schema of 'type: "object"', got 'type: "string"'.
  • Source: GitHub Issue #1597
  • Why It Happens: SDK's vendored zod-to-json-schema library doesn't support Zod v4 (missing ZodFirstPartyTypeKind export)
  • Prevention: Pin to Zod v3 ("zod": "^3.23.8") or use custom zodTextFormat with z.toJSONSchema({target: "draft-7"})
// Workaround: Pin to Zod v3 (recommended)
{
  "dependencies": {
    "openai": "^6.16.0",
    "zod": "^3.23.8"  // DO NOT upgrade to v4 yet
  }
}

10. Background Mode Web Search Missing Sources

  • Error: web_search_call output items contain query but no sources/results
  • Source: GitHub Issue #1676
  • Why It Happens: When using background: true + web_search tool, OpenAI doesn't return sources in the response
  • Prevention: Use synchronous mode (background: false) when web search sources are needed
// ✅ Sources available in sync mode
const response = await openai.responses.create({
  model: 'gpt-5',
  input: 'Latest AI news?',
  background: false,  // Required for sources
  tools: [{ type: 'web_search' }],
});

11. Streaming Mode Missing output_text Helper

  • Error: finalResponse().output_text is undefined in streaming mode
  • Source: GitHub Issue #1662
  • Why It Happens: stream.finalResponse() doesn't include output_text convenience field (only available in non-streaming responses)
  • Prevention: Listen for output_text.done event or manually extract from output items
// Workaround: Listen for event
const stream = openai.responses.stream({ model: 'gpt-5', input: 'Hello!' });
let outputText = '';
for await (const event of stream) {
  if (event.type === 'output_text.done') {
    outputText = event.output_text;  // ✅ Available in event
  }
}

Critical Patterns

✅ Always:

  • Use conversation IDs for multi-turn (40-80% better cache)
  • Handle all 8 output types in polymorphic responses
  • Use background: true for tasks >30s
  • Provide MCP authorization tokens (NOT stored, required each request)
  • Monitor response.usage.total_tokens for cost control

❌ Never:

  • Expose API keys in client-side code
  • Assume single message output (use response.output_text helper)
  • Reuse conversation IDs across users (security risk)
  • Ignore error types (handle rate_limit_error, mcp_connection_error specifically)
  • Poll faster than 1s for background tasks (use 5s intervals)

References

Official Docs:

Skill Resources: templates/, references/responses-vs-chat-completions.md, references/mcp-integration-guide.md, references/built-in-tools-guide.md, references/migration-guide.md, references/top-errors.md


Last verified: 2026-01-21 | Skill version: 2.1.0 | Changes: Added 3 TIER 1 issues (Zod v4, background web search, streaming output_text), 2 TIER 2 findings (MCP approval, reasoning privacy), Data Retention & ZDR section, Assistants API sunset timeline, background mode TTFT note, web search TypeScript limitation. Updated SDK version to 6.16.0.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

28.94%
按下载量换算829

Gemini CLI

20.69%
按下载量换算593

Antigravity

16.7%
按下载量换算478

OpenCode

12.59%
按下载量换算361

Cursor

6.78%
按下载量换算194

Codex

3.14%
按下载量换算90

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

可疑

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills