SpyBara
Go Premium

Reference 2026-08-03 21:58 UTC to 2026-08-04 00:59 UTC

2 files changed +8 −15. View all changes and history on the product overview
2026
Tue 4 00:59 Mon 3 21:58 Sat 1 01:00

java/index.md +4 −11

Details

1# OpenAI Java API Library1# OpenAI Java API Library

2 2 

3<!-- x-release-please-start-version -->3<!-- These URLs intentionally omit versions and stay outside Release Please markers so they track the latest release. -->

4 4[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java)

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

6[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/4.50.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/4.49.0)

7 

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

9 6 

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

11 8 

12<!-- x-release-please-start-version -->9The 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).

13 

14The 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.50.0).

15 

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

17 10 

18## Installation11## Installation

19 12 

Details

4 4 

5This library provides convenient access to the OpenAI REST API from TypeScript or JavaScript.5This library provides convenient access to the OpenAI REST API from TypeScript or JavaScript.

6 6 

7It is generated from our [OpenAPI specification](https://github.com/openai/openai-openapi) with [Stainless](https://stainlessapi.com/).7It is generated from our [OpenAPI specification](https://github.com/openai/openai-openapi).

8 8 

9To learn how to use the OpenAI API, check out our [API Reference](https://platform.openai.com/docs/api-reference) and [Documentation](https://platform.openai.com/docs).9To learn how to use the OpenAI API, check out our [API Reference](https://platform.openai.com/docs/api-reference) and [Documentation](https://platform.openai.com/docs).

10 10 


724To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy724To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy

725options to requests:725options to requests:

726 726 

727<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>727**Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>

728 728 

729```ts729```ts

730import OpenAI from 'openai';730import OpenAI from 'openai';


741 741 

742Undici-specific options like `dispatcher` must be paired with the matching `fetch` implementation.742Undici-specific options like `dispatcher` must be paired with the matching `fetch` implementation.

743 743 

744<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>744**Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>

745 745 

746```ts746```ts

747import OpenAI from 'openai';747import OpenAI from 'openai';


753});753});

754```754```

755 755 

756<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>756**Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>

757 757 

758```ts758```ts

759import OpenAI from 'npm:openai';759import OpenAI from 'npm:openai';