smithery/timequity

openai-sdk

OpenAI official SDK usage (Python, Node.js). Use when: writing code that calls OpenAI API, implementing chat/embeddings/images/audio features, handling streaming responses, async patterns, error handling with SDK. For raw HTTP/REST calls, see `openai-api` skill.

Installation

$ npx skills add smithery/timequity --skill openai-sdk

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/timequity · top by installs.

npx skills add smithery/timequity

Browse all from smithery/timequity

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 3,081 B
  • docs SUMMARY.md 282 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

OpenAI SDK

Official SDKs for Python and Node.js. Handles auth, retries, types automatically.

Quick Start

Python

pip install openai
from openai import OpenAI

client = OpenAI()  # Uses OPENAI_API_KEY env var

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)

Node.js

npm install openai
import OpenAI from "openai";

const client = new OpenAI();  // Uses OPENAI_API_KEY env var

const response = await client.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);

Environment Variables

export OPENAI_API_KEY="sk-..."
export OPENAI_ORG_ID="org-..."      # Optional
export OPENAI_PROJECT_ID="proj-..." # Optional

Key Features

Feature Python Node.js
Sync client OpenAI() new OpenAI()
Async client AsyncOpenAI() Same (async/await)
Streaming stream=True stream: true
Auto-retry Built-in Built-in
Timeout timeout=60 timeout: 60000
Types Full typing TypeScript

Common Operations

Chat Completion

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hi"}]
)

Streaming

stream = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hi"}],
    stream=True
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

Embeddings

response = client.embeddings.create(
    model="text-embedding-3-small",
    input="Hello world"
)
vector = response.data[0].embedding

Image Generation

response = client.images.generate(
    model="dall-e-3",
    prompt="A sunset over mountains",
    size="1024x1024"
)
url = response.data[0].url

Audio Transcription

with open("audio.mp3", "rb") as f:
    transcript = client.audio.transcriptions.create(
        model="whisper-1",
        file=f
    )
print(transcript.text)

Error Handling

from openai import OpenAI, APIError, RateLimitError

client = OpenAI()

try:
    response = client.chat.completions.create(...)
except RateLimitError:
    # Retry with backoff
except APIError as e:
    print(f"API error: {e.status_code}")

References

  • [python.md](references/python.md) — Full Python SDK guide
  • [nodejs.md](references/nodejs.md) — Full Node.js SDK guide
  • [streaming.md](references/streaming.md) — Streaming patterns for both

Related

  • openai-api skill — Raw REST API without SDK