Skip to content

Commit 31cd88f

Browse files
feat(api): add image sizes, reasoning encryption
1 parent dfbdc65 commit 31cd88f

File tree

5 files changed

+74
-38
lines changed

5 files changed

+74
-38
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 97
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8b68ae6b807dca92e914da1dd9e835a20f69b075e79102a264367fd7fddddb33.yml
3-
openapi_spec_hash: b6ade5b1a6327339e6669e1134de2d03
4-
config_hash: b597cd9a31e9e5ec709e2eefb4c54122
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0ee6b36cf3cc278cef4199a6aec5f7d530a6c1f17a74830037e96d50ca1edc50.yml
3+
openapi_spec_hash: e8ec5f46bc0655b34f292422d58a60f6
4+
config_hash: d9b6b6e6bc85744663e300eebc482067

src/resources/audio/speech.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export interface SpeechCreateParams {
6666

6767
/**
6868
* The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
69-
* the default.
69+
* the default. Does not work with `gpt-4o-mini-tts`.
7070
*/
7171
speed?: number;
7272
}

src/resources/images.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,13 @@ export interface ImageCreateVariationParams {
162162

163163
export interface ImageEditParams {
164164
/**
165-
* The image(s) to edit. Must be a supported image file or an array of images. For
166-
* `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
167-
* 25MB. For `dall-e-2`, you can only provide one image, and it should be a square
168-
* `png` file less than 4MB.
165+
* The image(s) to edit. Must be a supported image file or an array of images.
166+
*
167+
* For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
168+
* 25MB. You can provide up to 16 images.
169+
*
170+
* For `dall-e-2`, you can only provide one image, and it should be a square `png`
171+
* file less than 4MB.
169172
*/
170173
image: Core.Uploadable | Array<Core.Uploadable>;
171174

@@ -175,6 +178,17 @@ export interface ImageEditParams {
175178
*/
176179
prompt: string;
177180

181+
/**
182+
* Allows to set transparency for the background of the generated image(s). This
183+
* parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
184+
* `opaque` or `auto` (default value). When `auto` is used, the model will
185+
* automatically determine the best background for the image.
186+
*
187+
* If `transparent`, the output format needs to support transparency, so it should
188+
* be set to either `png` (default value) or `webp`.
189+
*/
190+
background?: 'transparent' | 'opaque' | 'auto' | null;
191+
178192
/**
179193
* An additional image whose fully transparent areas (e.g. where alpha is zero)
180194
* indicate where `image` should be edited. If there are multiple images provided,
@@ -215,7 +229,7 @@ export interface ImageEditParams {
215229
* (landscape), `1024x1536` (portrait), or `auto` (default value) for
216230
* `gpt-image-1`, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
217231
*/
218-
size?: '256x256' | '512x512' | '1024x1024' | null;
232+
size?: '256x256' | '512x512' | '1024x1024' | '1536x1024' | '1024x1536' | 'auto' | null;
219233

220234
/**
221235
* A unique identifier representing your end-user, which can help OpenAI to monitor

src/resources/responses/responses.ts

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export interface ComputerTool {
158158
/**
159159
* The type of computer environment to control.
160160
*/
161-
environment: 'mac' | 'windows' | 'ubuntu' | 'browser';
161+
environment: 'windows' | 'mac' | 'linux' | 'ubuntu' | 'browser';
162162

163163
/**
164164
* The type of the computer use tool. Always `computer_use_preview`.
@@ -209,9 +209,9 @@ export interface FileSearchTool {
209209
vector_store_ids: Array<string>;
210210

211211
/**
212-
* A filter to apply based on file attributes.
212+
* A filter to apply.
213213
*/
214-
filters?: Shared.ComparisonFilter | Shared.CompoundFilter;
214+
filters?: Shared.ComparisonFilter | Shared.CompoundFilter | null;
215215

216216
/**
217217
* The maximum number of results to return. This number should be between 1 and 50
@@ -258,12 +258,12 @@ export interface FunctionTool {
258258
/**
259259
* A JSON schema object describing the parameters of the function.
260260
*/
261-
parameters: Record<string, unknown>;
261+
parameters: Record<string, unknown> | null;
262262

263263
/**
264264
* Whether to enforce strict parameter validation. Default `true`.
265265
*/
266-
strict: boolean;
266+
strict: boolean | null;
267267

268268
/**
269269
* The type of the function tool. Always `function`.
@@ -1581,11 +1581,17 @@ export interface ResponseInProgressEvent {
15811581
* - `message.input_image.image_url`: Include image urls from the input message.
15821582
* - `computer_call_output.output.image_url`: Include image urls from the computer
15831583
* call output.
1584+
* - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
1585+
* tokens in reasoning item outputs. This enables reasoning items to be used in
1586+
* multi-turn conversations when using the Responses API statelessly (like when
1587+
* the `store` parameter is set to `false`, or when an organization is enrolled
1588+
* in the zero data retention program).
15841589
*/
15851590
export type ResponseIncludable =
15861591
| 'file_search_call.results'
15871592
| 'message.input_image.image_url'
1588-
| 'computer_call_output.output.image_url';
1593+
| 'computer_call_output.output.image_url'
1594+
| 'reasoning.encrypted_content';
15891595

15901596
/**
15911597
* An event that is emitted when a response finishes as incomplete.
@@ -1650,7 +1656,7 @@ export interface ResponseInputFile {
16501656
/**
16511657
* The ID of the file to be sent to the model.
16521658
*/
1653-
file_id?: string;
1659+
file_id?: string | null;
16541660

16551661
/**
16561662
* The name of the file to be sent to the model.
@@ -1667,7 +1673,7 @@ export interface ResponseInputImage {
16671673
* The detail level of the image to be sent to the model. One of `high`, `low`, or
16681674
* `auto`. Defaults to `auto`.
16691675
*/
1670-
detail: 'high' | 'low' | 'auto';
1676+
detail: 'low' | 'high' | 'auto';
16711677

16721678
/**
16731679
* The type of the input item. Always `input_image`.
@@ -1758,19 +1764,19 @@ export namespace ResponseInputItem {
17581764
/**
17591765
* The ID of the computer tool call output.
17601766
*/
1761-
id?: string;
1767+
id?: string | null;
17621768

17631769
/**
17641770
* The safety checks reported by the API that have been acknowledged by the
17651771
* developer.
17661772
*/
1767-
acknowledged_safety_checks?: Array<ComputerCallOutput.AcknowledgedSafetyCheck>;
1773+
acknowledged_safety_checks?: Array<ComputerCallOutput.AcknowledgedSafetyCheck> | null;
17681774

17691775
/**
17701776
* The status of the message input. One of `in_progress`, `completed`, or
17711777
* `incomplete`. Populated when input items are returned via API.
17721778
*/
1773-
status?: 'in_progress' | 'completed' | 'incomplete';
1779+
status?: 'in_progress' | 'completed' | 'incomplete' | null;
17741780
}
17751781

17761782
export namespace ComputerCallOutput {
@@ -1786,12 +1792,12 @@ export namespace ResponseInputItem {
17861792
/**
17871793
* The type of the pending safety check.
17881794
*/
1789-
code: string;
1795+
code?: string | null;
17901796

17911797
/**
17921798
* Details about the pending safety check.
17931799
*/
1794-
message: string;
1800+
message?: string | null;
17951801
}
17961802
}
17971803

@@ -1818,13 +1824,13 @@ export namespace ResponseInputItem {
18181824
* The unique ID of the function tool call output. Populated when this item is
18191825
* returned via API.
18201826
*/
1821-
id?: string;
1827+
id?: string | null;
18221828

18231829
/**
18241830
* The status of the item. One of `in_progress`, `completed`, or `incomplete`.
18251831
* Populated when items are returned via API.
18261832
*/
1827-
status?: 'in_progress' | 'completed' | 'incomplete';
1833+
status?: 'in_progress' | 'completed' | 'incomplete' | null;
18281834
}
18291835

18301836
/**
@@ -1839,7 +1845,7 @@ export namespace ResponseInputItem {
18391845
/**
18401846
* The type of item to reference. Always `item_reference`.
18411847
*/
1842-
type: 'item_reference';
1848+
type?: 'item_reference' | null;
18431849
}
18441850
}
18451851

