content/providers/01-ai-sdk-providers/06-open-responses.mdx
The Open Responses provider contains language model support for Open Responses compatible APIs.
The Open Responses provider is available in the @ai-sdk/open-responses module. You can install it with
<Tabs items={['pnpm', 'npm', 'yarn', 'bun']}> <Tab> <Snippet text="pnpm add @ai-sdk/open-responses" dark /> </Tab> <Tab> <Snippet text="npm install @ai-sdk/open-responses" dark /> </Tab> <Tab> <Snippet text="yarn add @ai-sdk/open-responses" dark /> </Tab> <Tab> <Snippet text="bun add @ai-sdk/open-responses" dark /> </Tab> </Tabs>
Create an Open Responses provider instance using createOpenResponses:
import { createOpenResponses } from '@ai-sdk/open-responses';
const openResponses = createOpenResponses({
name: 'aProvider',
url: 'http://localhost:1234/v1/responses',
});
The name and url options are required:
name string
Provider name. Used as the key for provider options and metadata.
url string
URL for the Open Responses API POST endpoint.
You can use the following optional settings to customize the Open Responses provider instance:
apiKey string
API key that is being sent using the Authorization header.
headers Record<string,string>
Custom headers to include in the requests.
fetch (input: RequestInfo, init?: RequestInit) => Promise<Response>
Custom fetch implementation.
Defaults to the global fetch function.
The Open Responses provider instance is a function that you can invoke to create a language model:
const model = openResponses('mistralai/ministral-3-14b-reasoning');
You can use Open Responses models with the generateText and streamText functions,
and they support structured data generation with Output
(see AI SDK Core).
import { createOpenResponses } from '@ai-sdk/open-responses';
import { generateText } from 'ai';
const openResponses = createOpenResponses({
name: 'aProvider',
url: 'http://localhost:1234/v1/responses',
});
const { text } = await generateText({
model: openResponses('mistralai/ministral-3-14b-reasoning'),
prompt: 'Invent a new holiday and describe its traditions.',
});
topK, and seed are not supported and are ignored with warnings.file parts using image media types.