SpyBara
Go Premium

Documentation 2026-10-05 22:59 UTC to 2026-10-06 22:58 UTC

31 files changed +2,810 −71. View all changes and history on the product overview
2026
Wed 7 13:00 Tue 6 22:58 Mon 5 22:59 Sun 4 22:58 Fri 2 23:58 Thu 1 22:59
Details

760 return {"content": response.output_text}760 return {"content": response.output_text}

761```761```

762 762 

763```go

764func main() {

765 client := openai.NewClient()

766 server := &http.Server{

767 Addr: "127.0.0.1:8000",

768 Handler: newChatHandler(client),

769 ReadHeaderTimeout: 5 * time.Second,

770 }

771 log.Fatal(server.ListenAndServe())

772}

773 

774func newChatHandler(client openai.Client) http.Handler {

775 var mutex sync.Mutex

776 type sessionConversation struct {

777 ready chan struct{}

778 id string

779 err error

780 responseSlot chan struct{}

781 }

782 conversationsBySession := map[string]*sessionConversation{}

783 mux := http.NewServeMux()

784 mux.HandleFunc("POST /messages", func(w http.ResponseWriter, r *http.Request) {

785 var message struct {

786 Content string `json:"content"`

787 SessionID string `json:"session_id"`

788 }

789 if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 1<<20)).Decode(&message); err != nil || strings.TrimSpace(message.Content) == "" || strings.TrimSpace(message.SessionID) == "" {

790 http.Error(w, "content and session_id must be non-empty strings", 400)

791 return

792 }

793 // A demo session map. Bind session IDs to authenticated users in your application.

794 mutex.Lock()

795 session, exists := conversationsBySession[message.SessionID]

796 if !exists {

797 session = &sessionConversation{ready: make(chan struct{}), responseSlot: make(chan struct{}, 1)}

798 conversationsBySession[message.SessionID] = session

799 }

800 mutex.Unlock()

801 if !exists {

802 go func() {

803 // Creation belongs to the shared session, not the first HTTP request.

804 ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)

805 defer cancel()

806 conversation, err := client.Conversations.New(ctx, conversations.ConversationNewParams{})

807 session.err = err

808 if err == nil {

809 session.id = conversation.ID

810 }

811 mutex.Lock()

812 if err != nil {

813 delete(conversationsBySession, message.SessionID)

814 }

815 close(session.ready)

816 mutex.Unlock()

817 }()

818 }

819 select {

820 case <-r.Context().Done():

821 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

822 return

823 case <-session.ready:

824 }

825 if session.err != nil {

826 http.Error(w, "Could not create conversation", http.StatusInternalServerError)

827 return

828 }

829 // Serialize responses within this conversation; waiting requests can cancel.

830 select {

831 case session.responseSlot <- struct{}{}:

832 defer func() { <-session.responseSlot }()

833 case <-r.Context().Done():

834 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

835 return

836 }

837 if r.Context().Err() != nil {

838 http.Error(w, "Request cancelled", http.StatusRequestTimeout)

839 return

840 }

841 // Replace this illustrative stored prompt ID with your prompt.

842 result, err := client.Responses.New(r.Context(), responses.ResponseNewParams{

843 Prompt: responses.ResponsePromptParam{

844 ID: "pmpt_123",

845 },

846 Input: responses.ResponseNewParamsInputUnion{

847 OfString: openai.String(message.Content),

848 },

849 Conversation: responses.ResponseNewParamsConversationUnion{

850 OfString: openai.String(session.id),

851 },

852 })

853 if err != nil || result.Status != responses.ResponseStatusCompleted {

854 http.Error(w, "Could not create response", 500)

855 return

856 }

857 w.Header().Set("Content-Type", "application/json")

858 if err := json.NewEncoder(w).Encode(map[string]string{

859 "content": result.OutputText(),

860 }); err != nil {

861 log.Print(err)

862 }

863 })

864 return mux

865}

866```

867 

763```ruby868```ruby

764# Replace the illustrative IDs and URLs below with your own resource values.869# Replace the illustrative IDs and URLs below with your own resource values.

765require "openai"870require "openai"

Details

22 22 

23### Resolve upload errors23### Resolve upload errors

24 24 

25File checks during session creation or file attachment can return HTTP 429 with

