extension-openai

Agent skill from caffeinelabs/skills.

caffeinelabs ↓ 7.9k Apache-2.0 updated 27d ago
Claude Code
View source ↗

What it does

  • Long-lived, no expiry. Spends the entire OpenAI account balance on every call.
  • No scoped permissions — there is no "tweet.read"-style narrowing. Every key has full account access.
  • OpenAI rate-limits per-key per-minute; treat the key like a billing credential, not a session token.
  • src/backend/main.mo — the actor: state + includes only.
  • src/backend/mixins/openai-chat.mo — the per-user endpoints (isMyOpenAIConfigured, setMyOpenAIApiKey, clearMyOpenAIApiKey, chat).
  • src/backend/lib/openai.mo — OpenAI SDK glue (Config builder + chat round-trip). Reused unchanged by §9.
  • Key the map by caller, never by user-supplied id. A Text userId from the frontend can be spoofed; Principal from shared ({ caller }) cannot.

Requirements & configuration

  • 2. A way to store the OpenAI API key (sk-...) as a canister-side secret. Three equivalent variants — the spec picks one:
  • OpenAI rate-limits per-key per-minute; treat the key like a billing credential, not a session token.
  • // §"Prerequisite").
  • Runtime.trap("Set your OpenAI API key first");
  • Trap cleanly when the key is missing. Use Runtime.trap("Set your OpenAI API key first") (or return a typed error) — the message identifies whose key is missing without leaking it.

Configuration: JSON

Derived from the skill's own SKILL.md documentation · extracted 2026-07-23

extension-openai FAQ

What does the extension-openai skill do?

>- MANDATORY recipe for every Caffeine build that calls OpenAI (ChatGPT, GPT-4o, an LLM, a chatbot, embeddings). The ONLY supported path is the `openai-client` mops package with a canister-side API-key bearer. Hand-rolling `ic.http_request` to `api.openai.com/v1/...` is a FORBIDDEN anti-pattern — it leaks the bearer across replicated outcalls (security + 13× billing impact), bypasses the typed request/response bindings, and forces hand-rolled JSON on a language with poor JSON support. Load this skill whenever the user, spec, or any prior task mentions ChatGPT, GPT (any version), OpenAI, an LLM, a chatbot, or embeddings — and BEFORE writing any code that touches `api.openai.com`. Long-lived, no expiry. Spends the entire OpenAI account balance on every call. No scoped permissions — there is no "tweet.read"-style narrowing. Every key has full account access.

What does extension-openai require?

2. A way to store the OpenAI API key (sk-...) as a canister-side secret. Three equivalent variants — the spec picks one: OpenAI rate-limits per-key per-minute; treat the key like a billing credential, not a session token. // §"Prerequisite"). Runtime.trap("Set your OpenAI API key first"); Trap cleanly when the key is missing. Use Runtime.trap("Set your OpenAI API key first") (or return a typed error) — the message identifies whose key is missing without leaking it. Configuration keys: JSON.

How do I install extension-openai?

Run: npx -y skills add https://github.com/caffeinelabs/skills --skill extension-openai --agent claude-code — the source lives at github.com/caffeinelabs/skills.

Maintain extension-openai?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

extension-openai on getagentictools
[![extension-openai on getagentictools](https://getagentictools.com/badge/skills/caffeinelabs-skills-extension-openai.svg)](https://getagentictools.com/skills/caffeinelabs-skills-extension-openai?ref=badge)
npx agentictools info skills/caffeinelabs-skills-extension-openai

The second line is the CLI lookup for this page — handy in READMEs and docs.