Class: OpenAIResponsesProvider
Defined in: providers/openai-responses.ts:417
OpenAI Responses-API provider.
Example
const provider = createOpenAIResponsesProvider({ model: 'gpt-6-sol' });
Implements
Constructors
Constructor
new OpenAIResponsesProvider(config?): OpenAIResponsesProvider;
Defined in: providers/openai-responses.ts:433
Parameters
| Parameter | Type |
|---|---|
config | OpenAIResponsesProviderConfig |
Returns
OpenAIResponsesProvider
Properties
name
readonly name: "openai" = 'openai';
Defined in: providers/openai-responses.ts:423
⚠️ 'openai', not 'openai-responses'. This string keys error classification, llm_retry event payloads and ProviderError.provider across the SDK, CLI and Desktop. It names the vendor, not the transport.
Implementation of
Methods
buildRequestBody()
buildRequestBody(messages, options?): ResponsesRequestBody;
Defined in: providers/openai-responses.ts:483
Build the request body.
What is deliberately NEVER sent, and why:
messages— this endpoint takesinput.max_tokens— measured “Unknown parameter”; the cap ismax_output_tokens.temperature/top_p— measured “‘temperature’ is not supported with this model”. Dropped silently, exactly asClaudeProviderdrops them for the models that reject them.stop— Chat-Completions-shaped, no caller sets it, unmeasured here.stream_options: {include_usage: true}— Chat-Completions only; usage arrives onresponse.completed.
Parameters
| Parameter | Type |
|---|---|
messages | Message[] |
options? | ChatOptions |
Returns
ResponsesRequestBody
chat()
chat(messages, options?): AsyncIterable<StreamChunk>;
Defined in: providers/openai-responses.ts:515
Stream a response.
⚠️ EVERY tool-call chunk carries toolCallId. This endpoint announces BOTH calls of a parallel turn (output_item.added ×2) before either has any arguments. Untagged, the agent’s accumulator closes whichever call it saw last: the two argument streams merge into one buffer, JSON.parse fails, and BOTH calls are dropped while the turn is reported as output-limit truncation — the user sees the agent say what it will do, then do nothing. With the id set, the accumulator keys each call separately and we can stream both live.
Parameters
| Parameter | Type |
|---|---|
messages | Message[] |
options? | ChatOptions |
Returns
AsyncIterable<StreamChunk>
Implementation of
countTokens()
countTokens(messages): Promise<number>;
Defined in: providers/openai-responses.ts:459
Count tokens in messages (optional, provider-specific)
Parameters
| Parameter | Type |
|---|---|
messages | Message[] |
Returns
Promise<number>
Implementation of
getModel()
getModel(): string;
Defined in: providers/openai-responses.ts:451
Get the current default model ID.
Returns
string
Implementation of
setModel()
setModel(modelId): void;
Defined in: providers/openai-responses.ts:455
Change the default model for subsequent calls. Same provider only. Takes effect on the next chat() call, not mid-stream.
Parameters
| Parameter | Type | Description |
|---|---|---|
modelId | string | The new model ID (e.g., ‘claude-opus-4-20250514’) |
Returns
void