Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.22.0"
".": "4.22.1"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 147
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a6dd5f8d7318fb1c5370d5ccb7148bacdfb3f3a665c4b85b7666e6188d9bd909.yml
openapi_spec_hash: c4824e385a81b9021428304ccc96538f
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-46434d15307c0a84fad213c705ba29ab7342f27aa377e302d506a51cb784613b.yml
openapi_spec_hash: 4a64f88af6142d69d6e01dc9207f232a
config_hash: 948733484caf41e71093c6582dbc319c
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 4.22.1 (2026-02-22)

Full Changelog: [v4.22.0...v4.22.1](https://github.com/openai/openai-java/compare/v4.22.0...v4.22.1)

### Documentation

* **api:** add batch size limit to file batch create parameters ([764fd86](https://github.com/openai/openai-java/commit/764fd868ab4d0f9642ae2facb6ca98ef3a491888))
* **api:** clarify safety_identifier max length in chat completions and responses ([b2735b0](https://github.com/openai/openai-java/commit/b2735b002e3591513ea743062e36d6f965f1fd46))

## 4.22.0 (2026-02-19)

Full Changelog: [v4.21.0...v4.22.0](https://github.com/openai/openai-java/compare/v4.21.0...v4.22.0)
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/4.22.0)
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/4.22.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/4.22.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/4.22.1)
[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/4.22.1/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/4.22.1)

<!-- x-release-please-end -->

The OpenAI Java SDK provides convenient access to the [OpenAI REST API](https://platform.openai.com/docs) from applications written in Java.

<!-- x-release-please-start-version -->

The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/4.22.0).
The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/4.22.1).

<!-- x-release-please-end -->

Expand All @@ -24,7 +24,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor
### Gradle

```kotlin
implementation("com.openai:openai-java:4.22.0")
implementation("com.openai:openai-java:4.22.1")
```

### Maven
Expand All @@ -33,7 +33,7 @@ implementation("com.openai:openai-java:4.22.0")
<dependency>
<groupId>com.openai</groupId>
<artifactId>openai-java</artifactId>
<version>4.22.0</version>
<version>4.22.1</version>
</dependency>
```

Expand Down Expand Up @@ -1342,7 +1342,7 @@ If you're using Spring Boot, then you can use the SDK's [Spring Boot starter](ht
#### Gradle

```kotlin
implementation("com.openai:openai-java-spring-boot-starter:4.22.0")
implementation("com.openai:openai-java-spring-boot-starter:4.22.1")
```

#### Maven
Expand All @@ -1351,7 +1351,7 @@ implementation("com.openai:openai-java-spring-boot-starter:4.22.0")
<dependency>
<groupId>com.openai</groupId>
<artifactId>openai-java-spring-boot-starter</artifactId>
<version>4.22.0</version>
<version>4.22.1</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {

allprojects {
group = "com.openai"
version = "4.22.0" // x-release-please-version
version = "4.22.1" // x-release-please-version
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,9 @@ private constructor(

/**
* A stable identifier used to help detect users of your application that may be violating
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We
* recommend hashing their username or email address, in order to avoid sending us any
* identifying information.
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user, with
* a maximum length of 64 characters. We recommend hashing their username or email address, in
* order to avoid sending us any identifying information.
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
Expand Down Expand Up @@ -1484,9 +1484,9 @@ private constructor(

/**
* A stable identifier used to help detect users of your application that may be violating
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user.
* We recommend hashing their username or email address, in order to avoid sending us any
* identifying information.
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user,
* with a maximum length of 64 characters. We recommend hashing their username or email
* address, in order to avoid sending us any identifying information.
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
*/
fun safetyIdentifier(safetyIdentifier: String) = apply {
Expand Down Expand Up @@ -2476,9 +2476,9 @@ private constructor(

/**
* A stable identifier used to help detect users of your application that may be violating
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user.
* We recommend hashing their username or email address, in order to avoid sending us any
* identifying information.
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user,
* with a maximum length of 64 characters. We recommend hashing their username or email
* address, in order to avoid sending us any identifying information.
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
Expand Down Expand Up @@ -3822,8 +3822,9 @@ private constructor(
/**
* A stable identifier used to help detect users of your application that may be
* violating OpenAI's usage policies. The IDs should be a string that uniquely
* identifies each user. We recommend hashing their username or email address, in order
* to avoid sending us any identifying information.
* identifies each user, with a maximum length of 64 characters. We recommend hashing
* their username or email address, in order to avoid sending us any identifying
* information.
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
*/
fun safetyIdentifier(safetyIdentifier: String) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,9 @@ private constructor(

/**
* A stable identifier used to help detect users of your application that may be violating
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We
* recommend hashing their username or email address, in order to avoid sending us any
* identifying information.
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user, with
* a maximum length of 64 characters. We recommend hashing their username or email address, in
* order to avoid sending us any identifying information.
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
Expand Down Expand Up @@ -1671,9 +1671,9 @@ private constructor(

/**
* A stable identifier used to help detect users of your application that may be violating
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user.
* We recommend hashing their username or email address, in order to avoid sending us any
* identifying information.
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user,
* with a maximum length of 64 characters. We recommend hashing their username or email
* address, in order to avoid sending us any identifying information.
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
*/
fun safetyIdentifier(safetyIdentifier: String) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ private constructor(

/**
* A stable identifier used to help detect users of your application that may be violating
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We
* recommend hashing their username or email address, in order to avoid sending us any
* identifying information.
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user, with
* a maximum length of 64 characters. We recommend hashing their username or email address, in
* order to avoid sending us any identifying information.
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
Expand Down Expand Up @@ -1048,9 +1048,9 @@ private constructor(

/**
* A stable identifier used to help detect users of your application that may be violating
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user.
* We recommend hashing their username or email address, in order to avoid sending us any
* identifying information.
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user,
* with a maximum length of 64 characters. We recommend hashing their username or email
* address, in order to avoid sending us any identifying information.
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
*/
fun safetyIdentifier(safetyIdentifier: String) = apply {
Expand Down Expand Up @@ -1964,9 +1964,9 @@ private constructor(

/**
* A stable identifier used to help detect users of your application that may be violating
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user.
* We recommend hashing their username or email address, in order to avoid sending us any
* identifying information.
* OpenAI's usage policies. The IDs should be a string that uniquely identifies each user,
* with a maximum length of 64 characters. We recommend hashing their username or email
* address, in order to avoid sending us any identifying information.
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
Expand Down Expand Up @@ -2881,8 +2881,9 @@ private constructor(
/**
* A stable identifier used to help detect users of your application that may be
* violating OpenAI's usage policies. The IDs should be a string that uniquely
* identifies each user. We recommend hashing their username or email address, in order
* to avoid sending us any identifying information.
* identifies each user, with a maximum length of 64 characters. We recommend hashing
* their username or email address, in order to avoid sending us any identifying
* information.
* [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
*/
fun safetyIdentifier(safetyIdentifier: String) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ private constructor(
/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that the vector
* store should use. Useful for tools like `file_search` that can access files. If `attributes`
* or `chunking_strategy` are provided, they will be applied to all files in the batch. Mutually
* exclusive with `files`.
* or `chunking_strategy` are provided, they will be applied to all files in the batch. The
* maximum batch size is 2000 files. Mutually exclusive with `files`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand All @@ -72,7 +72,7 @@ private constructor(
* A list of objects that each include a `file_id` plus optional `attributes` or
* `chunking_strategy`. Use this when you need to override metadata for specific files. The
* global `attributes` or `chunking_strategy` will be ignored and must be specified for each
* file. Mutually exclusive with `file_ids`.
* file. The maximum batch size is 2000 files. Mutually exclusive with `file_ids`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -228,7 +228,7 @@ private constructor(
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that the
* vector store should use. Useful for tools like `file_search` that can access files. If
* `attributes` or `chunking_strategy` are provided, they will be applied to all files in
* the batch. Mutually exclusive with `files`.
* the batch. The maximum batch size is 2000 files. Mutually exclusive with `files`.
*/
fun fileIds(fileIds: List<String>) = apply { body.fileIds(fileIds) }

Expand All @@ -252,7 +252,7 @@ private constructor(
* A list of objects that each include a `file_id` plus optional `attributes` or
* `chunking_strategy`. Use this when you need to override metadata for specific files. The
* global `attributes` or `chunking_strategy` will be ignored and must be specified for each
* file. Mutually exclusive with `file_ids`.
* file. The maximum batch size is 2000 files. Mutually exclusive with `file_ids`.
*/
fun files(files: List<File>) = apply { body.files(files) }

Expand Down Expand Up @@ -465,7 +465,7 @@ private constructor(
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that the
* vector store should use. Useful for tools like `file_search` that can access files. If
* `attributes` or `chunking_strategy` are provided, they will be applied to all files in
* the batch. Mutually exclusive with `files`.
* the batch. The maximum batch size is 2000 files. Mutually exclusive with `files`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand All @@ -476,7 +476,7 @@ private constructor(
* A list of objects that each include a `file_id` plus optional `attributes` or
* `chunking_strategy`. Use this when you need to override metadata for specific files. The
* global `attributes` or `chunking_strategy` will be ignored and must be specified for each
* file. Mutually exclusive with `file_ids`.
* file. The maximum batch size is 2000 files. Mutually exclusive with `file_ids`.
*
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -623,7 +623,8 @@ private constructor(
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that the
* vector store should use. Useful for tools like `file_search` that can access files.
* If `attributes` or `chunking_strategy` are provided, they will be applied to all
* files in the batch. Mutually exclusive with `files`.
* files in the batch. The maximum batch size is 2000 files. Mutually exclusive with
* `files`.
*/
fun fileIds(fileIds: List<String>) = fileIds(JsonField.of(fileIds))

Expand Down Expand Up @@ -654,7 +655,8 @@ private constructor(
* A list of objects that each include a `file_id` plus optional `attributes` or
* `chunking_strategy`. Use this when you need to override metadata for specific files.
* The global `attributes` or `chunking_strategy` will be ignored and must be specified
* for each file. Mutually exclusive with `file_ids`.
* for each file. The maximum batch size is 2000 files. Mutually exclusive with
* `file_ids`.
*/
fun files(files: List<File>) = files(JsonField.of(files))

Expand Down