@kody/ai
Call GPT, Claude, and Grok, plus open models like Llama, Mistral, and Gemma.
UtilitiesTopics: ai, llm, chat, structured-output, openai, anthropic, groq, cloudflare, dry-run
- Version
- 1.0.0
- License
- MIT
- Published
- September 10, 2026
- Pinned commit
704b75d- Rating
- ★ 5.0 (1)
- Forks
- 6
- Adaptation effort
- 1.0
README
Agent docs@kody/ai
Generic geometric mark (not a vendor logo). This package is not affiliated with OpenAI, Anthropic, Groq, or Cloudflare.
Intent
Give every Kody account reusable, provider-agnostic AI helpers: chat completions, structured JSON generation, and a thin host-side tool loop. Callers pass the provider, model, and their own saved API key. Success means a forked copy can dry-run a request, then generate text or JSON, without anyone baking in personal keys, account ids, or a single vendor.
Live @kody/ai storage is the platform package bucket, not the caller's.
Fork first (or packages.invoke the user's copy) before saving defaults.
What it does
- Chat completions across OpenAI, Anthropic, Groq, Cloudflare Workers AI, and OpenAI-compatible base URLs
- Structured JSON generation from a JSON Schema
- Model-only steps with default Kody search/execute tool schemas for host packages
- Optional tool-using agent turns (search/execute run as package
ai) - Fork-local provider/model defaults via
./settings(writes needconfirm: true)
No jobs or schedules ship in this package.
Prerequisites / setup
API key (secret-backed). There is no AI OAuth integration and no baked-in key.
Do not open /connect/oauth for this package. Never paste key values into chat.
Agents: see AGENTS.md for import paths, smoke, and dryRun.
| Secret | Provider | Hosts to approve |
|---|---|---|
openaiApiKey | OpenAI | api.openai.com |
anthropicApiKey | Anthropic | api.anthropic.com |
groqApiKey | Groq | api.groq.com |
cloudflareApiToken | Cloudflare Workers AI | api.cloudflare.com, gateway.ai.cloudflare.com |
openaiCompatibleApiKey | Custom OpenAI-compatible base URL | the host you pass as baseUrl |
Readable defaults (not secrets) live in this package's packageStorage()
after you fork: provider, model, baseUrl, cloudflareAccountId,
cloudflareAiGatewayId.
- Create an API key in the provider console.
- Save the matching secret (pick one provider to start):
- Approve the host(s) listed above for that secret.
- Cloudflare also needs
cloudflareAccountIdin./settingson your fork (optionalcloudflareAiGatewayIdif you already have a gateway — this package never creates one). - Run the smoke test.
Additional accounts
Pass account: "work" to use openaiApiKey-work (or the matching provider
secret), or pass apiKeySecret explicitly.
Done when
- A provider secret is saved and its host(s) are approved
- Smoke test returns
{ ok: true }(live: falsebefore credentials; models-list only when a secret exists — no completion tokens) ./settingswrites refuse unlessconfirm: true;dryRun: truenever calls the vendor
Branding
Keep LICENSE (MIT), ## Intent, and community-icon.svg intact for community listing.
Docs
Report this listing
Log in to report this listing.