@intentqa/llm-openai
v2.0.0
Published
OpenAI planner adapter for the intent-driven QA SDK. Bring your own API key.
Readme
@intentqa/llm-openai
OpenAI planner adapter for intentqa.
pnpm add -D @intentqa/llm-openai
export OPENAI_API_KEY=...
npx intentqa generate --intent "a premium user can apply a coupon"Bring your own key, always. This package never proxies through a key the project owns: a testing tool that quietly spends someone else's money is a tool nobody can adopt at work. Plans are cached on disk against the intent, the catalog hash and the prompt version, so unchanged intent against an unchanged vocabulary costs nothing to re-run.
No dependencies beyond intentqa itself. This adapter talks to POST /chat/completions
with the global fetch and hand-rolled JSON rather than taking openai as a dependency —
the same call @intentqa/mcp makes with JSON-RPC. One request shape does not justify
putting a vendor SDK, and its transitive tree, into everyone's lockfile.
Defaults to gpt-5.1. Every default is an option:
import { openaiPlanner } from "@intentqa/llm-openai";
export const planner = openaiPlanner({ model: "gpt-5.1-mini", maxTokens: 24000 });baseURL defaults to https://api.openai.com/v1 and points this adapter at anything
that speaks the same API — Azure OpenAI, OpenRouter, together.ai, or a local vLLM:
export const planner = openaiPlanner({
baseURL: "https://openrouter.ai/api/v1",
apiKey: process.env.OPENROUTER_API_KEY,
model: "anthropic/claude-sonnet-5",
});strictSchema is off by default. OpenAI's strict: true rejects any schema it
considers non-conforming, and the plan schema is generated from Zod in intentqa
rather than written against OpenAI's rules; the schema is still sent, so the model gets
the constraint either way. Turn it on if it works for your model and vocabulary.
The prompt and the plan schema live in intentqa, not here, so swapping providers
cannot silently change what the model is asked to do — and a cross-provider comparison
stays meaningful.
The model gets a strict output schema, no tools, and no way to emit code. The worst it can do is pick the wrong step from the catalog, which the compiler catches and the reviewer sees. Its reply is re-validated against the schema rather than trusted: strict output modes are a strong constraint, not a guarantee.
