Skip to content
Back to skills

Openai Api

ASecurity

Integrate OpenAI Responses or Chat Completions, tools, and embeddings with retry handling and clear client boundaries.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 22, 2026
ai-agentstypescriptpythongoazureapi

Works with

  • cursor
  • cli
  • api

Security analysis

A100/100

Scanned October 22, 2026

npx -y skills add alivirgo/Major-AI-Skills --skill openai-api --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Openai Api?

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

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

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
---
name: openai-api
description: "Integrate OpenAI Responses or Chat Completions, tools, and embeddings with retry handling and clear client boundaries."
category: development
risk: safe
source: self
source_type: self
date_added: "2026-08-26"
tags: ["openai", "api", "llm", "embeddings", "python", "claude"]
tools: ["claude", "cursor", "gemini", "codex"]
---

# OpenAI API Client AI Skill Guide

## Overview & Engine Architecture

The OpenAI Python/TypeScript SDKs call HTTP APIs for chat/responses, tools, embeddings, and media. Auth uses `OPENAI_API_KEY` (or Azure-specific endpoints). Agents pin model names, set timeouts/retries, bound `max_tokens`, separate system vs user content, and treat tool calls as privileged actions requiring validation.

```
Client (SDK)
   -> Chat/Responses / Embeddings / Images
   -> usage + rate limits
```

## When to use this skill

- Direct model calls without a heavy framework
- Embeddings for `@chromadb` / RAG
- Tool-calling agents with explicit function schemas

## Operational directives

1. Load API keys from the environment - never commit keys.
2. Set request timeouts; retry only idempotent GETs / safe completions with backoff.
3. Pin model ids used in production; log them with each request id.
4. Validate/allowlist tool names and arguments before executing side effects.
5. Redact PII in logs; do not log full prompts when they contain secrets.

## Chat example (Python SDK)

```python
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["OPENAI_API_KEY"], timeout=60.0)

resp = client.chat.completions.create(
    model="gpt-4.1-mini",
    temperature=0,
    messages=[
        {"role": "system", "content": "Be concise. Cite uncertainty."},
        {"role": "user", "content": "Summarize our refund window in one sentence."},
    ],
)
print(resp.choices[0].message.content)
print(resp.usage)
```

## Embeddings

```python
emb = client.embeddings.create(
    model="text-embedding-3-small",
    input=["Annual refund window is 14 days."],
)
vector = emb.data[0].embedding
```

## Common failures

| Symptom | Cause | Fix |
| --- | --- | --- |
| 401 | missing/wrong key | env var; org access |
| 429 | rate limits | backoff; smaller TPM |
| Truncated answers | low max tokens | raise cap; shorten context |
| Schema errors | bad tool JSON | strict schema; validate |

## Best practices

- Use structured outputs / JSON schema when parsing mechanically.
- Cache embeddings for unchanged documents.
- Track cost via usage fields in `@mlflow` or your metrics stack.
- Prefer official SDKs over raw HTTP for retries and compatibility.

## Limitations

- Model names and API surfaces change - check current docs when pinning.
- Azure OpenAI uses different base URLs/deployment names.
- Compliance (data residency, zero-retention) is account/configuration specific.

## Related skills

- `@anthropic-api` - Claude provider SDK
- `@langchain` / `@llamaindex` - orchestration layers
- `@chromadb` - store embeddings

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.