Skip to content

Commit f348ec8

Browse files
authored
feat(api): Add expiration controls for service account keys (#3825)
## Summary Allow project service accounts to create initial API keys with a configurable lifetime and expose their expiration timestamps. Clarify related API behavior and refresh inline documentation links. ## Changes - Add the optional `expires_in_seconds` parameter to synchronous and asynchronous service account creation and its request type. - Document that key lifetimes may be required or limited by policy and cannot be set with `create_service_account_only`. - Add `expires_at` expiration metadata to project API key and service account creation response types. - Clarify that transcription prompts are unsupported with `gpt-4o-transcribe-diarize`. - Clarify that incoming call webhook SIP headers exclude authorization headers, preserve repetitions and ordering, and must be treated as untrusted metadata. - Point SDK resource and type documentation to the current API guides and references. Co-authored-by: apcha-oai <228803254+apcha-oai@users.noreply.github.com>
1 parent 8011140 commit f348ec8

250 files changed

Lines changed: 2980 additions & 2668 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.castiron.stats.yml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
schema_version: 1
2-
generation_id: c48dfb66-88a5-4465-96d1-0585b9ab8215
3-
openapi_spec_hash: 0ac5ea4ab2546a188a36a0d370367637
4-
openapi_transformed_spec_hash: 6be6c39576ec27111cab26c251d2ab65
5-
config_hash: d92ec885ac2a08b6a4c1ff90420f0327
6-
codegen_sha: 9a9f8502cf7f372b0bc13c052819b78d02991ca5
7-
codegen_hash: 82d1c3235b99cb90187912ae7dd653fba230efd59dbf3c947b6c522a1a801d85
8-
public_codegen_sha: db47bcd202616d35b583b2433270b565be76233a
2+
generation_id: 6df05462-b7ff-42d2-8cda-723d52f989eb
3+
openapi_spec_hash: cc8bc0e9cda20d98cbcab338ff08b50c
4+
openapi_transformed_spec_hash: 2f1cea3510c46bd2b681baf83d8724c5
5+
config_hash: d7b82262337a543ff59106e4a32ead4e
6+
codegen_sha: 5e32d2afdf8428ec5caf80a1700a77e75f8e4e96
7+
codegen_hash: b253f3a3531fcc8accd8fe17b08357fcf075c246bc3bccb82ef95a2d13c5f3da
8+
public_codegen_sha: 2f7f196c41d4252ad343a2b7f8a08572e91680a0

‎api_reference/openapi.transformed.yml‎

Lines changed: 528 additions & 416 deletions
Large diffs are not rendered by default.

‎src/openai/resources/admin/organization/audit_logs.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def list(
237237
238238
event_types: Return only events with a `type` in one of these values. For example,
239239
`project.created`. For all options, see the documentation for the
240-
[audit log object](https://platform.openai.com/docs/api-reference/audit-logs/object).
240+
[audit log object](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/audit_logs).
241241
242242
limit: A limit on the number of objects to be returned. Limit can range between 1 and
243243
100, and the default is 20.
@@ -506,7 +506,7 @@ def list(
506506
507507
event_types: Return only events with a `type` in one of these values. For example,
508508
`project.created`. For all options, see the documentation for the
509-
[audit log object](https://platform.openai.com/docs/api-reference/audit-logs/object).
509+
[audit log object](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/audit_logs).
510510
511511
limit: A limit on the number of objects to be returned. Limit can range between 1 and
512512
100, and the default is 20.

‎src/openai/resources/admin/organization/projects/projects.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,14 @@ def create(
216216
217217
geography: Create the project with the specified data residency region. Your organization
218218
must have access to Data residency functionality in order to use. See
219-
[data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls)
219+
[data residency controls](https://developers.openai.com/api/docs/guides/your-data#data-residency-controls)
220220
to review the functionality and limitations of setting this field. Deprecated:
221221
use `residency` instead. Do not provide both `geography` and `residency`.
222222
223223
residency: Create the project with the specified residency configuration. Your organization
224224
must have access to the requested residency configuration in order to use it.
225225
See
226-
[data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls)
226+
[data residency controls](https://developers.openai.com/api/docs/guides/your-data#data-residency-controls)
227227
to review the functionality and limitations of setting this field.
228228
229229
extra_headers: Send extra headers
@@ -539,14 +539,14 @@ async def create(
539539
540540
geography: Create the project with the specified data residency region. Your organization
541541
must have access to Data residency functionality in order to use. See
542-
[data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls)
542+
[data residency controls](https://developers.openai.com/api/docs/guides/your-data#data-residency-controls)
543543
to review the functionality and limitations of setting this field. Deprecated:
544544
use `residency` instead. Do not provide both `geography` and `residency`.
545545
546546
residency: Create the project with the specified residency configuration. Your organization
547547
must have access to the requested residency configuration in order to use it.
548548
See
549-
[data residency controls](https://platform.openai.com/docs/guides/your-data#data-residency-controls)
549+
[data residency controls](https://developers.openai.com/api/docs/guides/your-data#data-residency-controls)
550550
to review the functionality and limitations of setting this field.
551551
552552
extra_headers: Send extra headers

‎src/openai/resources/admin/organization/projects/service_accounts/service_accounts.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def create(
6565
*,
6666
name: str,
6767
create_service_account_only: Optional[bool] | Omit = omit,
68+
expires_in_seconds: Optional[int] | Omit = omit,
6869
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6970
# The extra values given here take precedence over values defined on the client or passed to this method.
7071
extra_headers: Headers | None = None,
@@ -82,6 +83,12 @@ def create(
8283
8384
create_service_account_only: Create the service account without default roles or an API key.
8485
86+
expires_in_seconds: Number of seconds until the initial API key expires. If omitted or null, the key
87+
does not expire unless the effective organization or project policy requires an
88+
expiration. When a policy sets a maximum lifetime, this value must be provided
89+
and must not exceed that limit. A non-null value cannot be used when
90+
`create_service_account_only` is true.
91+
8592
extra_headers: Send extra headers
8693
8794
extra_query: Add additional query parameters to the request
@@ -98,6 +105,7 @@ def create(
98105
{
99106
"name": name,
100107
"create_service_account_only": create_service_account_only,
108+
"expires_in_seconds": expires_in_seconds,
101109
},
102110
service_account_create_params.ServiceAccountCreateParams,
103111
),
@@ -345,6 +353,7 @@ async def create(
345353
*,
346354
name: str,
347355
create_service_account_only: Optional[bool] | Omit = omit,
356+
expires_in_seconds: Optional[int] | Omit = omit,
348357
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
349358
# The extra values given here take precedence over values defined on the client or passed to this method.
350359
extra_headers: Headers | None = None,
@@ -362,6 +371,12 @@ async def create(
362371
363372
create_service_account_only: Create the service account without default roles or an API key.
364373
374+
expires_in_seconds: Number of seconds until the initial API key expires. If omitted or null, the key
375+
does not expire unless the effective organization or project policy requires an
376+
expiration. When a policy sets a maximum lifetime, this value must be provided
377+
and must not exceed that limit. A non-null value cannot be used when
378+
`create_service_account_only` is true.
379+
365380
extra_headers: Send extra headers
366381
367382
extra_query: Add additional query parameters to the request
@@ -378,6 +393,7 @@ async def create(
378393
{
379394
"name": name,
380395
"create_service_account_only": create_service_account_only,
396+
"expires_in_seconds": expires_in_seconds,
381397
},
382398
service_account_create_params.ServiceAccountCreateParams,
383399
),

‎src/openai/resources/audio/speech.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,16 @@ def create(
7373
input: The text to generate audio for. The maximum length is 4096 characters.
7474
7575
model:
76-
One of the available [TTS models](https://platform.openai.com/docs/models#tts):
76+
One of the available
77+
[TTS models](https://developers.openai.com/api/docs/guides/text-to-speech):
7778
`tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.
7879
7980
voice: The voice to use when generating the audio. Supported built-in voices are
8081
`alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`,
8182
`shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice
8283
object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
8384
voices are available in the
84-
[Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
85+
[Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
8586
8687
instructions: Control the voice of your generated audio with additional instructions. Does not
8788
work with `tts-1` or `tts-1-hd`.
@@ -177,15 +178,16 @@ async def create(
177178
input: The text to generate audio for. The maximum length is 4096 characters.
178179
179180
model:
180-
One of the available [TTS models](https://platform.openai.com/docs/models#tts):
181+
One of the available
182+
[TTS models](https://developers.openai.com/api/docs/guides/text-to-speech):
181183
`tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.
182184
183185
voice: The voice to use when generating the audio. Supported built-in voices are
184186
`alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`,
185187
`shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice
186188
object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
187189
voices are available in the
188-
[Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
190+
[Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
189191
190192
instructions: Control the voice of your generated audio with additional instructions. Does not
191193
work with `tts-1` or `tts-1-hd`.

‎src/openai/resources/audio/transcriptions.py‎

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ def create(
128128
129129
prompt: An optional text to guide the model's style or continue a previous audio
130130
segment. The
131-
[prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
132-
should match the audio language.
131+
[prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting)
132+
should match the audio language. This field is not supported when using
133+
`gpt-4o-transcribe-diarize`.
133134
134135
response_format: The format of the output, in one of these options: `json`, `text`, `srt`,
135136
`verbose_json`, or `vtt`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`,
@@ -139,7 +140,7 @@ def create(
139140
generated using
140141
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
141142
See the
142-
[Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
143+
[Streaming section of the Speech-to-Text guide](https://developers.openai.com/api/docs/guides/speech-to-text?lang=curl#streaming)
143144
for more information.
144145
145146
Note: Streaming is not supported for the `whisper-1` model and will be ignored.
@@ -276,7 +277,7 @@ def create(
276277
generated using
277278
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
278279
See the
279-
[Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
280+
[Streaming section of the Speech-to-Text guide](https://developers.openai.com/api/docs/guides/speech-to-text?lang=curl#streaming)
280281
for more information.
281282
282283
Note: Streaming is not supported for the `whisper-1` model and will be ignored.
@@ -318,7 +319,7 @@ def create(
318319
319320
prompt: An optional text to guide the model's style or continue a previous audio
320321
segment. The
321-
[prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
322+
[prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting)
322323
should match the audio language. This field is not supported when using
323324
`gpt-4o-transcribe-diarize`.
324325
@@ -397,7 +398,7 @@ def create(
397398
generated using
398399
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
399400
See the
400-
[Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
401+
[Streaming section of the Speech-to-Text guide](https://developers.openai.com/api/docs/guides/speech-to-text?lang=curl#streaming)
401402
for more information.
402403
403404
Note: Streaming is not supported for the `whisper-1` model and will be ignored.
@@ -439,7 +440,7 @@ def create(
439440
440441
prompt: An optional text to guide the model's style or continue a previous audio
441442
segment. The
442-
[prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
443+
[prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting)
443444
should match the audio language. This field is not supported when using
444445
`gpt-4o-transcribe-diarize`.
445446
@@ -644,7 +645,7 @@ async def create(
644645
645646
prompt: An optional text to guide the model's style or continue a previous audio
646647
segment. The
647-
[prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
648+
[prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting)
648649
should match the audio language. This field is not supported when using
649650
`gpt-4o-transcribe-diarize`.
650651
@@ -658,7 +659,7 @@ async def create(
658659
generated using
659660
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
660661
See the
661-
[Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
662+
[Streaming section of the Speech-to-Text guide](https://developers.openai.com/api/docs/guides/speech-to-text?lang=curl#streaming)
662663
for more information.
663664
664665
Note: Streaming is not supported for the `whisper-1` model and will be ignored.
@@ -773,7 +774,7 @@ async def create(
773774
generated using
774775
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
775776
See the
776-
[Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
777+
[Streaming section of the Speech-to-Text guide](https://developers.openai.com/api/docs/guides/speech-to-text?lang=curl#streaming)
777778
for more information.
778779
779780
Note: Streaming is not supported for the `whisper-1` model and will be ignored.
@@ -815,7 +816,7 @@ async def create(
815816
816817
prompt: An optional text to guide the model's style or continue a previous audio
817818
segment. The
818-
[prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
819+
[prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting)
819820
should match the audio language. This field is not supported when using
820821
`gpt-4o-transcribe-diarize`.
821822
@@ -894,7 +895,7 @@ async def create(
894895
generated using
895896
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
896897
See the
897-
[Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)
898+
[Streaming section of the Speech-to-Text guide](https://developers.openai.com/api/docs/guides/speech-to-text?lang=curl#streaming)
898899
for more information.
899900
900901
Note: Streaming is not supported for the `whisper-1` model and will be ignored.
@@ -936,7 +937,7 @@ async def create(
936937
937938
prompt: An optional text to guide the model's style or continue a previous audio
938939
segment. The
939-
[prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
940+
[prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting)
940941
should match the audio language. This field is not supported when using
941942
`gpt-4o-transcribe-diarize`.
942943

‎src/openai/resources/audio/translations.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def create(
130130
131131
prompt: An optional text to guide the model's style or continue a previous audio
132132
segment. The
133-
[prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
133+
[prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting)
134134
should be in English.
135135
136136
response_format: The format of the output, in one of these options: `json`, `text`, `srt`,
@@ -282,7 +282,7 @@ async def create(
282282
283283
prompt: An optional text to guide the model's style or continue a previous audio
284284
segment. The
285-
[prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
285+
[prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting)
286286
should be in English.
287287
288288
response_format: The format of the output, in one of these options: `json`, `text`, `srt`,

‎src/openai/resources/batches.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,12 @@ def create(
8484
8585
input_file_id: The ID of an uploaded file that contains requests for the new batch.
8686
87-
See [upload file](https://platform.openai.com/docs/api-reference/files/create)
87+
See
88+
[upload file](https://developers.openai.com/api/reference/resources/files/methods/create)
8889
for how to upload a file.
8990
9091
Your input file must be formatted as a
91-
[JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input),
92+
[JSONL file](https://developers.openai.com/api/docs/guides/batch#1-prepare-your-batch-file),
9293
and must be uploaded with the purpose `batch`. The file can contain up to 50,000
9394
requests, and can be up to 200 MB in size.
9495
@@ -325,11 +326,12 @@ async def create(
325326
326327
input_file_id: The ID of an uploaded file that contains requests for the new batch.
327328
328-
See [upload file](https://platform.openai.com/docs/api-reference/files/create)
329+
See
330+
[upload file](https://developers.openai.com/api/reference/resources/files/methods/create)
329331
for how to upload a file.
330332
331333
Your input file must be formatted as a
332-
[JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input),
334+
[JSONL file](https://developers.openai.com/api/docs/guides/batch#1-prepare-your-batch-file),
333335
and must be uploaded with the purpose `batch`. The file can contain up to 50,000
334336
requests, and can be up to 200 MB in size.
335337

0 commit comments

Comments
 (0)