Skip to content
Back to skills

Openai

ASecurity

OpenAI provides advanced machine learning models via REST API. This skill covers Chat Completions, Embeddings, and Vision models, focusing on streaming architectures and context management.

  • 13 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 5, 2026
ai-agentsbashapifrontendsecurity

Works with

  • api

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 8 files and shows the line behind each finding

Scanned September 5, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Openai?

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

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

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 API Skill

## Overview
OpenAI provides advanced machine learning models via REST API. This skill covers Chat Completions, Embeddings, and Vision models, focusing on streaming architectures and context management.

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

## Authentication
Authenticate using a Bearer token (`OPENAI_API_KEY`). For enterprise organizations, supply the `OPENAI_ORG_ID` to properly attribute billing.

## Core Concepts
- **Messages**: An array of `{ role, content }` objects representing conversation history.
- **Temperature**: Controls randomness (0.0 for deterministic, 1.0 for creative).
- **Tokens**: The atomic unit of billing and context limits.

## Common Workflows
1. Construct a system prompt.
2. Append user input to the messages array.
3. Call `chat.completions.create` with `stream: true` for low-latency UX.

## Error Handling
Catch `OpenAIError`. Handle `RateLimitError` (HTTP 429) via exponential backoff. Handle `LengthError` by dynamically summarizing or trimming the context window before retrying.

## Security
Never inject unsanitized user input directly into system prompts to avoid prompt injection attacks. Do not leak API keys in frontend bundles.

## Rate Limits
Limits are tiered based on usage. Tier 1 allows 500 RPM for GPT-3.5 and 500 RPM for GPT-4. Tier 5 allows 10,000 RPM.

## Best Practices
Use `max_tokens` defensively to bound costs. Utilize function calling (`tools`) to ensure the model outputs strictly typed JSON data rather than relying on regex parsing.

## Troubleshooting
If you receive 'Context window exceeded', count tokens using `tiktoken` before sending the request.

## References
- [API Reference](https://platform.openai.com/docs/api-reference)

## Why use this skill
Use this when your agent works with **openai** — structured patterns beat pasted docs and prevent common hallucinations.

## AI pitfalls
- Using deprecated model IDs or wrong API endpoints
- Confusing chat vs completions vs embeddings APIs
- Omitting rate-limit and token budget handling

## Production checklist
- [ ] Secrets in environment variables, not source code
- [ ] Error handling and logging in place
- [ ] Rate limits and timeouts configured

## Related skills
- No graph relationships yet — see the knowledge graph in the docs site.

---
> **Last Verified:** 2026-07-02

Files in this skill

  • SKILL.md2.3 KB
  • examples/basic.ts39 B
  • examples/example.py144 B
  • examples/example.ts178 B
  • prompts/stream-chat.md179 B
  • prompts/system.md41 B
  • tests/skill.test.ts29 B
  • tests/validation.test.ts104 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.

Comments

Loading comments…

Newsletter

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