Skip to content
Back to skills

Openai Responses

ASecurity

> **Verification Tier:** `code_example_tested` | **Last Verified:** 2026-11-18 > **Official Docs:** https://platform.openai.com/docs/api-reference/responses

  • 13 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
ai-agentsrustbashapibackendsecurity

Works with

  • cli
  • api
  • mcp

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 2 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add ashish7802/awesome-api-skills --skill openai-responses --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Openai Responses?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Openai Responses
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ashish7802-openai-responses/badge)](https://www.skillsdirectory.com/skills/ashish7802-openai-responses)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# OpenAI Responses API Skill

> **Verification Tier:** `code_example_tested` | **Last Verified:** 2026-11-18  
> **Official Docs:** https://platform.openai.com/docs/api-reference/responses

## Overview
The OpenAI Responses API (`POST /v1/responses`) is OpenAI's unified interface combining text/multimodal generation, built-in tools (web search, file search, code interpreter, remote MCP servers), Structured Outputs (`text.format`), and optional server-side conversation chaining (`previous_response_id` or Conversations).

## Installation
```bash
npm install openai zod
pip install openai pydantic
```

## Authentication
Authenticate using a server-side Bearer token via `OPENAI_API_KEY`. Never expose API keys in browser bundles; proxy requests through your backend.
```bash
export OPENAI_API_KEY="sk-proj-..."
```

## Core Concepts
- **`input` vs `instructions`**: Use `instructions` for developer/system guidance and `input` for strings or structured multimodal message items.
- **`output_text` helper**: The official SDK aggregates assistant text output into `response.output_text` instead of traversing `choices[0].message.content`.
- **Structured Outputs (`text.format`)**: Pass a strict JSON Schema (`strict: true`) under `text.format` (NOT the legacy Chat Completions `response_format` field).
- **Stateful chaining**: Pass `previous_response_id` for multi-turn continuity or set `store: false` when zero server-side retention is required.

## Common Workflows
1. Initialize `new OpenAI({ apiKey: process.env.OPENAI_API_KEY, timeout: 30_000, maxRetries: 2 })`.
2. Call `client.responses.create({ model, instructions, input, text: { format: ... } })`.
3. Stream events with `stream: true` and handle `response.output_text.delta` and `response.completed`.

## Error Handling & Rate Limits
- Catch `OpenAI.APIError` and inspect `err.status` (`429` rate limit, `408`/`5xx` transient).
- Respect `retry-after` and `x-ratelimit-remaining-tokens` headers; use exponential backoff with jitter.
- Bound spending with `max_output_tokens` and explicit `AbortSignal.timeout()`.

## Security Best Practices
- Never concatenate untrusted user content into `instructions`.
- For Zero Data Retention (ZDR) / privacy-sensitive workloads, pass `store: false`.
- Validate all tool call arguments against strict schemas before executing side effects.

## AI Pitfalls
- Passing Chat Completions parameters (`messages`, `response_format`, `max_tokens`) to `client.responses.create()` instead of `input`, `text.format`, and `max_output_tokens`.
- Reading `response.choices[0].message.content` instead of `response.output_text` or iterating `response.output`.
- Forgetting `additionalProperties: false` on strict JSON Schemas.

## Production Checklist
- [ ] `OPENAI_API_KEY` stored strictly in server-side environment variables
- [ ] `max_output_tokens` and request timeout configured
- [ ] Retry/backoff logic handles HTTP `429` and `5xx`
- [ ] Strict JSON schema validation applied to structured outputs and tool arguments

## References
- [Responses API Reference](https://platform.openai.com/docs/api-reference/responses)
- [Structured Outputs Guide](https://platform.openai.com/docs/guides/structured-outputs)

## Related skills
- [`openai`](../openai/SKILL.md) — integrates with
- [`vercel-ai-sdk`](../vercel-ai-sdk/SKILL.md) — integrates with
- [`langfuse`](../langfuse/SKILL.md) — works well with

Files in this skill

  • SKILL.md3.3 KB
  • examples/quickstart.ts992 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.