@@ -2119,7 +2125,9 @@ export namespace ResponseOutputText {
21192125

21202126
/**
21212127
* A description of the chain of thought used by a reasoning model while generating
2122-
* a response.
2128+
* a response. Be sure to include these items in your `input` to the Responses API
2129+
* for subsequent turns of a conversation if you are manually
2130+
* [managing context](https://platform.openai.com/docs/guides/conversation-state).
21232131
*/
21242132
export interface ResponseReasoningItem {
21252133
/**
@@ -2137,6 +2145,12 @@ export interface ResponseReasoningItem {
21372145
*/
21382146
type: 'reasoning';
21392147

2148+
/**
2149+
* The encrypted content of the reasoning item - populated when a response is
2150+
* generated with `reasoning.encrypted_content` in the `include` parameter.
2151+
*/
2152+
encrypted_content?: string | null;
2153+
21402154
/**
21412155
* The status of the item. One of `in_progress`, `completed`, or `incomplete`.
21422156
* Populated when items are returned via API.
@@ -2730,11 +2744,9 @@ export interface ResponseWebSearchCallSearchingEvent {
27302744
}
27312745

27322746
/**
2733-
* A tool that searches for relevant content from uploaded files. Learn more about
2734-
* the
2735-
* [file search tool](https://platform.openai.com/docs/guides/tools-file-search).
2747+
* A tool that can be used to generate a response.
27362748
*/
2737-
export type Tool = FileSearchTool | FunctionTool | ComputerTool | WebSearchTool;
2749+
export type Tool = FileSearchTool | FunctionTool | WebSearchTool | ComputerTool;
27382750

27392751
/**
27402752
* Use this option to force the model to call a specific function.
@@ -2788,10 +2800,8 @@ export interface ToolChoiceTypes {
27882800
*/
27892801
export interface WebSearchTool {
27902802
/**
2791-
* The type of the web search tool. One of:
2792-
*
2793-
* - `web_search_preview`
2794-
* - `web_search_preview_2025_03_11`
2803+
* The type of the web search tool. One of `web_search_preview` or
2804+
* `web_search_preview_2025_03_11`.
27952805
*/
27962806
type: 'web_search_preview' | 'web_search_preview_2025_03_11';
27972807

@@ -2801,10 +2811,16 @@ export interface WebSearchTool {
28012811
*/
28022812
search_context_size?: 'low' | 'medium' | 'high';
28032813

2814+
/**
2815+
* The user's location.
2816+
*/
28042817
user_location?: WebSearchTool.UserLocation | null;
28052818
}
28062819

28072820
export namespace WebSearchTool {
2821+
/**
2822+
* The user's location.
2823+
*/
28082824
export interface UserLocation {
28092825
/**
28102826
* The type of location approximation. Always `approximate`.
@@ -2814,24 +2830,24 @@ export namespace WebSearchTool {
28142830
/**
28152831
* Free text input for the city of the user, e.g. `San Francisco`.
28162832
*/
2817-
city?: string;
2833+
city?: string | null;
28182834

28192835
/**
28202836
* The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of
28212837
* the user, e.g. `US`.
28222838
*/
2823-
country?: string;
2839+
country?: string | null;
28242840

28252841
/**
28262842
* Free text input for the region of the user, e.g. `California`.
28272843
*/
2828-
region?: string;
2844+
region?: string | null;
28292845

28302846
/**
28312847
* The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the
28322848
* user, e.g. `America/Los_Angeles`.
28332849
*/
2834-
timezone?: string;
2850+
timezone?: string | null;
28352851
}
28362852
}
28372853

@@ -2869,6 +2885,11 @@ export interface ResponseCreateParamsBase {
28692885
* - `message.input_image.image_url`: Include image urls from the input message.
28702886
* - `computer_call_output.output.image_url`: Include image urls from the computer
28712887
* call output.
2888+
* - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
2889+
* tokens in reasoning item outputs. This enables reasoning items to be used in
2890+
* multi-turn conversations when using the Responses API statelessly (like when
2891+
* the `store` parameter is set to `false`, or when an organization is enrolled
2892+
* in the zero data retention program).
28722893
*/
28732894
include?: Array<ResponseIncludable> | null;
28742895

tests/api-resources/images.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ describe('resource images', () => {
5151
const response = await client.images.edit({
5252
image: await toFile(Buffer.from('# my file contents'), 'README.md'),
5353
prompt: 'A cute baby sea otter wearing a beret',
54+
background: 'transparent',
5455
mask: await toFile(Buffer.from('# my file contents'), 'README.md'),
5556
model: 'string',
5657
n: 1,

0 commit comments

Comments
 (0)