@ai-sdk/open-responses 2.0.7 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @ai-sdk/open-responses
2
2
 
3
+ ## 2.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [4be62c1]
8
+ - Updated dependencies [7805e4a]
9
+ - Updated dependencies [cd12954]
10
+ - @ai-sdk/provider-utils@5.0.9
11
+
12
+ ## 2.0.8
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [e193290]
17
+ - @ai-sdk/provider-utils@5.0.8
18
+
3
19
  ## 2.0.7
4
20
 
5
21
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = true ? "2.0.7" : "0.0.0-test";
2
+ var VERSION = true ? "2.0.9" : "0.0.0-test";
3
3
 
4
4
  // src/open-responses-provider.ts
5
5
  import {
@@ -5,7 +5,15 @@ description: Learn how to use the Open Responses provider for the AI SDK.
5
5
 
6
6
  # Open Responses Provider
7
7
 
8
- The [Open Responses](https://www.openresponses.org/) provider contains language model support for Open Responses compatible APIs.
8
+ The [Open Responses](https://www.openresponses.org/) provider connects AI SDK
9
+ Core to language model servers that implement an Open Responses-compatible
10
+ `POST` endpoint. Open Responses is an open specification based on the OpenAI
11
+ Responses API.
12
+
13
+ Use `@ai-sdk/open-responses` for third-party or self-hosted endpoints that
14
+ implement this protocol, such as LM Studio. If you call OpenAI directly and
15
+ need OpenAI-specific provider options or built-in tools, use the
16
+ [`@ai-sdk/openai` provider](/providers/ai-sdk-providers/openai) instead.
9
17
 
10
18
  ## Setup
11
19
 
@@ -21,7 +29,7 @@ Create an Open Responses provider instance using `createOpenResponses`:
21
29
  import { createOpenResponses } from '@ai-sdk/open-responses';
22
30
 
23
31
  const openResponses = createOpenResponses({
24
- name: 'aProvider',
32
+ name: 'lmstudio',
25
33
  url: 'http://localhost:1234/v1/responses',
26
34
  });
27
35
  ```
@@ -30,17 +38,19 @@ The `name` and `url` options are required:
30
38
 
31
39
  - **name** _string_
32
40
 
33
- Provider name. Used as the key for provider options and metadata.
41
+ Provider name. Used in the model's provider identifier and as the key for
42
+ provider options.
34
43
 
35
44
  - **url** _string_
36
45
 
37
- URL for the Open Responses API POST endpoint.
46
+ Full URL for the Open Responses API `POST` endpoint. Pass the endpoint URL,
47
+ such as `http://localhost:1234/v1/responses`, not only its base URL.
38
48
 
39
49
  You can use the following optional settings to customize the Open Responses provider instance:
40
50
 
41
51
  - **apiKey** _string_
42
52
 
43
- API key that is being sent using the `Authorization` header.
53
+ API key that is sent as a bearer token in the `Authorization` header.
44
54
 
45
55
  - **headers** _Record<string,string>_
46
56
 
@@ -51,36 +61,178 @@ You can use the following optional settings to customize the Open Responses prov
51
61
  Custom [fetch](https://developer.mozilla.org/en-US/docs/Web/API/fetch) implementation.
52
62
  Defaults to the global `fetch` function.
53
63
 
64
+ ### Endpoint Examples
65
+
66
+ For a local LM Studio server that does not require authentication:
67
+
68
+ ```ts
69
+ import { createOpenResponses } from '@ai-sdk/open-responses';
70
+
71
+ const lmstudio = createOpenResponses({
72
+ name: 'lmstudio',
73
+ url: 'http://localhost:1234/v1/responses',
74
+ });
75
+ ```
76
+
77
+ For the OpenAI Responses API:
78
+
79
+ ```ts
80
+ import { createOpenResponses } from '@ai-sdk/open-responses';
81
+
82
+ const openAIResponses = createOpenResponses({
83
+ name: 'openai',
84
+ url: 'https://api.openai.com/v1/responses',
85
+ apiKey: process.env.OPENAI_API_KEY,
86
+ });
87
+ ```
88
+
89
+ You can use the same setup with another compatible service by changing the
90
+ `name`, `url`, authentication, and model ID.
91
+
54
92
  ## Language Models
55
93
 
56
94
  The Open Responses provider instance is a function that you can invoke to create a language model:
57
95
 
58
96
  ```ts
59
- const model = openResponses('mistralai/ministral-3-14b-reasoning');
97
+ const model = openResponses('your-model-id');
60
98
  ```
61
99
 
100
+ The model ID is passed to the endpoint unchanged.
101
+
62
102
  You can use Open Responses models with the `generateText` and `streamText` functions,
63
103
  and they support structured data generation with [`Output`](/docs/reference/ai-sdk-core/output)
64
104
  (see [AI SDK Core](/docs/ai-sdk-core)).
65
105
 
66
- ### Example
106
+ ### Generate Text
67
107
 
68
108
  ```ts
69
109
  import { createOpenResponses } from '@ai-sdk/open-responses';
70
110
  import { generateText } from 'ai';
71
111
 
72
112
  const openResponses = createOpenResponses({
73
- name: 'aProvider',
113
+ name: 'lmstudio',
74
114
  url: 'http://localhost:1234/v1/responses',
75
115
  });
76
116
 
77
117
  const { text } = await generateText({
78
- model: openResponses('mistralai/ministral-3-14b-reasoning'),
118
+ model: openResponses('your-model-id'),
119
+ prompt: 'Invent a new holiday and describe its traditions.',
120
+ });
121
+
122
+ console.log(text);
123
+ ```
124
+
125
+ ### Stream Text
126
+
127
+ ```ts
128
+ import { createOpenResponses } from '@ai-sdk/open-responses';
129
+ import { streamText } from 'ai';
130
+
131
+ const openResponses = createOpenResponses({
132
+ name: 'lmstudio',
133
+ url: 'http://localhost:1234/v1/responses',
134
+ });
135
+
136
+ const result = streamText({
137
+ model: openResponses('your-model-id'),
79
138
  prompt: 'Invent a new holiday and describe its traditions.',
80
139
  });
140
+
141
+ for await (const textPart of result.textStream) {
142
+ process.stdout.write(textPart);
143
+ }
144
+ ```
145
+
146
+ ## Reasoning and Provider Options
147
+
148
+ Use the top-level [`reasoning`](/docs/ai-sdk-core/reasoning) setting to control
149
+ reasoning effort. The provider maps supported values to the Open Responses
150
+ `reasoning.effort` field.
151
+
152
+ The provider also supports `reasoningSummary` through `providerOptions`. The
153
+ provider option key must match the `name` passed to `createOpenResponses`:
154
+
155
+ ```ts
156
+ import {
157
+ createOpenResponses,
158
+ type OpenResponsesLanguageModelOptions,
159
+ } from '@ai-sdk/open-responses';
160
+ import { generateText } from 'ai';
161
+
162
+ const lmstudio = createOpenResponses({
163
+ name: 'lmstudio',
164
+ url: 'http://localhost:1234/v1/responses',
165
+ });
166
+
167
+ const { text, reasoningText } = await generateText({
168
+ model: lmstudio('your-reasoning-model-id'),
169
+ reasoning: 'high',
170
+ providerOptions: {
171
+ lmstudio: {
172
+ reasoningSummary: 'detailed',
173
+ } satisfies OpenResponsesLanguageModelOptions,
174
+ },
175
+ prompt: 'Explain why the sky appears blue.',
176
+ });
177
+
178
+ console.log(reasoningText);
179
+ console.log(text);
180
+ ```
181
+
182
+ `reasoningSummary` accepts `'auto'`, `'concise'`, or `'detailed'`. Reasoning
183
+ support and accepted values depend on the endpoint and model.
184
+
185
+ ## File Inputs
186
+
187
+ The provider supports image and non-image file inputs in user messages. Images
188
+ are sent as `input_image` parts, while other media types, such as PDFs, are
189
+ sent as `input_file` parts.
190
+
191
+ You can provide a file as inline data:
192
+
193
+ ```ts
194
+ import { createOpenResponses } from '@ai-sdk/open-responses';
195
+ import { readFileSync } from 'node:fs';
196
+ import { generateText } from 'ai';
197
+
198
+ const openResponses = createOpenResponses({
199
+ name: 'lmstudio',
200
+ url: 'http://localhost:1234/v1/responses',
201
+ });
202
+
203
+ const { text } = await generateText({
204
+ model: openResponses('your-file-capable-model-id'),
205
+ messages: [
206
+ {
207
+ role: 'user',
208
+ content: [
209
+ {
210
+ type: 'text',
211
+ text: 'Summarize this document.',
212
+ },
213
+ {
214
+ type: 'file',
215
+ data: readFileSync('./document.pdf'),
216
+ mediaType: 'application/pdf',
217
+ filename: 'document.pdf',
218
+ },
219
+ ],
220
+ },
221
+ ],
222
+ });
223
+
224
+ console.log(text);
81
225
  ```
82
226
 
83
- ## Notes
227
+ You can also set `data` to a `URL`. The endpoint and model must support the
228
+ file's media type. Provider file references, such as OpenAI file IDs, and
229
+ file data in `{ type: 'text', text: '...' }` format are not supported by this
230
+ provider.
231
+
232
+ ## Limitations
84
233
 
85
234
  - Stop sequences, `topK`, and `seed` are not supported and are ignored with warnings.
86
- - Image inputs are supported for user messages with `file` parts using image media types.
235
+ - The provider supports language models only. It does not provide embedding or
236
+ image generation models.
237
+ - AI SDK function tools are supported. Provider-specific built-in tools and
238
+ options require a dedicated provider implementation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/open-responses",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -30,15 +30,15 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@ai-sdk/provider": "4.0.3",
33
- "@ai-sdk/provider-utils": "5.0.7"
33
+ "@ai-sdk/provider-utils": "5.0.9"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "22.19.19",
37
37
  "tsup": "^8.5.1",
38
38
  "typescript": "5.8.3",
39
39
  "zod": "3.25.76",
40
- "@vercel/ai-tsconfig": "0.0.0",
41
- "@ai-sdk/test-server": "2.0.0"
40
+ "@ai-sdk/test-server": "2.0.0",
41
+ "@vercel/ai-tsconfig": "0.0.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "zod": "^3.25.76 || ^4.1.8"