26`files_api_rate_limit_exceeded`. See [Files API rate limits](https://developers.openai.com/api/docs/guides/agents-api/errors#files-api-rate-limits)

27for the response and recovery steps.

28 

25For HTTP 400, use `error.param` and `error.message` to identify the input to correct.29For HTTP 400, use `error.param` and `error.message` to identify the input to correct.

26For example, a destination outside `/workspace` returns:30For example, a destination outside `/workspace` returns:

27 31 

Details

12 12 

13## Configure the sandbox13## Configure the sandbox

14 14 

15Set `environment.type` to `openai_hosted` and add only the settings your workload15Set `environment.type` to `openai_hosted` in your create-session request. Add

16needs. The working directory is `/workspace`.16only the settings your workload needs. The sandbox's working directory is

17`/workspace`.

18 

19Choose the resources and network access your task needs with `container_size`

20and `network`. If you use an environment template, omitted settings inherit the

21template.

22 

23### Prepare packages and files

24 

25Use these settings to make dependencies and inputs available in the sandbox:

17 26 

18- `packages`: Install Python, system, or global `npm` packages with `python`, `system`, or `npm` lists. Pin versions when needed, such as `pandas==2.2.3`.27- `packages`: Install Python, system, or global `npm` packages with `python`, `system`, or `npm` lists. Pin versions when needed, such as `pandas==2.2.3`.

19- `setup_commands`: Run ordered shell commands before the agent starts, such as `[{ "command": "mkdir -p reports" }]`. Each command has its own optional `cwd`, defaulting to `/workspace`.

20- `files`: [Supply input files](https://developers.openai.com/api/docs/guides/agents-api/environments/files#upload-files) by Files API ID or inline base64 content.28- `files`: [Supply input files](https://developers.openai.com/api/docs/guides/agents-api/environments/files#upload-files) by Files API ID or inline base64 content.

21- `env`: Set string-valued environment variables. Agent-generated code can read these values. IMPORTANT: For secrets, use [vault credentials](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults#use-vault-secrets-for-api-requests-from-a-sandbox) to keep the real values outside the sandbox. Runtime-reserved names, including `PATH`, `CODEX_*`, and `OPENAI_API_KEY`, are rejected.

22- `skills`, `plugins`, `capability_directories`: Add [skills](https://developers.openai.com/api/docs/guides/tools-skills#agents-api) and [plugins](https://developers.openai.com/api/docs/guides/agents-api/tools/plugins).

23- `environment_template_id`: [Reuse saved configuration](https://developers.openai.com/api/docs/guides/agents-api/tools/plugins#reuse-a-hosted-plugin-setup) across sessions. Omitted settings inherit the template; network overrides cannot broaden its policy.

24 29 

25Packages and input files are prepared before setup commands run. A nonzero setup30### Run setup commands

26exit status prevents the agent from starting. Use a setup command to check required31 

27dependencies or files. Templates save configuration, not a running workspace.32Use `setup_commands` to run shell commands in order before the agent starts. For

33example, `[{ "command": "mkdir -p reports" }]` creates a directory. Each command

34can set its own `cwd`; the default is `/workspace`.

35 

36Packages and input files are prepared before setup commands run. Use a setup

37command to check required dependencies or files. A nonzero setup exit status

38prevents the agent from starting.

39 

40### Set environment variables

41 

42Use `env` to set string-valued environment variables. Agent-generated code can

43read these values.

44 

45For secrets, use [vault credentials](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults#use-vault-secrets-for-api-requests-from-a-sandbox)

46to keep the real values outside the sandbox. Runtime-reserved names, including

47`PATH`, `CODEX_*`, and `OPENAI_API_KEY`, are rejected.

28 48 

29### Choose a container size49### Choose a container size

30 50 


65destinations need their own entries. Hosted stdio MCP servers currently require85destinations need their own entries. Hosted stdio MCP servers currently require

66`enabled` access; see [stdio MCP requirements](https://developers.openai.com/api/docs/guides/agents-api/tools/mcp#start-a-server-over-stdio).86`enabled` access; see [stdio MCP requirements](https://developers.openai.com/api/docs/guides/agents-api/tools/mcp#start-a-server-over-stdio).

67 87 

88### Add skills and plugins

89 

90Use `skills`, `plugins`, and `capability_directories` to add

91[skills](https://developers.openai.com/api/docs/guides/tools-skills#agents-api) and

92[plugins](https://developers.openai.com/api/docs/guides/agents-api/tools/plugins).

93 

94### Reuse configuration across sessions

95 

96Set `environment_template_id` to [reuse saved configuration](https://developers.openai.com/api/docs/guides/agents-api/tools/plugins#reuse-a-hosted-plugin-setup).

97Omitted settings inherit the template. Network overrides cannot broaden its policy.

98Templates save configuration, not a running workspace.

99 

68### Check that setup succeeded100### Check that setup succeeded

69 101 

70The create-session response means setup has started. Retrieve102The create-session response means setup has started. To check its status, retrieve

71`GET /v1/agents/environments/{environment_id}` using the session's `environment.id`:103`GET /v1/agents/environments/{environment_id}` using the session's `environment.id`.

72`provisioning` means setup is running; `connected` means setup succeeded.104 

73For `failed`, read `environment.error` in the `agent.session.environment.failed`105| Status | What to do |

74event. Wait for `connected` before adding or listing live files.106| -------------- | ------------------------------------------------------------------------- |

107| `provisioning` | Wait while setup runs. |

108| `connected` | Setup succeeded. You can add or list live files. |

109| `failed` | Read `environment.error` in the `agent.session.environment.failed` event. |

110 

111Wait for `connected` before adding or listing live files.

75 112 

76## Files and lifetime113## Files and lifetime

77 114 

Details

40| 409: `conflict_error` | **Cause:** The operation conflicts with the current resource state. <br /> **Solution:** Read the message and retrieve the current state before retrying. |40| 409: `conflict_error` | **Cause:** The operation conflicts with the current resource state. <br /> **Solution:** Read the message and retrieve the current state before retrying. |

41| 409: `executor_version_incompatible` | **Cause:** The executor version isn't supported. <br /> **Solution:** Upgrade the executor, then retry. |41| 409: `executor_version_incompatible` | **Cause:** The executor version isn't supported. <br /> **Solution:** Upgrade the executor, then retry. |

42| 424: `mcp_server_startup_failed` | **Cause:** An MCP server failed to start. <br /> **Solution:** Check the server's configuration and credentials. See [Troubleshoot connections](https://developers.openai.com/api/docs/guides/agents-api/tools/mcp#troubleshoot-connections). |42| 424: `mcp_server_startup_failed` | **Cause:** An MCP server failed to start. <br /> **Solution:** Check the server's configuration and credentials. See [Troubleshoot connections](https://developers.openai.com/api/docs/guides/agents-api/tools/mcp#troubleshoot-connections). |

43| 429: `files_api_rate_limit_exceeded` | **Cause:** File requests exceeded the Files API limit for your user. <br /> **Solution:** Reduce concurrent requests and follow the [Files API rate-limit guidance](#files-api-rate-limits). |

43| 500: `internal_error` | **Cause:** The service encountered an unexpected error. <br /> **Solution:** [Check saved work before retrying](#retry-transient-failures). See the shared [server-error guidance](https://developers.openai.com/api/docs/guides/error-codes#api-errors). |44| 500: `internal_error` | **Cause:** The service encountered an unexpected error. <br /> **Solution:** [Check saved work before retrying](#retry-transient-failures). See the shared [server-error guidance](https://developers.openai.com/api/docs/guides/error-codes#api-errors). |

44| 503: `service_unavailable_error`, `server_is_overloaded` | **Cause:** The service or a dependency is temporarily unavailable or overloaded. <br /> **Solution:** Follow the shared [503 guidance](https://developers.openai.com/api/docs/guides/error-codes#api-errors) and [check saved work before retrying](#retry-transient-failures). |45| 503: `service_unavailable_error`, `server_is_overloaded` | **Cause:** The service or a dependency is temporarily unavailable or overloaded. <br /> **Solution:** Follow the shared [503 guidance](https://developers.openai.com/api/docs/guides/error-codes#api-errors) and [check saved work before retrying](#retry-transient-failures). |

45 46 

47### Files API rate limits

48 

49Session creation and file attachment requests can return HTTP 429 with

50`files_api_rate_limit_exceeded`. The Agents API checks files through the Files API.

51These checks consume the authenticated user's Files API allowance. Each attached file can require its own check.

52 

53```json

54{

55 "error": {

56 "type": "rate_limit_error",

57 "code": "files_api_rate_limit_exceeded",

58 "message": "The Files API rate limit for your user has been exceeded. Reduce the rate of requests that access files, then try again.",

59 "param": null

60 }

61}

62```

63 

64Reduce the number of concurrent requests that access files. Retry with exponential

65backoff and a limit on attempts. Immediate retries can continue to exhaust the

66allowance.

67 

68This HTTP response means the operation failed. It differs from a session or turn

69that fails asynchronously after a successful creation response. Check

70`error.code` to identify this condition instead of matching the message text.

71 

46## Turn errors72## Turn errors

47 73 

48A failed turn has `status: "failed"` and an `error` with a `code` and `message`.74A failed turn has `status: "failed"` and an `error` with a `code` and `message`.

Details

187 187 

188See [Configuring Agents](https://developers.openai.com/api/docs/guides/agents-api/configuration) for reusable agent settings and [Architecture](https://developers.openai.com/api/docs/guides/agents-api/architecture) for environment choices. Sessions with `environment.type: "none"` require initial input. The [Create session reference](https://developers.openai.com/api/reference/resources/beta/subresources/agents/subresources/sessions/methods/create) lists the request fields.188See [Configuring Agents](https://developers.openai.com/api/docs/guides/agents-api/configuration) for reusable agent settings and [Architecture](https://developers.openai.com/api/docs/guides/agents-api/architecture) for environment choices. Sessions with `environment.type: "none"` require initial input. The [Create session reference](https://developers.openai.com/api/reference/resources/beta/subresources/agents/subresources/sessions/methods/create) lists the request fields.

189 189 

190If the session uses Files API attachments, file checks can return HTTP 429 with

191`files_api_rate_limit_exceeded`. See [Files API rate limits](https://developers.openai.com/api/docs/guides/agents-api/errors#files-api-rate-limits)

192for recovery steps.

193 

190### Input size194### Input size

191 195 

192The agent runtime accepts requests up to 4 MiB (4,194,304 bytes). Keep the combined size of your `input` and output schema (`agent.text.format.schema`) below this limit. Leave some space for metadata added by the Agents API. Files uploaded to the environment follow separate [file limits](https://developers.openai.com/api/docs/guides/agents-api/environments/files#file-limits).196The agent runtime accepts requests up to 4 MiB (4,194,304 bytes). Keep the combined size of your `input` and output schema (`agent.text.format.schema`) below this limit. Leave some space for metadata added by the Agents API. Files uploaded to the environment follow separate [file limits](https://developers.openai.com/api/docs/guides/agents-api/environments/files#file-limits).

Details

188 188 

189 See the [chatkit-js repo](https://github.com/openai/chatkit-js) on GitHub.189 See the [chatkit-js repo](https://github.com/openai/chatkit-js) on GitHub.

190 190 

191 chatkit.js191 For Go, run `go get github.com/openai/openai-go/v3@v3.70.0`. For Java, add the Maven dependency `com.openai:openai-java:4.75.1`.

192 

193 Create a ChatKit session token

192 194 

193```javascript195```javascript

194export default async function getChatKitSessionToken(deviceId) {196export default async function getChatKitSessionToken(deviceId) {


226}228}

227```229```

228 230 

231```go

232// Call after authenticating the request. Pass the user's stable ID from your

233// server-side authentication context, never a client-supplied device ID.

234func getChatKitSessionToken(ctx context.Context, client openai.Client, authenticatedUserID string) (string, error) {

235 // Replace this illustrative workflow ID with your published workflow.

236 session, err := client.Beta.ChatKit.Sessions.New(ctx, openai.BetaChatKitSessionNewParams{

237 User: authenticatedUserID,

238 Workflow: openai.ChatSessionWorkflowParam{

239 ID: "wf_68df4b13b3588190a09d19288d4610ec0df388c3983f58d1",

240 },

241 })

242 if err != nil {

243 return "", err

244 }

245 return session.ClientSecret, nil

246}

247```

248 

249```java

250import com.openai.client.OpenAIClient;

251import com.openai.client.okhttp.OpenAIOkHttpClient;

252import com.openai.models.beta.chatkit.sessions.*;

253import com.openai.models.beta.chatkit.threads.ChatSessionWorkflowParam;

254 

255// Call after authenticating the request. Pass the user's stable ID from your

256// server-side authentication context, never a client-supplied device ID.

257static String getChatKitSessionToken(OpenAIClient client, String authenticatedUserId) {

258 // Replace this illustrative workflow ID with your published workflow.

259 return client

260 .beta()

261 .chatkit()

262 .sessions()

263 .create(

264 SessionCreateParams.builder()

265 .user(authenticatedUserId)

266 .workflow(

267 ChatSessionWorkflowParam.builder()

268 .id("wf_68df4b13b3588190a09d19288d4610ec0df388c3983f58d1")

269 .build())

270 .build())

271 .clientSecret();

272}

273```

274 

229 275 

2303. In your project directory, install the ChatKit React bindings:2763. In your project directory, install the ChatKit React bindings:

231 277 

Details

392 return clean_text392 return clean_text

393```393```

394 394 

395```go

396// Start and End are UTF-8 byte offsets, suitable for Go string slicing.

397type Citation struct {

398 Raw, Family string

399 SourceIDs []string

400 Locator string

401 Start, End int

402}

403 

404var sourceID = regexp.MustCompile(`^[A-Za-z0-9_-]+$`)

405var lineLocator = regexp.MustCompile(`^L\d+(?:-L\d+)?$`)

406 

407func extractCitations(text string, families []string) []Citation {

408 citations := []Citation{}

409 if len(families) == 0 {

410 return citations

411 }

412 escaped := make([]string, len(families))

413 for i, family := range families {

414 escaped[i] = regexp.QuoteMeta(family)

415 }

416 token := regexp.MustCompile("(?s)\uE200(" + strings.Join(escaped, "|") + ")\uE202(.*?)\uE201")

417 for _, match := range token.FindAllStringSubmatchIndex(text, -1) {

418 parts := []string{}

419 for _, part := range strings.Split(text[match[4]:match[5]], "\uE202") {

420 if part = strings.TrimSpace(part); part != "" {

421 parts = append(parts, part)

422 }

423 }

424 locator := ""

425 if len(parts) > 0 && lineLocator.MatchString(parts[len(parts)-1]) {

426 locator = parts[len(parts)-1]

427 parts = parts[:len(parts)-1]

428 }

429 valid := len(parts) > 0

430 for _, part := range parts {

431 if !sourceID.MatchString(part) {

432 valid = false

433 break

434 }

435 }

436 if valid {

437 citations = append(citations, Citation{

438 text[match[0]:match[1]],

439 text[match[2]:match[3]],

440 parts,

441 locator,

442 match[0],

443 match[1],

444 })

445 }

446 }

447 return citations

448}

449func stripCitations(text string, citations []Citation) string {

450 sorted := append([]Citation(nil), citations...)

451 sort.Slice(sorted, func(i, j int) bool {

452 return sorted[i].Start > sorted[j].Start

453 })

454 for _, citation := range sorted {

455 text = text[:citation.Start] + text[citation.End:]

456 }

457 return text

458}

459```

460 

461```java

462import java.util.*;

463import java.util.regex.Pattern;

464 

465// Java string offsets are UTF-16 code units, matching substring().

466record Citation(

467 String raw, String family, List<String> sourceIds, String locator, int start, int end) {}

468 

469static final Pattern SOURCE_ID = Pattern.compile("^[A-Za-z0-9_-]+$");

470static final Pattern LINE_LOCATOR = Pattern.compile("^L\\d+(?:-L\\d+)?$");

471 

472static List<Citation> extractCitations(String text, List<String> families) {

473 var citations = new ArrayList<Citation>();

474 if (families.isEmpty()) return citations;

475 var familyPattern =

476 families.stream().map(Pattern::quote).collect(java.util.stream.Collectors.joining("|"));

477 var matcher =

478 Pattern.compile("\uE200(" + familyPattern + ")\uE202(.*?)\uE201", Pattern.DOTALL)

479 .matcher(text);

480 while (matcher.find()) {

481 var parts =

482 new ArrayList<>(

483 Arrays.stream(matcher.group(2).split("\uE202"))

484 .map(String::strip)

485 .filter(s -> !s.isEmpty())

486 .toList());

487 String locator = null;

488 if (!parts.isEmpty() && LINE_LOCATOR.matcher(parts.get(parts.size() - 1)).matches())

489 locator = parts.remove(parts.size() - 1);

490 if (parts.isEmpty() || parts.stream().anyMatch(s -> !SOURCE_ID.matcher(s).matches()))

491 continue;

492 citations.add(

493 new Citation(

494 matcher.group(),

495 matcher.group(1),

496 List.copyOf(parts),

497 locator,

498 matcher.start(),

499 matcher.end()));

500 }

501 return citations;

502}

503 

504static String stripCitations(String text, List<Citation> citations) {

505 var sorted = new ArrayList<>(citations);

506 sorted.sort(Comparator.comparingInt(Citation::start).reversed());

507 for (var citation : sorted)

508 text = text.substring(0, citation.start()) + text.substring(citation.end());

509 return text;

510}

511```

512 

395```ruby513```ruby

396CITATION_START = "\u{E200}"514CITATION_START = "\u{E200}"

397CITATION_DELIMITER = "\u{E202}"515CITATION_DELIMITER = "\u{E202}"

Details

19| Mainline model with Daybreak Blue | `gpt-6-sol` | `daybreak_blue` | Approved defensive security work with a specific mainline model. |19| Mainline model with Daybreak Blue | `gpt-6-sol` | `daybreak_blue` | Approved defensive security work with a specific mainline model. |

20| GPT-6.1 Sol or GPT-6 Astra with Daybreak | `gpt-6.1-sol` or `gpt-6-astra` | `daybreak_blue` | Reduced refusals with either model. Requires Daybreak Red approval for your organization and access enabled for your project. |20| GPT-6.1 Sol or GPT-6 Astra with Daybreak | `gpt-6.1-sol` or `gpt-6-astra` | `daybreak_blue` | Reduced refusals with either model. Requires Daybreak Red approval for your organization and access enabled for your project. |

21| Cyber model with Daybreak Red | `gpt-5.6-cyber` | `daybreak_red` | Advanced, authorized security work with a specific cyber model. Requires Daybreak Red approval. |21| Cyber model with Daybreak Red | `gpt-5.6-cyber` | `daybreak_red` | Advanced, authorized security work with a specific cyber model. Requires Daybreak Red approval. |

22| Daybreak Blue alias | `gpt-daybreak-blue-latest` | `daybreak_blue` | Approved defensive security work that follows updates to the Blue alias's underlying model. |

23| Daybreak Red alias | `gpt-daybreak-red-latest` | `daybreak_red` | Advanced, authorized security work that follows updates to the Red alias's underlying model. Requires Daybreak Red approval. |

24 22 

25 23 

26 24 

27 25 

28Match the request value to the model, not your organization's approval level. For example, when using `gpt-6-sol` with Daybreak, send `daybreak_blue` even if your organization has Daybreak Red approval. Sending `daybreak_red` with this model returns `invalid_access_program`.26Match the request value to the model, not your organization's approval level. For example, when using `gpt-6-sol` with Daybreak, send `daybreak_blue` even if your organization has Daybreak Red approval. Sending `daybreak_red` with this model returns `invalid_access_program`.

29 27 

30Daybreak aliases accept only their matching program. For example, requesting `gpt-daybreak-blue-latest` with `daybreak_red` returns an error.

31 

32Reduced refusals on `gpt-6-astra` and `gpt-6.1-sol` require Daybreak Red28Reduced refusals on `gpt-6-astra` and `gpt-6.1-sol` require Daybreak Red

33 access, but the request value is `daybreak_blue`. Both models reject29 access, but the request value is `daybreak_blue`. Both models reject

34 `daybreak_red`. Daybreak Blue approval alone doesn't authorize reduced30 `daybreak_red`. Daybreak Blue approval alone doesn't authorize reduced


37 33 

38## Send a request34## Send a request

39 35 

40To get started with Daybreak Blue approval, explicitly select `daybreak_blue` with the `gpt-daybreak-blue-latest` alias:36To get started with Daybreak Blue approval, explicitly select `daybreak_blue` with a Daybreak-eligible model, such as `gpt-6-sol`:

41 37 

42```bash38```bash

43curl https://api.openai.com/v1/responses \39curl https://api.openai.com/v1/responses \

44 -H "Authorization: Bearer $OPENAI_API_KEY" \40 -H "Authorization: Bearer $OPENAI_API_KEY" \

45 -H "Content-Type: application/json" \41 -H "Content-Type: application/json" \

46 -d '{42 -d '{

47 "model": "gpt-daybreak-blue-latest",43 "model": "gpt-6-sol",

48 "input": "Explain how to validate a security patch in a test environment.",44 "input": "Explain how to validate a security patch in a test environment.",

49 "access_programs": {45 "access_programs": {

50 "cyber": "daybreak_blue"46 "cyber": "daybreak_blue"


76If you omit `access_programs.cyber`, the API selects a compatible program based on the model and your organization and project access:72If you omit `access_programs.cyber`, the API selects a compatible program based on the model and your organization and project access:

77 73 

78- **Mainline models such as `gpt-6-sol`:** Daybreak Blue treatment when your organization and project have the required access; otherwise, standard safeguards.74- **Mainline models such as `gpt-6-sol`:** Daybreak Blue treatment when your organization and project have the required access; otherwise, standard safeguards.

79- **Daybreak aliases and Red models:** The matching Daybreak program. For example, `gpt-daybreak-blue-latest` selects `daybreak_blue`. The request fails if the required access is missing.75- **Red models such as `gpt-5.6-cyber`:** The API selects `daybreak_red`. The request fails if the required access is missing.

80- **`gpt-6-astra` and `gpt-6.1-sol`:** Reduced refusals for eligible callers with Daybreak Red access enabled for their project; otherwise, standard safeguards.76- **`gpt-6-astra` and `gpt-6.1-sol`:** Reduced refusals for eligible callers with Daybreak Red access enabled for their project; otherwise, standard safeguards.

81 77 

82Model permissions still apply. To explicitly request standard safeguards on a compatible model, send `standard`. An explicit Daybreak selection fails if it's incompatible with the model or you don't have the required access.78Model permissions still apply. To explicitly request standard safeguards on a compatible model, send `standard`. An explicit Daybreak selection fails if it's incompatible with the model or you don't have the required access.

guides/decisions.md +214 −0 created

Details

1# Decisions

2 

3> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.

4 

5The Decisions API evaluates text, images, or both and returns typed answers about 10x faster than the Responses API. Get the probability that a condition is true, a choice from a fixed set, or a score against a rubric. Use those answers to classify content, route requests, and prioritize work in your application.

6 

7Try the Decisions API in the [Playground](https://platform.openai.com/decisions) to experiment with questions and inputs before writing code.

8 

9The Decisions API is in public beta, and we expect to GA in the coming weeks.

10 `gpt-6-luna` is the only model currently available. Use the dedicated `POST

11 /v1/decisions` endpoint.

12 

13## How decisions work

14 

15A request has three parts:

16 

17| Field | Purpose |

18| ----------- | -------------------------------------------------------------------------------------------------------- |

19| `model` | The model that evaluates the request. Currently, only `gpt-6-luna` is supported. |

20| `input` | Shared evidence for the questions: a text string or user messages containing text and images. |

21| `questions` | What to evaluate, including each question's type, instructions, and any allowed choices or score levels. |

22 

23The response contains an `answers` array. Give each question a unique `name` to identify its answer; the API echoes that name in the response.

24 

25### Choose a question type

26 

27| Type | Use it to | Main result |

28| ----------- | --------------------------------------------------------------- | ------------------------------------------------------------------ |

29| `predicate` | Check a condition, such as visible damage or passage relevance. | `probability`: an estimate from 0 to 1 that the condition is true. |

30| `choice` | Select one option, such as a department or content category. | `choice`: one of your supplied values. |

31| `score` | Rate an input against ordered levels, such as issue severity. | `score`: the probability-weighted average of the level indices. |

32 

33Both `choice` and `score` return probabilities over discrete options. Use `choice` for categories without an order, such as departments. Use `score` for ordered levels, such as severity; it takes the probability-weighted average of their numeric indices to produce a score that can fall between levels.

34 

35Use Decisions when your application needs one of these answer types. Use [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs) with the Responses API when you need to generate an object that follows your own JSON schema, such as extracted fields or a written explanation, or [function calling](https://developers.openai.com/api/docs/guides/function-calling) when you need a model to request a tool call with arguments.

36 

37## Check an image for visible damage

38 

39Use a `predicate` question to check a product photo for visible damage. This request combines the image with instructions to look for a crack, tear, or dent.

40 

41 

42 

43```bash

44IMAGE_BASE64="$(base64 < product.png | tr -d '\r\n')"

45 

46curl https://api.openai.com/v1/decisions \

47 -H "Authorization: Bearer $OPENAI_API_KEY" \

48 -H "Content-Type: application/json" \

49 --data-binary @- <<JSON

50{

51 "model": "gpt-6-luna",

52 "input": [{

53 "role": "user",

54 "content": [

55 {"type": "input_text", "text": "Inspect the product in this photo."},

56 {"type": "input_image", "image_url": "data:image/png;base64,$IMAGE_BASE64"}

57 ]

58 }],

59 "questions": [{

60 "type": "predicate",

61 "name": "visible_damage",

62 "instructions": "Does the product have visible damage, such as a crack, tear, or dent? Ignore shadows and damage to the packaging."

63 }]

64}

65JSON

66```

67 

68An illustrative response excerpt:

69 

70```json

71{

72 "answers": [

73 {

74 "type": "predicate",

75 "name": "visible_damage",

76 "probability": 0.92

77 }

78 ]

79}

80```

81 

82The `probability` is the model's estimate that the condition is true. Use it to flag photos for review based on a threshold you choose.

83 

84Images must be inline base64 data URLs. Hosted HTTP or HTTPS image URLs and `file_id` inputs aren't supported by this endpoint. Combine `input_text` and `input_image` parts in a user message to evaluate images together with instructions or other context.

85 

86## Select from fixed options

87 

88A `choice` question selects one value from the options you provide. Use distinct values and descriptions that explain when each option applies.

89 

90 

91 

92This request routes a customer complaint:

93 

94```bash

95curl https://api.openai.com/v1/decisions \

96 -H "Authorization: Bearer $OPENAI_API_KEY" \

97 -H "Content-Type: application/json" \

98 -d '{

99 "model": "gpt-6-luna",

100 "input": "I was charged twice for my order.",

101 "questions": [{

102 "type": "choice",

103 "name": "department",

104 "instructions": "Which department should handle this complaint?",

105 "choices": [

106 {"value": "billing", "description": "Payments, invoices, and refunds."},

107 {"value": "technical", "description": "Problems using the product."},

108 {"value": "shipping", "description": "Delivery and tracking."},

109 {"value": "other", "description": "Requests outside these categories."}

110 ]

111 }]

112 }'

113```

114 

115An illustrative response excerpt:

116 

117```json

118{

119 "answers": [

120 {

121 "type": "choice",

122 "name": "department",

123 "choice": "billing",

124 "probabilities": [

125 { "value": "billing", "probability": 0.95 },

126 { "value": "technical", "probability": 0.02 },

127 { "value": "shipping", "probability": 0.01 },

128 { "value": "other", "probability": 0.02 }

129 ],

130 "confidence": 0.93

131 }

132 ]

133}

134```

135 

136The answer's `choice` field contains a supplied value, here `"billing"`. It also includes a `probabilities` array for the options and a `confidence` field. See [Interpret the answers](#interpret-the-answers) for guidance on setting thresholds.

137 

138Include a fallback option such as `"other"` when your categories don't cover every possible input. Your application can send that result to a general review queue.

139 

140## Score against a rubric

141 

142A `score` question evaluates an input against ordered `levels`. Define the criteria for each level and arrange them from lowest to highest.

143 

144 

145 

146```bash

147curl https://api.openai.com/v1/decisions \

148 -H "Authorization: Bearer $OPENAI_API_KEY" \

149 -H "Content-Type: application/json" \

150 -d '{

151 "model": "gpt-6-luna",

152 "input": "Export fails in Safari but works in Chrome.",

153 "questions": [{

154 "type": "score",

155 "name": "severity",

156 "instructions": "How severe is this issue?",

157 "levels": [

158 {"label": "Cosmetic", "description": "Appearance only; no lost functionality."},

159 {"label": "Workaround available", "description": "A task fails, but another way works."},

160 {"label": "Fully blocked", "description": "A task fails with no workaround."}

161 ]

162 }]

163 }'

164```

165 

166An illustrative response excerpt:

167 

168```json

169{

170 "answers": [

171 {

172 "type": "score",

173 "name": "severity",

174 "score": 1.1,

175 "probabilities": [

176 { "value": 0, "label": "Cosmetic", "probability": 0.1 },

177 { "value": 1, "label": "Workaround available", "probability": 0.7 },

178 { "value": 2, "label": "Fully blocked", "probability": 0.2 }

179 ],

180 "confidence": 0.55

181 }

182 ]

183}

184```

185 

186Level indices start at 0. Here, 0 means cosmetic, 1 means a workaround is available, and 2 means fully blocked. The returned `score` is a probability-weighted average, so it can fall between levels. In this example, probabilities of 0.1, 0.7, and 0.2 produce a score of 1.1.

187 

188The answer also includes `confidence` and the per-level `probabilities`. The score summarizes the distribution across levels. Use `choice` to select a single category.

189 

190## Ask multiple questions

191 

192Put independent questions in the same `questions` array to evaluate shared input. For a product photo, you could check for damage and classify the product category in one request. Each question can use a different type.

193 

194For decisions that depend on an earlier answer, send separate requests. For example, check for damage first, then use the result to decide whether to request a repair category.

195 

196Write questions around observable criteria. Separate different concerns into different questions, give choices distinct meanings, and define score levels so that adjacent levels have distinct criteria.

197 

198## Interpret the answers

199 

200Predicates return the estimated probability that a condition is true. Choice and score answers return a probability distribution and a separate `confidence` field.

201 

202Use labeled examples from your application to set thresholds for routing, filtering, or review. Choose thresholds based on the cost of false positives and false negatives.

203 

204## Pricing and availability

205 

206With `gpt-6-luna`, input costs **$0.10 per 1M tokens**. You pay only for input tokens: there are no cache-read, cache-write, or output-token charges.

207 

208Regional processing premiums and long-context input pricing multipliers apply. These rates apply to `/v1/decisions`; other requests using `gpt-6-luna` follow the applicable [model and processing-tier pricing](https://developers.openai.com/api/docs/pricing).

209 

210The Decisions API supports Zero Data Retention (ZDR) and HIPAA use for eligible customers. Data residency and regional processing are supported in the United States and Europe (EEA + Switzerland). See [data controls](https://developers.openai.com/api/docs/guides/your-data) for eligibility requirements, required agreements, and limitations.

211 

212## Add voice control

213 

214Use [client delegation with the Live API](https://developers.openai.com/api/docs/guides/decisions-voice) to choose actions from voice requests and report their results to the user.

guides/decisions-voice.md +134 −0 created

Details

1# Connect voice to Decisions

2 

3> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.

4 

5Use the [Live API](https://developers.openai.com/api/docs/guides/live) for voice conversations and the [Decisions API](https://developers.openai.com/api/docs/guides/decisions) to select actions from spoken requests. With [client delegation](https://developers.openai.com/api/docs/guides/live-delegation?delegation-mode=client#configure-client-delegation), GPT-Live continues speaking and listening while your app calls Decisions, runs the selected action, and returns the result.

6 

7## Control a browser by voice

8 

9This example shows how to add voice controls to a browser.

10 

11When a user says “Reload this page,” send the conversation and current browser state to Decisions with three choices: `back`, `reload`, and `noop`. Decisions selects `reload`. Your app reloads the page, updates its state, and tells GPT-Live what happened.

12 

13 

14 

15> Illustration: GPT-Live handles the voice conversation while the app sends transcripts and browser state to Decisions. Decisions selects reload. The app reloads the page, updates its state, and returns the result to GPT-Live.

16 

17 

18 

19### Connect a voice session

20 

21Create a [Live session](https://developers.openai.com/api/docs/guides/voice-webrtc?api=live#connect-a-browser-to-gpt-live) with `delegation: { type: "client" }` and tell GPT-Live which actions your app supports. When you receive [`session.delegation.created`](https://developers.openai.com/api/docs/guides/live-delegation?delegation-mode=client#receive-a-client-delegation), save `event.delegation.id` and start the Decisions request. Use this ID to return the result to GPT-Live.

22 

23### Build the Decisions prompt

24 

25Track the current app state and collect user and assistant transcripts from [`session.input_transcript.delta` and `session.output_transcript.delta`](https://developers.openai.com/api/docs/guides/live-delegation?delegation-mode=client#keep-the-conversation-context-in-your-application).

26 

27Combine those transcripts with the user's latest request and current app state:

28 

29```text

30User conversation:

31user: Which page is open?

32assistant: The documentation page.

33 

34Last user request:

35Reload this page.

36 

37Current state:

38Active tab: Documentation. Page loaded.

39Available actions: back, reload, noop.

40```

41 

42### Select and run an action

43 

44Send the prompt and available choices to the Decisions API from your server. Keep `OPENAI_API_KEY` on the server:

45 

46```bash

47curl https://api.openai.com/v1/decisions \

48 -H "Authorization: Bearer $OPENAI_API_KEY" \

49 -H "Content-Type: application/json" \

50 -d '{

51 "model": "gpt-6-luna",

52 "input": "User conversation:\nuser: Which page is open?\nassistant: The documentation page.\n\nLast user request:\nReload this page.\n\nCurrent state:\nActive tab: Documentation. Page loaded.\nAvailable actions: back, reload, noop.",

53 "questions": [{

54 "type": "choice",

55 "name": "browser_action",

56 "instructions": "Choose the requested, currently available action. Choose noop if no action fits.",

57 "choices": [

58 {"value": "back", "description": "Go back one page."},

59 {"value": "reload", "description": "Reload the current page."},

60 {"value": "noop", "description": "Take no action."}

61 ]

62 }]

63 }'

64```

65 

66Find the answer named `browser_action` in the response’s `answers` array and read its `choice`. Run the matching action: `reload` reloads the current page, `back` goes back one page, and `noop` does nothing. Skip the action if the request was canceled or it no longer fits the current app state.

67 

68### Return the result to GPT-Live

69 

70Update your app state with the current page, load status, and whether the action succeeded. Use this state in the next Decisions prompt.

71 

72Send the result to GPT-Live with [`session.commentary.append`](https://developers.openai.com/api/docs/guides/live-delegation#send-the-right-kind-of-update) and the saved delegation ID. This prompts GPT-Live to tell the user what happened. For a successful reload, send:

73 

74```json

75{

76 "type": "session.commentary.append",

77 "delegation_id": "<event.delegation.id>",

78 "content": "The documentation page reloaded successfully and is ready."

79}

80```

81 

82Use `session.thinking.append` to update GPT-Live’s context without prompting it to speak. Keep each append within 500 tokens.

83 

84## Route complex requests to a reasoning model

85 

86Use Decisions to select a supported action or route a more complex request to a reasoning model. In a slide presenter, “Go to the next slide” maps to `next_slide`, while “Compare these two plans and recommend one” maps to `reason`.

87 

88Include the conversation and current state in `input`, then send the request to `POST /v1/decisions`:

89 

90```json

91{

92 "model": "gpt-6-luna",

93 "input": "User: Compare these two plans and recommend one. Current state: slide 3 of 10 is open and both plans are available.",

94 "questions": [

95 {

96 "type": "choice",

97 "name": "route",

98 "instructions": "Choose a matching slide action that is available in the current state. Otherwise, choose reason.",

99 "choices": [

100 {

101 "value": "next_slide",

102 "description": "Go to the next slide."

103 },

104 {

105 "value": "previous_slide",

106 "description": "Go to the previous slide."

107 },

108 {

109 "value": "first_slide",

110 "description": "Go to the first slide."

111 },

112 {

113 "value": "reason",

114 "description": "Use a reasoning model for analysis, planning, or other requests."

115 }

116 ]

117 }

118 ]

119}

120```

121 

122Read the `route` answer's `choice`. For a slide action, validate it against the current state and run the matching handler. For `reason`, call the [Responses API with a reasoning model](https://developers.openai.com/api/docs/guides/reasoning#get-started-with-reasoning), passing the original request and relevant context, such as the plans' contents.

123 

124Keep the session in client-delegation mode for both routes. Your app manages continuation and cancellation and returns the result with the same delegation ID.

125 

126## Other uses

127 

128Use the same workflow with choices and state from your application:

129 

130- **Slide navigation:** Offer `next`, `previous`, `start`, and `end` based on the current slide.

131- **UI actions:** Map choices such as `click_search` to element IDs from the current UI state. Check that the element is still available before acting.

132- **Voice-guided games:** Use the spoken goal and current game state to choose an available button. Repeat until the app confirms success or the user cancels, and send progress updates to GPT-Live.

133- **Robot gestures:** Map requests such as “Wave hello” to `nod`, `shake_head`, or `wave`, then send the selected gesture to the robot controller.

134- **Media controls:** Offer `play`, `pause`, and `next_track` based on the player’s current state.

Details

1800The JavaScript sample uses `npm install openai@^7.10.0 ws`.1800The JavaScript sample uses `npm install openai@^7.10.0 ws`.

1801The Ruby sample uses `gem install openai async-websocket`.1801The Ruby sample uses `gem install openai async-websocket`.

1802 1802 

1803For Go, run `go get github.com/openai/openai-go/v3@v3.70.0`.

1804For Java, add the Maven dependency `com.openai:openai-java:4.75.1`.

1805These Go and Java SDK versions provide native Responses WebSocket support.

1806 

1803Start a Responses API WebSocket session1807Start a Responses API WebSocket session

1804 1808 

1805```javascript1809```javascript


1879 print(first_event.type)1883 print(first_event.type)

1880```1884```

1881 1885 

1886```go

1887tools := []responses.ToolUnionParam{}

1888for _, name := range []string{

1889 "search_test_logs",

1890 "search_code",

1891} {

1892 tools = append(tools, responses.ToolUnionParam{

1893 OfFunction: &responses.FunctionToolParam{

1894 Name: name,

1895 Description: openai.String("Search for a query."),

1896 Parameters: map[string]any{

1897 "type": "object",

1898 "properties": map[string]any{

1899 "query": map[string]any{

1900 "type": "string",

1901 },

1902 },

1903 "required": []string{

1904 "query",

1905 },

1906 "additionalProperties": false,

1907 },

1908 Strict: openai.Bool(true),

1909 },

1910 })

1911}

1912ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)

1913defer cancel()

1914client := openai.NewClient()

1915conn, err := client.Responses.Connect(ctx, responses.ResponseConnectionOptions{})

1916if err != nil {

1917 log.Fatal(err)

1918}

1919defer conn.Close()

1920if err := conn.Create(ctx, responses.ResponsesClientEventResponseCreateParam{

1921 Model: "gpt-6-astra",

1922 Store: openai.Bool(false),

1923 Input: responses.ResponsesClientEventResponseCreateInputUnionParam{

1924 OfString: openai.String("Find the flaky test in this run, call the tools you need, and keep going until you can explain the root cause."),

1925 },

1926 Tools: tools,

1927}); err != nil {

1928 log.Fatal(err)

1929}

1930response, err := conn.FinalResponse(ctx)

1931if err != nil {

1932 log.Fatal(err)

1933}

1934if response.Status != responses.ResponseStatusCompleted {

1935 log.Fatalf("Response ended with status %s", response.Status)

1936}

1937output := make([]json.RawMessage, 0, len(response.Output))

1938for _, item := range response.Output {

1939 output = append(output, json.RawMessage(item.RawJSON()))

1940}

1941if err := json.NewEncoder(os.Stdout).Encode(output); err != nil {

1942 log.Fatal(err)

1943}

1944```

1945 

1946```java

1947import com.openai.client.okhttp.OpenAIOkHttpClient;

1948import com.openai.core.JsonValue;

1949import com.openai.models.responses.*;

1950import java.util.*;

1951 

1952var tools = new ArrayList<Tool>();

1953for (var name : List.of("search_test_logs", "search_code"))

1954 tools.add(

1955 Tool.ofFunction(

1956 FunctionTool.builder()

1957 .name(name)

1958 .description("Search for a query.")

1959 .strict(true)

1960 .parameters(

1961 FunctionTool.Parameters.builder()

1962 .putAdditionalProperty("type", JsonValue.from("object"))

1963 .putAdditionalProperty(

1964 "properties",

1965 JsonValue.from(Map.of("query", Map.of("type", "string"))))

1966 .putAdditionalProperty("required", JsonValue.from(List.of("query")))

1967 .putAdditionalProperty("additionalProperties", JsonValue.from(false))

1968 .build())

1969 .build()));

1970 

1971try (var conn = client.responses().connect()) {

1972 conn.send(

1973 ResponsesClientEvent.ofResponseCreate(

1974 ResponsesClientEvent.ResponseCreate.builder()

1975 .model("gpt-6-astra")

1976 .store(false)

1977 .input(

1978 "Find the flaky test in this run, call the tools you need, and keep going until you can explain the root cause.")

1979 .tools(tools)

1980 .build()));

1981 var response = conn.finalResponse();

1982 if (response.status().filter(ResponseStatus.COMPLETED::equals).isEmpty())

1983 throw new IllegalStateException(

1984 "Response ended with status " + response.status().orElse(null));

1985 System.out.println(response.output());

1986}

1987```

1988 

1882```ruby1989```ruby

1883require "async"1990require "async"

1884require "openai"1991require "openai"

guides/evals.md +107 −0

Details

282print(eval_obj)282print(eval_obj)

283```283```

284 284 

285```java

286import com.openai.client.okhttp.OpenAIOkHttpClient;

287import com.openai.core.JsonValue;

288import com.openai.models.evals.EvalCreateParams;

289import com.openai.models.graders.gradermodels.StringCheckGrader;

290import java.util.List;

291import java.util.Map;

292 

293var eval =

294 client

295 .evals()

296 .create(

297 EvalCreateParams.builder()

298 .name("IT Ticket Categorization")

299 .dataSourceConfig(

300 EvalCreateParams.DataSourceConfig.Custom.builder()

301 .itemSchema(

302 EvalCreateParams.DataSourceConfig.Custom.ItemSchema.builder()

303 .additionalProperties(

304 Map.of(

305 "type", JsonValue.from("object"),

306 "properties",

307 JsonValue.from(

308 Map.of(

309 "ticket_text",

310 Map.of("type", "string"),

311 "correct_label",

312 Map.of("type", "string"))),

313 "required",

314 JsonValue.from(

315 List.of("ticket_text", "correct_label"))))

316 .build())

317 .includeSampleSchema(true)

318 .build())

319 .addTestingCriterion(

320 StringCheckGrader.builder()

321 .name("Match output to human label")

322 .input("{{ sample.output_text }}")

323 .operation(StringCheckGrader.Operation.EQ)

324 .reference("{{ item.correct_label }}")

325 .build())

326 .build());

327System.out.println(eval);

328```

329 

285```ruby330```ruby

286require "openai"331require "openai"

287 332 


617print(run)662print(run)

618```663```

619 664 

665```java

666import com.openai.client.okhttp.OpenAIOkHttpClient;

667import com.openai.models.evals.runs.*;

668 

669// Replace these illustrative IDs with your eval and uploaded dataset file.

670var run =

671 client

672 .evals()

673 .runs()

674 .create(

675 RunCreateParams.builder()

676 .evalId("YOUR_EVAL_ID")

677 .name("Categorization text run")

678 .dataSource(

679 RunCreateParams.DataSource.CreateEvalResponsesRunDataSource.builder()

680 .type(

681 RunCreateParams.DataSource.CreateEvalResponsesRunDataSource.Type

682 .RESPONSES)

683 .model("gpt-6-astra")

684 .inputMessages(

685 RunCreateParams.DataSource.CreateEvalResponsesRunDataSource

686 .InputMessages.Template.builder()

687 .addTemplate(

688 RunCreateParams.DataSource.CreateEvalResponsesRunDataSource

689 .InputMessages.Template.InnerTemplate.ChatMessage

690 .builder()

691 .role("developer")

692 .content(

693 "You are an expert in categorizing IT support tickets. Given the support ticket below, categorize the request into one of 'Hardware', 'Software', or 'Other'. Respond with only one of those words.")

694 .build())

695 .addTemplate(

696 RunCreateParams.DataSource.CreateEvalResponsesRunDataSource

697 .InputMessages.Template.InnerTemplate.ChatMessage

698 .builder()

699 .role("user")

700 .content("{{ item.ticket_text }}")

701 .build())

702 .build())

703 .source(

704 RunCreateParams.DataSource.CreateEvalResponsesRunDataSource.Source

705 .FileId.builder()

706 .id("YOUR_FILE_ID")

707 .build())

708 .build())

709 .build());

710System.out.println(run);

711```

712 

620```ruby713```ruby

621require "openai"714require "openai"

622 715 


758print(run)851print(run)

759```852```

760 853 

854```java

855import com.openai.client.okhttp.OpenAIOkHttpClient;

856import com.openai.models.evals.runs.RunRetrieveParams;

857 

858// Replace these illustrative IDs with your eval and run.

859var run =

860 client

861 .evals()

862 .runs()

863 .retrieve(

864 RunRetrieveParams.builder().evalId("YOUR_EVAL_ID").runId("YOUR_RUN_ID").build());

865System.out.println(run);

866```

867 

761```ruby868```ruby

762require "openai"869require "openai"

763 870 

Details

17 17 

18In order to use third-party models, the following must be true:18In order to use third-party models, the following must be true:

19 19 

20- Your OpenAI organization must be in [usage tier 1](https://developers.openai.com/api/docs/guides/rate-limits#usage-tiers) or higher.20- Your OpenAI organization must be in [Build](https://developers.openai.com/api/docs/guides/rate-limits#usage-tiers) or higher.

21- An admin for your OpenAI organization must enable this feature via [Settings > Organization > General](https://platform.openai.com/settings/organization/general). To enable this feature, the admin must accept the usage disclaimer shown.21- An admin for your OpenAI organization must enable this feature via [Settings > Organization > General](https://platform.openai.com/settings/organization/general). To enable this feature, the admin must accept the usage disclaimer shown.

22 22 

23Calls made to external models pass data to third parties and are subject to23Calls made to external models pass data to third parties and are subject to


29 29 

30| Usage tier | Monthly spend limit (USD) |30| Usage tier | Monthly spend limit (USD) |

31| ---------- | ------------------------- |31| ---------- | ------------------------- |

32| Tier 1 | $5 |32| Build | $25 |

33| Tier 2 | $25 |33| Launch | $100 |

34| Tier 3 | $50 |34| Grow | $200 |

35| Tier 4 | $100 |

36| Tier 5 | $200 |

37 35 

38We serve these models via our partner, OpenRouter. In the future, third-party models will be charged as part of your regular OpenAI billing cycle, at [OpenRouter list prices](https://openrouter.ai/models).36We serve these models via our partner, OpenRouter. In the future, third-party models will be charged as part of your regular OpenAI billing cycle, at [OpenRouter list prices](https://openrouter.ai/models).

39 37 

Details

605 return input_cost605 return input_cost

606```606```

607 607 

608```go

609func calculateInputCost(usage responses.ResponseUsage, pricePerMillion, cacheInputMultiplier, cacheWriteMultiplier float64) float64 {

610 ordinary := usage.InputTokens - usage.InputTokensDetails.CachedTokens - usage.InputTokensDetails.CacheWriteTokens

611 weighted := float64(ordinary) + float64(usage.InputTokensDetails.CachedTokens)*cacheInputMultiplier + float64(usage.InputTokensDetails.CacheWriteTokens)*cacheWriteMultiplier

612 return weighted * pricePerMillion / 1_000_000

613}

614```

615 

616```java

617import com.openai.models.responses.ResponseUsage;

618 

619static double calculateInputCost(

620 ResponseUsage usage,

621 double pricePerMillion,

622 double cacheInputMultiplier,

623 double cacheWriteMultiplier) {

624 long cached = usage.inputTokensDetails().cachedTokens();

625 long written = usage.inputTokensDetails().cacheWriteTokens();

626 long ordinary = usage.inputTokens() - cached - written;

627 return (ordinary + cached * cacheInputMultiplier + written * cacheWriteMultiplier)

628 * pricePerMillion

629 / 1_000_000;

630}

631```

632 

608```ruby633```ruby

609def calculate_input_cost(634def calculate_input_cost(

610 usage,635 usage,

Details

35 35 

36## Usage tiers36## Usage tiers

37 37 

38You can view the rate and usage limits for your organization under the [limits](https://platform.openai.com/settings/organization/limits) section of your account settings. As your spend on our API goes up, we automatically graduate you to the next usage tier. This usually results in an increase in rate limits across most models.38The three paid usage tiers are **Build**, **Launch**, and **Grow**. Your organization's usage tier upgrades automatically as its total credit purchases reach each threshold. Higher tiers generally provide higher rate limits across models.

39 39 

40| Tier | Qualification | Usage limits |40| Tier | Qualification | Usage limits |

41| ----------- | --------------------------------------------------------------------- | ---------------- |41| ------ | --------------------------------------------------------------------- | ---------------- |

42| Free | User must be in an [allowed geography](https://developers.openai.com/api/docs/supported-countries) | $100 / month |42| Free | User must be in an [allowed geography](https://developers.openai.com/api/docs/supported-countries) | $100 / month |

43| Tier&nbsp;1 | $5 paid | $100 / month |43| Build | $5 in total credit purchases | $500 / month |

44| Tier&nbsp;2 | $50 paid | $500 / month |44| Launch | $100 in total credit purchases | $5,000 / month |

45| Tier&nbsp;3 | $100 paid | $1,000 / month |45| Grow | $500 in total credit purchases | $200,000 / month |

46| Tier&nbsp;4 | $250 paid | $5,000 / month |46 

47| Tier&nbsp;5 | $1,000 paid | $200,000 / month |47### Standard rate limits

48 48 

49To view a high-level summary of rate limits per model, visit the [models page](https://developers.openai.com/api/docs/models).49To view the limits for each model at your usage tier, go to [Settings > Organization > Limits](https://platform.openai.com/settings/organization/limits) and review **Rate limits**. To upgrade your usage tier, select **Upgrade tier** in the **Usage Tiers** section.

50 

51These Standard rate limits differ from [Ultrafast rate limits](https://developers.openai.com/api/docs/guides/ultrafast-mode#availability).

52 

53<table className="[&_th]:border-b [&_th]:border-[var(--tw-prose-th-borders)] [&_th]:py-3 [&_th]:pl-0 [&_th]:pr-4 [&_th]:text-left [&_td]:border-b [&_td]:border-[var(--tw-prose-td-borders)] [&_td]:py-2 [&_td]:pl-0 [&_td]:pr-4 [&_td]:text-left [&_td]:align-top">

54 <thead>

55 <tr>

56 <th scope="col">Tier</th>

57 <th scope="col">Model</th>

58 <th scope="col">RPM</th>

59 <th scope="col">TPM</th>

60 </tr>

61 </thead>

62 <tbody>

63 <tr>

64 <td rowSpan="2">Build</td>

65 <td>Astra, Sol, Terra</td>

66 <td>5,000</td>

67 <td>1,000,000</td>

68 </tr>

69 <tr>

70 <td>Luna</td>

71 <td>5,000</td>

72 <td>2,000,000</td>

73 </tr>

74 <tr>

75 <td rowSpan="2">Launch</td>

76 <td>Astra, Sol, Terra</td>

77 <td>10,000</td>

78 <td>4,000,000</td>

79 </tr>

80 <tr>

81 <td>Luna</td>

82 <td>10,000</td>

83 <td>10,000,000</td>

84 </tr>

85 <tr>

86 <td rowSpan="2">Grow</td>

87 <td>Astra, Sol, Terra</td>

88 <td>15,000</td>

89 <td>40,000,000</td>

90 </tr>

91 <tr>

92 <td>Luna</td>

93 <td>30,000</td>

94 <td>180,000,000</td>

95 </tr>

96 </tbody>

97</table>

50 98 

51### Spend limits99### Spend limits

52 100 

Details

120ws.send(json.dumps(event))120ws.send(json.dumps(event))

121```121```

122 122 

123```java

124import com.openai.client.okhttp.OkHttpClient;

125import com.openai.core.ClientOptions;

126import com.openai.core.JsonValue;

127import com.openai.helpers.RealtimeConnection;

128import com.openai.helpers.RealtimeWebSocketOptions;

129import com.openai.models.realtime.*;

130 

131// Replace pmpt_123 with your stored prompt ID.

132var pcm =

133 RealtimeAudioFormats.AudioPcm.builder()

134 .rate(RealtimeAudioFormats.AudioPcm.Rate._24000)

135 .build();

136connection.send(

137 RealtimeClientEvent.ofSessionUpdate(

138 SessionUpdateEvent.builder()

139 .session(

140 RealtimeSessionCreateRequest.builder()

141 .model("gpt-realtime-2.1")

142 .addOutputModality(RealtimeSessionCreateRequest.OutputModality.AUDIO)

143 .audio(

144 RealtimeAudioConfig.builder()

145 .input(

146 RealtimeAudioConfigInput.builder()

147 .format(pcm)

148 .turnDetection(

149 RealtimeAudioInputTurnDetection.SemanticVad.builder()

150 .build())

151 .build())

152 .output(

153 RealtimeAudioConfigOutput.builder()

154 .format(pcm)

155 .voice("marin")

156 .build())

157 .build())

158 .prompt(

159 com.openai.models.responses.ResponsePrompt.builder()

160 .id("pmpt_123")

161 .version("89")

162 .variables(

163 com.openai.models.responses.ResponsePrompt.Variables.builder()

164 .putAdditionalProperty("city", JsonValue.from("Paris"))

165 .build())

166 .build())

167 .instructions(

168 "Speak clearly and briefly. Confirm understanding before taking actions.")

169 .build())

170 .build()));

171```

172 

123```ruby173```ruby

124# Replace the illustrative IDs and URLs below with your own resource values.174# Replace the illustrative IDs and URLs below with your own resource values.

125connection.session.update(175connection.session.update(


216ws.send(json.dumps(event))266ws.send(json.dumps(event))

217```267```

218 268 

269```java

270import com.openai.client.okhttp.OkHttpClient;

271import com.openai.core.ClientOptions;

272import com.openai.helpers.RealtimeConnection;

273import com.openai.helpers.RealtimeWebSocketOptions;

274import com.openai.models.realtime.*;

275 

276connection.send(

277 RealtimeClientEvent.ofConversationItemCreate(

278 ConversationItemCreateEvent.builder()

279 .item(

280 RealtimeConversationItemUserMessage.builder()

281 .addContent(

282 RealtimeConversationItemUserMessage.Content.builder()

283 .type(RealtimeConversationItemUserMessage.Content.Type.INPUT_TEXT)

284 .text("What Prince album sold the most copies?")

285 .build())

286 .build())

287 .build()));

288```

289 

290```csharp

291using OpenAI.Realtime;

292 

293#pragma warning disable OPENAI002

294 

295RealtimeMessageItem item = RealtimeItem.CreateUserMessageItem("What Prince album sold the most copies?");

296item.Id = Guid.NewGuid().ToString("N");

297await session.SendCommandAsync(new RealtimeClientCommandConversationItemCreate(item), timeout.Token);

298```

299 

219```ruby300```ruby

220connection.conversation.items.create(301connection.conversation.items.create(

221 type: :message,302 type: :message,


251ws.send(json.dumps(event))332ws.send(json.dumps(event))

252```333```

253 334 

335```java

336import com.openai.client.okhttp.OkHttpClient;

337import com.openai.core.ClientOptions;

338import com.openai.helpers.RealtimeConnection;

339import com.openai.helpers.RealtimeWebSocketOptions;

340import com.openai.models.realtime.*;

341 

342connection.send(

343 RealtimeClientEvent.ofResponseCreate(

344 ResponseCreateEvent.builder()

345 .response(

346 RealtimeResponseCreateParams.builder()

347 .addOutputModality(RealtimeResponseCreateParams.OutputModality.TEXT)

348 .build())

349 .build()));

350```

351 

352```csharp

353using OpenAI.Realtime;

354 

355#pragma warning disable OPENAI002

356 

357await session.SendCommandAsync(new RealtimeClientCommandResponseCreate

358{

359 ResponseOptions = new()

360 {

361 OutputModalities =

362 {

363 RealtimeOutputModality.Text

364 }

365 }

366}, timeout.Token);

367```

368 

254```ruby369```ruby

255connection.response.create(370connection.response.create(

256 output_modalities: [:text],371 output_modalities: [:text],


286 print(server_event["response"]["output"][0])401 print(server_event["response"]["output"][0])

287```402```

288 403 

404```java

405import com.openai.client.okhttp.OkHttpClient;

406import com.openai.core.ClientOptions;

407import com.openai.helpers.RealtimeConnection;

408import com.openai.helpers.RealtimeWebSocketOptions;

409import com.openai.models.realtime.*;

410 

411static void handleEvent(RealtimeServerEvent event) {

412 event

413 .responseDone()

414 .ifPresent(

415 done -> {

416 if (!done.response()

417 .status()

418 .filter(RealtimeResponse.Status.COMPLETED::equals)

419 .isPresent())

420 throw new IllegalStateException(

421 "Response ended with status "

422 + done.response().status()

423 + ": "

424 + done.response().statusDetails());

425 System.out.println(done.response().output());

426 });

427}

428```

429 

430```csharp

431using OpenAI.Realtime;

432 

433#pragma warning disable OPENAI002

434 

435internal static void HandleEvent(RealtimeServerUpdate update)

436{

437 if (update is RealtimeServerUpdateResponseDone completion && completion.Response.Status != RealtimeResponseStatus.Completed)

438 throw new InvalidOperationException($"Response ended with status {completion.Response.Status}: {System.ClientModel.Primitives.ModelReaderWriter.Write(completion.Response)}");

439 if (update is RealtimeServerUpdateResponseDone done)

440 {

441 foreach (RealtimeItem item in done.Response.OutputItems)

442 Console.WriteLine(System.ClientModel.Primitives.ModelReaderWriter.Write(item));

443 }

444}

445```

446 

289```ruby447```ruby

290connection.each do |event|448connection.each do |event|

291 next unless event.is_a?(OpenAI::Realtime::ResponseDoneEvent)449 next unless event.is_a?(OpenAI::Realtime::ResponseDoneEvent)


616 ws.send(json.dumps(event))774 ws.send(json.dumps(event))

617```775```

618 776 

777```java

778import com.openai.client.okhttp.OkHttpClient;

779import com.openai.core.ClientOptions;

780import com.openai.helpers.RealtimeConnection;

781import com.openai.helpers.RealtimeWebSocketOptions;

782import com.openai.models.realtime.*;

783import java.util.Base64;

784 

785// Call for each PCM16, 24 kHz, mono chunk supplied by your audio source.

786static void appendAudio(RealtimeConnection connection, byte[] pcmAudio) throws Exception {

787 String base64Audio = Base64.getEncoder().encodeToString(pcmAudio);

788 send(

789 connection,

790 RealtimeClientEvent.ofInputAudioBufferAppend(

791 InputAudioBufferAppendEvent.builder().audio(base64Audio).build()));

792}

793 

794// Retry only explicit admission rejections; these guarantee nothing was sent.

795private static void send(RealtimeConnection connection, RealtimeClientEvent event)

796 throws Exception {

797 long deadline = System.nanoTime() + java.util.concurrent.TimeUnit.SECONDS.toNanos(5);

798 while (true) {

799 try {

800 connection.send(event);

801 return;

802 } catch (com.openai.core.http.WebSocketWriteNotAttempted.Busy busy) {

803 if (System.nanoTime() >= deadline) throw busy;

804 Thread.sleep(10);

805 }

806 }

807}

808```

809 

810```csharp

811using OpenAI.Realtime;

812 

813#pragma warning disable OPENAI002

814 

815// Call for each PCM16, 24 kHz, mono chunk supplied by your audio source.

816internal static async Task AppendAudioAsync(RealtimeSessionClient session, BinaryData pcmAudio, CancellationToken cancellationToken)

817{

818 await session.SendCommandAsync(new RealtimeClientCommandInputAudioBufferAppend(pcmAudio), cancellationToken);

819}

820```

821 

619```ruby822```ruby

620File.open("speech.pcm", "rb") do |audio|823File.open("speech.pcm", "rb") do |audio|

621 while (chunk = audio.read(9_600))824 while (chunk = audio.read(9_600))


672ws.send(json.dumps(event))875ws.send(json.dumps(event))

673```876```

674 877 

878```java

879import com.openai.client.okhttp.OkHttpClient;

880import com.openai.core.ClientOptions;

881import com.openai.helpers.RealtimeConnection;

882import com.openai.helpers.RealtimeWebSocketOptions;

883import com.openai.models.realtime.*;

884import java.util.Base64;

885 

886// Pass the complete PCM16, 24 kHz, mono recording from your application.

887static void sendAudioItem(RealtimeConnection connection, byte[] pcmAudio) throws Exception {

888 String fullAudio = Base64.getEncoder().encodeToString(pcmAudio);

889 connection.send(

890 RealtimeClientEvent.ofConversationItemCreate(

891 ConversationItemCreateEvent.builder()

892 .item(

893 RealtimeConversationItemUserMessage.builder()

894 .addContent(

895 RealtimeConversationItemUserMessage.Content.builder()

896 .type(RealtimeConversationItemUserMessage.Content.Type.INPUT_AUDIO)

897 .audio(fullAudio)

898 .build())

899 .build())

900 .build()));

901}

902```

903 

904```csharp

905using OpenAI.Realtime;

906 

907#pragma warning disable OPENAI002

908 

909// Pass the complete PCM16, 24 kHz, mono recording from your application.

910internal static async Task<string> SendAudioItemAsync(RealtimeSessionClient session, BinaryData pcmAudio, CancellationToken cancellationToken)

911{

912 RealtimeMessageItem item = RealtimeItem.CreateUserMessageItem([new RealtimeInputAudioMessageContentPart(pcmAudio)]);

913 string itemId = Guid.NewGuid().ToString("N");

914 item.Id = itemId;

915 await session.SendCommandAsync(new RealtimeClientCommandConversationItemCreate(item), cancellationToken);

916 return itemId;

917}

918```

919 

675```ruby920```ruby

676audio = Base64.strict_encode64(File.binread("speech.pcm"))921audio = Base64.strict_encode64(File.binread("speech.pcm"))

677 922 


724 print(server_event["delta"])969 print(server_event["delta"])

725```970```

726 971 

972```java

973import com.openai.client.okhttp.OkHttpClient;

974import com.openai.core.ClientOptions;

975import com.openai.helpers.RealtimeConnection;

976import com.openai.helpers.RealtimeWebSocketOptions;

977import com.openai.models.realtime.*;

978 

979static void handleEvent(RealtimeServerEvent event) {

980 event.responseOutputAudioDelta().ifPresent(delta -> System.out.println(delta.delta()));

981}

982```

983 

984```csharp

985using OpenAI.Realtime;

986 

987#pragma warning disable OPENAI002

988 

989internal static void HandleEvent(RealtimeServerUpdate update)

990{

991 if (update is RealtimeServerUpdateResponseOutputAudioDelta delta)

992 Console.WriteLine(Convert.ToBase64String(delta.Delta.ToArray()));

993}

994```

995 

727```ruby996```ruby

728connection.each do |event|997connection.each do |event|

729 case event998 case event


866ws.send(json.dumps(event))1135ws.send(json.dumps(event))

867```1136```

868 1137 

1138```java

1139import com.openai.client.okhttp.OkHttpClient;

1140import com.openai.core.ClientOptions;

1141import com.openai.core.JsonValue;

1142import com.openai.helpers.RealtimeConnection;

1143import com.openai.helpers.RealtimeWebSocketOptions;

1144import com.openai.models.realtime.*;

1145 

1146connection.send(

1147 RealtimeClientEvent.ofResponseCreate(

1148 ResponseCreateEvent.builder()

1149 .response(

1150 RealtimeResponseCreateParams.builder()

1151 .conversation("none")

1152 .metadata(

1153 RealtimeResponseCreateParams.Metadata.builder()

1154 .putAdditionalProperty("topic", JsonValue.from("classification"))

1155 .build())

1156 .addOutputModality(RealtimeResponseCreateParams.OutputModality.TEXT)

1157 .instructions(

1158 "Analyze the conversation so far. If it is related to support, output \"support\". If it is related to sales, output \"sales\".")

1159 .build())

1160 .build()));

1161```

1162 

1163```csharp

1164using OpenAI.Realtime;

1165 

1166#pragma warning disable OPENAI002

1167 

1168await session.SendCommandAsync(new RealtimeClientCommandResponseCreate

1169{

1170 ResponseOptions = new()

1171 {

1172 DefaultConversationConfiguration = RealtimeResponseDefaultConversationConfiguration.None,

1173 Metadata = new Dictionary<string, BinaryData>

1174 {

1175 ["topic"] = BinaryData.FromObjectAsJson("classification")

1176 },

1177 OutputModalities =

1178 {

1179 RealtimeOutputModality.Text

1180 },

1181 Instructions = "Analyze the conversation so far. If it is related to support, output \"support\". If it is related to sales, output \"sales\"."

1182 }

1183}, timeout.Token);

1184```

1185 

869```ruby1186```ruby

870connection.response.create(1187connection.response.create(

871 conversation: :none,1188 conversation: :none,


916 print(server_event["response"]["output"][0])1233 print(server_event["response"]["output"][0])

917```1234```

918 1235 

1236```java

1237import com.openai.client.okhttp.OkHttpClient;

1238import com.openai.core.ClientOptions;

1239import com.openai.core.JsonValue;

1240import com.openai.helpers.RealtimeConnection;

1241import com.openai.helpers.RealtimeWebSocketOptions;

1242import com.openai.models.realtime.*;

1243 

1244static boolean handleEvent(RealtimeServerEvent event) {

1245 if (event.responseDone().isEmpty()) return false;

1246 var response = event.responseDone().orElseThrow().response();

1247 if (!response

1248 .metadata()

1249 .map(m -> m._additionalProperties().get("topic"))

1250 .flatMap(JsonValue::asString)

1251 .filter("classification"::equals)

1252 .isPresent()) return false;

1253 if (!response.status().filter(RealtimeResponse.Status.COMPLETED::equals).isPresent())

1254 throw new IllegalStateException(

1255 "Response ended with status " + response.status() + ": " + response.statusDetails());

1256 System.out.println(response.output());

1257 return true;

1258}

1259```

1260 

1261```csharp

1262using OpenAI.Realtime;

1263 

1264#pragma warning disable OPENAI002

1265 

1266internal static bool HandleEvent(RealtimeServerUpdate update)

1267{

1268 if (update is not RealtimeServerUpdateResponseDone done ||

1269 !done.Response.Metadata.TryGetValue("topic", out BinaryData? topic) ||

1270 topic.ToObjectFromJson<string>() != "classification")

1271 return false;

1272 if (done.Response.Status != RealtimeResponseStatus.Completed)

1273 throw new InvalidOperationException($"Response ended with status {done.Response.Status}: {System.ClientModel.Primitives.ModelReaderWriter.Write(done.Response)}");

1274 foreach (RealtimeItem item in done.Response.OutputItems)

1275 Console.WriteLine(System.ClientModel.Primitives.ModelReaderWriter.Write(item));

1276 return true;

1277}

1278```

1279 

919```ruby1280```ruby

920connection.each do |event|1281connection.each do |event|

921 next unless event.is_a?(OpenAI::Realtime::ResponseDoneEvent)1282 next unless event.is_a?(OpenAI::Realtime::ResponseDoneEvent)


1074ws.send(json.dumps(event))1435ws.send(json.dumps(event))

1075```1436```

1076 1437 

1438```java

1439import com.openai.client.okhttp.OkHttpClient;

1440import com.openai.core.ClientOptions;

1441import com.openai.helpers.RealtimeConnection;

1442import com.openai.helpers.RealtimeWebSocketOptions;

1443import com.openai.models.realtime.*;

1444import java.util.List;

1445 

1446connection.send(

1447 RealtimeClientEvent.ofResponseCreate(

1448 ResponseCreateEvent.builder()

1449 .response(

1450 RealtimeResponseCreateParams.builder()

1451 .input(List.of())

1452 .instructions(

1453 "Say exactly the following: I'm a little teapot, short and stout! This is my handle, this is my spout!")

1454 .build())

1455 .build()));

1456```

1457 

1458```csharp

1459using OpenAI.Realtime;

1460 

1461#pragma warning disable OPENAI002

1462 

1463RealtimeResponseOptions options = new()

1464 

1465{

1466 Instructions = "Say exactly the following: I'm a little teapot, short and stout! This is my handle, this is my spout!"

1467 

1468};

1469options.InputItems.Clear();

1470// An explicitly empty list excludes conversation context.

1471await session.SendCommandAsync(new RealtimeClientCommandResponseCreate

1472{

1473 ResponseOptions = options

1474}, timeout.Token);

1475```

1476 

1077```ruby1477```ruby

1078connection.response.create(1478connection.response.create(

1079 input: [],1479 input: [],

Details

85ws.send(json.dumps(event))85ws.send(json.dumps(event))

86```86```

87 87 

88```java

89import com.openai.client.okhttp.OkHttpClient;

90import com.openai.core.ClientOptions;

91import com.openai.core.JsonValue;

92import com.openai.helpers.RealtimeConnection;

93import com.openai.helpers.RealtimeWebSocketOptions;

94import com.openai.models.realtime.*;

95import java.util.List;

96import java.util.Map;

97 

98connection.send(

99 RealtimeClientEvent.ofSessionUpdate(

100 SessionUpdateEvent.builder()

101 .session(

102 RealtimeSessionCreateRequest.builder()

103 .model("gpt-realtime-2.1")

104 .addTool(

105 RealtimeFunctionTool.builder()

106 .type(RealtimeFunctionTool.Type.FUNCTION)

107 .name("lookup_order")

108 .description("Look up an order by its order number.")

109 .parameters(

110 JsonValue.from(

111 Map.of(

112 "type",

113 "object",

114 "properties",

115 Map.of(

116 "order_number",

117 Map.of(

118 "type",

119 "string",

120 "description",

121 "The customer-facing order number.")),

122 "required",

123 List.of("order_number"))))

124 .build())

125 .toolChoice(com.openai.models.responses.ToolChoiceOptions.AUTO)

126 .build())

127 .build()));

128```

129 

130```csharp

131using OpenAI.Realtime;

132 

133#pragma warning disable OPENAI002

134 

135await session.SendCommandAsync(new RealtimeClientCommandSessionUpdate(new RealtimeConversationSessionOptions

136{

137 Model = "gpt-realtime-2.1",

138 Tools =

139 {

140 new RealtimeFunctionTool("lookup_order")

141 {

142 FunctionDescription = "Look up an order by its order number.",

143 FunctionParameters = BinaryData.FromObjectAsJson(new { type = "object", properties = new { order_number = new { type = "string", description = "The customer-facing order number." } }, required = (string[])["order_number"] })

144 }

145 },

146 ToolChoice = RealtimeDefaultToolChoice.Auto

147}), timeout.Token);

148```

149 

88```ruby150```ruby

89connection.session.update(151connection.session.update(

90 type: :realtime,152 type: :realtime,


151ws.send(json.dumps({"type": "response.create"}))213ws.send(json.dumps({"type": "response.create"}))

152```214```

153 215 

216```java

217import com.openai.client.okhttp.OkHttpClient;

218import com.openai.core.ClientOptions;

219import com.openai.core.JsonValue;

220import com.openai.helpers.RealtimeConnection;

221import com.openai.helpers.RealtimeWebSocketOptions;

222import com.openai.models.realtime.*;

223import com.openai.models.responses.ToolChoiceFunction;

224import com.openai.models.responses.ToolChoiceOptions;

225import java.util.Map;

226 

227static void sendFunctionCallOutput(RealtimeConnection connection, String callId)

228 throws Exception {

229 send(

230 connection,

231 RealtimeClientEvent.ofConversationItemCreate(

232 ConversationItemCreateEvent.builder()

233 .item(

234 RealtimeConversationItemFunctionCallOutput.builder()

235 .callId(callId)

236 .output("{\"status\":\"shipped\",\"delivery_date\":\"2026-05-09\"}")

237 .build())

238 .build()));

239 send(

240 connection,

241 RealtimeClientEvent.ofResponseCreate(

242 ResponseCreateEvent.builder()

243 .response(

244 RealtimeResponseCreateParams.builder()

245 .metadata(

246 RealtimeResponseCreateParams.Metadata.builder()

247 .putAdditionalProperty(

248 "topic", JsonValue.from("lookup_order_followup"))

249 .build())

250 .toolChoice(ToolChoiceOptions.NONE)

251 .build())

252 .build()));

253}

254 

255// Retry only explicit admission rejections; these guarantee nothing was sent.

256private static void send(RealtimeConnection connection, RealtimeClientEvent event)

257 throws Exception {

258 long deadline = System.nanoTime() + java.util.concurrent.TimeUnit.SECONDS.toNanos(5);

259 while (true) {

260 try {

261 connection.send(event);

262 return;

263 } catch (com.openai.core.http.WebSocketWriteNotAttempted.Busy busy) {

264 if (System.nanoTime() >= deadline) throw busy;

265 Thread.sleep(10);

266 }

267 }

268}

269```

270 

271```csharp

272using OpenAI.Realtime;

273 

274#pragma warning disable OPENAI002

275 

276internal static async Task SendFunctionCallOutputAsync(RealtimeSessionClient session, string callId, CancellationToken cancellationToken)

277{

278 string output = System.Text.Json.JsonSerializer.Serialize(new { status = "shipped", delivery_date = "2026-05-09" });

279 await session.SendCommandAsync(new RealtimeClientCommandConversationItemCreate(new RealtimeFunctionCallOutputItem(callId, output)), cancellationToken);

280 await session.SendCommandAsync(new RealtimeClientCommandResponseCreate

281 {

282 ResponseOptions = new()

283 {

284 Metadata = new Dictionary<string, BinaryData> { ["topic"] = BinaryData.FromObjectAsJson("lookup_order_followup") },

285 ToolChoice = RealtimeDefaultToolChoice.None

286 }

287 }, cancellationToken);

288}

289```

290 

154```ruby291```ruby

155connection.conversation.items.create(292connection.conversation.items.create(

156 type: :function_call_output,293 type: :function_call_output,


225ws.send(json.dumps(event))362ws.send(json.dumps(event))

226```363```

227 364 

365```java

366import com.openai.client.okhttp.OkHttpClient;

367import com.openai.core.ClientOptions;

368import com.openai.helpers.RealtimeConnection;

369import com.openai.helpers.RealtimeWebSocketOptions;

370import com.openai.models.realtime.*;

371import java.util.List;

372 

373connection.send(

374 RealtimeClientEvent.ofSessionUpdate(

375 SessionUpdateEvent.builder()

376 .session(

377 RealtimeSessionCreateRequest.builder()

378 .model("gpt-realtime-2.1")

379 .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT)

380 .addTool(

381 RealtimeToolsConfigUnion.Mcp.builder()

382 .serverLabel("openai_docs")

383 .serverUrl("https://developers.openai.com/mcp")

384 .allowedToolsOfMcp(

385 List.of("search_openai_docs", "fetch_openai_doc"))

386 .requireApproval(

387 RealtimeToolsConfigUnion.Mcp.RequireApproval

388 .McpToolApprovalSetting.NEVER)

389 .build())

390 .build())

391 .build()));

392```

393 

394```csharp

395using OpenAI.Realtime;

396 

397#pragma warning disable OPENAI002

398 

399await session.SendCommandAsync(new RealtimeClientCommandSessionUpdate(new RealtimeConversationSessionOptions

400{

401 Model = "gpt-realtime-2.1",

402 OutputModalities =

403 {

404 RealtimeOutputModality.Text

405 },

406 Tools =

407 {

408 new RealtimeMcpTool("openai_docs", new Uri("https://developers.openai.com/mcp"))

409 {

410 AllowedTools = new()

411 {

412 ToolNames =

413 {

414 "search_openai_docs",

415 "fetch_openai_doc"

416 }

417 },

418 ToolCallApprovalPolicy = RealtimeDefaultMcpToolCallApprovalPolicy.NeverRequireApproval

419 }

420 }

421}), timeout.Token);

422```

423 

228```ruby424```ruby

229connection.session.update(425connection.session.update(

230 type: :realtime,426 type: :realtime,


311ws.send(json.dumps(event))507ws.send(json.dumps(event))

312```508```

313 509 

510```java

511import com.openai.client.okhttp.OkHttpClient;

512import com.openai.core.ClientOptions;

513import com.openai.helpers.RealtimeConnection;

514import com.openai.helpers.RealtimeWebSocketOptions;

515import com.openai.models.realtime.*;

516import java.util.List;

517 

518connection.send(

519 RealtimeClientEvent.ofSessionUpdate(

520 SessionUpdateEvent.builder()

521 .session(

522 RealtimeSessionCreateRequest.builder()

523 .model("gpt-realtime-1.5")

524 .addOutputModality(RealtimeSessionCreateRequest.OutputModality.TEXT)

525 .addTool(

526 RealtimeToolsConfigUnion.Mcp.builder()

527 .serverLabel("google_calendar")

528 .connectorId(

529 RealtimeToolsConfigUnion.Mcp.ConnectorId

530 .CONNECTOR_GOOGLECALENDAR)

531 .authorization(System.getenv("OPENAI_CONNECTOR_AUTHORIZATION"))

532 .allowedToolsOfMcp(List.of("search_events", "read_event"))

533 .requireApproval(

534 RealtimeToolsConfigUnion.Mcp.RequireApproval

535 .McpToolApprovalSetting.NEVER)

536 .build())

537 .build())

538 .build()));

539```

540 

541```csharp

542using OpenAI.Realtime;

543 

544#pragma warning disable OPENAI002

545 

546await session.SendCommandAsync(new RealtimeClientCommandSessionUpdate(new RealtimeConversationSessionOptions

547{

548 Model = "gpt-realtime-1.5",

549 OutputModalities =

550 {

551 RealtimeOutputModality.Text

552 },

553 Tools =

554 {

555 new RealtimeMcpTool("google_calendar", RealtimeMcpToolConnectorId.GoogleCalendar)

556 {

557 AuthorizationToken = Environment.GetEnvironmentVariable("OPENAI_CONNECTOR_AUTHORIZATION")!,

558 AllowedTools = new()

559 {

560 ToolNames =

561 {

562 "search_events",

563 "read_event"

564 }

565 },

566 ToolCallApprovalPolicy = RealtimeDefaultMcpToolCallApprovalPolicy.NeverRequireApproval

567 }

568 }

569}), timeout.Token);

570```

571 

314```ruby572```ruby

315access_token = ENV.fetch("OPENAI_MCP_ACCESS_TOKEN")573access_token = ENV.fetch("OPENAI_MCP_ACCESS_TOKEN")

316 574 


619 ws.send(json.dumps(event))877 ws.send(json.dumps(event))

620```878```

621 879 

880```java

881import com.openai.client.okhttp.OkHttpClient;

882import com.openai.core.ClientOptions;

883import com.openai.helpers.RealtimeConnection;

884import com.openai.helpers.RealtimeWebSocketOptions;

885import com.openai.models.realtime.*;

886import com.openai.models.responses.ToolChoiceOptions;

887 

888// Replace https://mcp.example.com/mcp with your company's MCP server URL.

889 

890static void approveMcpRequest(RealtimeConnection connection, String approvalRequestId)

891 throws Exception {

892 send(

893 connection,

894 RealtimeClientEvent.ofConversationItemCreate(

895 ConversationItemCreateEvent.builder()

896 .item(

897 RealtimeMcpApprovalResponse.builder()

898 .id("mcp_approval_" + approvalRequestId)

899 .approvalRequestId(approvalRequestId)

900 .approve(true)

901 .build())

902 .build()));

903}

904 

905// Retry only explicit admission rejections; these guarantee nothing was sent.

906private static void send(RealtimeConnection connection, RealtimeClientEvent event)

907 throws Exception {

908 long deadline = System.nanoTime() + java.util.concurrent.TimeUnit.SECONDS.toNanos(5);

909 while (true) {

910 try {

911 connection.send(event);

912 return;

913 } catch (com.openai.core.http.WebSocketWriteNotAttempted.Busy busy) {

914 if (System.nanoTime() >= deadline) throw busy;

915 Thread.sleep(10);

916 }

917 }

918}

919```

920 

921```csharp

922using OpenAI.Realtime;

923 

924#pragma warning disable OPENAI002

925// Replace https://mcp.example.com/mcp with your company's MCP server URL.

926 

927internal static async Task ApproveMcpRequestAsync(RealtimeSessionClient session, string approvalRequestId, CancellationToken cancellationToken)

928{

929 await session.SendCommandAsync(new RealtimeClientCommandConversationItemCreate(new RealtimeMcpToolCallApprovalResponseItem(approvalRequestId, true)

930 {

931 Id = $"mcp_approval_{approvalRequestId}"

932 }), cancellationToken);

933}

934```

935 

622```ruby936```ruby

623# Use the ID from the received MCP approval-request item.937# Use the ID from the received MCP approval-request item.

624approval_request_id = item.id938approval_request_id = item.id


704ws.send(json.dumps(event))1018ws.send(json.dumps(event))

705```1019```

706 1020 

1021```java

1022import com.openai.client.okhttp.OkHttpClient;

1023import com.openai.core.ClientOptions;

1024import com.openai.helpers.RealtimeConnection;

1025import com.openai.helpers.RealtimeWebSocketOptions;

1026import com.openai.models.realtime.*;

1027import java.util.List;

1028 

1029connection.send(

1030 RealtimeClientEvent.ofResponseCreate(

1031 ResponseCreateEvent.builder()

1032 .response(

1033 RealtimeResponseCreateParams.builder()

1034 .metadata(

1035 RealtimeResponseCreateParams.Metadata.builder()

1036 .putAdditionalProperty(

1037 "topic", com.openai.core.JsonValue.from("mcp_initial"))

1038 .build())

1039 .addOutputModality(RealtimeResponseCreateParams.OutputModality.TEXT)

1040 .addInput(

1041 RealtimeConversationItemUserMessage.builder()

1042 .addContent(

1043 RealtimeConversationItemUserMessage.Content.builder()

1044 .type(

1045 RealtimeConversationItemUserMessage.Content.Type

1046 .INPUT_TEXT)

1047 .text(

1048 "Which transport should I use for browser clients in the Realtime API?")

1049 .build())

1050 .build())

1051 .addTool(

1052 RealtimeResponseCreateMcpTool.builder()

1053 .serverLabel("openai_docs")

1054 .serverUrl("https://developers.openai.com/mcp")

1055 .allowedToolsOfMcp(

1056 List.of("search_openai_docs", "fetch_openai_doc"))

1057 .requireApproval(

1058 RealtimeResponseCreateMcpTool.RequireApproval

1059 .McpToolApprovalSetting.NEVER)

1060 .build())

1061 .build())

1062 .build()));

1063```

1064 

1065```csharp

1066using OpenAI.Realtime;

1067 

1068#pragma warning disable OPENAI002

1069 

1070await session.SendCommandAsync(new RealtimeClientCommandResponseCreate

1071{

1072 ResponseOptions = new()

1073 {

1074 Metadata = new Dictionary<string, BinaryData> { ["topic"] = BinaryData.FromObjectAsJson("mcp_initial") },

1075 OutputModalities =

1076 {

1077 RealtimeOutputModality.Text

1078 },

1079 InputItems =

1080 {

1081 RealtimeItem.CreateUserMessageItem("Which transport should I use for browser clients in the Realtime API?")

1082 },

1083 Tools =

1084 {

1085 new RealtimeMcpTool("openai_docs", new Uri("https://developers.openai.com/mcp"))

1086 {

1087 AllowedTools = new()

1088 {

1089 ToolNames =

1090 {

1091 "search_openai_docs",

1092 "fetch_openai_doc"

1093 }

1094 },

1095 ToolCallApprovalPolicy = RealtimeDefaultMcpToolCallApprovalPolicy.NeverRequireApproval

1096 }

1097 }

1098 }

1099}, timeout.Token);

1100```

1101 

707```ruby1102```ruby

708connection.response.create(1103connection.response.create(

709 output_modalities: [:text],1104 output_modalities: [:text],


805ws.send(json.dumps(event))1200ws.send(json.dumps(event))

806```1201```

807 1202 

1203```java

1204import com.openai.client.okhttp.OkHttpClient;

1205import com.openai.core.ClientOptions;

1206import com.openai.helpers.RealtimeConnection;

1207import com.openai.helpers.RealtimeWebSocketOptions;

1208import com.openai.models.realtime.*;

1209import java.util.List;

1210 

1211send(

1212 connection,

1213 RealtimeClientEvent.ofResponseCreate(

1214 ResponseCreateEvent.builder()

1215 .response(

1216 RealtimeResponseCreateParams.builder()

1217 .metadata(

1218 RealtimeResponseCreateParams.Metadata.builder()

1219 .putAdditionalProperty(

1220 "topic", com.openai.core.JsonValue.from("mcp_initial"))

1221 .build())

1222 .addOutputModality(RealtimeResponseCreateParams.OutputModality.TEXT)

1223 .addInput(

1224 RealtimeConversationItemUserMessage.builder()

1225 .addContent(

1226 RealtimeConversationItemUserMessage.Content.builder()

1227 .type(

1228 RealtimeConversationItemUserMessage.Content.Type

1229 .INPUT_TEXT)

1230 .text("Check my schedule for this afternoon.")

1231 .build())

1232 .build())

1233 .addTool(

1234 RealtimeResponseCreateMcpTool.builder()

1235 .serverLabel("google_calendar")

1236 .build())

1237 .build())

1238 .build()));

1239 

1240// Retry only explicit admission rejections; these guarantee nothing was sent.

1241private static void send(RealtimeConnection connection, RealtimeClientEvent event)

1242 throws Exception {

1243 long deadline = System.nanoTime() + java.util.concurrent.TimeUnit.SECONDS.toNanos(5);

1244 while (true) {

1245 try {

1246 connection.send(event);

1247 return;

1248 } catch (com.openai.core.http.WebSocketWriteNotAttempted.Busy busy) {

1249 if (System.nanoTime() >= deadline) throw busy;

1250 Thread.sleep(10);

1251 }

1252 }

1253}

1254```

1255 

1256```csharp

1257using OpenAI.Realtime;

1258 

1259#pragma warning disable OPENAI002

1260 

1261await session.SendCommandAsync(new RealtimeClientCommandResponseCreate

1262{

1263 ResponseOptions = new()

1264 {

1265 Metadata = new Dictionary<string, BinaryData> { ["topic"] = BinaryData.FromObjectAsJson("mcp_initial") },

1266 OutputModalities =

1267 {

1268 RealtimeOutputModality.Text

1269 },

1270 InputItems =

1271 {

1272 RealtimeItem.CreateUserMessageItem("Check my schedule for this afternoon.")

1273 },

1274 Tools =

1275 {

1276 new RealtimeMcpTool

1277 {

1278 ServerLabel = "google_calendar"

1279 }

1280 }

1281 }

1282}, timeout.Token);

1283```

1284 

808```ruby1285```ruby

809connection.response.create(1286connection.response.create(

810 output_modalities: [:text],1287 output_modalities: [:text],

Details

123 123 

124Connect to the dedicated translation endpoint and select the model in the URL:124Connect to the dedicated translation endpoint and select the model in the URL:

125 125 

126Before running this example, install `ws` for Node.js, `websocket-client` for Python, or `async-websocket` for Ruby (`gem install async-websocket`).126Before running this example, install `ws` for Node.js, `websocket-client` for Python, or `async-websocket` for Ruby (`gem install async-websocket`). For Java, add the Maven dependency `com.openai:openai-java:4.75.1`.

127 

128The Java examples cover connection setup, language configuration, and audio input separately. They don't show a complete translation workflow: the Java SDK supports receiving events and finishing a session, but this guide doesn't include Java examples for those steps. Use the Node.js or Python examples to follow the complete workflow below.

127 129 

128Connect to a translation session130Connect to a translation session

129 131 


155)157)

156```158```

157 159 

160```java

161import com.openai.client.okhttp.OkHttpClient;

162import com.openai.core.ClientOptions;

163import com.openai.helpers.TranslationConnection;

164import com.openai.helpers.TranslationWebSocketOptions;

165import com.openai.models.realtime.*;

166 

167var http = OkHttpClient.builder().build();

168var options =

169 ClientOptions.builder()

170 .fromEnv()

171 .httpClient(http)

172 .putHeader("OpenAI-Safety-Identifier", "hashed-user-id")

173 .build();

174try (http;

175 var connection =

176 TranslationConnection.connect(

177 options,

178 TranslationWebSocketOptions.builder()

179 .model("gpt-realtime-translate")

180 .sendTimeout(java.time.Duration.ofSeconds(30))

181 .build())) {

182 while (true) {

183 var event = connection.receive();

184 if (event.error().isPresent())

185 throw new IllegalStateException(event.error().orElseThrow().toString());

186 if (event.sessionCreated().isPresent()) {

187 System.out.println("Connected to translation session.");

188 System.out.println(event);

189 break;

190 }

191 }

192}

193```

194 

158```ruby195```ruby

159require "async"196require "async"

160require "async/http/endpoint"197require "async/http/endpoint"


182 219 

183For Ruby, insert the following configuration and audio-append snippets inside the `Async::WebSocket::Client.connect` block, after the session-created check and before the block ends. Keep the connection open while sending audio and receiving translation events.220For Ruby, insert the following configuration and audio-append snippets inside the `Async::WebSocket::Client.connect` block, after the session-created check and before the block ends. Keep the connection open while sending audio and receiving translation events.

184 221 

222The Java connection example closes the socket when its `try` block ends. The Java configuration and audio-input examples require an open `TranslationConnection`; keep it open while sending audio and receiving output. Before leaving the block, finish the session and drain its events through `session.closed` as described in [Close a WebSocket session](#close-a-websocket-session).

223 

185Configure the target language after the socket opens:224Configure the target language after the socket opens:

186 225 

187Configure the target language226Configure the target language


222)261)

223```262```

224 263 

264```java

265import com.openai.client.okhttp.OkHttpClient;

266import com.openai.core.ClientOptions;

267import com.openai.helpers.TranslationConnection;

268import com.openai.helpers.TranslationWebSocketOptions;

269import com.openai.models.realtime.*;

270 

271connection.send(

272 RealtimeTranslationClientEvent.ofSessionUpdate(

273 RealtimeTranslationSessionUpdateEvent.builder()

274 .session(

275 RealtimeTranslationSessionUpdateRequest.builder()

276 .audio(

277 RealtimeTranslationSessionUpdateRequest.Audio.builder()

278 .output(

279 RealtimeTranslationSessionUpdateRequest.Audio.Output.builder()

280 .language("es")

281 .build())

282 .build())

283 .build())

284 .build()));

285```

286 

225```ruby287```ruby

226connection.write(JSON.generate(type: "session.update", session: { audio: { output: { language: "es" } } }))288connection.write(JSON.generate(type: "session.update", session: { audio: { output: { language: "es" } } }))

227connection.flush289connection.flush


252)314)

253```315```

254 316 

317```java

318import com.openai.client.okhttp.OkHttpClient;

319import com.openai.core.ClientOptions;

320import com.openai.helpers.TranslationConnection;

321import com.openai.helpers.TranslationWebSocketOptions;

322import com.openai.models.realtime.*;

323import java.util.Base64;

324 

325// Call for each PCM16, 24 kHz, mono chunk supplied by your audio source.

326static void appendAudio(TranslationConnection connection, byte[] pcmAudio) {

327 String base64Pcm16 = Base64.getEncoder().encodeToString(pcmAudio);

328 connection.send(

329 RealtimeTranslationClientEvent.ofSessionInputAudioBufferAppend(

330 RealtimeTranslationInputAudioBufferAppendEvent.builder().audio(base64Pcm16).build()));

331}

332```

333 

255```ruby334```ruby

256require "base64"335require "base64"

257 336 

guides/steering.md +132 −0

Details

190asyncio.run(main())190asyncio.run(main())

191```191```

192 192 

193```go

194ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)

195defer cancel()

196client := openai.NewClient()

197conn, err := client.Responses.Connect(ctx, responses.ResponseConnectionOptions{})

198if err != nil {

199 log.Fatal(err)

200}

201defer conn.Close()

202if err := conn.Create(ctx, responses.ResponsesClientEventResponseCreateParam{

203 Model: "gpt-6-astra",

204 Reasoning: shared.ReasoningParam{

205 Effort: shared.ReasoningEffortMedium,

206 },

207 Store: openai.Bool(false),

208 Input: responses.ResponsesClientEventResponseCreateInputUnionParam{

209 OfString: openai.String("Draft a project plan for building a task-tracking app."),

210 },

211}); err != nil {

212 log.Fatal(err)

213}

214initialID, successorID := "", ""

215for {

216 event, err := conn.Recv(ctx)

217 if err != nil {

218 log.Fatal(err)

219 }

220 switch event.Type {

221 case "response.created":

222 id := event.OfResponsesServerEventResponseWsCreated.Response.ID

223 if initialID == "" {

224 initialID = id

225 err := conn.Send(ctx, responses.ResponsesClientEventUnionParam{

226 OfResponseSteer: &responses.ResponseSteerEventParam{

227 PreviousResponseID: id,

228 Input: responses.ResponseSteerInputUnionParam{

229 OfString: openai.String("Keep the scope small enough for one developer to finish in two weeks."),

230 },

231 },

232 })

233 if err != nil {

234 log.Fatal(err)

235 }

236 } else {

237 successorID = id

238 }

239 case "response.steer.failed", "response.failed", "error":

240 log.Fatal(event.RawJSON())

241 case "response.incomplete":

242 r := event.OfResponsesServerEventResponseWsIncomplete.Response

243 if r.ID != initialID || r.IncompleteDetails.Reason != "steered" {

244 log.Fatal(event.RawJSON())

245 }

246 case "response.completed":

247 r := event.OfResponsesServerEventResponseWsCompleted.Response

248 if successorID != "" && r.ID == successorID {

249 fmt.Println(r.OutputText())

250 return

251 }

252 }

253 // Steering acceptance only queues input. Wait for the successor to complete.

254}

255```

256 

257```java

258import com.openai.client.okhttp.OpenAIOkHttpClient;

259import com.openai.models.responses.*;

260import java.util.*;

261 

262long deadline = System.nanoTime() + java.util.concurrent.TimeUnit.SECONDS.toNanos(120);

263try (var conn =

264 client.async().responses().connect().get(10, java.util.concurrent.TimeUnit.SECONDS)) {

265 conn.send(

266 ResponsesClientEvent.ofResponseCreate(

267 ResponsesClientEvent.ResponseCreate.builder()

268 .model("gpt-6-astra")

269 .reasoning(

270 com.openai.models.Reasoning.builder()

271 .effort(com.openai.models.ReasoningEffort.MEDIUM)

272 .build())

273 .store(false)

274 .input("Draft a project plan for building a task-tracking app.")

275 .build()));

276 String initialId = null, successorId = null;

277 while (true) {

278 var event =

279 conn.receive()

280 .get(

281 Math.max(1, deadline - System.nanoTime()),

282 java.util.concurrent.TimeUnit.NANOSECONDS);

283 if (event.responseCreated().isPresent()) {

284 var id = event.responseCreated().orElseThrow().response().id();

285 if (initialId == null) {

286 initialId = id;

287 conn.send(

288 ResponsesClientEvent.ofResponseSteer(

289 ResponseSteerEvent.builder()

290 .previousResponseId(id)

291 .input(

292 "Keep the scope small enough for one developer to finish in two weeks.")

293 .build()));

294 } else {

295 successorId = id;

296 }

297 } else if (event.responseSteerFailed().isPresent()

298 || event.responseFailed().isPresent()

299 || event.error().isPresent()) {

300 throw new IllegalStateException(event.toString());

301 } else if (event.responseIncomplete().isPresent()) {

302 var response = event.responseIncomplete().orElseThrow().response();

303 if (!response.id().equals(initialId)

304 || !response

305 .incompleteDetails()

306 .flatMap(Response.IncompleteDetails::reason)

307 .map(r -> r.toString().equals("steered"))

308 .orElse(false)) throw new IllegalStateException(event.toString());

309 } else if (event.responseCompleted().isPresent()

310 && event.responseCompleted().orElseThrow().response().id().equals(successorId)) {

311 event.responseCompleted().orElseThrow().response().output().stream()

312 .flatMap(item -> item.message().stream())

313 .flatMap(message -> message.content().stream())

314 .flatMap(content -> content.outputText().stream())

315 .forEach(text -> System.out.println(text.text()));

316 break;

317 }

318 // Acceptance only queues input; follow the successor through completion.

319 }

320} finally {

321 client.close();

322}

323```

324 

193```ruby325```ruby

194require "async"326require "async"

195require "openai"327require "openai"

Details

1890 1890 

1891Set `OPENAI_API_KEY` for the API client and `OPENAI_EXAMPLE_CODE_EXECUTION_URL` to your service endpoint. Set `OPENAI_EXAMPLE_CODE_EXECUTION_TOKEN` if your service requires a bearer token. These service settings are example configuration, not OpenAI API parameters.1891Set `OPENAI_API_KEY` for the API client and `OPENAI_EXAMPLE_CODE_EXECUTION_URL` to your service endpoint. Set `OPENAI_EXAMPLE_CODE_EXECUTION_TOKEN` if your service requires a bearer token. These service settings are example configuration, not OpenAI API parameters.

1892 1892 

1893For Go, initialize a module if your project doesn't have one, then install the pinned SDK:

1894 

1895```bash

1896go mod init example.com/computer-use

1897go get github.com/openai/openai-go/v3@v3.70.0

1898```

1899 

1900For Java 17 or later, add these dependencies to your Maven `pom.xml`:

1901 

1902```xml

1903<dependencies>

1904 <dependency>

1905 <groupId>com.openai</groupId>

1906 <artifactId>openai-java</artifactId>

1907 <version>4.75.1</version>

1908 </dependency>

1909 <dependency>

1910 <groupId>com.fasterxml.jackson.core</groupId>

1911 <artifactId>jackson-databind</artifactId>

1912 <version>2.18.9</version>

1913 </dependency>

1914</dependencies>

1915```

1916 

1917The Java adapter is a standalone execution-service example with partial workflow coverage. The linked [computer use guide](https://developers.openai.com/api/docs/guides/tools-computer-use#connect-your-own-runtime) doesn't provide a complete Java API loop.

1918 

1893Connect the API client to your execution service1919Connect the API client to your execution service

1894 1920 

1895```javascript1921```javascript


2009 return observations2035 return observations

2010```2036```

2011 2037 

2038```go

2039// This is an application adapter to your sandbox, not an SDK execution helper.

2040func executeInSandbox(ctx context.Context, code, sessionID, endpoint string, input io.Reader) (responses.ResponseFunctionCallOutputItemListParam, error) {

2041 fmt.Println(code)

2042 fmt.Print("Run this code in the isolated runtime? Type yes: ")

2043 scanner := bufio.NewScanner(input)

2044 if !scanner.Scan() {

2045 if err := scanner.Err(); err != nil {

2046 return nil, err

2047 }

2048 }

2049 if strings.TrimSpace(scanner.Text()) != "yes" {

2050 return responses.ResponseFunctionCallOutputItemListParam{

2051 {

2052 OfInputText: &responses.ResponseInputTextContentParam{

2053 Text: "The user declined this execution.",

2054 },

2055 },

2056 }, nil

2057 }

2058 payload, err := json.Marshal(map[string]string{

2059 "session_id": sessionID,

2060 "language": "python",

2061 "code": code,

2062 })

2063 if err != nil {

2064 return nil, err

2065 }

2066 ctx, cancel := context.WithTimeout(ctx, 30*time.Second)

2067 defer cancel()

2068 request, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint, bytes.NewReader(payload))

2069 if err != nil {

2070 return nil, err

2071 }

2072 request.Header.Set("Content-Type", "application/json")

2073 if token := os.Getenv("OPENAI_EXAMPLE_CODE_EXECUTION_TOKEN"); token != "" {

2074 request.Header.Set("Authorization", "Bearer "+token)

2075 }

2076 response, err := http.DefaultClient.Do(request)

2077 if err != nil {

2078 return nil, err

2079 }

2080 defer response.Body.Close()

2081 if response.StatusCode < 200 || response.StatusCode >= 300 {

2082 return nil, fmt.Errorf("execution service returned HTTP %d", response.StatusCode)

2083 }

2084 var result struct {

2085 Output []struct {

2086 Type string `json:"type"`

2087 Text *string `json:"text"`

2088 ImageURL *string `json:"image_url"`

2089 Detail string `json:"detail"`

2090 } `json:"output"`

2091 }

2092 if err := json.NewDecoder(response.Body).Decode(&result); err != nil {

2093 return nil, err

2094 }

2095 if len(result.Output) == 0 {

2096 return nil, fmt.Errorf("expected nonempty execution output")

2097 }

2098 output := make(responses.ResponseFunctionCallOutputItemListParam, 0, len(result.Output))

2099 for _, item := range result.Output {

2100 switch {

2101 case item.Type == "input_text" && item.Text != nil:

2102 output = append(output, responses.ResponseFunctionCallOutputItemUnionParam{

2103 OfInputText: &responses.ResponseInputTextContentParam{

2104 Text: *item.Text,

2105 },

2106 })

2107 case item.Type == "input_image" && item.ImageURL != nil && item.Detail == "original":

2108 output = append(output, responses.ResponseFunctionCallOutputItemUnionParam{

2109 OfInputImage: &responses.ResponseInputImageContentParam{

2110 ImageURL: openai.String(*item.ImageURL),

2111 Detail: "original",

2112 },

2113 })

2114 default:

2115 return nil, fmt.Errorf("expected input_text or input_image with original detail")

2116 }

2117 }

2118 return output, nil

2119}

2120```

2121 

2122```java

2123import com.fasterxml.jackson.databind.ObjectMapper;

2124import com.openai.models.responses.*;

2125import java.net.http.*;

2126import java.util.*;

2127 

2128// Application-owned adapter: the sandbox must implement this HTTP contract.

2129static List<ResponseFunctionCallOutputItem> executeInSandbox(

2130 String code, String sessionId, java.net.URI endpoint, java.io.BufferedReader input)

2131 throws Exception {

2132 System.out.println(code);

2133 System.out.print("Run this code in the isolated runtime? Type yes: ");

2134 String approval = input.readLine();

2135 if (approval == null || !approval.strip().equals("yes"))

2136 return List.of(

2137 ResponseFunctionCallOutputItem.ofInputText(

2138 ResponseInputTextContent.builder()

2139 .text("The user declined this execution.")

2140 .build()));

2141 var mapper = new ObjectMapper();

2142 var request =

2143 HttpRequest.newBuilder(endpoint)

2144 .timeout(java.time.Duration.ofSeconds(30))

2145 .header("Content-Type", "application/json")

2146 .POST(

2147 HttpRequest.BodyPublishers.ofString(

2148 mapper.writeValueAsString(

2149 Map.of("session_id", sessionId, "language", "python", "code", code))));

2150 String token = System.getenv("OPENAI_EXAMPLE_CODE_EXECUTION_TOKEN");

2151 if (token != null && !token.isBlank()) request.header("Authorization", "Bearer " + token);

2152 var response =

2153 HttpClient.newHttpClient().send(request.build(), HttpResponse.BodyHandlers.ofString());

2154 if (response.statusCode() < 200 || response.statusCode() >= 300)

2155 throw new IllegalStateException("Execution service returned HTTP " + response.statusCode());

2156 var items = mapper.readTree(response.body()).path("output");

2157 if (!items.isArray() || items.isEmpty())

2158 throw new IllegalStateException("Expected nonempty execution output");

2159 var output = new ArrayList<ResponseFunctionCallOutputItem>();

2160 for (var item : items) {

2161 if (item.path("type").asText().equals("input_text") && item.path("text").isTextual())

2162 output.add(

2163 ResponseFunctionCallOutputItem.ofInputText(

2164 ResponseInputTextContent.builder().text(item.get("text").asText()).build()));

2165 else if (item.path("type").asText().equals("input_image")

2166 && item.path("image_url").isTextual()

2167 && item.path("detail").asText().equals("original"))

2168 output.add(

2169 ResponseFunctionCallOutputItem.ofInputImage(

2170 ResponseInputImageContent.builder()

2171 .imageUrl(item.get("image_url").asText())

2172 .detail(ResponseInputImageContent.Detail.ORIGINAL)

2173 .build()));

2174 else

2175 throw new IllegalStateException("Expected input_text or input_image with original detail");

2176 }

2177 return output;

2178}

2179```

2180 

2012```ruby2181```ruby

2013require "net/http"2182require "net/http"

2014 2183 


2060```2229```

2061 2230 

2062 2231 

2063Combine the adapter with the [API loop](https://developers.openai.com/api/docs/guides/tools-computer-use#connect-your-own-runtime), then call `run_computer_use` in Python or `runComputerUse` in JavaScript with your endpoint and task. The loop preserves the runtime session and uses `previous_response_id` to continue the model conversation. It stops after 20 responses if the task has not finished.2232Python, JavaScript, Ruby, and Go have complete [API loop examples](https://developers.openai.com/api/docs/guides/tools-computer-use#connect-your-own-runtime) for this execution-service contract. Use `run_computer_use` in Python or Ruby, or `runComputerUse` in JavaScript or Go, with your endpoint and task. The Go example also takes a context, SDK client, terminal scanner, and output writer; use its included adapter to preserve those inputs across calls. The loop preserves the runtime session and uses `previous_response_id` to continue the model conversation. It stops after 20 responses if the task has not finished.

2064 2233 

2065This adapter asks for approval before every generated script as a conservative demonstration. A production runtime must enforce the action-specific rules in [Handle user confirmation and consent](#handle-user-confirmation-and-consent). Removing the prompt does not supply those controls.2234This adapter asks for approval before every generated script as a conservative demonstration. A production runtime must enforce the action-specific rules in [Handle user confirmation and consent](#handle-user-confirmation-and-consent). Removing the prompt does not supply those controls.

2066 2235 

Details

1938 1938 

1939</td>1939</td>

1940<td style={{"maxWidth": "150px"}}>1940<td style={{"maxWidth": "150px"}}>

1941**Tier 1**1941**Build**

1942 

1943200 RPM

1944 

1945**Tier 2 and 3**

1946 1942 

19471000 RPM19431000 RPM

1948 1944 

1949**Tier 4 and 5**1945**Launch and Grow**

1950 1946 

19512000 RPM19472000 RPM

1952 1948 

Details

978print(response.output_text)978print(response.output_text)

979```979```

980 980 

981```go

982var bundle bytes.Buffer

983archive := zip.NewWriter(&bundle)

984file, err := archive.Create("csv-insights/SKILL.md")

985if err != nil {

986 log.Fatal(err)

987}

988if _, err := file.Write([]byte("---\nname: csv-insights\ndescription: Summarize CSV files.\n---\nRead the CSV and produce a Markdown report of totals.\n")); err != nil {

989 log.Fatal(err)

990}

991if err := archive.Close(); err != nil {

992 log.Fatal(err)

993}

994client := openai.NewClient()

995inlineZip := base64.StdEncoding.EncodeToString(bundle.Bytes())

996reportCSV := base64.StdEncoding.EncodeToString([]byte("product,revenue\nA,120\nB,80\n"))

997container, err := client.Containers.New(context.Background(), openai.ContainerNewParams{

998 Name: "inline-skill-container",

999 Skills: []openai.ContainerNewParamsSkillUnion{

1000 {

1001 OfInline: &responses.InlineSkillParam{

1002 Name: "csv-insights",

1003 Description: "Summarize CSV files and produce a markdown report.",

1004 Source: responses.InlineSkillSourceParam{

1005 Data: inlineZip,

1006 },

1007 },

1008 },

1009 },

1010})

1011if err != nil {

1012 log.Fatal(err)

1013}

1014response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{

1015 Model: "gpt-6-astra",

1016 Tools: []responses.ToolUnionParam{

1017 {

1018 OfShell: &responses.FunctionShellToolParam{

1019 Environment: responses.FunctionShellToolEnvironmentUnionParam{

1020 OfContainerReference: &responses.ContainerReferenceParam{

1021 ContainerID: container.ID,

1022 },

1023 },

1024 },

1025 },

1026 },

1027 Input: responses.ResponseNewParamsInputUnion{

1028 OfInputItemList: []responses.ResponseInputItemUnionParam{

1029 {

1030 OfMessage: &responses.EasyInputMessageParam{

1031 Role: responses.EasyInputMessageRoleUser,

1032 Content: responses.EasyInputMessageContentUnionParam{

1033 OfInputItemContentList: []responses.ResponseInputContentUnionParam{

1034 {

1035 OfInputFile: &responses.ResponseInputFileParam{

1036 Filename: openai.String("report.csv"),

1037 FileData: openai.String("data:text/csv;base64," + reportCSV),

1038 },

1039 },

1040 {

1041 OfInputText: &responses.ResponseInputTextParam{

1042 Text: "Use the csv-insights skill to summarize report.csv.",

1043 },

1044 },

1045 },

1046 },

1047 },

1048 },

1049 },

1050 },

1051})

1052if err != nil {

1053 log.Fatal(err)

1054}

1055if response.Status != responses.ResponseStatusCompleted {

1056 log.Fatalf("Response ended with status %s", response.Status)

1057}

1058fmt.Println(response.OutputText())

1059```

1060 

1061```java

1062import com.openai.client.okhttp.OpenAIOkHttpClient;

1063import com.openai.models.containers.ContainerCreateParams;

1064import com.openai.models.responses.*;

1065import java.util.*;

1066 

1067var bundle = new java.io.ByteArrayOutputStream();

1068try (var zip = new java.util.zip.ZipOutputStream(bundle)) {

1069 zip.putNextEntry(new java.util.zip.ZipEntry("csv-insights/SKILL.md"));

1070 zip.write(

1071 "---\nname: csv-insights\ndescription: Summarize CSV files.\n---\nRead the CSV and produce a Markdown report of totals.\n"

1072 .getBytes(java.nio.charset.StandardCharsets.UTF_8));

1073 zip.closeEntry();

1074}

1075var client = OpenAIOkHttpClient.fromEnv();

1076 

1077var inlineZip = Base64.getEncoder().encodeToString(bundle.toByteArray());

1078var reportCsv =

1079 Base64.getEncoder()

1080 .encodeToString(

1081 "product,revenue\nA,120\nB,80\n".getBytes(java.nio.charset.StandardCharsets.UTF_8));

1082var container =

1083 client

1084 .containers()

1085 .create(

1086 ContainerCreateParams.builder()

1087 .name("inline-skill-container")

1088 .addSkill(

1089 InlineSkill.builder()

1090 .name("csv-insights")

1091 .description("Summarize CSV files and produce a markdown report.")

1092 .source(InlineSkillSource.builder().data(inlineZip).build())

1093 .build())

1094 .build());

1095var response =

1096 client

1097 .responses()

1098 .create(

1099 ResponseCreateParams.builder()

1100 .model("gpt-6-astra")

1101 .addTool(

1102 FunctionShellTool.builder()

1103 .containerReferenceEnvironment(container.id())

1104 .build())

1105 .inputOfResponse(

1106 List.of(

1107 ResponseInputItem.ofMessage(

1108 ResponseInputItem.Message.builder()

1109 .role(ResponseInputItem.Message.Role.USER)

1110 .addContent(

1111 ResponseInputFile.builder()

1112 .filename("report.csv")

1113 .fileData("data:text/csv;base64," + reportCsv)

1114 .build())

1115 .addInputTextContent(

1116 "Use the csv-insights skill to summarize report.csv.")

1117 .build())))

1118 .build());

1119if (response.status().filter(ResponseStatus.COMPLETED::equals).isEmpty())

1120 throw new IllegalStateException(

1121 "Response ended with status " + response.status().orElse(null));

1122response.output().stream()

1123 .flatMap(item -> item.message().stream())

1124 .flatMap(message -> message.content().stream())

1125 .flatMap(content -> content.outputText().stream())

1126 .forEach(text -> System.out.println(text.text()));

1127```

1128 

981```ruby1129```ruby

982require "base64"1130require "base64"

983require "openai"1131require "openai"

Details

207 207 

208| API usage tier | Tokens per minute (TPM) |208| API usage tier | Tokens per minute (TPM) |

209| -------------- | ----------------------- |209| -------------- | ----------------------- |

210| Tiers 1–3 | 500,000 |210| Build | 500,000 |

211| Tier 4 | 1,000,000 |211| Launch | 1,000,000 |

212| Tier 5 | 5,000,000 |212| Grow | 5,000,000 |

213 213 

214See the [Ultrafast pricing table](https://developers.openai.com/api/docs/pricing?latest-pricing=ultrafast) for input, cached input, cache write, and output prices.214See the [Ultrafast pricing table](https://developers.openai.com/api/docs/pricing?latest-pricing=ultrafast) for input, cached input, cache write, and output prices.

215 215 

Details

303 { value: "ws", label: "ws module (Node.js)" },303 { value: "ws", label: "ws module (Node.js)" },

304 { value: "python", label: "websocket-client (Python)" },304 { value: "python", label: "websocket-client (Python)" },

305 { value: "ruby", label: "OpenAI SDK (Ruby)" },305 { value: "ruby", label: "OpenAI SDK (Ruby)" },

306 { value: "java", label: "OpenAI SDK (Java)" },

307 { value: "csharp", label: "OpenAI SDK (.NET)" },

306 { value: "websocket", label: "WebSocket (browsers)" },308 { value: "websocket", label: "WebSocket (browsers)" },

307 ]}309 ]}

308>310>


411 413

412 414 

413 415

416OpenAI SDK (Java)

417 

418

419 

420 Use Java 17 or later with `com.openai:openai-java:4.75.1`.

421

422 

423 Connect with the OpenAI SDK (Java)

424 

425```java

426import com.openai.client.okhttp.OkHttpClient;

427import com.openai.core.ClientOptions;

428import com.openai.helpers.RealtimeConnection;

429import com.openai.helpers.RealtimeWebSocketOptions;

430import com.openai.models.realtime.*;

431 

432var http = OkHttpClient.builder().build();

433var options =

434 ClientOptions.builder()

435 .fromEnv()

436 .httpClient(http)

437 .putHeader("OpenAI-Safety-Identifier", "hashed-user-id")

438 .build();

439try (http;

440 var connection =

441 RealtimeConnection.connect(

442 options,

443 RealtimeWebSocketOptions.builder().model("gpt-realtime-2.1").build())) {

444 while (true) {

445 var event = connection.receive();

446 if (event.error().isPresent())

447 throw new IllegalStateException(event.error().orElseThrow().toString());

448 if (event.sessionCreated().isPresent()) {

449 System.out.println("Connected to server.");

450 System.out.println(event);

451 break;

452 }

453 }

454}

455```

456 

457

458 

459

460 

461

462OpenAI SDK (.NET)

463 

464

465 

466 Install the SDK with

467 `dotnet add package OpenAI --version 2.14.0`. The Realtime API

468 uses experimental SDK types; the example includes the required warning

469 directive.

470

471 

472 Connect with the OpenAI SDK (.NET)

473 

474```csharp

475using OpenAI.Realtime;

476 

477#pragma warning disable OPENAI002

478 

479string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

480RealtimeClient client = new(key);

481 

482RealtimeSessionClientOptions options = new();

483options.Headers["OpenAI-Safety-Identifier"] = "hashed-user-id";

484using CancellationTokenSource timeout = new(TimeSpan.FromSeconds(30));

485using RealtimeSessionClient session = await client.StartConversationSessionAsync("gpt-realtime-2.1", options, cancellationToken: timeout.Token);

486await foreach (RealtimeServerUpdate update in session.ReceiveUpdatesAsync(timeout.Token))

487{

488 if (update is RealtimeServerUpdateError error)

489 throw new InvalidOperationException(error.Error.Message);

490 if (update is RealtimeServerUpdateSessionCreated)

491 {

492 Console.WriteLine("Connected to server.");

493 Console.WriteLine(System.ClientModel.Primitives.ModelReaderWriter.Write(update));

494 return;

495 }

496}

497throw new InvalidOperationException("Connection closed before session creation.");

498```

499 

500

501 

502

503 

504

414WebSocket (browsers)505WebSocket (browsers)

415 506 

416 Connect with standard WebSocket (browsers)507 Connect with standard WebSocket (browsers)

Details

369)369)

370```370```

371 371 

372```go

373// Verify the original bytes, before any JSON parsing.

374event, err := client.Webhooks.Unwrap(body, r.Header)

375if err != nil {

376 http.Error(w, "Invalid webhook", http.StatusBadRequest)

377 return

378}

379fmt.Println(event.Type)

380```

381 

382```java

383import com.openai.client.OpenAIClient;

384import com.openai.core.http.Headers;

385import com.openai.models.webhooks.UnwrapWebhookEvent;

386import com.openai.models.webhooks.WebhookVerificationParams;

387 

388// Your HTTP framework supplies the original request bytes and headers.

389// Load secret from OPENAI_WEBHOOK_SECRET in your application.

390// Reject InvalidWebhookSignatureException (invalid signature or timestamp)

391// and IllegalArgumentException (missing required headers).

392public static UnwrapWebhookEvent verifyWebhook(

393 OpenAIClient client, byte[] body, Headers headers, String secret) {

394 return client

395 .webhooks()

396 .unwrap(

397 WebhookVerificationParams.builder()

398 .payload(body)

399 .headers(headers)

400 .secret(secret)

401 .build());

402}

403```

404 

372```ruby405```ruby

373require "openai"406require "openai"

374require "webrick"407require "webrick"

Details

16 16 

17Install the WebSocket dependencies with `pip install "openai[realtime]>=3.8.0"` for Python, `npm install openai@^7.10.0 ws` for JavaScript, or `gem install openai async-websocket` for Ruby.17Install the WebSocket dependencies with `pip install "openai[realtime]>=3.8.0"` for Python, `npm install openai@^7.10.0 ws` for JavaScript, or `gem install openai async-websocket` for Ruby.

18 18 

19For Go, run `go get github.com/openai/openai-go/v3@v3.70.0`.

20For Java, add the Maven dependency `com.openai:openai-java:4.75.1`.

21These Go and Java SDK versions provide native Responses WebSocket support.

22 

19In WebSocket mode, start each turn by sending a `response.create` event from the client. The payload mirrors the normal [Responses create body](https://developers.openai.com/api/reference/resources/responses/methods/create), except that transport-specific fields like `stream` and `background` are not used.23In WebSocket mode, start each turn by sending a `response.create` event from the client. The payload mirrors the normal [Responses create body](https://developers.openai.com/api/reference/resources/responses/methods/create), except that transport-specific fields like `stream` and `background` are not used.

20 24 

21```javascript25```javascript


91 raise RuntimeError(event.to_json())95 raise RuntimeError(event.to_json())

92```96```

93 97 

98```go

99ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)

100defer cancel()

101client := openai.NewClient()

102conn, err := client.Responses.Connect(ctx, responses.ResponseConnectionOptions{})

103if err != nil {

104 log.Fatal(err)

105}

106defer conn.Close()

107if err := conn.Create(ctx, responses.ResponsesClientEventResponseCreateParam{

108 Model: "gpt-6-astra",

109 Store: openai.Bool(false),

110 Input: responses.ResponsesClientEventResponseCreateInputUnionParam{

111 OfString: openai.String("Find fizz_buzz()"),

112 },

113 StreamID: openai.String("main"),

114 Tools: []responses.ToolUnionParam{},

115}); err != nil {

116 log.Fatal(err)

117}

118response, err := conn.FinalResponse(ctx)

119if err != nil {

120 log.Fatal(err)

121}

122if response.Status != responses.ResponseStatusCompleted {

123 log.Fatalf("Response ended with status %s", response.Status)

124}

125fmt.Println(response.OutputText())

126```

127 

128```java

129import com.openai.client.okhttp.OpenAIOkHttpClient;

130import com.openai.models.responses.*;

131import java.util.*;

132 

133try (var conn = client.responses().connect()) {

134 conn.send(

135 ResponsesClientEvent.ofResponseCreate(

136 ResponsesClientEvent.ResponseCreate.builder()

137 .model("gpt-6-astra")

138 .store(false)

139 .input("Find fizz_buzz()")

140 .streamId("main")

141 .tools(List.of())

142 .build()));

143 var response = conn.finalResponse();

144 if (response.status().filter(ResponseStatus.COMPLETED::equals).isEmpty())

145 throw new IllegalStateException(

146 "Response ended with status " + response.status().orElse(null));

147 response.output().stream()

148 .flatMap(item -> item.message().stream())

149 .flatMap(message -> message.content().stream())

150 .flatMap(content -> content.outputText().stream())

151 .forEach(text -> System.out.println(text.text()));

152}

153```

154 

94```ruby155```ruby

95require "async"156require "async"

96require "openai"157require "openai"


296 print(wait_for_response(connection).output_text)357 print(wait_for_response(connection).output_text)

297```358```

298 359 

360```go

361ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)

362defer cancel()

363client := openai.NewClient()

364tools := []responses.ToolUnionParam{

365 {

366 OfFunction: &responses.FunctionToolParam{

367 Name: "get_test_results",

368 Description: openai.String("Return a local demo test result."),

369 Parameters: map[string]any{

370 "type": "object",

371 "properties": map[string]any{},

372 "additionalProperties": false,

373 },

374 Strict: openai.Bool(true),

375 },

376 },

377}

378conn, err := client.Responses.Connect(ctx, responses.ResponseConnectionOptions{})

379if err != nil {

380 log.Fatal(err)

381}

382defer conn.Close()

383if err := conn.Create(ctx, responses.ResponsesClientEventResponseCreateParam{

384 Model: "gpt-6-astra",

385 Store: openai.Bool(false),

386 Input: responses.ResponsesClientEventResponseCreateInputUnionParam{

387 OfString: openai.String("Find the failing test and suggest a fix."),

388 },

389 StreamID: openai.String("main"),

390 Tools: tools,

391 ParallelToolCalls: openai.Bool(false),

392 ToolChoice: responses.ResponsesClientEventResponseCreateToolChoiceUnionParam{

393 OfFunctionTool: &responses.ToolChoiceFunctionParam{

394 Name: "get_test_results",

395 },

396 },

397}); err != nil {

398 log.Fatal(err)

399}

400first, err := conn.FinalResponse(ctx)

401if err != nil {

402 log.Fatal(err)

403}

404if first.Status != responses.ResponseStatusCompleted {

405 log.Fatalf("Response ended with status %s", first.Status)

406}

407var callID string

408for _, item := range first.Output {

409 if item.Type == "function_call" && item.Name == "get_test_results" {

410 callID = item.CallID

411 break

412 }

413}

414if callID == "" {

415 log.Fatal("Expected a get_test_results function call")

416}

417// The result is a local demo fixture; carry the real response and call IDs.

418result := `{"test":"test_fizz_buzz","failure":"Expected FizzBuzz for 15, got Fizz."}`

419if err := conn.Create(ctx, responses.ResponsesClientEventResponseCreateParam{

420 Model: "gpt-6-astra",

421 StreamID: openai.String("main"),

422 Store: openai.Bool(false),

423 PreviousResponseID: openai.String(first.ID),

424 Tools: tools,

425 ToolChoice: responses.ResponsesClientEventResponseCreateToolChoiceUnionParam{

426 OfToolChoiceMode: openai.Opt(responses.ToolChoiceOptionsNone),

427 },

428 Input: responses.ResponsesClientEventResponseCreateInputUnionParam{

429 OfResponse: &responses.ResponseInputParam{

430 {

431 OfFunctionCallOutput: &responses.ResponseInputItemFunctionCallOutputParam{

432 CallID: openai.String(callID),

433 Output: responses.ResponseInputItemFunctionCallOutputOutputUnionParam{

434 OfString: openai.String(result),

435 },

436 },

437 },

438 responses.ResponseInputItemParamOfMessage("Now optimize it.", responses.EasyInputMessageRoleUser),

439 },

440 },

441}); err != nil {

442 log.Fatal(err)

443}

444response, err := conn.FinalResponse(ctx)

445if err != nil {

446 log.Fatal(err)

447}

448if response.Status != responses.ResponseStatusCompleted {

449 log.Fatalf("Response ended with status %s", response.Status)

450}

451fmt.Println(response.OutputText())

452```

453 

454```java

455import com.openai.client.okhttp.OpenAIOkHttpClient;

456import com.openai.core.JsonValue;

457import com.openai.models.responses.*;

458import java.util.*;

459 

460var tool =

461 FunctionTool.builder()

462 .name("get_test_results")

463 .description("Return a local demo test result.")

464 .strict(true)

465 .parameters(

466 FunctionTool.Parameters.builder()

467 .putAdditionalProperty("type", JsonValue.from("object"))

468 .putAdditionalProperty("properties", JsonValue.from(Map.of()))

469 .putAdditionalProperty("additionalProperties", JsonValue.from(false))

470 .build())

471 .build();

472try (var conn = client.responses().connect()) {

473 conn.send(

474 ResponsesClientEvent.ofResponseCreate(

475 ResponsesClientEvent.ResponseCreate.builder()

476 .model("gpt-6-astra")

477 .store(false)

478 .input("Find the failing test and suggest a fix.")

479 .streamId("main")

480 .addTool(tool)

481 .parallelToolCalls(false)

482 .toolChoice(ToolChoiceFunction.builder().name("get_test_results").build())

483 .build()));

484 var first = conn.finalResponse();

485 if (first.status().filter(ResponseStatus.COMPLETED::equals).isEmpty())

486 throw new IllegalStateException(

487 "Response ended with status " + first.status().orElse(null));

488 var call =

489 first.output().stream()

490 .flatMap(item -> item.functionCall().stream())

491 .filter(item -> item.name().equals("get_test_results"))

492 .findFirst()

493 .orElseThrow(() -> new IllegalStateException("Expected get_test_results call"));

494 // Use the real response and call IDs with a local demo result.

495 var result =

496 "{\"test\":\"test_fizz_buzz\",\"failure\":\"Expected FizzBuzz for 15, got Fizz.\"}";

497 conn.send(

498 ResponsesClientEvent.ofResponseCreate(

499 ResponsesClientEvent.ResponseCreate.builder()

500 .model("gpt-6-astra")

501 .streamId("main")

502 .store(false)

503 .previousResponseId(first.id())

504 .addTool(tool)

505 .toolChoice(ToolChoiceOptions.NONE)

506 .inputOfResponse(

507 List.of(

508 ResponseInputItem.ofFunctionCallOutput(

509 ResponseInputItem.FunctionCallOutput.builder()

510 .callId(call.callId())

511 .output(result)

512 .build()),

513 ResponseInputItem.ofEasyInputMessage(

514 EasyInputMessage.builder()

515 .role(EasyInputMessage.Role.USER)

516 .content("Now optimize it.")

517 .build())))

518 .build()));

519 var response = conn.finalResponse();

520 if (response.status().filter(ResponseStatus.COMPLETED::equals).isEmpty())

521 throw new IllegalStateException(

522 "Response ended with status " + response.status().orElse(null));

523 response.output().stream()

524 .flatMap(item -> item.message().stream())

525 .flatMap(message -> message.content().stream())

526 .flatMap(content -> content.outputText().stream())

527 .forEach(text -> System.out.println(text.text()));

528}

529```

530 

299```ruby531```ruby

300require "async"532require "async"

301require "openai"533require "openai"

Details

71| -------------------------- | :--------------------: | :------------------------: | :----------------------------: | :----------------------------: | :------------------------------------------------------: |71| -------------------------- | :--------------------: | :------------------------: | :----------------------------: | :----------------------------: | :------------------------------------------------------: |

72| `/v1/chat/completions` | No | 30 days | None, see below for exceptions | Yes, see below for limitations | Yes, see below for limitations |72| `/v1/chat/completions` | No | 30 days | None, see below for exceptions | Yes, see below for limitations | Yes, see below for limitations |

73| `/v1/responses` | No | 30 days | None, see below for exceptions | Yes, see below for limitations | Yes, see below for limitations |73| `/v1/responses` | No | 30 days | None, see below for exceptions | Yes, see below for limitations | Yes, see below for limitations |

74| `/v1/decisions` | No | 30 days | None, see below for exceptions | Yes, see below for limitations | Pending confirmation |

74| `/v1/conversations` | No | Until deleted | Until deleted | No | No |75| `/v1/conversations` | No | Until deleted | Until deleted | No | No |

75| `/v1/conversations/items` | No | Until deleted | Until deleted | No | No |76| `/v1/conversations/items` | No | Until deleted | Until deleted | No | No |

76| `/v1/chatkit/threads` | No | Until deleted | Until deleted | No | No |77| `/v1/chatkit/threads` | No | Until deleted | Until deleted | No | No |


118- We support [Skills](https://developers.openai.com/api/docs/guides/tools-skills) in two form factors, both local execution and hosted container-based execution. Hosted skills follow the same container lifecycle as hosted shell: mounted skills and container files remain available while the container is active and are discarded when the container expires or is deleted.119- We support [Skills](https://developers.openai.com/api/docs/guides/tools-skills) in two form factors, both local execution and hosted container-based execution. Hosted skills follow the same container lifecycle as hosted shell: mounted skills and container files remain available while the container is active and are discarded when the container expires or is deleted.

119- Data transmitted to third-party services over network connections is subject to their data retention policies.120- Data transmitted to third-party services over network connections is subject to their data retention policies.

120 121 

122#### `/v1/decisions`

123 

124By default, abuse monitoring logs are retained for up to 30 days. Eligible customers can use Zero Data Retention, subject to the limitations below.

125 

126- Prompt caching may store encrypted key/value tensors in GPU-local storage as application state. This data is stored on the local GPU machines and is not retained after the 24-hour expiration. To learn more, see the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching#prompt-cache-retention).

127- See [image and file inputs](#image-and-file-inputs) for the CSAM retention exception for image inputs.

128 

129The Decisions API is eligible for HIPAA use under an executed OpenAI Business Associate and Healthcare Addendum, subject to the applicable account configuration requirements.

130 

121#### `/v1/assistants`, `/v1/threads`, and `/v1/vector_stores`131#### `/v1/assistants`, `/v1/threads`, and `/v1/vector_stores`

122 132 

123- Objects related to the Assistants API are deleted from our servers 30 days after you delete them via the API or the dashboard. Objects that are not deleted via the API or dashboard are retained indefinitely.133- Objects related to the Assistants API are deleted from our servers 30 days after you delete them via the API or the dashboard. Objects that are not deleted via the API or dashboard are retained indefinitely.


136 146 

137#### Image and file inputs147#### Image and file inputs

138 148 

139Images and files may be uploaded as inputs to `/v1/responses` (including when using the Computer Use tool), `/v1/chat/completions`, and `/v1/images`. Image and file inputs are scanned for CSAM content upon submission. If the classifier detects potential CSAM content, the image will be retained for manual review, even if Zero Data Retention, Modified Abuse Monitoring, or Private Retention with PSP is enabled.149Images and files may be uploaded as inputs to `/v1/responses` (including when using the Computer Use tool), `/v1/chat/completions`, and `/v1/images`. Images may also be uploaded to `/v1/decisions`. Image and file inputs are scanned for CSAM content upon submission. If the classifier detects potential CSAM content, the image will be retained for manual review, even if Zero Data Retention, Modified Abuse Monitoring, or Private Retention with PSP is enabled.

140 150 

141#### Web Search151#### Web Search

142 152 


257The complete, unfiltered regional support table follows. Model snapshots for each service are listed in **API Endpoint, tool and model support**. When regional processing supports only a subset of snapshots, that subset is included in the processing-services cell.267The complete, unfiltered regional support table follows. Model snapshots for each service are listed in **API Endpoint, tool and model support**. When regional processing supports only a subset of snapshots, that subset is included in the processing-services cell.

258 268 

259| Region | Domain prefix | Regional storage | Regional processing | MAM or ZDR required | Supported modes | Storage services | Processing services |269| Region | Domain prefix | Regional storage | Regional processing | MAM or ZDR required | Supported modes | Storage services | Processing services |

260| -------------------------- | ------------------- | :--------------: | :-----------------: | :-----------------: | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |270| -------------------------- | ------------------- | :--------------: | :-----------------: | :-----------------: | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

261| United States | `us.api.openai.com` | Yes | Yes | No | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/embeddings`<br />`/v1/evals`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/live/sessions`<br />`/v1/realtime`<br />`/v1/realtime/transcription_sessions`<br />`/v1/realtime/translations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/embeddings`<br />`/v1/evals`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/live/sessions`<br />`/v1/realtime`<br />`/v1/realtime/transcription_sessions`<br />`/v1/realtime/translations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`Code Interpreter tool`<br />`File Search`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` |271| United States | `us.api.openai.com` | Yes | Yes | No | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/decisions`<br />`/v1/embeddings`<br />`/v1/evals`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/live/sessions`<br />`/v1/realtime`<br />`/v1/realtime/transcription_sessions`<br />`/v1/realtime/translations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/decisions`<br />`/v1/embeddings`<br />`/v1/evals`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/live/sessions`<br />`/v1/realtime`<br />`/v1/realtime/transcription_sessions`<br />`/v1/realtime/translations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`Code Interpreter tool`<br />`File Search`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` |

262| Europe (EEA + Switzerland) | `eu.api.openai.com` | Yes | Yes | Yes\*\* | Text, Audio, Voice, Image\* | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/embeddings`<br />`/v1/evals`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/live/sessions`<br />`/v1/realtime`<br />`/v1/realtime/transcription_sessions`<br />`/v1/realtime/translations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/embeddings`<br />`/v1/evals`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/live/sessions`<br />`/v1/realtime`<br />`/v1/realtime/transcription_sessions`<br />`/v1/realtime/translations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`Code Interpreter tool`<br />`File Search`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` |272| Europe (EEA + Switzerland) | `eu.api.openai.com` | Yes | Yes | Yes\*\* | Text, Audio, Voice, Image\* | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/decisions`<br />`/v1/embeddings`<br />`/v1/evals`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/live/sessions`<br />`/v1/realtime`<br />`/v1/realtime/transcription_sessions`<br />`/v1/realtime/translations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/decisions`<br />`/v1/embeddings`<br />`/v1/evals`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/live/sessions`<br />`/v1/realtime`<br />`/v1/realtime/transcription_sessions`<br />`/v1/realtime/translations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`Code Interpreter tool`<br />`File Search`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` |

263| Australia\* | `au.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |273| Australia\* | `au.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/decisions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |

264| Canada\* | `ca.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |274| Canada\* | `ca.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/decisions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |

265| Japan\* | `jp.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |275| Japan\* | `jp.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/decisions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |

266| India\* | `in.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |276| India\* | `in.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/decisions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |

267| Singapore\* | `sg.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |277| Singapore\* | `sg.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/decisions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |

268| South Korea\* | `kr.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |278| South Korea\* | `kr.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/decisions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |

269| United Kingdom\* | `gb.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |279| United Kingdom\* | `gb.api.openai.com` | Yes | No | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/decisions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | None |

270| United Arab Emirates\* | `ae.api.openai.com` | Yes | Yes | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | `/v1/chat/completions` (`gpt-5.6-luna`, `gpt-5.5-2026-04-23`, `gpt-5.2-2025-12-11`)<br />`/v1/embeddings` (`text-embedding-3-large`)<br />`/v1/responses` (`gpt-5.5-pro-2026-04-23`, `gpt-5.6-luna`, `gpt-5.5-2026-04-23`, `gpt-5.2-2025-12-11`) |280| United Arab Emirates\* | `ae.api.openai.com` | Yes | Yes | Yes | Text, Audio, Voice, Image | `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech`<br />`/v1/batches`<br />`/v1/chat/completions`<br />`/v1/decisions`<br />`/v1/embeddings`<br />`/v1/files`<br />`/v1/fine_tuning/jobs`<br />`/v1/images/edits`<br />`/v1/images/generations`<br />`/v1/moderations`<br />`/v1/responses`<br />`/v1/responses File Search`<br />`/v1/responses Web Search`<br />`/v1/vector_stores`<br />`Code Interpreter tool`<br />`File Search`<br />`File Uploads`<br />`Remote MCP server tool`<br />`Scale Tier`<br />`Structured Outputs (excluding schema)`<br />`Supported input modalities` | `/v1/chat/completions` (`gpt-5.6-luna`, `gpt-5.5-2026-04-23`, `gpt-5.2-2025-12-11`)<br />`/v1/embeddings` (`text-embedding-3-large`)<br />`/v1/responses` (`gpt-5.5-pro-2026-04-23`, `gpt-5.6-luna`, `gpt-5.5-2026-04-23`, `gpt-5.2-2025-12-11`) |

271 281 

272\* Image support in these regions requires approval for enhanced Zero Data Retention or enhanced Modified Abuse Monitoring.282\* Image support in these regions requires approval for enhanced Zero Data Retention or enhanced Modified Abuse Monitoring.

273 283 


276#### API Endpoint, tool and model support286#### API Endpoint, tool and model support

277 287 

278| Endpoint or feature | Service | Storage regions | Processing regions | Supported models and snapshots | Regional processing snapshot exceptions | Notes |288| Endpoint or feature | Service | Storage regions | Processing regions | Supported models and snapshots | Regional processing snapshot exceptions | Notes |

279| -------------------------------------------------------------------- | ---------------- | ----------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |289| -------------------------------------------------------------------- | ---------------- | ----------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

280| `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech` | Audio | All listed regions | United States, Europe (EEA + Switzerland) | `tts-1`, `whisper-1`, `gpt-4o-tts`, `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, `gpt-transcribe` | None | — |290| `/v1/audio/transcriptions, /v1/audio/translations, /v1/audio/speech` | Audio | All listed regions | United States, Europe (EEA + Switzerland) | `tts-1`, `whisper-1`, `gpt-4o-tts`, `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, `gpt-transcribe` | None | — |

281| `/v1/batches` | Batches | All listed regions | United States, Europe (EEA + Switzerland) | `gpt-6-astra`, `gpt-6.1-sol`, `gpt-6-sol`, `gpt-6-luna`, `gpt-5.5-pro-2026-04-23`, `gpt-5.4-pro-2026-03-05`, `gpt-5.2-pro-2025-12-11`, `gpt-5-pro-2025-10-06`, `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`, `gpt-5.5-2026-04-23`, `gpt-5.4-2026-03-05`, `gpt-5-2025-08-07`, `gpt-5.4-mini-2026-03-17`, `gpt-5.4-nano-2026-03-17`, `gpt-5.2-2025-12-11`, `gpt-5.1-2025-11-13`, `gpt-5-mini-2025-08-07`, `gpt-5-nano-2025-08-07`, `gpt-4.1-2025-04-14`, `gpt-4.1-mini-2025-04-14`, `gpt-4.1-nano-2025-04-14`, `o3-2025-04-16`, `o4-mini-2025-04-16`, `o1-pro`, `o1-pro-2025-03-19`, `o3-mini-2025-01-31`, `o1-2024-12-17`, `gpt-4o-2024-11-20`, `gpt-4o-2024-08-06`, `gpt-4o-mini-2024-07-18`, `gpt-4-turbo-2024-04-09`, `gpt-4-0613`, `gpt-3.5-turbo-0125` | None | GPT-6.1 Sol, GPT-6 Sol, and GPT-6 Luna support EU data residency with Standard, Flex, and Batch processing. GPT-6.1 Sol supports only US and EU data residency. |291| `/v1/batches` | Batches | All listed regions | United States, Europe (EEA + Switzerland) | `gpt-6-astra`, `gpt-6.1-sol`, `gpt-6-sol`, `gpt-6-luna`, `gpt-5.5-pro-2026-04-23`, `gpt-5.4-pro-2026-03-05`, `gpt-5.2-pro-2025-12-11`, `gpt-5-pro-2025-10-06`, `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`, `gpt-5.5-2026-04-23`, `gpt-5.4-2026-03-05`, `gpt-5-2025-08-07`, `gpt-5.4-mini-2026-03-17`, `gpt-5.4-nano-2026-03-17`, `gpt-5.2-2025-12-11`, `gpt-5.1-2025-11-13`, `gpt-5-mini-2025-08-07`, `gpt-5-nano-2025-08-07`, `gpt-4.1-2025-04-14`, `gpt-4.1-mini-2025-04-14`, `gpt-4.1-nano-2025-04-14`, `o3-2025-04-16`, `o4-mini-2025-04-16`, `o1-pro`, `o1-pro-2025-03-19`, `o3-mini-2025-01-31`, `o1-2024-12-17`, `gpt-4o-2024-11-20`, `gpt-4o-2024-08-06`, `gpt-4o-mini-2024-07-18`, `gpt-4-turbo-2024-04-09`, `gpt-4-0613`, `gpt-3.5-turbo-0125` | None | GPT-6.1 Sol, GPT-6 Sol, and GPT-6 Luna support EU data residency with Standard, Flex, and Batch processing. GPT-6.1 Sol supports only US and EU data residency. |

282| `/v1/chat/completions` | Chat Completions | All listed regions | United States, Europe (EEA + Switzerland), United Arab Emirates | `gpt-6-astra`, `gpt-6.1-sol`, `gpt-6-sol`, `gpt-6-luna`, `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`, `gpt-5.5-2026-04-23`, `gpt-5.4-2026-03-05`, `gpt-5.4-mini-2026-03-17`, `gpt-5.4-nano-2026-03-17`, `gpt-5.2-2025-12-11`, `gpt-5.1-2025-11-13`, `gpt-5-2025-08-07`, `gpt-5-mini-2025-08-07`, `gpt-5-nano-2025-08-07`, `gpt-4.1-2025-04-14`, `gpt-4.1-mini-2025-04-14`, `gpt-4.1-nano-2025-04-14`, `o3-mini-2025-01-31`, `o3-2025-04-16`, `o4-mini-2025-04-16`, `o1-2024-12-17`, `gpt-4o-2024-11-20`, `gpt-4o-2024-08-06`, `gpt-4o-mini-2024-07-18`, `gpt-4-turbo-2024-04-09`, `gpt-4-0613`, `gpt-3.5-turbo-0125` | United Arab Emirates: `gpt-5.6-luna`, `gpt-5.5-2026-04-23`, `gpt-5.2-2025-12-11` | Fast mode is not available with EU data residency for GPT-6 Astra, GPT-6.1 Sol, GPT-6 Sol, or GPT-6 Luna. GPT-6.1 Sol supports only US and EU data residency. |292| `/v1/chat/completions` | Chat Completions | All listed regions | United States, Europe (EEA + Switzerland), United Arab Emirates | `gpt-6-astra`, `gpt-6.1-sol`, `gpt-6-sol`, `gpt-6-luna`, `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`, `gpt-5.5-2026-04-23`, `gpt-5.4-2026-03-05`, `gpt-5.4-mini-2026-03-17`, `gpt-5.4-nano-2026-03-17`, `gpt-5.2-2025-12-11`, `gpt-5.1-2025-11-13`, `gpt-5-2025-08-07`, `gpt-5-mini-2025-08-07`, `gpt-5-nano-2025-08-07`, `gpt-4.1-2025-04-14`, `gpt-4.1-mini-2025-04-14`, `gpt-4.1-nano-2025-04-14`, `o3-mini-2025-01-31`, `o3-2025-04-16`, `o4-mini-2025-04-16`, `o1-2024-12-17`, `gpt-4o-2024-11-20`, `gpt-4o-2024-08-06`, `gpt-4o-mini-2024-07-18`, `gpt-4-turbo-2024-04-09`, `gpt-4-0613`, `gpt-3.5-turbo-0125` | United Arab Emirates: `gpt-5.6-luna`, `gpt-5.5-2026-04-23`, `gpt-5.2-2025-12-11` | Fast mode is not available with EU data residency for GPT-6 Astra, GPT-6.1 Sol, GPT-6 Sol, or GPT-6 Luna. GPT-6.1 Sol supports only US and EU data residency. |

293| `/v1/decisions` | Decisions | All listed regions | United States, Europe (EEA + Switzerland) | `gpt-6-luna` | None | Available in all supported API regions. Regional processing is supported in the United States and Europe (EEA + Switzerland). Prompt caching is subject to the retention limitations below. |

283| `/v1/embeddings` | Embeddings | All listed regions | United States, Europe (EEA + Switzerland), United Arab Emirates | `text-embedding-3-small`, `text-embedding-3-large`, `text-embedding-ada-002` | United Arab Emirates: `text-embedding-3-large` | — |294| `/v1/embeddings` | Embeddings | All listed regions | United States, Europe (EEA + Switzerland), United Arab Emirates | `text-embedding-3-small`, `text-embedding-3-large`, `text-embedding-ada-002` | United Arab Emirates: `text-embedding-3-large` | — |

284| `/v1/evals` | Evals | United States, Europe (EEA + Switzerland) | United States, Europe (EEA + Switzerland) | Service-level support | None | — |295| `/v1/evals` | Evals | United States, Europe (EEA + Switzerland) | United States, Europe (EEA + Switzerland) | Service-level support | None | — |

285| `/v1/files` | Files | All listed regions | None | Service-level support | None | — |296| `/v1/files` | Files | All listed regions | None | Service-level support | None | — |


307 318 

308### Endpoint limitations319### Endpoint limitations

309 320 

321#### /v1/decisions

322 

323The Decisions API is available in all supported API regions. Regional processing is supported in the United States and Europe (EEA + Switzerland). Availability in a region does not imply that inference is performed in that region.

324 

325- [Extended prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching#prompt-cache-retention) in regions that do not support Regional processing may require that OpenAI process and temporarily store Customer Content outside of the Region to deliver the services.

326 

310#### /v1/chat/completions327#### /v1/chat/completions

311 328 

312- Cannot set store=true in non-US regions.329- Cannot set store=true in non-US regions.

libraries.md +1 −1

Details

173<dependency>173<dependency>

174 <groupId>com.openai</groupId>174 <groupId>com.openai</groupId>

175 <artifactId>openai-java</artifactId>175 <artifactId>openai-java</artifactId>

176 <version>4.76.0</version>176 <version>4.77.0</version>

177</dependency>177</dependency>

178```178```

179 179 

models/all.md +2 −2

Details

47Advanced cyber models for defenders47Advanced cyber models for defenders

48 48 

49- [GPT-5.6 Cyber](/api/docs/models/gpt-5.6-cyber.md): Our most advanced cybersecurity model for authorized vulnerability research and security testing.49- [GPT-5.6 Cyber](/api/docs/models/gpt-5.6-cyber.md): Our most advanced cybersecurity model for authorized vulnerability research and security testing.

50- [Daybreak Red](/api/docs/models/gpt-daybreak-red-latest.md): An alias for advanced cybersecurity models for authorized vulnerability research and security testing.

51- [Daybreak Blue](/api/docs/models/gpt-daybreak-blue-latest.md): An alias for flagship general-purpose models with safeguards for defensive cybersecurity work.

52 50 

53## Life sciences51## Life sciences

54 52 


97- [omni-moderation](/api/docs/models/omni-moderation-latest.md): Identify potentially harmful content in text and images95- [omni-moderation](/api/docs/models/omni-moderation-latest.md): Identify potentially harmful content in text and images

98- [GPT-4o Mini](/api/docs/models/gpt-4o-mini.md): Fast, affordable small model for focused tasks96- [GPT-4o Mini](/api/docs/models/gpt-4o-mini.md): Fast, affordable small model for focused tasks

99- [GPT-4o](/api/docs/models/gpt-4o.md): Fast, intelligent, flexible GPT model97- [GPT-4o](/api/docs/models/gpt-4o.md): Fast, intelligent, flexible GPT model

98- [Daybreak Red](/api/docs/models/gpt-daybreak-red-latest.md): Deprecated. An alias for advanced cybersecurity models for authorized vulnerability research and security testing.

99- [Daybreak Blue](/api/docs/models/gpt-daybreak-blue-latest.md): Deprecated. An alias for flagship general-purpose models with safeguards for defensive cybersecurity work.

100- [GPT-5.4 nano](/api/docs/models/gpt-5.4-nano.md): Deprecated. Our cheapest GPT-5.4-class model for simple high-volume tasks100- [GPT-5.4 nano](/api/docs/models/gpt-5.4-nano.md): Deprecated. Our cheapest GPT-5.4-class model for simple high-volume tasks

101- [GPT-5.3-Codex](/api/docs/models/gpt-5.3-codex.md): Deprecated. The most capable agentic coding model to date.101- [GPT-5.3-Codex](/api/docs/models/gpt-5.3-codex.md): Deprecated. The most capable agentic coding model to date.

102- [GPT-5.1](/api/docs/models/gpt-5.1.md): Deprecated. The best model for coding and agentic tasks with configurable reasoning effort102- [GPT-5.1](/api/docs/models/gpt-5.1.md): Deprecated. The best model for coding and agentic tasks with configurable reasoning effort

quickstart.md +1 −1

Details

190<dependency>190<dependency>

191 <groupId>com.openai</groupId>191 <groupId>com.openai</groupId>

192 <artifactId>openai-java</artifactId>192 <artifactId>openai-java</artifactId>

193 <version>4.76.0</version>193 <version>4.77.0</version>

194</dependency>194</dependency>

195```195```

196 196