From 1b2ebfbb2ba4557497500df5fd787e8bf37a8060 Mon Sep 17 00:00:00 2001 From: apcha-oai <228803254+apcha-oai@users.noreply.github.com> Date: Thu, 10 Sep 2026 19:28:07 +0000 Subject: [PATCH] feat(agents): add beta API and one-turn streaming helpers Castiron-Internal-PR: https://github.com/openai/openai-ruby-internal/pull/71 Castiron-Source-SHA: 158509d17ef21c865f48b60bdb74de2e63e1d760 Castiron-Public-Base-SHA: 18cca401092d30da148f5a77707e8a167122e959 --- .castiron.stats.yml | 14 +- api_reference/openapi.transformed.yml | 77318 +++++++++------- docs/agents-helpers.md | 45 + lib/openai.rb | 176 + lib/openai/helpers/agents/message.rb | 20 + lib/openai/helpers/agents/session_stream.rb | 168 + lib/openai/helpers/agents/tools.rb | 65 + lib/openai/internal/token_page.rb | 91 + lib/openai/models/beta/agent.rb | 148 + .../beta/agent_close_subagent_call_item.rb | 66 + .../beta/agent_command_execution_item.rb | 93 + lib/openai/models/beta/agent_content.rb | 46 + lib/openai/models/beta/agent_create_params.rb | 128 + .../beta/agent_create_subagent_call_item.rb | 84 + lib/openai/models/beta/agent_delete_params.rb | 22 + lib/openai/models/beta/agent_deleted.rb | 40 + .../models/beta/agent_function_call_item.rb | 75 + .../models/beta/agent_function_call_output.rb | 22 + .../beta/agent_function_call_output_param.rb | 22 + .../models/beta/agent_function_call_status.rb | 27 + .../agent_interrupt_subagent_call_item.rb | 67 + lib/openai/models/beta/agent_list_params.rb | 57 + lib/openai/models/beta/agent_mcp_call_item.rb | 93 + ...ut_command_execution_output_delta_event.rb | 75 + lib/openai/models/beta/agent_output_item.rb | 53 + .../models/beta/agent_output_item_status.rb | 24 + lib/openai/models/beta/agent_reasoning.rb | 67 + .../models/beta/agent_reasoning_item.rb | 57 + .../models/beta/agent_reasoning_param.rb | 67 + .../beta/agent_resume_subagent_call_item.rb | 66 + .../models/beta/agent_retrieve_params.rb | 22 + .../agent_send_subagent_input_call_item.rb | 75 + lib/openai/models/beta/agent_session.rb | 339 + .../beta/agent_session_assistant_message.rb | 91 + .../beta/agent_session_created_event.rb | 39 + .../models/beta/agent_session_deleted.rb | 42 + ...ent_session_environment_connected_event.rb | 57 + ..._session_environment_disconnected_event.rb | 57 + .../agent_session_environment_failed_event.rb | 57 + ...agent_session_environment_pending_event.rb | 57 + .../agent_session_environment_ready_event.rb | 57 + .../beta/agent_session_environment_state.rb | 106 + .../models/beta/agent_session_error_event.rb | 48 + lib/openai/models/beta/agent_session_event.rb | 128 + .../models/beta/agent_session_failed_event.rb | 39 + .../models/beta/agent_session_idle_event.rb | 39 + .../beta/agent_session_in_progress_event.rb | 39 + .../beta/agent_session_input_message_param.rb | 51 + .../models/beta/agent_session_input_param.rb | 131 + lib/openai/models/beta/agent_session_item.rb | 186 + .../models/beta/agent_session_message.rb | 106 + .../beta/agent_session_message_content.rb | 97 + .../agent_session_requires_action_event.rb | 39 + .../agent_session_subagent_active_event.rb | 39 + .../agent_session_subagent_closed_event.rb | 39 + .../agent_session_subagent_created_event.rb | 39 + .../agent_session_turn_cancelled_event.rb | 66 + .../agent_session_turn_completed_event.rb | 66 + ...t_session_turn_content_part_added_event.rb | 84 + ...nt_session_turn_content_part_done_event.rb | 84 + .../beta/agent_session_turn_created_event.rb | 57 + .../beta/agent_session_turn_failed_event.rb | 66 + .../agent_session_turn_in_progress_event.rb | 57 + .../agent_session_turn_item_added_event.rb | 66 + .../agent_session_turn_item_done_event.rb | 66 + ...nt_session_turn_output_text_delta_event.rb | 84 + ...ent_session_turn_output_text_done_event.rb | 84 + ...turn_reasoning_summary_part_added_event.rb | 86 + ..._turn_reasoning_summary_part_done_event.rb | 93 + ...turn_reasoning_summary_text_delta_event.rb | 86 + ..._turn_reasoning_summary_text_done_event.rb | 84 + lib/openai/models/beta/agent_text.rb | 44 + lib/openai/models/beta/agent_text_param.rb | 49 + lib/openai/models/beta/agent_tool.rb | 314 + lib/openai/models/beta/agent_tool_param.rb | 359 + lib/openai/models/beta/agent_update_params.rb | 137 + .../agent_wait_for_subagents_call_item.rb | 66 + .../models/beta/agent_web_search_call_item.rb | 57 + .../models/beta/agents/environment_info.rb | 107 + .../agents/environment_retrieve_params.rb | 24 + .../agents/environments/environment_file.rb | 55 + .../environments/environment_template.rb | 368 + .../environment_template_deleted.rb | 46 + .../agents/environments/file_create_params.rb | 26 + .../agents/environments/file_list_params.rb | 77 + .../environments/template_create_params.rb | 209 + .../environments/template_delete_params.rb | 26 + .../environments/template_list_params.rb | 61 + .../environments/template_retrieve_params.rb | 26 + .../environments/template_update_params.rb | 212 + .../beta/agents/session_create_params.rb | 203 + .../beta/agents/session_delete_params.rb | 24 + .../models/beta/agents/session_list_params.rb | 73 + .../beta/agents/session_retrieve_params.rb | 24 + .../beta/agents/session_update_params.rb | 38 + .../sessions/artifact_content_params.rb | 32 + .../agents/sessions/artifact_delete_params.rb | 32 + .../agents/sessions/artifact_list_params.rb | 77 + .../sessions/artifact_retrieve_params.rb | 32 + .../agents/sessions/event_create_params.rb | 43 + .../agents/sessions/event_stream_params.rb | 26 + .../beta/agents/sessions/item_list_params.rb | 68 + .../beta/agents/sessions/session_artifact.rb | 91 + .../sessions/session_artifact_deleted.rb | 46 + .../agents/sessions/subagent_list_params.rb | 68 + .../sessions/subagent_retrieve_params.rb | 32 + .../sessions/subagents/item_list_params.rb | 77 + .../sessions/subagents/turn_list_params.rb | 77 + .../subagents/turn_retrieve_params.rb | 40 + .../subagents/turns/item_list_params.rb | 86 + .../models/beta/agents/sessions/turn.rb | 148 + .../beta/agents/sessions/turn_list_params.rb | 68 + .../agents/sessions/turn_retrieve_params.rb | 32 + lib/openai/models/beta/agents/vault.rb | 63 + .../models/beta/agents/vault_create_params.rb | 40 + .../models/beta/agents/vault_delete_params.rb | 24 + .../models/beta/agents/vault_deleted.rb | 42 + .../models/beta/agents/vault_list_params.rb | 75 + .../beta/agents/vault_retrieve_params.rb | 24 + lib/openai/models/beta/agents/vault_status.rb | 20 + .../models/beta/agents/vault_status_filter.rb | 27 + .../models/beta/agents/vaults/credential.rb | 80 + .../beta/agents/vaults/credential_auth.rb | 155 + .../vaults/credential_auth_create_param.rb | 184 + .../vaults/credential_auth_rotate_param.rb | 147 + .../agents/vaults/credential_create_params.rb | 47 + .../agents/vaults/credential_delete_params.rb | 32 + .../beta/agents/vaults/credential_deleted.rb | 44 + .../agents/vaults/credential_list_params.rb | 84 + .../vaults/credential_retrieve_params.rb | 32 + .../agents/vaults/credential_update_params.rb | 43 + .../vaults/mcp_oauth_token_endpoint_auth.rb | 78 + ..._oauth_token_endpoint_auth_create_param.rb | 96 + ..._oauth_token_endpoint_auth_rotate_param.rb | 84 + lib/openai/models/beta/environment.rb | 246 + lib/openai/models/beta/environment_param.rb | 269 + .../models/beta/hosted_environment_file.rb | 64 + .../models/beta/hosted_environment_file_id.rb | 57 + .../beta/hosted_environment_file_param.rb | 87 + lib/openai/models/beta/hosted_plugin.rb | 39 + lib/openai/models/beta/hosted_plugin_param.rb | 48 + lib/openai/models/beta/hosted_skill.rb | 55 + lib/openai/models/beta/hosted_skill_param.rb | 96 + .../models/beta/hosted_skill_reference.rb | 57 + .../beta/inline_capability_source_param.rb | 39 + lib/openai/models/beta/input_content.rb | 71 + lib/openai/models/beta/input_content_param.rb | 69 + lib/openai/models/beta/mcp_transport.rb | 96 + lib/openai/models/beta/mcp_transport_param.rb | 123 + lib/openai/models/beta/multi_agent_config.rb | 32 + .../models/beta/multi_agent_config_param.rb | 30 + lib/openai/models/beta/output_text.rb | 30 + .../models/beta/persisted_agent_tool.rb | 329 + .../models/beta/persisted_agent_tool_param.rb | 355 + .../models/beta/persisted_mcp_transport.rb | 105 + .../beta/persisted_mcp_transport_param.rb | 105 + lib/openai/models/beta/session_error.rb | 48 + lib/openai/models/beta/session_turn_error.rb | 88 + lib/openai/models/beta/setup_command_param.rb | 30 + lib/openai/models/beta/subagent.rb | 121 + lib/openai/models/beta/summary_text.rb | 30 + lib/openai/models/beta/text_format.rb | 60 + lib/openai/models/beta/text_format_param.rb | 60 + lib/openai/models/beta/token_usage.rb | 87 + lib/openai/models/beta/web_search_action.rb | 130 + .../models/chat/completion_create_params.rb | 2 +- lib/openai/resources/beta.rb | 4 + lib/openai/resources/beta/agents.rb | 213 + .../resources/beta/agents/environments.rb | 50 + .../beta/agents/environments/files.rb | 89 + .../beta/agents/environments/templates.rb | 206 + lib/openai/resources/beta/agents/sessions.rb | 294 + .../beta/agents/sessions/artifacts.rb | 155 + .../resources/beta/agents/sessions/events.rb | 80 + .../resources/beta/agents/sessions/items.rb | 57 + .../beta/agents/sessions/subagents.rb | 95 + .../beta/agents/sessions/subagents/items.rb | 66 + .../beta/agents/sessions/subagents/turns.rb | 108 + .../agents/sessions/subagents/turns/items.rb | 82 + .../resources/beta/agents/sessions/turns.rb | 89 + lib/openai/resources/beta/agents/vaults.rb | 137 + .../beta/agents/vaults/credentials.rb | 195 + lib/openai/resources/live/sessions.rb | 14 +- rbi/openai/helpers/agents.rbi | 71 + rbi/openai/internal/token_page.rbi | 25 + rbi/openai/models/beta/agent.rbi | 209 + .../beta/agent_close_subagent_call_item.rbi | 102 + .../beta/agent_command_execution_item.rbi | 132 + rbi/openai/models/beta/agent_content.rbi | 75 + .../models/beta/agent_create_params.rbi | 212 + .../beta/agent_create_subagent_call_item.rbi | 124 + .../models/beta/agent_delete_params.rbi | 53 + rbi/openai/models/beta/agent_deleted.rbi | 68 + .../models/beta/agent_function_call_item.rbi | 112 + .../beta/agent_function_call_output.rbi | 33 + .../beta/agent_function_call_output_param.rbi | 33 + .../beta/agent_function_call_status.rbi | 35 + .../agent_interrupt_subagent_call_item.rbi | 103 + rbi/openai/models/beta/agent_list_params.rbi | 102 + .../models/beta/agent_mcp_call_item.rbi | 132 + ...t_command_execution_output_delta_event.rbi | 112 + rbi/openai/models/beta/agent_output_item.rbi | 38 + .../models/beta/agent_output_item_status.rbi | 32 + rbi/openai/models/beta/agent_reasoning.rbi | 103 + .../models/beta/agent_reasoning_item.rbi | 92 + .../models/beta/agent_reasoning_param.rbi | 103 + .../beta/agent_resume_subagent_call_item.rbi | 102 + .../models/beta/agent_retrieve_params.rbi | 53 + .../agent_send_subagent_input_call_item.rbi | 114 + rbi/openai/models/beta/agent_session.rbi | 494 + .../beta/agent_session_assistant_message.rbi | 130 + .../beta/agent_session_created_event.rbi | 71 + .../models/beta/agent_session_deleted.rbi | 71 + ...nt_session_environment_connected_event.rbi | 95 + ...session_environment_disconnected_event.rbi | 95 + ...agent_session_environment_failed_event.rbi | 95 + ...gent_session_environment_pending_event.rbi | 95 + .../agent_session_environment_ready_event.rbi | 95 + .../beta/agent_session_environment_state.rbi | 168 + .../models/beta/agent_session_error_event.rbi | 80 + .../models/beta/agent_session_event.rbi | 56 + .../beta/agent_session_failed_event.rbi | 71 + .../models/beta/agent_session_idle_event.rbi | 71 + .../beta/agent_session_in_progress_event.rbi | 71 + .../agent_session_input_message_param.rbi | 100 + .../models/beta/agent_session_input_param.rbi | 232 + rbi/openai/models/beta/agent_session_item.rbi | 239 + .../models/beta/agent_session_message.rbi | 153 + .../beta/agent_session_message_content.rbi | 172 + .../agent_session_requires_action_event.rbi | 71 + .../agent_session_subagent_active_event.rbi | 71 + .../agent_session_subagent_closed_event.rbi | 71 + .../agent_session_subagent_created_event.rbi | 71 + .../agent_session_turn_cancelled_event.rbi | 108 + .../agent_session_turn_completed_event.rbi | 108 + ..._session_turn_content_part_added_event.rbi | 125 + ...t_session_turn_content_part_done_event.rbi | 125 + .../beta/agent_session_turn_created_event.rbi | 95 + .../beta/agent_session_turn_failed_event.rbi | 108 + .../agent_session_turn_in_progress_event.rbi | 95 + .../agent_session_turn_item_added_event.rbi | 117 + .../agent_session_turn_item_done_event.rbi | 115 + ...t_session_turn_output_text_delta_event.rbi | 122 + ...nt_session_turn_output_text_done_event.rbi | 122 + ...urn_reasoning_summary_part_added_event.rbi | 127 + ...turn_reasoning_summary_part_done_event.rbi | 135 + ...urn_reasoning_summary_text_delta_event.rbi | 124 + ...turn_reasoning_summary_text_done_event.rbi | 122 + rbi/openai/models/beta/agent_text.rbi | 75 + rbi/openai/models/beta/agent_text_param.rbi | 87 + rbi/openai/models/beta/agent_tool.rbi | 467 + rbi/openai/models/beta/agent_tool_param.rbi | 530 + .../models/beta/agent_update_params.rbi | 225 + .../agent_wait_for_subagents_call_item.rbi | 102 + .../beta/agent_web_search_call_item.rbi | 99 + .../models/beta/agents/environment_info.rbi | 156 + .../agents/environment_retrieve_params.rbi | 57 + .../agents/environments/environment_file.rbi | 87 + .../environments/environment_template.rbi | 582 + .../environment_template_deleted.rbi | 78 + .../environments/file_create_params.rbi | 61 + .../agents/environments/file_list_params.rbi | 130 + .../environments/template_create_params.rbi | 350 + .../environments/template_delete_params.rbi | 61 + .../environments/template_list_params.rbi | 117 + .../environments/template_retrieve_params.rbi | 61 + .../environments/template_update_params.rbi | 354 + .../beta/agents/session_create_params.rbi | 336 + .../beta/agents/session_delete_params.rbi | 57 + .../beta/agents/session_list_params.rbi | 124 + .../beta/agents/session_retrieve_params.rbi | 57 + .../beta/agents/session_update_params.rbi | 74 + .../sessions/artifact_content_params.rbi | 68 + .../sessions/artifact_delete_params.rbi | 68 + .../agents/sessions/artifact_list_params.rbi | 127 + .../sessions/artifact_retrieve_params.rbi | 68 + .../agents/sessions/event_create_params.rbi | 107 + .../agents/sessions/event_stream_params.rbi | 61 + .../beta/agents/sessions/item_list_params.rbi | 121 + .../beta/agents/sessions/session_artifact.rbi | 132 + .../sessions/session_artifact_deleted.rbi | 78 + .../agents/sessions/subagent_list_params.rbi | 123 + .../sessions/subagent_retrieve_params.rbi | 68 + .../sessions/subagents/item_list_params.rbi | 139 + .../sessions/subagents/turn_list_params.rbi | 139 + .../subagents/turn_retrieve_params.rbi | 79 + .../subagents/turns/item_list_params.rbi | 161 + .../models/beta/agents/sessions/turn.rbi | 200 + .../beta/agents/sessions/turn_list_params.rbi | 121 + .../agents/sessions/turn_retrieve_params.rbi | 68 + rbi/openai/models/beta/agents/vault.rbi | 99 + .../beta/agents/vault_create_params.rbi | 75 + .../beta/agents/vault_delete_params.rbi | 57 + .../models/beta/agents/vault_deleted.rbi | 72 + .../models/beta/agents/vault_list_params.rbi | 149 + .../beta/agents/vault_retrieve_params.rbi | 57 + .../models/beta/agents/vault_status.rbi | 30 + .../beta/agents/vault_status_filter.rbi | 39 + .../models/beta/agents/vaults/credential.rbi | 123 + .../beta/agents/vaults/credential_auth.rbi | 248 + .../vaults/credential_auth_create_param.rbi | 293 + .../vaults/credential_auth_rotate_param.rbi | 252 + .../vaults/credential_create_params.rbi | 99 + .../vaults/credential_delete_params.rbi | 68 + .../beta/agents/vaults/credential_deleted.rbi | 76 + .../agents/vaults/credential_list_params.rbi | 163 + .../vaults/credential_retrieve_params.rbi | 68 + .../vaults/credential_update_params.rbi | 95 + .../vaults/mcp_oauth_token_endpoint_auth.rbi | 151 + ...oauth_token_endpoint_auth_create_param.rbi | 171 + ...oauth_token_endpoint_auth_rotate_param.rbi | 137 + rbi/openai/models/beta/environment.rbi | 400 + rbi/openai/models/beta/environment_param.rbi | 448 + .../models/beta/hosted_environment_file.rbi | 93 + .../beta/hosted_environment_file_id.rbi | 86 + .../beta/hosted_environment_file_param.rbi | 140 + rbi/openai/models/beta/hosted_plugin.rbi | 68 + .../models/beta/hosted_plugin_param.rbi | 80 + rbi/openai/models/beta/hosted_skill.rbi | 84 + rbi/openai/models/beta/hosted_skill_param.rbi | 152 + .../models/beta/hosted_skill_reference.rbi | 86 + .../beta/inline_capability_source_param.rbi | 68 + rbi/openai/models/beta/input_content.rbi | 124 + .../models/beta/input_content_param.rbi | 122 + rbi/openai/models/beta/mcp_transport.rbi | 149 + .../models/beta/mcp_transport_param.rbi | 188 + rbi/openai/models/beta/multi_agent_config.rbi | 61 + .../models/beta/multi_agent_config_param.rbi | 62 + rbi/openai/models/beta/output_text.rbi | 59 + .../models/beta/persisted_agent_tool.rbi | 507 + .../beta/persisted_agent_tool_param.rbi | 546 + .../models/beta/persisted_mcp_transport.rbi | 158 + .../beta/persisted_mcp_transport_param.rbi | 164 + rbi/openai/models/beta/session_error.rbi | 77 + rbi/openai/models/beta/session_turn_error.rbi | 125 + .../models/beta/setup_command_param.rbi | 59 + rbi/openai/models/beta/subagent.rbi | 158 + rbi/openai/models/beta/summary_text.rbi | 59 + rbi/openai/models/beta/text_format.rbi | 113 + rbi/openai/models/beta/text_format_param.rbi | 113 + rbi/openai/models/beta/token_usage.rbi | 174 + rbi/openai/models/beta/web_search_action.rbi | 227 + rbi/openai/resources/beta.rbi | 3 + rbi/openai/resources/beta/agents.rbi | 180 + .../resources/beta/agents/environments.rbi | 44 + .../beta/agents/environments/files.rbi | 79 + .../beta/agents/environments/templates.rbi | 194 + rbi/openai/resources/beta/agents/sessions.rbi | 208 + .../beta/agents/sessions/artifacts.rbi | 105 + .../resources/beta/agents/sessions/events.rbi | 71 + .../resources/beta/agents/sessions/items.rbi | 53 + .../beta/agents/sessions/subagents.rbi | 74 + .../beta/agents/sessions/subagents/items.rbi | 60 + .../beta/agents/sessions/subagents/turns.rbi | 85 + .../agents/sessions/subagents/turns/items.rbi | 67 + .../resources/beta/agents/sessions/turns.rbi | 70 + rbi/openai/resources/beta/agents/vaults.rbi | 106 + .../beta/agents/vaults/credentials.rbi | 148 + rbi/openai/resources/live/sessions.rbi | 14 +- rbi/openai/resources/responses.rbi | 16 +- scripts/castiron/test_custom_code_report.py | 2 +- sig/openai/helpers/agents.rbs | 50 + sig/openai/internal/token_page.rbs | 15 + sig/openai/models/beta/agent.rbs | 96 + .../beta/agent_close_subagent_call_item.rbs | 47 + .../beta/agent_command_execution_item.rbs | 62 + sig/openai/models/beta/agent_content.rbs | 33 + .../models/beta/agent_create_params.rbs | 91 + .../beta/agent_create_subagent_call_item.rbs | 57 + .../models/beta/agent_delete_params.rbs | 25 + sig/openai/models/beta/agent_deleted.rbs | 24 + .../models/beta/agent_function_call_item.rbs | 52 + .../beta/agent_function_call_output.rbs | 16 + .../beta/agent_function_call_output_param.rbs | 16 + .../beta/agent_function_call_status.rbs | 26 + .../agent_interrupt_subagent_call_item.rbs | 47 + sig/openai/models/beta/agent_list_params.rbs | 58 + .../models/beta/agent_mcp_call_item.rbs | 62 + ...t_command_execution_output_delta_event.rbs | 52 + sig/openai/models/beta/agent_output_item.rbs | 25 + .../models/beta/agent_output_item_status.rbs | 22 + sig/openai/models/beta/agent_reasoning.rbs | 60 + .../models/beta/agent_reasoning_item.rbs | 42 + .../models/beta/agent_reasoning_param.rbs | 60 + .../beta/agent_resume_subagent_call_item.rbs | 47 + .../models/beta/agent_retrieve_params.rbs | 25 + .../agent_send_subagent_input_call_item.rbs | 52 + sig/openai/models/beta/agent_session.rbs | 234 + .../beta/agent_session_assistant_message.rbs | 66 + .../beta/agent_session_created_event.rbs | 32 + .../models/beta/agent_session_deleted.rbs | 28 + ...nt_session_environment_connected_event.rbs | 42 + ...session_environment_disconnected_event.rbs | 42 + ...agent_session_environment_failed_event.rbs | 42 + ...gent_session_environment_pending_event.rbs | 42 + .../agent_session_environment_ready_event.rbs | 42 + .../beta/agent_session_environment_state.rbs | 74 + .../models/beta/agent_session_error_event.rbs | 37 + .../models/beta/agent_session_event.rbs | 43 + .../beta/agent_session_failed_event.rbs | 32 + .../models/beta/agent_session_idle_event.rbs | 32 + .../beta/agent_session_in_progress_event.rbs | 32 + .../agent_session_input_message_param.rbs | 46 + .../models/beta/agent_session_input_param.rbs | 91 + sig/openai/models/beta/agent_session_item.rbs | 116 + .../models/beta/agent_session_message.rbs | 77 + .../beta/agent_session_message_content.rbs | 52 + .../agent_session_requires_action_event.rbs | 32 + .../agent_session_subagent_active_event.rbs | 32 + .../agent_session_subagent_closed_event.rbs | 32 + .../agent_session_subagent_created_event.rbs | 32 + .../agent_session_turn_cancelled_event.rbs | 47 + .../agent_session_turn_completed_event.rbs | 47 + ..._session_turn_content_part_added_event.rbs | 57 + ...t_session_turn_content_part_done_event.rbs | 57 + .../beta/agent_session_turn_created_event.rbs | 42 + .../beta/agent_session_turn_failed_event.rbs | 47 + .../agent_session_turn_in_progress_event.rbs | 42 + .../agent_session_turn_item_added_event.rbs | 47 + .../agent_session_turn_item_done_event.rbs | 47 + ...t_session_turn_output_text_delta_event.rbs | 57 + ...nt_session_turn_output_text_done_event.rbs | 57 + ...urn_reasoning_summary_part_added_event.rbs | 57 + ...turn_reasoning_summary_part_done_event.rbs | 64 + ...urn_reasoning_summary_text_delta_event.rbs | 57 + ...turn_reasoning_summary_text_done_event.rbs | 57 + sig/openai/models/beta/agent_text.rbs | 39 + sig/openai/models/beta/agent_text_param.rbs | 44 + sig/openai/models/beta/agent_tool.rbs | 226 + sig/openai/models/beta/agent_tool_param.rbs | 251 + .../models/beta/agent_update_params.rbs | 98 + .../agent_wait_for_subagents_call_item.rbs | 47 + .../beta/agent_web_search_call_item.rbs | 42 + .../models/beta/agents/environment_info.rbs | 80 + .../agents/environment_retrieve_params.rbs | 27 + .../agents/environments/environment_file.rbs | 43 + .../environments/environment_template.rbs | 255 + .../environment_template_deleted.rbs | 38 + .../environments/file_create_params.rbs | 29 + .../agents/environments/file_list_params.rbs | 72 + .../environments/template_create_params.rbs | 138 + .../environments/template_delete_params.rbs | 32 + .../environments/template_list_params.rbs | 64 + .../environments/template_retrieve_params.rbs | 32 + .../environments/template_update_params.rbs | 143 + .../beta/agents/session_create_params.rbs | 144 + .../beta/agents/session_delete_params.rbs | 27 + .../beta/agents/session_list_params.rbs | 67 + .../beta/agents/session_retrieve_params.rbs | 27 + .../beta/agents/session_update_params.rbs | 35 + .../sessions/artifact_content_params.rbs | 37 + .../sessions/artifact_delete_params.rbs | 37 + .../agents/sessions/artifact_list_params.rbs | 70 + .../sessions/artifact_retrieve_params.rbs | 37 + .../agents/sessions/event_create_params.rbs | 44 + .../agents/sessions/event_stream_params.rbs | 29 + .../beta/agents/sessions/item_list_params.rbs | 69 + .../beta/agents/sessions/session_artifact.rbs | 63 + .../sessions/session_artifact_deleted.rbs | 38 + .../agents/sessions/subagent_list_params.rbs | 69 + .../sessions/subagent_retrieve_params.rbs | 37 + .../sessions/subagents/item_list_params.rbs | 76 + .../sessions/subagents/turn_list_params.rbs | 76 + .../subagents/turn_retrieve_params.rbs | 44 + .../subagents/turns/item_list_params.rbs | 83 + .../models/beta/agents/sessions/turn.rbs | 108 + .../beta/agents/sessions/turn_list_params.rbs | 69 + .../agents/sessions/turn_retrieve_params.rbs | 37 + sig/openai/models/beta/agents/vault.rbs | 44 + .../beta/agents/vault_create_params.rbs | 37 + .../beta/agents/vault_delete_params.rbs | 27 + .../models/beta/agents/vault_deleted.rbs | 30 + .../models/beta/agents/vault_list_params.rbs | 69 + .../beta/agents/vault_retrieve_params.rbs | 27 + .../models/beta/agents/vault_status.rbs | 18 + .../beta/agents/vault_status_filter.rbs | 19 + .../models/beta/agents/vaults/credential.rbs | 56 + .../beta/agents/vaults/credential_auth.rbs | 104 + .../vaults/credential_auth_create_param.rbs | 121 + .../vaults/credential_auth_rotate_param.rbs | 90 + .../vaults/credential_create_params.rbs | 42 + .../vaults/credential_delete_params.rbs | 37 + .../beta/agents/vaults/credential_deleted.rbs | 32 + .../agents/vaults/credential_list_params.rbs | 76 + .../vaults/credential_retrieve_params.rbs | 37 + .../vaults/credential_update_params.rbs | 42 + .../vaults/mcp_oauth_token_endpoint_auth.rbs | 50 + ...oauth_token_endpoint_auth_create_param.rbs | 68 + ...oauth_token_endpoint_auth_rotate_param.rbs | 57 + sig/openai/models/beta/environment.rbs | 181 + sig/openai/models/beta/environment_param.rbs | 183 + .../models/beta/hosted_environment_file.rbs | 42 + .../beta/hosted_environment_file_id.rbs | 42 + .../beta/hosted_environment_file_param.rbs | 47 + sig/openai/models/beta/hosted_plugin.rbs | 23 + .../models/beta/hosted_plugin_param.rbs | 37 + sig/openai/models/beta/hosted_skill.rbs | 32 + sig/openai/models/beta/hosted_skill_param.rbs | 70 + .../models/beta/hosted_skill_reference.rbs | 42 + .../beta/inline_capability_source_param.rbs | 28 + sig/openai/models/beta/input_content.rbs | 39 + .../models/beta/input_content_param.rbs | 39 + sig/openai/models/beta/mcp_transport.rbs | 63 + .../models/beta/mcp_transport_param.rbs | 89 + sig/openai/models/beta/multi_agent_config.rbs | 21 + .../models/beta/multi_agent_config_param.rbs | 23 + sig/openai/models/beta/output_text.rbs | 17 + .../models/beta/persisted_agent_tool.rbs | 237 + .../beta/persisted_agent_tool_param.rbs | 251 + .../models/beta/persisted_mcp_transport.rbs | 75 + .../beta/persisted_mcp_transport_param.rbs | 79 + sig/openai/models/beta/session_error.rbs | 32 + sig/openai/models/beta/session_turn_error.rbs | 96 + .../models/beta/setup_command_param.rbs | 17 + sig/openai/models/beta/subagent.rbs | 76 + sig/openai/models/beta/summary_text.rbs | 17 + sig/openai/models/beta/text_format.rbs | 39 + sig/openai/models/beta/text_format_param.rbs | 40 + sig/openai/models/beta/token_usage.rbs | 62 + sig/openai/models/beta/web_search_action.rbs | 85 + sig/openai/resources/beta.rbs | 2 + sig/openai/resources/beta/agents.rbs | 59 + .../resources/beta/agents/environments.rbs | 20 + .../beta/agents/environments/files.rbs | 28 + .../beta/agents/environments/templates.rbs | 57 + sig/openai/resources/beta/agents/sessions.rbs | 65 + .../beta/agents/sessions/artifacts.rbs | 40 + .../resources/beta/agents/sessions/events.rbs | 25 + .../resources/beta/agents/sessions/items.rbs | 21 + .../beta/agents/sessions/subagents.rbs | 31 + .../beta/agents/sessions/subagents/items.rbs | 24 + .../beta/agents/sessions/subagents/turns.rbs | 33 + .../agents/sessions/subagents/turns/items.rbs | 27 + .../resources/beta/agents/sessions/turns.rbs | 27 + sig/openai/resources/beta/agents/vaults.rbs | 37 + .../beta/agents/vaults/credentials.rbs | 48 + .../agent_session_stream_valid.rb.txt | 11 + .../helpers/agent_session_stream_test.rb | 464 + test/openai/resource_namespaces.rb | 51 + .../resources/agents_pagination_test.rb | 99 + .../beta/agents/environments/files_test.rb | 50 + .../agents/environments/templates_test.rb | 132 + .../beta/agents/environments_test.rb | 25 + .../beta/agents/sessions/artifacts_test.rb | 78 + .../beta/agents/sessions/events_test.rb | 21 + .../beta/agents/sessions/items_test.rb | 146 + .../agents/sessions/subagents/items_test.rb | 146 + .../sessions/subagents/turns/items_test.rb | 150 + .../agents/sessions/subagents/turns_test.rb | 64 + .../beta/agents/sessions/subagents_test.rb | 56 + .../beta/agents/sessions/turns_test.rb | 60 + .../resources/beta/agents/sessions_test.rb | 128 + .../beta/agents/vaults/credentials_test.rb | 116 + .../resources/beta/agents/vaults_test.rb | 82 + test/openai/resources/beta/agents_test.rb | 132 + .../resources/environment_token_page_test.rb | 56 + 556 files changed, 93758 insertions(+), 33276 deletions(-) create mode 100644 docs/agents-helpers.md create mode 100644 lib/openai/helpers/agents/message.rb create mode 100644 lib/openai/helpers/agents/session_stream.rb create mode 100644 lib/openai/helpers/agents/tools.rb create mode 100644 lib/openai/internal/token_page.rb create mode 100644 lib/openai/models/beta/agent.rb create mode 100644 lib/openai/models/beta/agent_close_subagent_call_item.rb create mode 100644 lib/openai/models/beta/agent_command_execution_item.rb create mode 100644 lib/openai/models/beta/agent_content.rb create mode 100644 lib/openai/models/beta/agent_create_params.rb create mode 100644 lib/openai/models/beta/agent_create_subagent_call_item.rb create mode 100644 lib/openai/models/beta/agent_delete_params.rb create mode 100644 lib/openai/models/beta/agent_deleted.rb create mode 100644 lib/openai/models/beta/agent_function_call_item.rb create mode 100644 lib/openai/models/beta/agent_function_call_output.rb create mode 100644 lib/openai/models/beta/agent_function_call_output_param.rb create mode 100644 lib/openai/models/beta/agent_function_call_status.rb create mode 100644 lib/openai/models/beta/agent_interrupt_subagent_call_item.rb create mode 100644 lib/openai/models/beta/agent_list_params.rb create mode 100644 lib/openai/models/beta/agent_mcp_call_item.rb create mode 100644 lib/openai/models/beta/agent_output_command_execution_output_delta_event.rb create mode 100644 lib/openai/models/beta/agent_output_item.rb create mode 100644 lib/openai/models/beta/agent_output_item_status.rb create mode 100644 lib/openai/models/beta/agent_reasoning.rb create mode 100644 lib/openai/models/beta/agent_reasoning_item.rb create mode 100644 lib/openai/models/beta/agent_reasoning_param.rb create mode 100644 lib/openai/models/beta/agent_resume_subagent_call_item.rb create mode 100644 lib/openai/models/beta/agent_retrieve_params.rb create mode 100644 lib/openai/models/beta/agent_send_subagent_input_call_item.rb create mode 100644 lib/openai/models/beta/agent_session.rb create mode 100644 lib/openai/models/beta/agent_session_assistant_message.rb create mode 100644 lib/openai/models/beta/agent_session_created_event.rb create mode 100644 lib/openai/models/beta/agent_session_deleted.rb create mode 100644 lib/openai/models/beta/agent_session_environment_connected_event.rb create mode 100644 lib/openai/models/beta/agent_session_environment_disconnected_event.rb create mode 100644 lib/openai/models/beta/agent_session_environment_failed_event.rb create mode 100644 lib/openai/models/beta/agent_session_environment_pending_event.rb create mode 100644 lib/openai/models/beta/agent_session_environment_ready_event.rb create mode 100644 lib/openai/models/beta/agent_session_environment_state.rb create mode 100644 lib/openai/models/beta/agent_session_error_event.rb create mode 100644 lib/openai/models/beta/agent_session_event.rb create mode 100644 lib/openai/models/beta/agent_session_failed_event.rb create mode 100644 lib/openai/models/beta/agent_session_idle_event.rb create mode 100644 lib/openai/models/beta/agent_session_in_progress_event.rb create mode 100644 lib/openai/models/beta/agent_session_input_message_param.rb create mode 100644 lib/openai/models/beta/agent_session_input_param.rb create mode 100644 lib/openai/models/beta/agent_session_item.rb create mode 100644 lib/openai/models/beta/agent_session_message.rb create mode 100644 lib/openai/models/beta/agent_session_message_content.rb create mode 100644 lib/openai/models/beta/agent_session_requires_action_event.rb create mode 100644 lib/openai/models/beta/agent_session_subagent_active_event.rb create mode 100644 lib/openai/models/beta/agent_session_subagent_closed_event.rb create mode 100644 lib/openai/models/beta/agent_session_subagent_created_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_cancelled_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_completed_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_content_part_added_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_content_part_done_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_created_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_failed_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_in_progress_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_item_added_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_item_done_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_output_text_delta_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_output_text_done_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_reasoning_summary_part_added_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_reasoning_summary_part_done_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_reasoning_summary_text_delta_event.rb create mode 100644 lib/openai/models/beta/agent_session_turn_reasoning_summary_text_done_event.rb create mode 100644 lib/openai/models/beta/agent_text.rb create mode 100644 lib/openai/models/beta/agent_text_param.rb create mode 100644 lib/openai/models/beta/agent_tool.rb create mode 100644 lib/openai/models/beta/agent_tool_param.rb create mode 100644 lib/openai/models/beta/agent_update_params.rb create mode 100644 lib/openai/models/beta/agent_wait_for_subagents_call_item.rb create mode 100644 lib/openai/models/beta/agent_web_search_call_item.rb create mode 100644 lib/openai/models/beta/agents/environment_info.rb create mode 100644 lib/openai/models/beta/agents/environment_retrieve_params.rb create mode 100644 lib/openai/models/beta/agents/environments/environment_file.rb create mode 100644 lib/openai/models/beta/agents/environments/environment_template.rb create mode 100644 lib/openai/models/beta/agents/environments/environment_template_deleted.rb create mode 100644 lib/openai/models/beta/agents/environments/file_create_params.rb create mode 100644 lib/openai/models/beta/agents/environments/file_list_params.rb create mode 100644 lib/openai/models/beta/agents/environments/template_create_params.rb create mode 100644 lib/openai/models/beta/agents/environments/template_delete_params.rb create mode 100644 lib/openai/models/beta/agents/environments/template_list_params.rb create mode 100644 lib/openai/models/beta/agents/environments/template_retrieve_params.rb create mode 100644 lib/openai/models/beta/agents/environments/template_update_params.rb create mode 100644 lib/openai/models/beta/agents/session_create_params.rb create mode 100644 lib/openai/models/beta/agents/session_delete_params.rb create mode 100644 lib/openai/models/beta/agents/session_list_params.rb create mode 100644 lib/openai/models/beta/agents/session_retrieve_params.rb create mode 100644 lib/openai/models/beta/agents/session_update_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/artifact_content_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/artifact_delete_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/artifact_list_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/artifact_retrieve_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/event_create_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/event_stream_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/item_list_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/session_artifact.rb create mode 100644 lib/openai/models/beta/agents/sessions/session_artifact_deleted.rb create mode 100644 lib/openai/models/beta/agents/sessions/subagent_list_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/subagent_retrieve_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/subagents/item_list_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/subagents/turn_list_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/subagents/turn_retrieve_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/subagents/turns/item_list_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/turn.rb create mode 100644 lib/openai/models/beta/agents/sessions/turn_list_params.rb create mode 100644 lib/openai/models/beta/agents/sessions/turn_retrieve_params.rb create mode 100644 lib/openai/models/beta/agents/vault.rb create mode 100644 lib/openai/models/beta/agents/vault_create_params.rb create mode 100644 lib/openai/models/beta/agents/vault_delete_params.rb create mode 100644 lib/openai/models/beta/agents/vault_deleted.rb create mode 100644 lib/openai/models/beta/agents/vault_list_params.rb create mode 100644 lib/openai/models/beta/agents/vault_retrieve_params.rb create mode 100644 lib/openai/models/beta/agents/vault_status.rb create mode 100644 lib/openai/models/beta/agents/vault_status_filter.rb create mode 100644 lib/openai/models/beta/agents/vaults/credential.rb create mode 100644 lib/openai/models/beta/agents/vaults/credential_auth.rb create mode 100644 lib/openai/models/beta/agents/vaults/credential_auth_create_param.rb create mode 100644 lib/openai/models/beta/agents/vaults/credential_auth_rotate_param.rb create mode 100644 lib/openai/models/beta/agents/vaults/credential_create_params.rb create mode 100644 lib/openai/models/beta/agents/vaults/credential_delete_params.rb create mode 100644 lib/openai/models/beta/agents/vaults/credential_deleted.rb create mode 100644 lib/openai/models/beta/agents/vaults/credential_list_params.rb create mode 100644 lib/openai/models/beta/agents/vaults/credential_retrieve_params.rb create mode 100644 lib/openai/models/beta/agents/vaults/credential_update_params.rb create mode 100644 lib/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth.rb create mode 100644 lib/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_create_param.rb create mode 100644 lib/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_rotate_param.rb create mode 100644 lib/openai/models/beta/environment.rb create mode 100644 lib/openai/models/beta/environment_param.rb create mode 100644 lib/openai/models/beta/hosted_environment_file.rb create mode 100644 lib/openai/models/beta/hosted_environment_file_id.rb create mode 100644 lib/openai/models/beta/hosted_environment_file_param.rb create mode 100644 lib/openai/models/beta/hosted_plugin.rb create mode 100644 lib/openai/models/beta/hosted_plugin_param.rb create mode 100644 lib/openai/models/beta/hosted_skill.rb create mode 100644 lib/openai/models/beta/hosted_skill_param.rb create mode 100644 lib/openai/models/beta/hosted_skill_reference.rb create mode 100644 lib/openai/models/beta/inline_capability_source_param.rb create mode 100644 lib/openai/models/beta/input_content.rb create mode 100644 lib/openai/models/beta/input_content_param.rb create mode 100644 lib/openai/models/beta/mcp_transport.rb create mode 100644 lib/openai/models/beta/mcp_transport_param.rb create mode 100644 lib/openai/models/beta/multi_agent_config.rb create mode 100644 lib/openai/models/beta/multi_agent_config_param.rb create mode 100644 lib/openai/models/beta/output_text.rb create mode 100644 lib/openai/models/beta/persisted_agent_tool.rb create mode 100644 lib/openai/models/beta/persisted_agent_tool_param.rb create mode 100644 lib/openai/models/beta/persisted_mcp_transport.rb create mode 100644 lib/openai/models/beta/persisted_mcp_transport_param.rb create mode 100644 lib/openai/models/beta/session_error.rb create mode 100644 lib/openai/models/beta/session_turn_error.rb create mode 100644 lib/openai/models/beta/setup_command_param.rb create mode 100644 lib/openai/models/beta/subagent.rb create mode 100644 lib/openai/models/beta/summary_text.rb create mode 100644 lib/openai/models/beta/text_format.rb create mode 100644 lib/openai/models/beta/text_format_param.rb create mode 100644 lib/openai/models/beta/token_usage.rb create mode 100644 lib/openai/models/beta/web_search_action.rb create mode 100644 lib/openai/resources/beta/agents.rb create mode 100644 lib/openai/resources/beta/agents/environments.rb create mode 100644 lib/openai/resources/beta/agents/environments/files.rb create mode 100644 lib/openai/resources/beta/agents/environments/templates.rb create mode 100644 lib/openai/resources/beta/agents/sessions.rb create mode 100644 lib/openai/resources/beta/agents/sessions/artifacts.rb create mode 100644 lib/openai/resources/beta/agents/sessions/events.rb create mode 100644 lib/openai/resources/beta/agents/sessions/items.rb create mode 100644 lib/openai/resources/beta/agents/sessions/subagents.rb create mode 100644 lib/openai/resources/beta/agents/sessions/subagents/items.rb create mode 100644 lib/openai/resources/beta/agents/sessions/subagents/turns.rb create mode 100644 lib/openai/resources/beta/agents/sessions/subagents/turns/items.rb create mode 100644 lib/openai/resources/beta/agents/sessions/turns.rb create mode 100644 lib/openai/resources/beta/agents/vaults.rb create mode 100644 lib/openai/resources/beta/agents/vaults/credentials.rb create mode 100644 rbi/openai/helpers/agents.rbi create mode 100644 rbi/openai/internal/token_page.rbi create mode 100644 rbi/openai/models/beta/agent.rbi create mode 100644 rbi/openai/models/beta/agent_close_subagent_call_item.rbi create mode 100644 rbi/openai/models/beta/agent_command_execution_item.rbi create mode 100644 rbi/openai/models/beta/agent_content.rbi create mode 100644 rbi/openai/models/beta/agent_create_params.rbi create mode 100644 rbi/openai/models/beta/agent_create_subagent_call_item.rbi create mode 100644 rbi/openai/models/beta/agent_delete_params.rbi create mode 100644 rbi/openai/models/beta/agent_deleted.rbi create mode 100644 rbi/openai/models/beta/agent_function_call_item.rbi create mode 100644 rbi/openai/models/beta/agent_function_call_output.rbi create mode 100644 rbi/openai/models/beta/agent_function_call_output_param.rbi create mode 100644 rbi/openai/models/beta/agent_function_call_status.rbi create mode 100644 rbi/openai/models/beta/agent_interrupt_subagent_call_item.rbi create mode 100644 rbi/openai/models/beta/agent_list_params.rbi create mode 100644 rbi/openai/models/beta/agent_mcp_call_item.rbi create mode 100644 rbi/openai/models/beta/agent_output_command_execution_output_delta_event.rbi create mode 100644 rbi/openai/models/beta/agent_output_item.rbi create mode 100644 rbi/openai/models/beta/agent_output_item_status.rbi create mode 100644 rbi/openai/models/beta/agent_reasoning.rbi create mode 100644 rbi/openai/models/beta/agent_reasoning_item.rbi create mode 100644 rbi/openai/models/beta/agent_reasoning_param.rbi create mode 100644 rbi/openai/models/beta/agent_resume_subagent_call_item.rbi create mode 100644 rbi/openai/models/beta/agent_retrieve_params.rbi create mode 100644 rbi/openai/models/beta/agent_send_subagent_input_call_item.rbi create mode 100644 rbi/openai/models/beta/agent_session.rbi create mode 100644 rbi/openai/models/beta/agent_session_assistant_message.rbi create mode 100644 rbi/openai/models/beta/agent_session_created_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_deleted.rbi create mode 100644 rbi/openai/models/beta/agent_session_environment_connected_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_environment_disconnected_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_environment_failed_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_environment_pending_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_environment_ready_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_environment_state.rbi create mode 100644 rbi/openai/models/beta/agent_session_error_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_failed_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_idle_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_in_progress_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_input_message_param.rbi create mode 100644 rbi/openai/models/beta/agent_session_input_param.rbi create mode 100644 rbi/openai/models/beta/agent_session_item.rbi create mode 100644 rbi/openai/models/beta/agent_session_message.rbi create mode 100644 rbi/openai/models/beta/agent_session_message_content.rbi create mode 100644 rbi/openai/models/beta/agent_session_requires_action_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_subagent_active_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_subagent_closed_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_subagent_created_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_cancelled_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_completed_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_content_part_added_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_content_part_done_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_created_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_failed_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_in_progress_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_item_added_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_item_done_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_output_text_delta_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_output_text_done_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_reasoning_summary_part_added_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_reasoning_summary_part_done_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_reasoning_summary_text_delta_event.rbi create mode 100644 rbi/openai/models/beta/agent_session_turn_reasoning_summary_text_done_event.rbi create mode 100644 rbi/openai/models/beta/agent_text.rbi create mode 100644 rbi/openai/models/beta/agent_text_param.rbi create mode 100644 rbi/openai/models/beta/agent_tool.rbi create mode 100644 rbi/openai/models/beta/agent_tool_param.rbi create mode 100644 rbi/openai/models/beta/agent_update_params.rbi create mode 100644 rbi/openai/models/beta/agent_wait_for_subagents_call_item.rbi create mode 100644 rbi/openai/models/beta/agent_web_search_call_item.rbi create mode 100644 rbi/openai/models/beta/agents/environment_info.rbi create mode 100644 rbi/openai/models/beta/agents/environment_retrieve_params.rbi create mode 100644 rbi/openai/models/beta/agents/environments/environment_file.rbi create mode 100644 rbi/openai/models/beta/agents/environments/environment_template.rbi create mode 100644 rbi/openai/models/beta/agents/environments/environment_template_deleted.rbi create mode 100644 rbi/openai/models/beta/agents/environments/file_create_params.rbi create mode 100644 rbi/openai/models/beta/agents/environments/file_list_params.rbi create mode 100644 rbi/openai/models/beta/agents/environments/template_create_params.rbi create mode 100644 rbi/openai/models/beta/agents/environments/template_delete_params.rbi create mode 100644 rbi/openai/models/beta/agents/environments/template_list_params.rbi create mode 100644 rbi/openai/models/beta/agents/environments/template_retrieve_params.rbi create mode 100644 rbi/openai/models/beta/agents/environments/template_update_params.rbi create mode 100644 rbi/openai/models/beta/agents/session_create_params.rbi create mode 100644 rbi/openai/models/beta/agents/session_delete_params.rbi create mode 100644 rbi/openai/models/beta/agents/session_list_params.rbi create mode 100644 rbi/openai/models/beta/agents/session_retrieve_params.rbi create mode 100644 rbi/openai/models/beta/agents/session_update_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/artifact_content_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/artifact_delete_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/artifact_list_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/artifact_retrieve_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/event_create_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/event_stream_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/item_list_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/session_artifact.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/session_artifact_deleted.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/subagent_list_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/subagent_retrieve_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/subagents/item_list_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/subagents/turn_list_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/subagents/turn_retrieve_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/subagents/turns/item_list_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/turn.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/turn_list_params.rbi create mode 100644 rbi/openai/models/beta/agents/sessions/turn_retrieve_params.rbi create mode 100644 rbi/openai/models/beta/agents/vault.rbi create mode 100644 rbi/openai/models/beta/agents/vault_create_params.rbi create mode 100644 rbi/openai/models/beta/agents/vault_delete_params.rbi create mode 100644 rbi/openai/models/beta/agents/vault_deleted.rbi create mode 100644 rbi/openai/models/beta/agents/vault_list_params.rbi create mode 100644 rbi/openai/models/beta/agents/vault_retrieve_params.rbi create mode 100644 rbi/openai/models/beta/agents/vault_status.rbi create mode 100644 rbi/openai/models/beta/agents/vault_status_filter.rbi create mode 100644 rbi/openai/models/beta/agents/vaults/credential.rbi create mode 100644 rbi/openai/models/beta/agents/vaults/credential_auth.rbi create mode 100644 rbi/openai/models/beta/agents/vaults/credential_auth_create_param.rbi create mode 100644 rbi/openai/models/beta/agents/vaults/credential_auth_rotate_param.rbi create mode 100644 rbi/openai/models/beta/agents/vaults/credential_create_params.rbi create mode 100644 rbi/openai/models/beta/agents/vaults/credential_delete_params.rbi create mode 100644 rbi/openai/models/beta/agents/vaults/credential_deleted.rbi create mode 100644 rbi/openai/models/beta/agents/vaults/credential_list_params.rbi create mode 100644 rbi/openai/models/beta/agents/vaults/credential_retrieve_params.rbi create mode 100644 rbi/openai/models/beta/agents/vaults/credential_update_params.rbi create mode 100644 rbi/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth.rbi create mode 100644 rbi/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_create_param.rbi create mode 100644 rbi/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_rotate_param.rbi create mode 100644 rbi/openai/models/beta/environment.rbi create mode 100644 rbi/openai/models/beta/environment_param.rbi create mode 100644 rbi/openai/models/beta/hosted_environment_file.rbi create mode 100644 rbi/openai/models/beta/hosted_environment_file_id.rbi create mode 100644 rbi/openai/models/beta/hosted_environment_file_param.rbi create mode 100644 rbi/openai/models/beta/hosted_plugin.rbi create mode 100644 rbi/openai/models/beta/hosted_plugin_param.rbi create mode 100644 rbi/openai/models/beta/hosted_skill.rbi create mode 100644 rbi/openai/models/beta/hosted_skill_param.rbi create mode 100644 rbi/openai/models/beta/hosted_skill_reference.rbi create mode 100644 rbi/openai/models/beta/inline_capability_source_param.rbi create mode 100644 rbi/openai/models/beta/input_content.rbi create mode 100644 rbi/openai/models/beta/input_content_param.rbi create mode 100644 rbi/openai/models/beta/mcp_transport.rbi create mode 100644 rbi/openai/models/beta/mcp_transport_param.rbi create mode 100644 rbi/openai/models/beta/multi_agent_config.rbi create mode 100644 rbi/openai/models/beta/multi_agent_config_param.rbi create mode 100644 rbi/openai/models/beta/output_text.rbi create mode 100644 rbi/openai/models/beta/persisted_agent_tool.rbi create mode 100644 rbi/openai/models/beta/persisted_agent_tool_param.rbi create mode 100644 rbi/openai/models/beta/persisted_mcp_transport.rbi create mode 100644 rbi/openai/models/beta/persisted_mcp_transport_param.rbi create mode 100644 rbi/openai/models/beta/session_error.rbi create mode 100644 rbi/openai/models/beta/session_turn_error.rbi create mode 100644 rbi/openai/models/beta/setup_command_param.rbi create mode 100644 rbi/openai/models/beta/subagent.rbi create mode 100644 rbi/openai/models/beta/summary_text.rbi create mode 100644 rbi/openai/models/beta/text_format.rbi create mode 100644 rbi/openai/models/beta/text_format_param.rbi create mode 100644 rbi/openai/models/beta/token_usage.rbi create mode 100644 rbi/openai/models/beta/web_search_action.rbi create mode 100644 rbi/openai/resources/beta/agents.rbi create mode 100644 rbi/openai/resources/beta/agents/environments.rbi create mode 100644 rbi/openai/resources/beta/agents/environments/files.rbi create mode 100644 rbi/openai/resources/beta/agents/environments/templates.rbi create mode 100644 rbi/openai/resources/beta/agents/sessions.rbi create mode 100644 rbi/openai/resources/beta/agents/sessions/artifacts.rbi create mode 100644 rbi/openai/resources/beta/agents/sessions/events.rbi create mode 100644 rbi/openai/resources/beta/agents/sessions/items.rbi create mode 100644 rbi/openai/resources/beta/agents/sessions/subagents.rbi create mode 100644 rbi/openai/resources/beta/agents/sessions/subagents/items.rbi create mode 100644 rbi/openai/resources/beta/agents/sessions/subagents/turns.rbi create mode 100644 rbi/openai/resources/beta/agents/sessions/subagents/turns/items.rbi create mode 100644 rbi/openai/resources/beta/agents/sessions/turns.rbi create mode 100644 rbi/openai/resources/beta/agents/vaults.rbi create mode 100644 rbi/openai/resources/beta/agents/vaults/credentials.rbi create mode 100644 sig/openai/helpers/agents.rbs create mode 100644 sig/openai/internal/token_page.rbs create mode 100644 sig/openai/models/beta/agent.rbs create mode 100644 sig/openai/models/beta/agent_close_subagent_call_item.rbs create mode 100644 sig/openai/models/beta/agent_command_execution_item.rbs create mode 100644 sig/openai/models/beta/agent_content.rbs create mode 100644 sig/openai/models/beta/agent_create_params.rbs create mode 100644 sig/openai/models/beta/agent_create_subagent_call_item.rbs create mode 100644 sig/openai/models/beta/agent_delete_params.rbs create mode 100644 sig/openai/models/beta/agent_deleted.rbs create mode 100644 sig/openai/models/beta/agent_function_call_item.rbs create mode 100644 sig/openai/models/beta/agent_function_call_output.rbs create mode 100644 sig/openai/models/beta/agent_function_call_output_param.rbs create mode 100644 sig/openai/models/beta/agent_function_call_status.rbs create mode 100644 sig/openai/models/beta/agent_interrupt_subagent_call_item.rbs create mode 100644 sig/openai/models/beta/agent_list_params.rbs create mode 100644 sig/openai/models/beta/agent_mcp_call_item.rbs create mode 100644 sig/openai/models/beta/agent_output_command_execution_output_delta_event.rbs create mode 100644 sig/openai/models/beta/agent_output_item.rbs create mode 100644 sig/openai/models/beta/agent_output_item_status.rbs create mode 100644 sig/openai/models/beta/agent_reasoning.rbs create mode 100644 sig/openai/models/beta/agent_reasoning_item.rbs create mode 100644 sig/openai/models/beta/agent_reasoning_param.rbs create mode 100644 sig/openai/models/beta/agent_resume_subagent_call_item.rbs create mode 100644 sig/openai/models/beta/agent_retrieve_params.rbs create mode 100644 sig/openai/models/beta/agent_send_subagent_input_call_item.rbs create mode 100644 sig/openai/models/beta/agent_session.rbs create mode 100644 sig/openai/models/beta/agent_session_assistant_message.rbs create mode 100644 sig/openai/models/beta/agent_session_created_event.rbs create mode 100644 sig/openai/models/beta/agent_session_deleted.rbs create mode 100644 sig/openai/models/beta/agent_session_environment_connected_event.rbs create mode 100644 sig/openai/models/beta/agent_session_environment_disconnected_event.rbs create mode 100644 sig/openai/models/beta/agent_session_environment_failed_event.rbs create mode 100644 sig/openai/models/beta/agent_session_environment_pending_event.rbs create mode 100644 sig/openai/models/beta/agent_session_environment_ready_event.rbs create mode 100644 sig/openai/models/beta/agent_session_environment_state.rbs create mode 100644 sig/openai/models/beta/agent_session_error_event.rbs create mode 100644 sig/openai/models/beta/agent_session_event.rbs create mode 100644 sig/openai/models/beta/agent_session_failed_event.rbs create mode 100644 sig/openai/models/beta/agent_session_idle_event.rbs create mode 100644 sig/openai/models/beta/agent_session_in_progress_event.rbs create mode 100644 sig/openai/models/beta/agent_session_input_message_param.rbs create mode 100644 sig/openai/models/beta/agent_session_input_param.rbs create mode 100644 sig/openai/models/beta/agent_session_item.rbs create mode 100644 sig/openai/models/beta/agent_session_message.rbs create mode 100644 sig/openai/models/beta/agent_session_message_content.rbs create mode 100644 sig/openai/models/beta/agent_session_requires_action_event.rbs create mode 100644 sig/openai/models/beta/agent_session_subagent_active_event.rbs create mode 100644 sig/openai/models/beta/agent_session_subagent_closed_event.rbs create mode 100644 sig/openai/models/beta/agent_session_subagent_created_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_cancelled_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_completed_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_content_part_added_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_content_part_done_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_created_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_failed_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_in_progress_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_item_added_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_item_done_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_output_text_delta_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_output_text_done_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_reasoning_summary_part_added_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_reasoning_summary_part_done_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_reasoning_summary_text_delta_event.rbs create mode 100644 sig/openai/models/beta/agent_session_turn_reasoning_summary_text_done_event.rbs create mode 100644 sig/openai/models/beta/agent_text.rbs create mode 100644 sig/openai/models/beta/agent_text_param.rbs create mode 100644 sig/openai/models/beta/agent_tool.rbs create mode 100644 sig/openai/models/beta/agent_tool_param.rbs create mode 100644 sig/openai/models/beta/agent_update_params.rbs create mode 100644 sig/openai/models/beta/agent_wait_for_subagents_call_item.rbs create mode 100644 sig/openai/models/beta/agent_web_search_call_item.rbs create mode 100644 sig/openai/models/beta/agents/environment_info.rbs create mode 100644 sig/openai/models/beta/agents/environment_retrieve_params.rbs create mode 100644 sig/openai/models/beta/agents/environments/environment_file.rbs create mode 100644 sig/openai/models/beta/agents/environments/environment_template.rbs create mode 100644 sig/openai/models/beta/agents/environments/environment_template_deleted.rbs create mode 100644 sig/openai/models/beta/agents/environments/file_create_params.rbs create mode 100644 sig/openai/models/beta/agents/environments/file_list_params.rbs create mode 100644 sig/openai/models/beta/agents/environments/template_create_params.rbs create mode 100644 sig/openai/models/beta/agents/environments/template_delete_params.rbs create mode 100644 sig/openai/models/beta/agents/environments/template_list_params.rbs create mode 100644 sig/openai/models/beta/agents/environments/template_retrieve_params.rbs create mode 100644 sig/openai/models/beta/agents/environments/template_update_params.rbs create mode 100644 sig/openai/models/beta/agents/session_create_params.rbs create mode 100644 sig/openai/models/beta/agents/session_delete_params.rbs create mode 100644 sig/openai/models/beta/agents/session_list_params.rbs create mode 100644 sig/openai/models/beta/agents/session_retrieve_params.rbs create mode 100644 sig/openai/models/beta/agents/session_update_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/artifact_content_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/artifact_delete_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/artifact_list_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/artifact_retrieve_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/event_create_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/event_stream_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/item_list_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/session_artifact.rbs create mode 100644 sig/openai/models/beta/agents/sessions/session_artifact_deleted.rbs create mode 100644 sig/openai/models/beta/agents/sessions/subagent_list_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/subagent_retrieve_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/subagents/item_list_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/subagents/turn_list_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/subagents/turn_retrieve_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/subagents/turns/item_list_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/turn.rbs create mode 100644 sig/openai/models/beta/agents/sessions/turn_list_params.rbs create mode 100644 sig/openai/models/beta/agents/sessions/turn_retrieve_params.rbs create mode 100644 sig/openai/models/beta/agents/vault.rbs create mode 100644 sig/openai/models/beta/agents/vault_create_params.rbs create mode 100644 sig/openai/models/beta/agents/vault_delete_params.rbs create mode 100644 sig/openai/models/beta/agents/vault_deleted.rbs create mode 100644 sig/openai/models/beta/agents/vault_list_params.rbs create mode 100644 sig/openai/models/beta/agents/vault_retrieve_params.rbs create mode 100644 sig/openai/models/beta/agents/vault_status.rbs create mode 100644 sig/openai/models/beta/agents/vault_status_filter.rbs create mode 100644 sig/openai/models/beta/agents/vaults/credential.rbs create mode 100644 sig/openai/models/beta/agents/vaults/credential_auth.rbs create mode 100644 sig/openai/models/beta/agents/vaults/credential_auth_create_param.rbs create mode 100644 sig/openai/models/beta/agents/vaults/credential_auth_rotate_param.rbs create mode 100644 sig/openai/models/beta/agents/vaults/credential_create_params.rbs create mode 100644 sig/openai/models/beta/agents/vaults/credential_delete_params.rbs create mode 100644 sig/openai/models/beta/agents/vaults/credential_deleted.rbs create mode 100644 sig/openai/models/beta/agents/vaults/credential_list_params.rbs create mode 100644 sig/openai/models/beta/agents/vaults/credential_retrieve_params.rbs create mode 100644 sig/openai/models/beta/agents/vaults/credential_update_params.rbs create mode 100644 sig/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth.rbs create mode 100644 sig/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_create_param.rbs create mode 100644 sig/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_rotate_param.rbs create mode 100644 sig/openai/models/beta/environment.rbs create mode 100644 sig/openai/models/beta/environment_param.rbs create mode 100644 sig/openai/models/beta/hosted_environment_file.rbs create mode 100644 sig/openai/models/beta/hosted_environment_file_id.rbs create mode 100644 sig/openai/models/beta/hosted_environment_file_param.rbs create mode 100644 sig/openai/models/beta/hosted_plugin.rbs create mode 100644 sig/openai/models/beta/hosted_plugin_param.rbs create mode 100644 sig/openai/models/beta/hosted_skill.rbs create mode 100644 sig/openai/models/beta/hosted_skill_param.rbs create mode 100644 sig/openai/models/beta/hosted_skill_reference.rbs create mode 100644 sig/openai/models/beta/inline_capability_source_param.rbs create mode 100644 sig/openai/models/beta/input_content.rbs create mode 100644 sig/openai/models/beta/input_content_param.rbs create mode 100644 sig/openai/models/beta/mcp_transport.rbs create mode 100644 sig/openai/models/beta/mcp_transport_param.rbs create mode 100644 sig/openai/models/beta/multi_agent_config.rbs create mode 100644 sig/openai/models/beta/multi_agent_config_param.rbs create mode 100644 sig/openai/models/beta/output_text.rbs create mode 100644 sig/openai/models/beta/persisted_agent_tool.rbs create mode 100644 sig/openai/models/beta/persisted_agent_tool_param.rbs create mode 100644 sig/openai/models/beta/persisted_mcp_transport.rbs create mode 100644 sig/openai/models/beta/persisted_mcp_transport_param.rbs create mode 100644 sig/openai/models/beta/session_error.rbs create mode 100644 sig/openai/models/beta/session_turn_error.rbs create mode 100644 sig/openai/models/beta/setup_command_param.rbs create mode 100644 sig/openai/models/beta/subagent.rbs create mode 100644 sig/openai/models/beta/summary_text.rbs create mode 100644 sig/openai/models/beta/text_format.rbs create mode 100644 sig/openai/models/beta/text_format_param.rbs create mode 100644 sig/openai/models/beta/token_usage.rbs create mode 100644 sig/openai/models/beta/web_search_action.rbs create mode 100644 sig/openai/resources/beta/agents.rbs create mode 100644 sig/openai/resources/beta/agents/environments.rbs create mode 100644 sig/openai/resources/beta/agents/environments/files.rbs create mode 100644 sig/openai/resources/beta/agents/environments/templates.rbs create mode 100644 sig/openai/resources/beta/agents/sessions.rbs create mode 100644 sig/openai/resources/beta/agents/sessions/artifacts.rbs create mode 100644 sig/openai/resources/beta/agents/sessions/events.rbs create mode 100644 sig/openai/resources/beta/agents/sessions/items.rbs create mode 100644 sig/openai/resources/beta/agents/sessions/subagents.rbs create mode 100644 sig/openai/resources/beta/agents/sessions/subagents/items.rbs create mode 100644 sig/openai/resources/beta/agents/sessions/subagents/turns.rbs create mode 100644 sig/openai/resources/beta/agents/sessions/subagents/turns/items.rbs create mode 100644 sig/openai/resources/beta/agents/sessions/turns.rbs create mode 100644 sig/openai/resources/beta/agents/vaults.rbs create mode 100644 sig/openai/resources/beta/agents/vaults/credentials.rbs create mode 100644 test/fixtures/rbs_compatibility/agent_session_stream_valid.rb.txt create mode 100644 test/openai/helpers/agent_session_stream_test.rb create mode 100644 test/openai/resources/agents_pagination_test.rb create mode 100644 test/openai/resources/beta/agents/environments/files_test.rb create mode 100644 test/openai/resources/beta/agents/environments/templates_test.rb create mode 100644 test/openai/resources/beta/agents/environments_test.rb create mode 100644 test/openai/resources/beta/agents/sessions/artifacts_test.rb create mode 100644 test/openai/resources/beta/agents/sessions/events_test.rb create mode 100644 test/openai/resources/beta/agents/sessions/items_test.rb create mode 100644 test/openai/resources/beta/agents/sessions/subagents/items_test.rb create mode 100644 test/openai/resources/beta/agents/sessions/subagents/turns/items_test.rb create mode 100644 test/openai/resources/beta/agents/sessions/subagents/turns_test.rb create mode 100644 test/openai/resources/beta/agents/sessions/subagents_test.rb create mode 100644 test/openai/resources/beta/agents/sessions/turns_test.rb create mode 100644 test/openai/resources/beta/agents/sessions_test.rb create mode 100644 test/openai/resources/beta/agents/vaults/credentials_test.rb create mode 100644 test/openai/resources/beta/agents/vaults_test.rb create mode 100644 test/openai/resources/beta/agents_test.rb create mode 100644 test/openai/resources/environment_token_page_test.rb diff --git a/.castiron.stats.yml b/.castiron.stats.yml index 62caa09c7..1bb755790 100644 --- a/.castiron.stats.yml +++ b/.castiron.stats.yml @@ -1,8 +1,8 @@ schema_version: 1 -generation_id: 90145766-81b2-4f9e-aa08-34d49473f3e4 -openapi_spec_hash: 782181534a53a11117f14e80cb3883a9 -openapi_transformed_spec_hash: 22088ed8f250e13a06d229d57bcccdb3 -config_hash: e906a9378d154c280041967c79592d12 -codegen_sha: ffa87c574ee0d859a8655be8fca24b8b5b110966 -codegen_hash: 631855af70c7bc01e1bc477b4bce6668b5bab407a68303b35a5785782bbbe543 -public_codegen_sha: a578ab645df95d6a7025b5bae9a76d2b905ade71 +generation_id: b4b2034a-2d49-4149-98ea-be20c6acd553 +openapi_spec_hash: 3bbe70558d1cb860c1efbfd901285796 +openapi_transformed_spec_hash: 2daccabc873f61eec5ef07ab28b20a1a +config_hash: c234968a5221983d6e4315cda9d36d23 +codegen_sha: 3cb02b6d3ead4b19aa326f06138d09f7f1995da0 +codegen_hash: d4b7f4df5c568940a95d217fcf7ac71b831a641b8ec5d9ab870348322ce3d4c1 +public_codegen_sha: a2d4699c91560eca118a2dff85bde4794396de85 diff --git a/api_reference/openapi.transformed.yml b/api_reference/openapi.transformed.yml index f7e108486..f9513d5e9 100644 --- a/api_reference/openapi.transformed.yml +++ b/api_reference/openapi.transformed.yml @@ -8226,7 +8226,7 @@ paths: post: operationId: accept-live-session summary: Accept call - description: Accept an incoming SIP call with Live startup configuration. + description: Accept an incoming SIP call. Supply session with type live, the model, and startup configuration. Before accepting calls, follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) to write frontend conversation instructions and a separate backend prompt. SIP media format is negotiated; omit audio.format. tags: - Live parameters: @@ -8291,7 +8291,7 @@ paths: post: operationId: hangup-live-session summary: Hang up session - description: Hang up a Live session. + description: End a SIP call identified by session_id. tags: - Live parameters: @@ -8312,7 +8312,7 @@ paths: post: operationId: refer-live-session summary: Transfer call - description: Transfer a Live SIP call to another destination. + description: Transfer a SIP call to another destination. Supply a nonblank target_uri for the SIP Refer-To header. tags: - Live parameters: @@ -8339,7 +8339,7 @@ paths: post: operationId: reject-live-session summary: Reject call - description: Reject an incoming SIP call. + description: Reject an incoming SIP call. Send a required SIP rejection status_code between 300 and 699. tags: - Live parameters: @@ -25212,347 +25212,3592 @@ paths: "object": "list" } description: List ChatKit threads with optional pagination and user filters. - /responses?beta=true: + /agents/environments/{environment_id}: + get: + operationId: retrieveAgentEnvironment + summary: Retrieve an agent environment + description: Retrieves an execution environment's connection status and safe installed metadata. See [environment lifecycle](https://developers.openai.com/api/docs/guides/agents-api/environments/lifecycle). + tags: + - Agents + parameters: + - name: environment_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the environment. + responses: + '200': + description: The requested environment. + content: + application/json: + schema: + $ref: '#/components/schemas/PublicEnvironmentResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Retrieve an agent environment + /agents/environments/{environment_id}/files: + get: + operationId: listAgentEnvironmentFiles + summary: List agent environment files + description: Lists live files on a connected execution environment with optional directory filtering and opaque cursor pagination. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files). + tags: + - Agents + parameters: + - name: environment_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the environment. + - name: path + in: query + required: false + schema: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: Restrict the listing to this absolute workspace directory. + - name: limit + in: query + required: false + schema: + type: + - integer + - 'null' + format: int64 + minimum: 1 + maximum: 100 + description: The maximum number of files to return, between 1 and 100. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + description: Sort by case-sensitive path components. Defaults to descending. + - name: page + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The opaque token from the previous page. Keep the same path, order, and limit. + responses: + '200': + description: A page of live environment files. + content: + application/json: + schema: + $ref: '#/components/schemas/EnvironmentFileListResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: List agent environment files post: - operationId: beta_createResponse + operationId: createAgentEnvironmentFile + summary: Create an agent environment file + description: Copies inline bytes or a Files API file into a connected execution environment. See [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files). tags: - - Responses - summary: Create a model response - requestBody: + - Agents + parameters: + - name: environment_id + in: path required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the environment. + requestBody: content: application/json: schema: - $ref: '#/components/schemas/BetaCreateResponse' + $ref: '#/components/schemas/HostedEnvironmentFileParam' + responses: + '201': + description: The created live environment file. + content: + application/json: + schema: + $ref: '#/components/schemas/EnvironmentFileResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Create an agent environment file + /agents/sessions/{session_id}/subagents: + get: + operationId: listAgentSessionSubagents + summary: List session subagents + description: Lists subagents in a session, including nested and closed subagents. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. responses: '200': - description: OK + description: The requested subagents. content: application/json: schema: - $ref: '#/components/schemas/BetaResponse' - text/event-stream: + type: object + properties: + object: + type: string + enum: + - list + default: list + x-stainless-const: true + description: The object type, which is always `list`. + data: + type: array + items: + $ref: '#/components/schemas/SubagentResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. + required: + - object + - data + - first_id + - last_id + - has_more + additionalProperties: false + description: A page of Agents API resources, with IDs for retrieving additional pages. + '400': + description: The request was invalid. + content: + application/json: schema: - $ref: '#/components/schemas/BetaResponseStreamEvent' - '429': - $ref: '#/components/responses/InferenceRateLimited' + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' '503': - $ref: '#/components/responses/InferenceServiceUnavailable' + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' x-oaiMeta: - name: Create a model response - group: responses - path: create - examples: - - title: Text input - request: - curl: | - curl https://api.openai.com/v1/responses \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $OPENAI_API_KEY" \ - -d '{ - "model": "gpt-6-astra", - "input": "Tell me a three sentence bedtime story about a unicorn." - }' - javascript: | - import OpenAI from "openai"; - - const openai = new OpenAI(); - - const response = await openai.responses.create({ - model: "gpt-6-astra", - input: "Tell me a three sentence bedtime story about a unicorn." - }); - - console.log(response); - python: | - from openai import OpenAI - - client = OpenAI() - - response = client.responses.create( - model="gpt-6-astra", - input="Tell me a three sentence bedtime story about a unicorn." - ) - - print(response) - csharp: | - using System; - using OpenAI.Responses; - - OpenAIResponseClient client = new( - model: "gpt-6-astra", - apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") - ); - - OpenAIResponse response = client.CreateResponse("Tell me a three sentence bedtime story about a unicorn."); - - Console.WriteLine(response.GetOutputText()); - response: | - { - "id": "resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b", - "object": "response", - "created_at": 1741476542, - "status": "completed", - "completed_at": 1741476543, - "error": null, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "model": "gpt-6-astra", - "output": [ - { - "type": "message", - "id": "msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "output_text", - "text": "In a peaceful grove beneath a silver moon, a unicorn named Lumina discovered a hidden pool that reflected the stars. As she dipped her horn into the water, the pool began to shimmer, revealing a pathway to a magical realm of endless night skies. Filled with wonder, Lumina whispered a wish for all who dream to find their own hidden magic, and as she glanced back, her hoofprints sparkled like stardust.", - "annotations": [] - } - ] - } - ], - "parallel_tool_calls": true, - "previous_response_id": null, - "reasoning": { - "effort": null, - "summary": null - }, - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - } - }, - "tool_choice": "auto", - "tools": [], - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 36, - "input_tokens_details": { - "cached_tokens": 0, - "cache_write_tokens": 0 - }, - "output_tokens": 87, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 123 - }, - "user": null, - "metadata": {} - } - - title: Image input - request: - curl: | - curl https://api.openai.com/v1/responses \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $OPENAI_API_KEY" \ - -d '{ - "model": "gpt-6-astra", - "input": [ - { - "role": "user", - "content": [ - {"type": "input_text", "text": "what is in this image?"}, - { - "type": "input_image", - "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" - } - ] - } - ] - }' - javascript: | - import OpenAI from "openai"; - - const openai = new OpenAI(); - - const response = await openai.responses.create({ - model: "gpt-6-astra", - input: [ - { - role: "user", - content: [ - { type: "input_text", text: "what is in this image?" }, - { - type: "input_image", - image_url: - "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg", - }, - ], - }, - ], - }); - - console.log(response); - python: | - from openai import OpenAI - - client = OpenAI() - - response = client.responses.create( - model="gpt-6-astra", - input=[ - { - "role": "user", - "content": [ - { "type": "input_text", "text": "what is in this image?" }, - { - "type": "input_image", - "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" - } - ] - } - ] - ) - - print(response) - csharp: | - using System; - using System.Collections.Generic; - - using OpenAI.Responses; - - OpenAIResponseClient client = new( - model: "gpt-6-astra", - apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") - ); - - List inputItems = - [ - ResponseItem.CreateUserMessageItem( - [ - ResponseContentPart.CreateInputTextPart("What is in this image?"), - ResponseContentPart.CreateInputImagePart(new Uri("https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg")) - ] - ) - ]; - - OpenAIResponse response = client.CreateResponse(inputItems); - - Console.WriteLine(response.GetOutputText()); - response: | - { - "id": "resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41", - "object": "response", - "created_at": 1741476777, - "status": "completed", - "completed_at": 1741476778, - "error": null, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "model": "gpt-6-astra", - "output": [ - { - "type": "message", - "id": "msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "output_text", - "text": "The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.", - "annotations": [] - } - ] - } - ], - "parallel_tool_calls": true, - "previous_response_id": null, - "reasoning": { - "effort": null, - "summary": null - }, - "store": true, - "temperature": 1.0, - "text": { - "format": { - "type": "text" - } - }, - "tool_choice": "auto", - "tools": [], - "top_p": 1.0, - "truncation": "disabled", - "usage": { - "input_tokens": 328, - "input_tokens_details": { - "cached_tokens": 0, - "cache_write_tokens": 0 - }, - "output_tokens": 52, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 380 - }, - "user": null, - "metadata": {} - } - - title: File input - request: - curl: | - curl https://api.openai.com/v1/responses \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $OPENAI_API_KEY" \ - -d '{ - "model": "gpt-6-astra", - "input": [ - { - "role": "user", - "content": [ - {"type": "input_text", "text": "what is in this file?"}, - { - "type": "input_file", - "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf", - "detail": "auto" - } - ] - } - ] - }' - javascript: | - import OpenAI from "openai"; - - const openai = new OpenAI(); - - const response = await openai.responses.create({ - model: "gpt-6-astra", - input: [ - { - role: "user", - content: [ - { type: "input_text", text: "what is in this file?" }, - { - type: "input_file", - file_url: "https://www.berkshirehathaway.com/letters/2024ltr.pdf", - detail: "auto", - }, - ], - }, - ], - }); - - console.log(response); - python: | - from openai import OpenAI - - client = OpenAI() - - response = client.responses.create( - model="gpt-6-astra", - input=[ - { - "role": "user", - "content": [ - { "type": "input_text", "text": "what is in this file?" }, - { + name: List session subagents + /agents/sessions/{session_id}/subagents/{subagent_id}: + get: + operationId: retrieveAgentSessionSubagent + summary: Retrieve a session subagent + description: Retrieves a subagent belonging to this session. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + - name: subagent_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the subagent in this session. + responses: + '200': + description: The requested subagent. + content: + application/json: + schema: + $ref: '#/components/schemas/SubagentResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Retrieve a session subagent + /agents/sessions/{session_id}/subagents/{subagent_id}/items: + get: + operationId: listAgentSessionSubagentItems + summary: List subagent items + description: Lists this subagent's own items across all of its turns. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + - name: subagent_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the subagent in this session. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. + responses: + '200': + description: The requested subagent history. + content: + application/json: + schema: + $ref: '#/components/schemas/SessionItemListResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: List subagent items + /agents/sessions/{session_id}/subagents/{subagent_id}/turns: + get: + operationId: listAgentSessionSubagentTurns + summary: List subagent turns + description: Lists all turns of this subagent, including turns after a resume. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + - name: subagent_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the subagent in this session. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. + responses: + '200': + description: The requested subagent history. + content: + application/json: + schema: + $ref: '#/components/schemas/SessionTurnListResource' + description: A page of turns from an agent session or subagent. + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: List subagent turns + /agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}: + get: + operationId: retrieveAgentSessionSubagentTurn + summary: Retrieve a subagent turn + description: Retrieves a turn belonging to this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + - name: subagent_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the subagent in this session. + - name: turn_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of a turn belonging to this subagent. + responses: + '200': + description: The requested subagent history. + content: + application/json: + schema: + $ref: '#/components/schemas/TurnResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Retrieve a subagent turn + /agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}/items: + get: + operationId: listAgentSessionSubagentTurnItems + summary: List subagent turn items + description: Lists items belonging to one turn of this subagent. See [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + - name: subagent_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the subagent in this session. + - name: turn_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of a turn belonging to this subagent. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. + responses: + '200': + description: The requested subagent history. + content: + application/json: + schema: + $ref: '#/components/schemas/SessionItemListResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: List subagent turn items + /agents: + get: + operationId: listAgents + summary: List agents + description: Lists reusable agents in the current project. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + tags: + - Agents + parameters: + - name: limit + in: query + required: false + schema: + type: + - integer + - 'null' + format: int64 + minimum: 1 + description: The maximum number of resources to return. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. + responses: + '200': + description: A page of agents. + content: + application/json: + schema: + $ref: '#/components/schemas/AgentListResource' + description: A page of reusable agents. + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: List agents + post: + operationId: createAgent + summary: Create an agent + description: Creates a reusable agent without storing credentials. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + tags: + - Agents + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAgentParams' + responses: + '201': + description: The created agent. + content: + application/json: + schema: + $ref: '#/components/schemas/AgentResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Create an agent + /agents/{agent_id}: + get: + operationId: retrieveAgent + summary: Retrieve an agent + description: Retrieves a reusable agent by ID. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + tags: + - Agents + parameters: + - name: agent_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the reusable agent. + responses: + '200': + description: The requested agent. + content: + application/json: + schema: + $ref: '#/components/schemas/AgentResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Retrieve an agent + post: + operationId: updateAgent + summary: Update an agent + description: Updates a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + tags: + - Agents + parameters: + - name: agent_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the reusable agent. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAgentParams' + responses: + '200': + description: The updated agent. + content: + application/json: + schema: + $ref: '#/components/schemas/AgentResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Update an agent + delete: + operationId: deleteAgent + summary: Delete an agent + description: Deletes a reusable agent. See [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + tags: + - Agents + parameters: + - name: agent_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the reusable agent. + responses: + '200': + description: The deleted agent. + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedAgentResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Delete an agent + /agents/environments/templates: + get: + operationId: listAgentEnvironmentTemplates + summary: List agent environment templates + description: Lists reusable environment templates without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + tags: + - Agents + parameters: + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. + responses: + '200': + description: A page of environment templates. + content: + application/json: + schema: + $ref: '#/components/schemas/EnvironmentTemplateListResource' + description: A page of reusable environment templates. + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested environment definition was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: List agent environment templates + post: + operationId: createAgentEnvironmentTemplate + summary: Create an agent environment template + description: Creates reusable environment configuration without returning confidential setup commands or environment values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + tags: + - Agents + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEnvironmentTemplateParams' + responses: + '201': + description: The created environment template. + content: + application/json: + schema: + $ref: '#/components/schemas/EnvironmentTemplateResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested environment definition was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Create an agent environment template + /agents/environments/templates/{environment_template_id}: + get: + operationId: retrieveAgentEnvironmentTemplate + summary: Retrieve an agent environment template + description: Retrieves reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + tags: + - Agents + parameters: + - name: environment_template_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the reusable environment template. + responses: + '200': + description: The requested environment template. + content: + application/json: + schema: + $ref: '#/components/schemas/EnvironmentTemplateResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested environment definition was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Retrieve an agent environment template + post: + operationId: updateAgentEnvironmentTemplate + summary: Update an agent environment template + description: Updates reusable environment configuration without returning confidential values. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + tags: + - Agents + parameters: + - name: environment_template_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the reusable environment template. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateEnvironmentTemplateParams' + responses: + '200': + description: The updated environment template. + content: + application/json: + schema: + $ref: '#/components/schemas/EnvironmentTemplateResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested environment definition was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current environment state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Update an agent environment template + delete: + operationId: deleteAgentEnvironmentTemplate + summary: Delete an agent environment template + description: Deletes reusable environment configuration and all confidential template inputs. See [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + tags: + - Agents + parameters: + - name: environment_template_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the reusable environment template. + responses: + '200': + description: The deleted environment template. + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedEnvironmentTemplateResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested environment definition was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current environment state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Delete an agent environment template + /agents/sessions: + get: + operationId: listAgentSessions + summary: List agent sessions + description: Lists managed agent sessions using ID-based pagination and the requested sort order. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + tags: + - Agents + parameters: + - name: limit + in: query + required: false + schema: + type: + - integer + - 'null' + format: int64 + minimum: 1 + description: The maximum number of resources to return. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: Sort order by the `created_at` timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `desc`. + - name: agent_id + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Only return sessions whose root agent has this ID. Omit to return sessions for all agents. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. + responses: + '200': + description: A page of sessions. + content: + application/json: + schema: + $ref: '#/components/schemas/SessionListResource' + description: A paginated list of sessions. + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: List agent sessions + post: + operationId: createAgentSession + summary: Create an agent session + description: Creates a managed agent session, optionally submits initial input, and returns the session or streams its events when stream is true. See [running sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions). + tags: + - Agents + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateAgentSessionParams' + responses: + '201': + description: The created session or its event stream. + content: + application/json: + schema: + $ref: '#/components/schemas/SessionResource' + text/event-stream: + schema: + $ref: '#/components/schemas/SessionEvent' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oai-streaming: + request_field: stream + response_status_code: 201 + x-oaiMeta: + name: Create an agent session + /agents/sessions/{session_id}: + get: + operationId: retrieveAgentSession + summary: Retrieve an agent session + description: Retrieves the current state of a managed agent session. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + responses: + '200': + description: The requested session. + content: + application/json: + schema: + $ref: '#/components/schemas/SessionResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Retrieve an agent session + post: + operationId: updateAgentSession + summary: Update an agent session + description: Updates session metadata. Omitted fields are unchanged. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateAgentSessionParams' + responses: + '200': + description: The updated session. + content: + application/json: + schema: + $ref: '#/components/schemas/SessionResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Update an agent session + delete: + operationId: deleteAgentSession + summary: Delete an agent session + description: Removes a managed agent session from the public API and returns a deletion confirmation. Physical cleanup may continue asynchronously. See [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + responses: + '200': + description: The deleted session. + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedSessionResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Delete an agent session + /agents/sessions/{session_id}/artifacts: + get: + operationId: listAgentSessionArtifacts + summary: List agent session artifacts + description: Lists immutable artifacts published by completed hosted session turns. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + description: Sort by creation time and ID. Defaults to descending. + - name: environment_id + in: query + required: false + schema: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: Restrict the listing to artifacts produced by this environment. + - name: limit + in: query + required: false + schema: + type: + - integer + - 'null' + format: int64 + minimum: 1 + maximum: 100 + description: The maximum number of artifacts to return, between 1 and 100. + - name: after + in: query + required: false + schema: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: Return artifacts after this immutable artifact ID. + responses: + '200': + description: A page of durable session artifacts. + content: + application/json: + schema: + $ref: '#/components/schemas/SessionArtifactListResource' + description: A page of durable artifacts published by a session. + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: List agent session artifacts + /agents/sessions/{session_id}/artifacts/{artifact_id}: + get: + operationId: retrieveAgentSessionArtifact + summary: Retrieve an agent session artifact + description: Retrieves immutable metadata for one durable session artifact. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session that owns the artifact. + - name: artifact_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The immutable session artifact ID. + responses: + '200': + description: The requested session artifact. + content: + application/json: + schema: + $ref: '#/components/schemas/SessionArtifactResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Retrieve an agent session artifact + delete: + operationId: deleteAgentSessionArtifact + summary: Delete an agent session artifact + description: Deletes an immutable session artifact without deleting its live environment file or original Files API object. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session that owns the artifact. + - name: artifact_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The immutable session artifact ID. + responses: + '200': + description: The deleted session artifact. + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedSessionArtifactResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Delete an agent session artifact + /agents/sessions/{session_id}/artifacts/{artifact_id}/content: + get: + operationId: retrieveAgentSessionArtifactContent + summary: Retrieve agent session artifact content + description: Downloads immutable session artifact bytes after the execution environment expires. See [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session that owns the artifact. + - name: artifact_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The immutable session artifact ID. + responses: + '200': + description: The immutable artifact contents. + content: + application/octet-stream: + schema: + type: string + format: binary + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Retrieve agent session artifact content + /agents/sessions/{session_id}/events: + get: + operationId: listAgentSessionEvents + summary: Stream agent session events + description: Streams live events for an agent session. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + responses: + '200': + description: A live stream of session events. + content: + text/event-stream: + schema: + $ref: '#/components/schemas/SessionEvent' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oai-streaming: + request_field: null + response_status_code: 200 + x-oaiMeta: + name: Stream agent session events + post: + operationId: createAgentSessionEvents + summary: Create agent session input events + description: Submits message, cancellation, or tool-result events to a managed agent session. See [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + - name: Idempotency-Key + in: header + required: false + schema: + type: string + minLength: 1 + maxLength: 256 + description: An optional client-generated key that makes retries of submitted messages idempotent. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateSessionEventsParams' + responses: + '202': + description: The events were accepted. + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Create agent session input events + /agents/sessions/{session_id}/items: + get: + operationId: listAgentSessionItems + summary: List agent session items + description: Lists items produced by the session's root agent, including its interactions with subagents. Each subagent has its own item history. See [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. + responses: + '200': + description: A page of session items. + content: + application/json: + schema: + $ref: '#/components/schemas/SessionItemListResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required Responses permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: List agent session items + /agents/sessions/{session_id}/turns: + get: + operationId: listAgentSessionTurns + summary: List agent session turns + description: Lists turns by creation time and turn ID. The after cursor is exclusive in the selected order. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session. + - name: limit + in: query + required: false + schema: + type: integer + format: int64 + minimum: 1 + maximum: 100 + default: 20 + description: The maximum number of resources to return, between 1 and 100. Defaults to 20. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: The order in which resources are returned. Defaults to `desc`. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. + responses: + '200': + description: A page of session turns. + content: + application/json: + schema: + $ref: '#/components/schemas/SessionTurnListResource' + description: A page of turns from an agent session or subagent. + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: List agent session turns + /agents/sessions/{session_id}/turns/{turn_id}: + get: + operationId: retrieveAgentSessionTurn + summary: Retrieve an agent session turn + description: Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if the turn does not belong to the session. See [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns). + tags: + - Agents + parameters: + - name: session_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the session that owns the turn. + - name: turn_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the turn. + responses: + '200': + description: The requested turn. + content: + application/json: + schema: + $ref: '#/components/schemas/TurnResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested session or event was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current session state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Retrieve an agent session turn + /vaults: + get: + operationId: listVaults + summary: List vaults + description: Lists vaults using ID-based pagination. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + parameters: + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: Sort order by the `created_at` timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `desc`. + - name: limit + in: query + required: false + schema: + type: + - integer + - 'null' + format: int64 + minimum: 0 + description: The maximum number of resources to return. Defaults to 20. Values are clamped between 1 and 100. + - name: status + in: query + required: false + schema: + $ref: '#/components/schemas/VaultStatusFilterParam' + description: Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. + responses: + '200': + description: A page of vaults. + content: + application/json: + schema: + $ref: '#/components/schemas/VaultListResource' + description: A page of vaults. + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: List vaults + post: + operationId: createVault + summary: Create a vault + description: Creates a vault for the current project. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVaultParams' + responses: + '201': + description: The created vault. + content: + application/json: + schema: + $ref: '#/components/schemas/VaultResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Create a vault + /vaults/{vault_id}: + get: + operationId: retrieveVault + summary: Retrieve a vault + description: Retrieves a vault by its ID. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + parameters: + - name: vault_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. + responses: + '200': + description: The requested vault. + content: + application/json: + schema: + $ref: '#/components/schemas/VaultResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Retrieve a vault + delete: + operationId: deleteVault + summary: Delete a vault + description: Deletes a vault and all its credentials. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + parameters: + - name: vault_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. + responses: + '200': + description: The deleted vault. + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedVaultResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Delete a vault + /vaults/{vault_id}/credentials: + get: + operationId: listVaultCredentials + summary: List vault credentials + description: Lists a vault's credentials using ID-based pagination without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + parameters: + - name: vault_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. + - name: order + in: query + required: false + schema: + $ref: '#/components/schemas/ListOrderParam' + default: desc + description: Sort order by the `created_at` timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `desc`. + - name: limit + in: query + required: false + schema: + type: + - integer + - 'null' + format: int64 + minimum: 0 + description: The maximum number of resources to return. Defaults to 20. Values are clamped between 1 and 100. + - name: status + in: query + required: false + schema: + $ref: '#/components/schemas/VaultStatusFilterParam' + description: Filter by one status or a list, such as `status=active` or `status[]=active&status[]=archived`. Both statuses are included by default. + - name: after + in: query + required: false + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: Return resources after this resource ID in the selected order. + responses: + '200': + description: A page of vault credentials. + content: + application/json: + schema: + $ref: '#/components/schemas/VaultCredentialListResource' + description: A page of credentials in a vault. + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: List vault credentials + post: + operationId: createVaultCredential + summary: Create a vault credential + description: Creates a vault credential. Secret values are write-only and are never returned. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + parameters: + - name: vault_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateVaultCredentialParams' + responses: + '201': + description: The created vault credential without secret values. + content: + application/json: + schema: + $ref: '#/components/schemas/VaultCredentialResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Create a vault credential + /vaults/{vault_id}/credentials/{credential_id}: + get: + operationId: retrieveVaultCredential + summary: Retrieve a vault credential + description: Retrieves vault credential metadata without returning secret values. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + parameters: + - name: vault_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. + - name: credential_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault credential. + responses: + '200': + description: The requested vault credential without secret values. + content: + application/json: + schema: + $ref: '#/components/schemas/VaultCredentialResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Retrieve a vault credential + post: + operationId: rotateVaultCredential + summary: Rotate a vault credential + description: Rotates a vault credential's write-only secret and returns only credential metadata. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + parameters: + - name: vault_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. + - name: credential_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault credential. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RotateVaultCredentialParams' + responses: + '200': + description: The rotated vault credential without secret values. + content: + application/json: + schema: + $ref: '#/components/schemas/VaultCredentialResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Rotate a vault credential + delete: + operationId: deleteVaultCredential + summary: Delete a vault credential + description: Deletes a vault credential. See [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + tags: + - Vaults + parameters: + - name: vault_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault. + - name: credential_id + in: path + required: true + schema: + type: string + minLength: 0 + maxLength: 1048576 + description: The ID of the vault credential. + responses: + '200': + description: The deleted vault credential. + content: + application/json: + schema: + $ref: '#/components/schemas/DeletedVaultCredentialResource' + '400': + description: The request was invalid. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '401': + description: Authentication or project context was missing. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '403': + description: The API key lacks the required management permission. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '404': + description: The requested vault or credential was not found. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '409': + description: The request conflicted with the current vault state. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '500': + description: An internal error occurred. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + '503': + description: The service is temporarily unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse-2' + x-oaiMeta: + name: Delete a vault credential + /responses?beta=true: + post: + operationId: beta_createResponse + tags: + - Responses + summary: Create a model response + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/BetaCreateResponse' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BetaResponse' + text/event-stream: + schema: + $ref: '#/components/schemas/BetaResponseStreamEvent' + '429': + $ref: '#/components/responses/InferenceRateLimited' + '503': + $ref: '#/components/responses/InferenceServiceUnavailable' + x-oaiMeta: + name: Create a model response + group: responses + path: create + examples: + - title: Text input + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-6-astra", + "input": "Tell me a three sentence bedtime story about a unicorn." + }' + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "gpt-6-astra", + input: "Tell me a three sentence bedtime story about a unicorn." + }); + + console.log(response); + python: | + from openai import OpenAI + + client = OpenAI() + + response = client.responses.create( + model="gpt-6-astra", + input="Tell me a three sentence bedtime story about a unicorn." + ) + + print(response) + csharp: | + using System; + using OpenAI.Responses; + + OpenAIResponseClient client = new( + model: "gpt-6-astra", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + OpenAIResponse response = client.CreateResponse("Tell me a three sentence bedtime story about a unicorn."); + + Console.WriteLine(response.GetOutputText()); + response: | + { + "id": "resp_67ccd2bed1ec8190b14f964abc0542670bb6a6b452d3795b", + "object": "response", + "created_at": 1741476542, + "status": "completed", + "completed_at": 1741476543, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-6-astra", + "output": [ + { + "type": "message", + "id": "msg_67ccd2bf17f0819081ff3bb2cf6508e60bb6a6b452d3795b", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "In a peaceful grove beneath a silver moon, a unicorn named Lumina discovered a hidden pool that reflected the stars. As she dipped her horn into the water, the pool began to shimmer, revealing a pathway to a magical realm of endless night skies. Filled with wonder, Lumina whispered a wish for all who dream to find their own hidden magic, and as she glanced back, her hoofprints sparkled like stardust.", + "annotations": [] + } + ] + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 36, + "input_tokens_details": { + "cached_tokens": 0, + "cache_write_tokens": 0 + }, + "output_tokens": 87, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 123 + }, + "user": null, + "metadata": {} + } + - title: Image input + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-6-astra", + "input": [ + { + "role": "user", + "content": [ + {"type": "input_text", "text": "what is in this image?"}, + { + "type": "input_image", + "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" + } + ] + } + ] + }' + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "gpt-6-astra", + input: [ + { + role: "user", + content: [ + { type: "input_text", text: "what is in this image?" }, + { + type: "input_image", + image_url: + "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg", + }, + ], + }, + ], + }); + + console.log(response); + python: | + from openai import OpenAI + + client = OpenAI() + + response = client.responses.create( + model="gpt-6-astra", + input=[ + { + "role": "user", + "content": [ + { "type": "input_text", "text": "what is in this image?" }, + { + "type": "input_image", + "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" + } + ] + } + ] + ) + + print(response) + csharp: | + using System; + using System.Collections.Generic; + + using OpenAI.Responses; + + OpenAIResponseClient client = new( + model: "gpt-6-astra", + apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ); + + List inputItems = + [ + ResponseItem.CreateUserMessageItem( + [ + ResponseContentPart.CreateInputTextPart("What is in this image?"), + ResponseContentPart.CreateInputImagePart(new Uri("https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg")) + ] + ) + ]; + + OpenAIResponse response = client.CreateResponse(inputItems); + + Console.WriteLine(response.GetOutputText()); + response: | + { + "id": "resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41", + "object": "response", + "created_at": 1741476777, + "status": "completed", + "completed_at": 1741476778, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-6-astra", + "output": [ + { + "type": "message", + "id": "msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.", + "annotations": [] + } + ] + } + ], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1.0, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1.0, + "truncation": "disabled", + "usage": { + "input_tokens": 328, + "input_tokens_details": { + "cached_tokens": 0, + "cache_write_tokens": 0 + }, + "output_tokens": 52, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 380 + }, + "user": null, + "metadata": {} + } + - title: File input + request: + curl: | + curl https://api.openai.com/v1/responses \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $OPENAI_API_KEY" \ + -d '{ + "model": "gpt-6-astra", + "input": [ + { + "role": "user", + "content": [ + {"type": "input_text", "text": "what is in this file?"}, + { + "type": "input_file", + "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf", + "detail": "auto" + } + ] + } + ] + }' + javascript: | + import OpenAI from "openai"; + + const openai = new OpenAI(); + + const response = await openai.responses.create({ + model: "gpt-6-astra", + input: [ + { + role: "user", + content: [ + { type: "input_text", text: "what is in this file?" }, + { + type: "input_file", + file_url: "https://www.berkshirehathaway.com/letters/2024ltr.pdf", + detail: "auto", + }, + ], + }, + ], + }); + + console.log(response); + python: | + from openai import OpenAI + + client = OpenAI() + + response = client.responses.create( + model="gpt-6-astra", + input=[ + { + "role": "user", + "content": [ + { "type": "input_text", "text": "what is in this file?" }, + { "type": "input_file", "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf", "detail": "auto" @@ -28287,135 +31532,506 @@ components: properties: id: type: string - description: The ID of the IP allowlist configuration. - allowed_ips: - type: array - description: The updated set of IP addresses or CIDR ranges in the configuration. - items: - type: string - ip_allowlist.deleted: + description: The ID of the IP allowlist configuration. + allowed_ips: + type: array + description: The updated set of IP addresses or CIDR ranges in the configuration. + items: + type: string + ip_allowlist.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the IP allowlist configuration. + name: + type: string + description: The name of the IP allowlist configuration. + allowed_ips: + type: array + description: The IP addresses or CIDR ranges that were in the configuration. + items: + type: string + ip_allowlist.config.activated: + type: object + description: The details for events with this `type`. + properties: + configs: + type: array + description: The configurations that were activated. + items: + type: object + properties: + id: + type: string + description: The ID of the IP allowlist configuration. + name: + type: string + description: The name of the IP allowlist configuration. + ip_allowlist.config.deactivated: + type: object + description: The details for events with this `type`. + properties: + configs: + type: array + description: The configurations that were deactivated. + items: + type: object + properties: + id: + type: string + description: The ID of the IP allowlist configuration. + name: + type: string + description: The name of the IP allowlist configuration. + login.succeeded: + type: object + description: This event has no additional fields beyond the standard audit log attributes. + login.failed: + type: object + description: The details for events with this `type`. + properties: + error_code: + type: string + description: The error code of the failure. + error_message: + type: string + description: The error message of the failure. + logout.succeeded: + type: object + description: This event has no additional fields beyond the standard audit log attributes. + logout.failed: + type: object + description: The details for events with this `type`. + properties: + error_code: + type: string + description: The error code of the failure. + error_message: + type: string + description: The error message of the failure. + organization.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The organization ID. + changes_requested: + type: object + description: The payload used to update the organization settings. + properties: + title: + type: string + description: The organization title. + description: + type: string + description: The organization description. + name: + type: string + description: The organization name. + threads_ui_visibility: + type: string + description: Visibility of the threads page which shows messages created with the Assistants API and Playground. One of `ANY_ROLE`, `OWNERS`, or `NONE`. + usage_dashboard_visibility: + type: string + description: Visibility of the usage dashboard which shows activity and costs for your organization. One of `ANY_ROLE` or `OWNERS`. + api_call_logging: + type: string + description: How your organization logs data from supported API calls. One of `disabled`, `enabled_per_call`, `enabled_for_all_projects`, or `enabled_for_selected_projects` + api_call_logging_project_ids: + type: string + description: The list of project ids if api_call_logging is set to `enabled_for_selected_projects` + project.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + data: + type: object + description: The payload used to create the project. + properties: + name: + type: string + description: The project name. + title: + type: string + description: The title of the project as seen on the dashboard. + project.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + changes_requested: + type: object + description: The payload used to update the project. + properties: + title: + type: string + description: The title of the project as seen on the dashboard. + project.archived: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + project.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The project ID. + rate_limit.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The rate limit ID + changes_requested: + type: object + description: The payload used to update the rate limits. + properties: + max_requests_per_1_minute: + type: integer + description: The maximum requests per minute. + max_tokens_per_1_minute: + type: integer + description: The maximum tokens per minute. + max_images_per_1_minute: + type: integer + description: The maximum images per minute. Only relevant for certain models. + max_audio_megabytes_per_1_minute: + type: integer + description: The maximum audio megabytes per minute. Only relevant for certain models. + max_requests_per_1_day: + type: integer + description: The maximum requests per day. Only relevant for certain models. + batch_1_day_max_input_tokens: + type: integer + description: The maximum batch input tokens per day. Only relevant for certain models. + rate_limit.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The rate limit ID + role.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The role ID. + role_name: + type: string + description: The name of the role. + permissions: + type: array + items: + type: string + description: The permissions granted by the role. + resource_type: + type: string + description: The type of resource the role belongs to. + resource_id: + type: string + description: The resource the role is scoped to. + role.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The role ID. + changes_requested: + type: object + description: The payload used to update the role. + properties: + role_name: + type: string + description: The updated role name, when provided. + resource_id: + type: string + description: The resource the role is scoped to. + resource_type: + type: string + description: The type of resource the role belongs to. + permissions_added: + type: array + items: + type: string + description: The permissions added to the role. + permissions_removed: + type: array + items: + type: string + description: The permissions removed from the role. + description: + type: string + description: The updated role description, when provided. + metadata: + type: object + description: Additional metadata stored on the role. + role.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The role ID. + role.assignment.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The identifier of the role assignment. + principal_id: + type: string + description: The principal (user or group) that received the role. + principal_type: + type: string + description: The type of principal (user or group) that received the role. + resource_id: + type: string + description: The resource the role assignment is scoped to. + resource_type: + type: string + description: The type of resource the role assignment is scoped to. + role.assignment.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The identifier of the role assignment. + principal_id: + type: string + description: The principal (user or group) that had the role removed. + principal_type: + type: string + description: The type of principal (user or group) that had the role removed. + resource_id: + type: string + description: The resource the role assignment was scoped to. + resource_type: + type: string + description: The type of resource the role assignment was scoped to. + role.bound_to_resource: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the resource the role was bound to. ChatGPT workspace connector resources use `__`. + role_id: + type: string + description: The ID of the role that was bound to the resource. + resource_id: + type: string + description: The ID of the resource the role was bound to. + resource_type: + type: string + description: The type of resource the role was bound to. + permissions: + type: array + items: + type: string + description: The permissions granted to the role for the resource. + workspace_id: + type: string + description: The workspace ID for a ChatGPT workspace connector resource. + connector_id: + type: string + description: The connector ID for a ChatGPT workspace connector resource. + connector_name: + type: string + description: The connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved. + enabled: + type: boolean + description: Whether the connector is enabled for the role. + source: + type: string + description: The connector role mutation path that produced the event. + enum: + - role_toggle + - role_connector_update + - role_delete + - workspace_permissions + - connector_publish + role.unbound_from_resource: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The ID of the resource the role was unbound from. ChatGPT workspace connector resources use `__`. + role_id: + type: string + description: The ID of the role that was unbound from the resource. + resource_id: + type: string + description: The ID of the resource the role was unbound from. + resource_type: + type: string + description: The type of resource the role was unbound from. + permissions: + type: array + items: + type: string + description: The permissions remaining for the role after the change. + workspace_id: + type: string + description: The workspace ID for a ChatGPT workspace connector resource. + connector_id: + type: string + description: The connector ID for a ChatGPT workspace connector resource. + connector_name: + type: string + description: The connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved. + enabled: + type: boolean + description: Whether the connector is enabled for the role. + source: + type: string + description: The connector role mutation path that produced the event. + enum: + - role_toggle + - role_connector_update + - role_delete + - workspace_permissions + - connector_publish + service_account.created: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The service account ID. + data: + type: object + description: The payload used to create the service account. + properties: + role: + type: string + description: The role of the service account. Is either `owner` or `member`. + service_account.updated: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The service account ID. + changes_requested: + type: object + description: The payload used to updated the service account. + properties: + role: + type: string + description: The role of the service account. Is either `owner` or `member`. + service_account.deleted: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The service account ID. + workload_identity_provider.created: type: object description: The details for events with this `type`. properties: id: type: string - description: The ID of the IP allowlist configuration. - name: - type: string - description: The name of the IP allowlist configuration. - allowed_ips: - type: array - description: The IP addresses or CIDR ranges that were in the configuration. - items: - type: string - ip_allowlist.config.activated: - type: object - description: The details for events with this `type`. - properties: - configs: - type: array - description: The configurations that were activated. - items: - type: object - properties: - id: - type: string - description: The ID of the IP allowlist configuration. - name: - type: string - description: The name of the IP allowlist configuration. - ip_allowlist.config.deactivated: + description: The workload identity provider ID. + data: + type: object + description: The payload used to create the workload identity provider. + workload_identity_provider.updated: type: object description: The details for events with this `type`. properties: - configs: - type: array - description: The configurations that were deactivated. - items: - type: object - properties: - id: - type: string - description: The ID of the IP allowlist configuration. - name: - type: string - description: The name of the IP allowlist configuration. - login.succeeded: - type: object - description: This event has no additional fields beyond the standard audit log attributes. - login.failed: + id: + type: string + description: The workload identity provider ID. + changes_requested: + type: object + description: The payload used to update the workload identity provider. + workload_identity_provider.deleted: type: object description: The details for events with this `type`. properties: - error_code: + id: type: string - description: The error code of the failure. - error_message: + description: The workload identity provider ID. + name: type: string - description: The error message of the failure. - logout.succeeded: - type: object - description: This event has no additional fields beyond the standard audit log attributes. - logout.failed: + description: The workload identity provider name. + workload_identity_provider_mapping.created: type: object description: The details for events with this `type`. properties: - error_code: + id: type: string - description: The error code of the failure. - error_message: + description: The workload identity provider mapping ID. + identity_provider_id: type: string - description: The error message of the failure. - organization.updated: + description: The workload identity provider ID. + data: + type: object + description: The payload used to create the workload identity provider mapping. + workload_identity_provider_mapping.updated: type: object description: The details for events with this `type`. properties: id: type: string - description: The organization ID. + description: The workload identity provider mapping ID. + identity_provider_id: + type: string + description: The workload identity provider ID. changes_requested: type: object - description: The payload used to update the organization settings. - properties: - title: - type: string - description: The organization title. - description: - type: string - description: The organization description. - name: - type: string - description: The organization name. - threads_ui_visibility: - type: string - description: Visibility of the threads page which shows messages created with the Assistants API and Playground. One of `ANY_ROLE`, `OWNERS`, or `NONE`. - usage_dashboard_visibility: - type: string - description: Visibility of the usage dashboard which shows activity and costs for your organization. One of `ANY_ROLE` or `OWNERS`. - api_call_logging: - type: string - description: How your organization logs data from supported API calls. One of `disabled`, `enabled_per_call`, `enabled_for_all_projects`, or `enabled_for_selected_projects` - api_call_logging_project_ids: - type: string - description: The list of project ids if api_call_logging is set to `enabled_for_selected_projects` - project.created: + description: The payload used to update the workload identity provider mapping. + workload_identity_provider_mapping.deleted: type: object description: The details for events with this `type`. properties: id: + type: string + description: The workload identity provider mapping ID. + identity_provider_id: + type: string + description: The workload identity provider ID. + project_id: type: string description: The project ID. + service_account_id: + type: string + description: The mapped service account ID. + user.added: + type: object + description: The details for events with this `type`. + properties: + id: + type: string + description: The user ID. data: type: object - description: The payload used to create the project. + description: The payload used to add the user to the project. properties: - name: - type: string - description: The project name. - title: + role: type: string - description: The title of the project as seen on the dashboard. - project.updated: + description: The role of the user. Is either `owner` or `member`. + user.updated: type: object description: The details for events with this `type`. properties: @@ -28424,3047 +32040,5938 @@ components: description: The project ID. changes_requested: type: object - description: The payload used to update the project. + description: The payload used to update the user. properties: - title: + role: type: string - description: The title of the project as seen on the dashboard. - project.archived: + description: The role of the user. Is either `owner` or `member`. + user.deleted: type: object description: The details for events with this `type`. properties: id: type: string - description: The project ID. - project.deleted: + description: The user ID. + certificate.created: type: object description: The details for events with this `type`. properties: id: type: string - description: The project ID. - rate_limit.updated: + description: The certificate ID. + name: + type: string + description: The name of the certificate. + certificate.updated: type: object description: The details for events with this `type`. properties: id: type: string - description: The rate limit ID - changes_requested: - type: object - description: The payload used to update the rate limits. - properties: - max_requests_per_1_minute: - type: integer - description: The maximum requests per minute. - max_tokens_per_1_minute: - type: integer - description: The maximum tokens per minute. - max_images_per_1_minute: - type: integer - description: The maximum images per minute. Only relevant for certain models. - max_audio_megabytes_per_1_minute: - type: integer - description: The maximum audio megabytes per minute. Only relevant for certain models. - max_requests_per_1_day: - type: integer - description: The maximum requests per day. Only relevant for certain models. - batch_1_day_max_input_tokens: - type: integer - description: The maximum batch input tokens per day. Only relevant for certain models. - rate_limit.deleted: + description: The certificate ID. + name: + type: string + description: The name of the certificate. + certificate.deleted: type: object description: The details for events with this `type`. properties: id: type: string - description: The rate limit ID - role.created: + description: The certificate ID. + name: + type: string + description: The name of the certificate. + certificate: + type: string + description: The certificate content in PEM format. + certificates.activated: type: object description: The details for events with this `type`. properties: - id: - type: string - description: The role ID. - role_name: + certificates: + type: array + items: + type: object + properties: + id: + type: string + description: The certificate ID. + name: + type: string + description: The name of the certificate. + certificates.deactivated: + type: object + description: The details for events with this `type`. + properties: + certificates: + type: array + items: + type: object + properties: + id: + type: string + description: The certificate ID. + name: + type: string + description: The name of the certificate. + required: + - id + - type + - effective_at + x-oaiMeta: + name: The audit log object + example: | + { + "id": "req_xxx_20240101", + "type": "api_key.created", + "effective_at": 1720804090, + "actor": { + "type": "session", + "session": { + "user": { + "id": "user-xxx", + "email": "user@example.com" + }, + "ip_address": "127.0.0.1", + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" + } + }, + "api_key.created": { + "id": "key_xxxx", + "data": { + "scopes": ["resource.operation"] + } + } + } + AuditLogActor: + type: object + description: The actor who performed the audit logged action. + properties: + type: + type: string + description: The type of actor. Is either `session` or `api_key`. + enum: + - session + - api_key + session: + $ref: '#/components/schemas/AuditLogActorSession' + api_key: + $ref: '#/components/schemas/AuditLogActorApiKey' + AuditLogActorApiKey: + type: object + description: The API Key used to perform the audit logged action. + properties: + id: + type: string + description: The tracking id of the API key. + type: + type: string + description: The type of API key. Can be either `user` or `service_account`. + enum: + - user + - service_account + user: + $ref: '#/components/schemas/AuditLogActorUser' + service_account: + $ref: '#/components/schemas/AuditLogActorServiceAccount' + AuditLogActorServiceAccount: + type: object + description: The service account that performed the audit logged action. + properties: + id: + type: string + description: The service account id. + AuditLogActorSession: + type: object + description: The session in which the audit logged action was performed. + properties: + user: + $ref: '#/components/schemas/AuditLogActorUser' + ip_address: + type: string + description: The IP address from which the action was performed. + AuditLogActorUser: + type: object + description: The user who performed the audit logged action. + properties: + id: + type: string + description: The user id. + email: + type: string + description: The user email. + AuditLogEventType: + type: string + description: The event type. + enum: + - api_key.created + - api_key.updated + - api_key.deleted + - certificate.created + - certificate.updated + - certificate.deleted + - certificates.activated + - certificates.deactivated + - checkpoint.permission.created + - checkpoint.permission.deleted + - external_key.registered + - external_key.removed + - group.created + - group.updated + - group.deleted + - invite.sent + - invite.accepted + - invite.deleted + - ip_allowlist.created + - ip_allowlist.updated + - ip_allowlist.deleted + - ip_allowlist.config.activated + - ip_allowlist.config.deactivated + - login.succeeded + - login.failed + - logout.succeeded + - logout.failed + - organization.updated + - project.created + - project.updated + - project.archived + - project.deleted + - rate_limit.updated + - rate_limit.deleted + - resource.deleted + - tunnel.created + - tunnel.updated + - tunnel.deleted + - workload_identity_provider.created + - workload_identity_provider.updated + - workload_identity_provider.deleted + - workload_identity_provider_mapping.created + - workload_identity_provider_mapping.updated + - workload_identity_provider_mapping.deleted + - role.created + - role.updated + - role.deleted + - role.assignment.created + - role.assignment.deleted + - role.bound_to_resource + - role.unbound_from_resource + - scim.enabled + - scim.disabled + - service_account.created + - service_account.updated + - service_account.deleted + - user.added + - user.updated + - user.deleted + - tenant.metadata.updated + - tenant.microsoft_entra_mapping.upserted + - tenant.microsoft_entra_mapping.deleted + - tenant.workload_identity.provider.created + - tenant.workload_identity.provider.updated + - tenant.workload_identity.provider.archived + - tenant.workload_identity.mapping.created + - tenant.workload_identity.mapping.updated + - tenant.workload_identity.mapping.archived + - tenant.workload_identity.binding.created + - tenant.workload_identity.principal.provisioned + - tenant.workload_identity.access_token.issued + - tenant.admin_api_key.created + - tenant.admin_api_key.updated + - tenant.admin_api_key.deleted + - tenant.project_api_key.created + - tenant.trusted_access.business_verification.started + - tenant.trusted_access.application.submitted + - tenant.chatgpt_access_token.revoked + - tenant.migration.completed + - tenant.sso.migrated + - tenant.domains.migrated + - tenant.sso_connection.created + - tenant.sso_connection.updated + - tenant.sso_connection.deleted + - tenant.sso_connection.setup.started + - tenant.policy.created + - tenant.policy.updated + - tenant.policy.deleted + - tenant.policy.attached + - tenant.policy.detached + - tenant.principal_authentication_policy.resolved + - tenant.scim.setup.started + - tenant.scim.deletion.requested + - tenant.scim.directory.created + - tenant.product_access_policy.updated + - tenant.resource_share_grant.created + - tenant.resource_share_grant.updated + - tenant.resource_share_grant.accepted + - tenant.resource_share_grant.declined + - tenant.resource_share_grant.revoked + - tenant.resource_share_grant.deleted + - tenant.service_account.updated + - tenant.service_account.deleted + - tenant.service_account.token.revoked + - tenant.billing.overage_limit.updated + - tenant.billing.alerts.updated + - tenant.billing.info.updated + - tenant.usage_limit.workspace.updated + - tenant.usage_limit.group.updated + - tenant.usage_limit.user.updated + - tenant.usage_limit.increase_request.updated + - tenant.usage_limit.increase_request.resolved + - tenant.group.created + - tenant.group.updated + - tenant.group.deleted + - tenant.group.member.added + - tenant.group.member.removed + - tenant.migration_rollout.status.updated + - tenant.migration_rollout.tier.updated + - tenant.role.metadata.updated + - tenant.custom_role.created + - tenant.custom_role.updated + - tenant.custom_role.deleted + - tenant.role_assignment.created + - tenant.role_assignment.deleted + - tenant.resource_role_assignment.created + - tenant.resource_role_assignment.deleted + - tenant.resource_access.updated + - tenant.resource_access.deleted + - tenant.ads_account.onboarding.redemption + - tenant.session_policy.created + - tenant.session_policy.updated + - tenant.session_policy.deleted + - tenant.session_revocation.started + - tenant.third_party_app_policy.updated + - tenant.user.added + - tenant.user.updated + - tenant.user.removed + - tenant.user.looked_up + - tenant.user.invited + - tenant.membership.revoked + - tenant.api_organization_invite.upserted + - tenant.api_organization_invite.deleted + - tenant.chatgpt_workspace_invite.upserted + - tenant.membership.accepted + - tenant.membership.declined + - tenant.workspace_invite_email_settings.updated + AutoChunkingStrategyRequestParam: + type: object + title: Auto Chunking Strategy + description: The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`. + additionalProperties: false + properties: + type: + type: string + description: Always `auto`. + enum: + - auto + x-stainless-const: true + required: + - type + Batch: + type: object + properties: + id: + type: string + object: + type: string + enum: + - batch + description: The object type, which is always `batch`. + x-stainless-const: true + endpoint: + type: string + description: The OpenAI API endpoint used by the batch. + model: + type: string + description: | + Model ID used to process the batch, like `gpt-6-astra`. OpenAI + offers a wide range of models with different capabilities, performance + characteristics, and price points. Refer to the [model + guide](https://developers.openai.com/api/docs/models) to browse and compare available models. + errors: + type: object + properties: + object: type: string - description: The name of the role. - permissions: + description: The object type, which is always `list`. + data: type: array items: - type: string - description: The permissions granted by the role. - resource_type: - type: string - description: The type of resource the role belongs to. - resource_id: - type: string - description: The resource the role is scoped to. - role.updated: + $ref: '#/components/schemas/BatchError' + input_file_id: + type: string + description: The ID of the input file for the batch. + completion_window: + type: string + description: The time frame within which the batch should be processed. + status: + type: string + description: The current status of the batch. + enum: + - validating + - failed + - in_progress + - finalizing + - completed + - expired + - cancelling + - cancelled + output_file_id: + type: string + description: The ID of the file containing the outputs of successfully executed requests. + error_file_id: + type: string + description: The ID of the file containing the outputs of requests with errors. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was created. + in_progress_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch started processing. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch will expire. + finalizing_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch started finalizing. + completed_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was completed. + failed_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch failed. + expired_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch expired. + cancelling_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch started cancelling. + cancelled_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the batch was cancelled. + request_counts: + $ref: '#/components/schemas/BatchRequestCounts' + usage: type: object - description: The details for events with this `type`. + description: | + Represents token usage details including input tokens, output tokens, a + breakdown of output tokens, and the total tokens used. Only populated on + batches created after September 7, 2025. properties: - id: - type: string - description: The role ID. - changes_requested: + input_tokens: + type: integer + description: The number of input tokens. + input_tokens_details: type: object - description: The payload used to update the role. + description: A detailed breakdown of the input tokens. properties: - role_name: - type: string - description: The updated role name, when provided. - resource_id: - type: string - description: The resource the role is scoped to. - resource_type: - type: string - description: The type of resource the role belongs to. - permissions_added: - type: array - items: - type: string - description: The permissions added to the role. - permissions_removed: - type: array - items: - type: string - description: The permissions removed from the role. - description: - type: string - description: The updated role description, when provided. - metadata: - type: object - description: Additional metadata stored on the role. - role.deleted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The role ID. - role.assignment.created: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The identifier of the role assignment. - principal_id: - type: string - description: The principal (user or group) that received the role. - principal_type: - type: string - description: The type of principal (user or group) that received the role. - resource_id: - type: string - description: The resource the role assignment is scoped to. - resource_type: - type: string - description: The type of resource the role assignment is scoped to. - role.assignment.deleted: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The identifier of the role assignment. - principal_id: - type: string - description: The principal (user or group) that had the role removed. - principal_type: - type: string - description: The type of principal (user or group) that had the role removed. - resource_id: - type: string - description: The resource the role assignment was scoped to. - resource_type: - type: string - description: The type of resource the role assignment was scoped to. - role.bound_to_resource: + cached_tokens: + type: integer + description: | + The number of tokens that were retrieved from the cache. [More on + prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching). + required: + - cached_tokens + output_tokens: + type: integer + description: The number of output tokens. + output_tokens_details: + type: object + description: A detailed breakdown of the output tokens. + properties: + reasoning_tokens: + type: integer + description: The number of reasoning tokens. + required: + - reasoning_tokens + total_tokens: + type: integer + description: The total number of tokens used. + required: + - input_tokens + - input_tokens_details + - output_tokens + - output_tokens_details + - total_tokens + metadata: + $ref: '#/components/schemas/Metadata' + required: + - id + - object + - endpoint + - input_file_id + - completion_window + - status + - created_at + x-oaiMeta: + name: The batch object + example: | + { + "id": "batch_abc123", + "object": "batch", + "endpoint": "/v1/chat/completions", + "model": "gpt-6-astra", + "errors": null, + "input_file_id": "file-abc123", + "completion_window": "24h", + "status": "completed", + "output_file_id": "file-cvaTdG", + "error_file_id": "file-HOWS94", + "created_at": 1711471533, + "in_progress_at": 1711471538, + "expires_at": 1711557933, + "finalizing_at": 1711493133, + "completed_at": 1711493163, + "failed_at": null, + "expired_at": null, + "cancelling_at": null, + "cancelled_at": null, + "request_counts": { + "total": 100, + "completed": 95, + "failed": 5 + }, + "usage": { + "input_tokens": 1500, + "input_tokens_details": { + "cached_tokens": 1024 + }, + "output_tokens": 500, + "output_tokens_details": { + "reasoning_tokens": 300 + }, + "total_tokens": 2000 + }, + "metadata": { + "customer_id": "user_123456789", + "batch_description": "Nightly eval job", + } + } + BatchError: + type: object + properties: + code: + type: string + description: An error code identifying the error type. + message: + type: string + description: A human-readable message providing more details about the error. + param: + anyOf: + - type: string + description: The name of the parameter that caused the error, if applicable. + - type: 'null' + line: + anyOf: + - type: integer + description: The line number of the input file where the error occurred, if applicable. + - type: 'null' + BatchFileExpirationAfter: + type: object + title: File expiration policy + description: The expiration policy for the output and/or error file that are generated for a batch. + properties: + anchor: + description: 'Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`. Note that the anchor is the file creation time, not the time the batch is created.' + type: string + enum: + - created_at + x-stainless-const: true + seconds: + description: The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days). + type: integer + format: int64 + minimum: 3600 + maximum: 2592000 + required: + - anchor + - seconds + BatchRequestCounts: + type: object + properties: + total: + type: integer + description: Total number of requests in the batch. + completed: + type: integer + description: Number of requests that have been completed successfully. + failed: + type: integer + description: Number of requests that have failed. + required: + - total + - completed + - failed + description: The request counts for different statuses within the batch. + Certificate: + type: object + description: Represents an individual `certificate` uploaded to the organization. + properties: + object: + type: string + enum: + - certificate + - organization.certificate + - organization.project.certificate + description: | + The object type. + + - If creating, updating, or getting a specific certificate, the object type is `certificate`. + - If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`. + - If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`. + x-stainless-const: true + id: + type: string + description: The identifier, which can be referenced in API endpoints + name: + anyOf: + - type: string + - type: 'null' + description: The name of the certificate. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the certificate was uploaded. + certificate_details: type: object - description: The details for events with this `type`. properties: - id: - type: string - description: The ID of the resource the role was bound to. ChatGPT workspace connector resources use `__`. - role_id: - type: string - description: The ID of the role that was bound to the resource. - resource_id: - type: string - description: The ID of the resource the role was bound to. - resource_type: - type: string - description: The type of resource the role was bound to. - permissions: - type: array - items: - type: string - description: The permissions granted to the role for the resource. - workspace_id: - type: string - description: The workspace ID for a ChatGPT workspace connector resource. - connector_id: - type: string - description: The connector ID for a ChatGPT workspace connector resource. - connector_name: - type: string - description: The connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved. - enabled: - type: boolean - description: Whether the connector is enabled for the role. - source: + valid_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the certificate becomes valid. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the certificate expires. + content: type: string - description: The connector role mutation path that produced the event. - enum: - - role_toggle - - role_connector_update - - role_delete - - workspace_permissions - - connector_publish - role.unbound_from_resource: + description: The content of the certificate in PEM format. + active: + type: boolean + description: Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. + required: + - object + - id + - name + - created_at + - certificate_details + x-oaiMeta: + name: The certificate object + example: | + { + "object": "certificate", + "id": "cert_abc", + "name": "My Certificate", + "created_at": 1234567, + "certificate_details": { + "valid_at": 1234567, + "expires_at": 12345678, + "content": "-----BEGIN CERTIFICATE----- MIIGAjCCA...6znFlOW+ -----END CERTIFICATE-----" + } + } + ChatCompletionAllowedTools: + type: object + title: Allowed tools + description: | + Constrains the tools available to the model to a pre-defined set. + properties: + mode: + type: string + enum: + - auto + - required + description: | + Constrains the tools available to the model to a pre-defined set. + + `auto` allows the model to pick from among the allowed tools and generate a + message. + + `required` requires the model to call one or more of the allowed tools. + tools: + type: array + description: | + A list of tool definitions that the model should be allowed to call. + + For the Chat Completions API, the list of tool definitions might look like: + ```json + [ + { "type": "function", "function": { "name": "get_weather" } }, + { "type": "function", "function": { "name": "get_time" } } + ] + ``` + items: + type: object + x-oaiExpandable: false + description: | + A tool definition that the model should be allowed to call. + additionalProperties: true + required: + - mode + - tools + ChatCompletionAllowedToolsChoice: + type: object + title: Allowed tools + description: | + Constrains the tools available to the model to a pre-defined set. + properties: + type: + type: string + enum: + - allowed_tools + description: Allowed tool configuration type. Always `allowed_tools`. + x-stainless-const: true + allowed_tools: + $ref: '#/components/schemas/ChatCompletionAllowedTools' + required: + - type + - allowed_tools + ChatCompletionDeleted: + type: object + properties: + object: + type: string + description: The type of object being deleted. + enum: + - chat.completion.deleted + x-stainless-const: true + id: + type: string + description: The ID of the chat completion that was deleted. + deleted: + type: boolean + description: Whether the chat completion was deleted. + required: + - object + - id + - deleted + ChatCompletionFunctionCallOption: + type: object + description: | + Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. + properties: + name: + type: string + description: The name of the function to call. + required: + - name + x-stainless-variantName: function_call_option + ChatCompletionFunctions: + type: object + deprecated: true + properties: + description: + type: string + description: A description of what the function does, used by the model to choose when and how to call the function. + name: + type: string + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + parameters: + $ref: '#/components/schemas/FunctionParameters' + required: + - name + ChatCompletionList: + type: object + title: ChatCompletionList + description: | + An object representing a list of Chat Completions. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of chat completion objects. + items: + $ref: '#/components/schemas/CreateChatCompletionResponse' + first_id: + type: string + description: The identifier of the first chat completion in the data array. + last_id: + type: string + description: The identifier of the last chat completion in the data array. + has_more: + type: boolean + description: Indicates whether there are more Chat Completions available. + required: + - object + - data + - first_id + - last_id + - has_more + x-oaiMeta: + name: The chat completion list object + group: chat + example: | + { + "object": "list", + "data": [ + { + "object": "chat.completion", + "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "model": "gpt-6-astra", + "created": 1738960610, + "request_id": "req_ded8ab984ec4bf840f37566c1011c417", + "tool_choice": null, + "usage": { + "total_tokens": 31, + "completion_tokens": 18, + "prompt_tokens": 13 + }, + "seed": 4944116822809979520, + "top_p": 1.0, + "temperature": 1.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0, + "system_fingerprint": "fp_50cad350e4", + "input_user": null, + "service_tier": "default", + "tools": null, + "metadata": {}, + "choices": [ + { + "index": 0, + "message": { + "content": "Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark.", + "role": "assistant", + "tool_calls": null, + "function_call": null + }, + "finish_reason": "stop", + "logprobs": null + } + ], + "response_format": null + } + ], + "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", + "has_more": false + } + ChatCompletionMessageCustomToolCall: + type: object + title: Custom tool call + description: | + A call to a custom tool created by the model. + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - custom + description: The type of the tool. Always `custom`. + x-stainless-const: true + custom: type: object - description: The details for events with this `type`. + description: The custom tool that the model called. properties: - id: - type: string - description: The ID of the resource the role was unbound from. ChatGPT workspace connector resources use `__`. - role_id: - type: string - description: The ID of the role that was unbound from the resource. - resource_id: - type: string - description: The ID of the resource the role was unbound from. - resource_type: - type: string - description: The type of resource the role was unbound from. - permissions: - type: array - items: - type: string - description: The permissions remaining for the role after the change. - workspace_id: - type: string - description: The workspace ID for a ChatGPT workspace connector resource. - connector_id: - type: string - description: The connector ID for a ChatGPT workspace connector resource. - connector_name: - type: string - description: The connector display name for a ChatGPT workspace connector resource, or the connector ID when the display name could not be resolved. - enabled: - type: boolean - description: Whether the connector is enabled for the role. - source: + name: type: string - description: The connector role mutation path that produced the event. - enum: - - role_toggle - - role_connector_update - - role_delete - - workspace_permissions - - connector_publish - service_account.created: - type: object - description: The details for events with this `type`. - properties: - id: + description: The name of the custom tool to call. + input: type: string - description: The service account ID. - data: - type: object - description: The payload used to create the service account. + description: The input for the custom tool call generated by the model. + required: + - name + - input + required: + - id + - type + - custom + ChatCompletionMessageList: + type: object + title: ChatCompletionMessageList + description: | + An object representing a list of chat completion messages. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of chat completion message objects. + items: + allOf: + - $ref: '#/components/schemas/ChatCompletionResponseMessage' + - type: object + required: + - id properties: - role: + id: type: string - description: The role of the service account. Is either `owner` or `member`. - service_account.updated: + description: The identifier of the chat message. + content_parts: + anyOf: + - type: array + description: | + If a content parts array was provided, this is an array of `text` and `image_url` parts. + Otherwise, null. + items: + anyOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartImage' + - type: 'null' + first_id: + type: string + description: The identifier of the first chat message in the data array. + last_id: + type: string + description: The identifier of the last chat message in the data array. + has_more: + type: boolean + description: Indicates whether there are more chat messages available. + required: + - object + - data + - first_id + - last_id + - has_more + x-oaiMeta: + name: The chat completion message list object + group: chat + example: | + { + "object": "list", + "data": [ + { + "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "role": "user", + "content": "write a haiku about ai", + "name": null, + "content_parts": null + } + ], + "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", + "has_more": false + } + ChatCompletionMessageToolCall: + type: object + title: Function tool call + description: | + A call to a function tool created by the model. + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + x-stainless-const: true + function: type: object - description: The details for events with this `type`. + description: The function that the model called. properties: - id: + name: type: string - description: The service account ID. - changes_requested: - type: object - description: The payload used to updated the service account. - properties: - role: - type: string - description: The role of the service account. Is either `owner` or `member`. - service_account.deleted: - type: object - description: The details for events with this `type`. - properties: - id: + description: The name of the function to call. + arguments: type: string - description: The service account ID. - workload_identity_provider.created: + description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + required: + - name + - arguments + required: + - id + - type + - function + ChatCompletionMessageToolCallChunk: + type: object + properties: + index: + type: integer + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + x-stainless-const: true + function: type: object - description: The details for events with this `type`. properties: - id: + name: type: string - description: The workload identity provider ID. - data: - type: object - description: The payload used to create the workload identity provider. - workload_identity_provider.updated: + description: The name of the function to call. + arguments: + type: string + description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + required: + - index + ChatCompletionMessageToolCalls: + type: array + description: The tool calls generated by the model, such as function calls. + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/ChatCompletionMessageToolCall' + - $ref: '#/components/schemas/ChatCompletionMessageCustomToolCall' + x-stainless-naming: + python: + model_name: chat_completion_message_tool_call_union + param_model_name: chat_completion_message_tool_call_union_param + x-stainless-go-variant-constructor: skip + ChatCompletionModalities: + anyOf: + - type: array + description: | + Output types that you would like the model to generate for this request. + Most models are capable of generating text, which is the default: + + `["text"]` + + The `gpt-4o-audio-preview` model can also be used to [generate audio](https://developers.openai.com/api/docs/guides/audio). To + request that this model generate both text and audio responses, you can + use: + + `["text", "audio"]` + items: + type: string + enum: + - text + - audio + - type: 'null' + ChatCompletionModeration: + type: object + description: Moderation results or errors for the request input and generated output. + properties: + input: + description: Moderation for the request input. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/ChatCompletionModerationResults' + - $ref: '#/components/schemas/ChatCompletionModerationError' + output: + description: Moderation for the generated output. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/ChatCompletionModerationResults' + - $ref: '#/components/schemas/ChatCompletionModerationError' + required: + - input + - output + ChatCompletionModerationError: + type: object + description: An error produced while attempting moderation. + properties: + type: + type: string + enum: + - error + description: The object type, which is always `error`. + x-stainless-const: true + code: + type: string + description: The error code. + message: + type: string + description: The error message. + required: + - type + - code + - message + ChatCompletionModerationResults: + type: object + description: Successful moderation results for the request input or generated output. + properties: + type: + type: string + enum: + - moderation_results + description: The object type, which is always `moderation_results`. + x-stainless-const: true + model: + type: string + description: The moderation model used to generate the results. + results: + type: array + description: A list of moderation results. + items: + $ref: '#/components/schemas/ModerationResultBody' + required: + - type + - model + - results + ChatCompletionNamedToolChoice: + type: object + title: Function tool choice + description: Specifies a tool the model should use. Use to force the model to call a specific function. + properties: + type: + type: string + enum: + - function + description: For function calling, the type is always `function`. + x-stainless-const: true + function: type: object - description: The details for events with this `type`. properties: - id: + name: type: string - description: The workload identity provider ID. - changes_requested: - type: object - description: The payload used to update the workload identity provider. - workload_identity_provider.deleted: + description: The name of the function to call. + required: + - name + required: + - type + - function + ChatCompletionNamedToolChoiceCustom: + type: object + title: Custom tool choice + description: Specifies a tool the model should use. Use to force the model to call a specific custom tool. + properties: + type: + type: string + enum: + - custom + description: For custom tool calling, the type is always `custom`. + x-stainless-const: true + custom: type: object - description: The details for events with this `type`. properties: - id: - type: string - description: The workload identity provider ID. name: type: string - description: The workload identity provider name. - workload_identity_provider_mapping.created: + description: The name of the custom tool to call. + required: + - name + required: + - type + - custom + ChatCompletionRequestAssistantMessage: + type: object + title: Assistant message + description: | + Messages sent by the model in response to user messages. + properties: + content: + anyOf: + - description: | + The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified. + anyOf: + - type: string + description: The contents of the assistant message. + title: Text content + - type: array + description: An array of content parts with a defined type. Can be one or more of type `text`, or exactly one of type `refusal`. + title: Array of content parts + items: + $ref: '#/components/schemas/ChatCompletionRequestAssistantMessageContentPart' + minItems: 1 + - type: 'null' + refusal: + anyOf: + - type: string + description: The refusal message by the assistant. + - type: 'null' + role: + type: string + enum: + - assistant + description: The role of the messages author, in this case `assistant`. + x-stainless-const: true + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + audio: + anyOf: + - type: object + description: | + Data about a previous audio response from the model. + [Learn more](https://developers.openai.com/api/docs/guides/audio). + required: + - id + properties: + id: + type: string + description: | + Unique identifier for a previous audio response from the model. + - type: 'null' + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCalls' + function_call: + anyOf: + - type: object + deprecated: true + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + properties: + arguments: + type: string + description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + name: + type: string + description: The name of the function to call. + required: + - arguments + - name + - type: 'null' + required: + - role + x-stainless-soft-required: + - content + ChatCompletionRequestAssistantMessageContentPart: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartRefusal' + ChatCompletionRequestDeveloperMessage: + type: object + title: Developer message + description: | + Developer-provided instructions that the model should follow, regardless of + messages sent by the user. With o1 models and newer, `developer` messages + replace the previous `system` messages. + properties: + content: + description: The contents of the developer message. + anyOf: + - type: string + description: The contents of the developer message. + title: Text content + - type: array + description: An array of content parts with a defined type. For developer messages, only type `text` is supported. + title: Array of content parts + items: + $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + minItems: 1 + role: + type: string + enum: + - developer + description: The role of the messages author, in this case `developer`. + x-stainless-const: true + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + required: + - content + - role + x-stainless-naming: + go: + variant_constructor: DeveloperMessage + ChatCompletionRequestFunctionMessage: + type: object + title: Function message + deprecated: true + properties: + role: + type: string + enum: + - function + description: The role of the messages author, in this case `function`. + x-stainless-const: true + content: + anyOf: + - type: string + description: The contents of the function message. + - type: 'null' + name: + type: string + description: The name of the function to call. + required: + - role + - content + - name + ChatCompletionRequestMessage: + discriminator: + propertyName: role + anyOf: + - $ref: '#/components/schemas/ChatCompletionRequestDeveloperMessage' + - $ref: '#/components/schemas/ChatCompletionRequestSystemMessage' + - $ref: '#/components/schemas/ChatCompletionRequestUserMessage' + - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage' + - $ref: '#/components/schemas/ChatCompletionRequestToolMessage' + - $ref: '#/components/schemas/ChatCompletionRequestFunctionMessage' + ChatCompletionRequestMessageContentPartAudio: + type: object + title: Audio content part + description: | + Learn about [audio inputs](https://developers.openai.com/api/docs/guides/audio). + properties: + type: + type: string + enum: + - input_audio + description: The type of the content part. Always `input_audio`. + x-stainless-const: true + input_audio: type: object - description: The details for events with this `type`. properties: - id: - type: string - description: The workload identity provider mapping ID. - identity_provider_id: - type: string - description: The workload identity provider ID. data: - type: object - description: The payload used to create the workload identity provider mapping. - workload_identity_provider_mapping.updated: - type: object - description: The details for events with this `type`. - properties: - id: - type: string - description: The workload identity provider mapping ID. - identity_provider_id: - type: string - description: The workload identity provider ID. - changes_requested: - type: object - description: The payload used to update the workload identity provider mapping. - workload_identity_provider_mapping.deleted: - type: object - description: The details for events with this `type`. - properties: - id: type: string - description: The workload identity provider mapping ID. - identity_provider_id: - type: string - description: The workload identity provider ID. - project_id: - type: string - description: The project ID. - service_account_id: + description: Base64 encoded audio data. + format: type: string - description: The mapped service account ID. - user.added: + enum: + - wav + - mp3 + description: | + The format of the encoded audio data. Currently supports "wav" and "mp3". + required: + - data + - format + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointParam' + required: + - type + - input_audio + x-stainless-naming: + go: + variant_constructor: InputAudioContentPart + ChatCompletionRequestMessageContentPartFile: + type: object + title: File content part + description: | + Learn about [file inputs](https://developers.openai.com/api/docs/guides/text) for text generation. + properties: + type: + type: string + enum: + - file + description: The type of the content part. Always `file`. + x-stainless-const: true + file: type: object - description: The details for events with this `type`. properties: - id: + filename: type: string - description: The user ID. - data: - type: object - description: The payload used to add the user to the project. - properties: - role: - type: string - description: The role of the user. Is either `owner` or `member`. - user.updated: - type: object - description: The details for events with this `type`. - properties: - id: + description: | + The name of the file, used when passing the file to the model as a + string. + file_data: type: string - description: The project ID. - changes_requested: - type: object - description: The payload used to update the user. - properties: - role: - type: string - description: The role of the user. Is either `owner` or `member`. - user.deleted: - type: object - description: The details for events with this `type`. - properties: - id: + description: | + The base64 encoded file data, used when passing the file to the model + as a string. + file_id: type: string - description: The user ID. - certificate.created: + description: | + The ID of an uploaded file to use as input. + x-stainless-naming: + java: + type_name: FileObject + kotlin: + type_name: FileObject + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointParam' + required: + - type + - file + x-stainless-naming: + go: + variant_constructor: FileContentPart + ChatCompletionRequestMessageContentPartImage: + type: object + title: Image content part + description: | + Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision). + properties: + type: + type: string + enum: + - image_url + description: The type of the content part. + x-stainless-const: true + image_url: type: object - description: The details for events with this `type`. properties: - id: + url: type: string - description: The certificate ID. - name: + description: Either a URL of the image or the base64 encoded image data. + format: uri + detail: type: string - description: The name of the certificate. - certificate.updated: + description: Specifies the detail level of the image. Learn more in the [Vision guide](https://developers.openai.com/api/docs/guides/images-vision#choose-an-image-detail-level). + enum: + - auto + - low + - high + default: auto + required: + - url + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointParam' + required: + - type + - image_url + x-stainless-naming: + go: + variant_constructor: ImageContentPart + ChatCompletionRequestMessageContentPartRefusal: + type: object + title: Refusal content part + properties: + type: + type: string + enum: + - refusal + description: The type of the content part. + x-stainless-const: true + refusal: + type: string + description: The refusal message generated by the model. + required: + - type + - refusal + ChatCompletionRequestMessageContentPartText: + type: object + title: Text content part + description: | + Learn about [text inputs](https://developers.openai.com/api/docs/guides/text). + properties: + type: + type: string + enum: + - text + description: The type of the content part. + x-stainless-const: true + text: + type: string + description: The text content. + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointParam' + required: + - type + - text + x-stainless-naming: + go: + variant_constructor: TextContentPart + ChatCompletionRequestSystemMessage: + type: object + title: System message + description: | + Developer-provided instructions that the model should follow, regardless of + messages sent by the user. With o1 models and newer, use `developer` messages + for this purpose instead. + properties: + content: + description: The contents of the system message. + anyOf: + - type: string + description: The contents of the system message. + title: Text content + - type: array + description: An array of content parts with a defined type. For system messages, only type `text` is supported. + title: Array of content parts + items: + $ref: '#/components/schemas/ChatCompletionRequestSystemMessageContentPart' + minItems: 1 + role: + type: string + enum: + - system + description: The role of the messages author, in this case `system`. + x-stainless-const: true + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + required: + - content + - role + x-stainless-naming: + go: + variant_constructor: SystemMessage + ChatCompletionRequestSystemMessageContentPart: + anyOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + ChatCompletionRequestToolMessage: + type: object + title: Tool message + properties: + role: + type: string + enum: + - tool + description: The role of the messages author, in this case `tool`. + x-stainless-const: true + content: + description: The contents of the tool message. + anyOf: + - type: string + description: The contents of the tool message. + title: Text content + - type: array + description: An array of content parts with a defined type. For tool messages, only type `text` is supported. + title: Array of content parts + items: + $ref: '#/components/schemas/ChatCompletionRequestToolMessageContentPart' + minItems: 1 + tool_call_id: + type: string + description: Tool call that this message is responding to. + required: + - role + - content + - tool_call_id + x-stainless-naming: + go: + variant_constructor: ToolMessage + ChatCompletionRequestToolMessageContentPart: + anyOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + ChatCompletionRequestUserMessage: + type: object + title: User message + description: | + Messages sent by an end user, containing prompts or additional context + information. + properties: + content: + description: | + The contents of the user message. + anyOf: + - type: string + description: The text contents of the message. + title: Text content + - type: array + description: An array of content parts with a defined type. Supported options differ based on the [model](https://developers.openai.com/api/docs/models) being used to generate the response. Can contain text, image, or audio inputs. + title: Array of content parts + items: + $ref: '#/components/schemas/ChatCompletionRequestUserMessageContentPart' + minItems: 1 + role: + type: string + enum: + - user + description: The role of the messages author, in this case `user`. + x-stainless-const: true + name: + type: string + description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + required: + - content + - role + x-stainless-naming: + go: + variant_constructor: UserMessage + ChatCompletionRequestUserMessageContentPart: + anyOf: + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartImage' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartAudio' + - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartFile' + discriminator: + propertyName: type + ChatCompletionResponseMessage: + type: object + description: A chat completion message generated by the model. + properties: + content: + anyOf: + - type: string + description: The contents of the message. + - type: 'null' + refusal: + anyOf: + - type: string + description: The refusal message generated by the model. + - type: 'null' + tool_calls: + $ref: '#/components/schemas/ChatCompletionMessageToolCalls' + annotations: + type: array + description: | + Annotations for the message, when applicable, as when using the + [web search tool](https://developers.openai.com/api/docs/guides/tools-web-search). + items: + type: object + description: | + A URL citation when using web search. + required: + - type + - url_citation + properties: + type: + type: string + description: The type of the URL citation. Always `url_citation`. + enum: + - url_citation + x-stainless-const: true + url_citation: + type: object + description: A URL citation when using web search. + required: + - end_index + - start_index + - url + - title + properties: + end_index: + type: integer + description: The index of the last character of the URL citation in the message. + start_index: + type: integer + description: The index of the first character of the URL citation in the message. + url: + type: string + format: uri + description: The URL of the web resource. + title: + type: string + description: The title of the web resource. + role: + type: string + enum: + - assistant + description: The role of the author of this message. + x-stainless-const: true + function_call: type: object - description: The details for events with this `type`. + deprecated: true + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. properties: - id: + arguments: type: string - description: The certificate ID. + description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. name: type: string - description: The name of the certificate. - certificate.deleted: + description: The name of the function to call. + required: + - name + - arguments + audio: + anyOf: + - type: object + description: | + If the audio output modality is requested, this object contains data + about the audio response from the model. [Learn more](https://developers.openai.com/api/docs/guides/audio). + required: + - id + - expires_at + - data + - transcript + properties: + id: + type: string + description: Unique identifier for this audio response. + expires_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) for when this audio response will + no longer be accessible on the server for use in multi-turn + conversations. + data: + type: string + description: | + Base64 encoded audio bytes generated by the model, in the format + specified in the request. + transcript: + type: string + description: Transcript of the audio generated by the model. + - type: 'null' + required: + - role + - content + - refusal + ChatCompletionRole: + type: string + description: The role of the author of a message + enum: + - developer + - system + - user + - assistant + - tool + - function + ChatCompletionStreamOptions: + anyOf: + - description: | + Options for streaming response. Only set this when you set `stream: true`. + type: object + properties: + include_usage: + type: boolean + description: | + If set, an additional chunk will be streamed before the `data: [DONE]` + message. The `usage` field on this chunk shows the token usage statistics + for the entire request, and the `choices` field will always be an empty + array. + + All other chunks will also include a `usage` field, but with a null + value. **NOTE:** If the stream is interrupted, you may not receive the + final usage chunk which contains the total token usage for the request. + include_obfuscation: + type: boolean + description: | + When true, stream obfuscation will be enabled. Stream obfuscation adds + random characters to an `obfuscation` field on streaming delta events to + normalize payload sizes as a mitigation to certain side-channel attacks. + These obfuscation fields are included by default, but add a small amount + of overhead to the data stream. You can set `include_obfuscation` to + false to optimize for bandwidth if you trust the network links between + your application and the OpenAI API. + - type: 'null' + ChatCompletionStreamResponseDelta: + type: object + description: A chat completion delta generated by streamed model responses. + properties: + content: + anyOf: + - type: string + description: The contents of the chunk message. + - type: 'null' + function_call: + deprecated: true type: object - description: The details for events with this `type`. + description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. properties: - id: + arguments: type: string - description: The certificate ID. + description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. name: type: string - description: The name of the certificate. - certificate: - type: string - description: The certificate content in PEM format. - certificates.activated: + description: The name of the function to call. + tool_calls: + type: array + items: + $ref: '#/components/schemas/ChatCompletionMessageToolCallChunk' + role: + type: string + enum: + - developer + - system + - user + - assistant + - tool + description: The role of the author of this message. + refusal: + anyOf: + - type: string + description: The refusal message generated by the model. + - type: 'null' + ChatCompletionTokenLogprob: + type: object + properties: + token: + description: The token. + type: string + logprob: + description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. + type: number + bytes: + anyOf: + - description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. + type: array + items: + type: integer + - type: 'null' + top_logprobs: + description: List of the most likely tokens and their log probability, at this token position. The number of entries may be fewer than the requested `top_logprobs`. + type: array + items: + type: object + properties: + token: + description: The token. + type: string + logprob: + description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. + type: number + bytes: + anyOf: + - description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. + type: array + items: + type: integer + - type: 'null' + required: + - token + - logprob + - bytes + required: + - token + - logprob + - bytes + - top_logprobs + ChatCompletionTool: + type: object + title: Function tool + description: | + A function tool that can be used to generate a response. + properties: + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + x-stainless-const: true + function: + $ref: '#/components/schemas/FunctionObject' + required: + - type + - function + ChatCompletionToolChoiceOption: + description: | + Controls which (if any) tool is called by the model. + `none` means the model will not call any tool and instead generates a message. + `auto` means the model can pick between generating a message or calling one or more tools. + `required` means the model must call one or more tools. + Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. + + `none` is the default when no tools are present. `auto` is the default if tools are present. + anyOf: + - type: string + title: Auto + description: | + `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. + enum: + - none + - auto + - required + - $ref: '#/components/schemas/ChatCompletionAllowedToolsChoice' + - $ref: '#/components/schemas/ChatCompletionNamedToolChoice' + - $ref: '#/components/schemas/ChatCompletionNamedToolChoiceCustom' + x-stainless-go-variant-constructor: + naming: tool_choice_option_{variant} + ChunkingStrategyRequestParam: + type: object + description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty. + anyOf: + - $ref: '#/components/schemas/AutoChunkingStrategyRequestParam' + - $ref: '#/components/schemas/StaticChunkingStrategyRequestParam' + discriminator: + propertyName: type + CodeInterpreterFileOutput: + type: object + title: Code interpreter file output + description: | + The output of a code interpreter tool call that is a file. + properties: + type: + type: string + enum: + - files + description: | + The type of the code interpreter file output. Always `files`. + x-stainless-const: true + files: + type: array + items: + type: object + properties: + mime_type: + type: string + description: | + The MIME type of the file. + file_id: + type: string + description: | + The ID of the file. + required: + - mime_type + - file_id + required: + - type + - files + CodeInterpreterTextOutput: + type: object + title: Code interpreter text output + description: | + The output of a code interpreter tool call that is text. + properties: + type: + type: string + enum: + - logs + description: | + The type of the code interpreter text output. Always `logs`. + x-stainless-const: true + logs: + type: string + description: | + The logs of the code interpreter tool call. + required: + - type + - logs + CodeInterpreterTool: + type: object + title: Code interpreter + description: | + A tool that runs Python code to help generate a response to a prompt. + properties: + type: + type: string + enum: + - code_interpreter + description: | + The type of the code interpreter tool. Always `code_interpreter`. + x-stainless-const: true + container: + description: | + The code interpreter container. Can be a container ID or an object that + specifies uploaded file IDs to make available to your code, along with an + optional `memory_limit` setting. + anyOf: + - type: string + description: The container ID. + - $ref: '#/components/schemas/CodeInterpreterContainerAuto' + allowed_callers: + anyOf: + - type: array + minItems: 1 + items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + description: The tool invocation context(s). + - type: 'null' + required: + - type + - container + CodeInterpreterToolCall: + type: object + title: Code interpreter tool call + description: | + A tool call to run code. + properties: + type: + type: string + enum: + - code_interpreter_call + default: code_interpreter_call + x-stainless-const: true + description: | + The type of the code interpreter tool call. Always `code_interpreter_call`. + id: + type: string + description: | + The unique ID of the code interpreter tool call. + status: + type: string + enum: + - in_progress + - completed + - incomplete + - interpreting + - failed + description: | + The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`. + container_id: + type: string + description: | + The ID of the container used to run the code. + code: + anyOf: + - type: string + description: | + The code to run, or null if not available. + - type: 'null' + outputs: + anyOf: + - type: array + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/CodeInterpreterOutputLogs' + - $ref: '#/components/schemas/CodeInterpreterOutputImage' + discriminator: + propertyName: type + description: | + The outputs generated by the code interpreter, such as logs or images. + Can be null if no outputs are available. + - type: 'null' + required: + - type + - id + - status + - container_id + - code + - outputs + ComparisonFilter: + type: object + additionalProperties: false + title: Comparison Filter + description: | + A filter used to compare a specified attribute key to a given value using a defined comparison operation. + properties: + type: + type: string + default: eq + enum: + - eq + - ne + - gt + - gte + - lt + - lte + - in + - nin + description: | + Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`. + - `eq`: equals + - `ne`: not equal + - `gt`: greater than + - `gte`: greater than or equal + - `lt`: less than + - `lte`: less than or equal + - `in`: in + - `nin`: not in + key: + type: string + description: The key to compare against the value. + value: + description: The value to compare against the attribute key; supports string, number, or boolean types. + anyOf: + - type: string + - type: number + - type: boolean + - type: array + items: + $ref: '#/components/schemas/ComparisonFilterValueItems' + required: + - type + - key + - value + x-oaiMeta: + name: ComparisonFilter + CompleteUploadRequest: + type: object + additionalProperties: false + properties: + part_ids: + type: array + description: | + The ordered list of Part IDs. + items: + type: string + md5: + description: | + The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect. + type: string + required: + - part_ids + CompletionUsage: + type: object + description: Usage statistics for the completion request. + properties: + completion_tokens: + type: integer + default: 0 + description: Number of tokens in the generated completion. + prompt_tokens: + type: integer + default: 0 + description: Number of tokens in the prompt. + total_tokens: + type: integer + default: 0 + description: Total number of tokens used in the request (prompt + completion). + completion_tokens_details: type: object - description: The details for events with this `type`. + description: Breakdown of tokens used in a completion. properties: - certificates: - type: array - items: - type: object - properties: - id: - type: string - description: The certificate ID. - name: - type: string - description: The name of the certificate. - certificates.deactivated: + accepted_prediction_tokens: + type: integer + default: 0 + description: | + When using Predicted Outputs, the number of tokens in the + prediction that appeared in the completion. + audio_tokens: + type: integer + default: 0 + description: Audio input tokens generated by the model. + reasoning_tokens: + type: integer + default: 0 + description: Tokens generated by the model for reasoning. + text_tokens: + type: integer + description: Text output tokens generated by the model. + rejected_prediction_tokens: + type: integer + default: 0 + description: | + When using Predicted Outputs, the number of tokens in the + prediction that did not appear in the completion. However, like + reasoning tokens, these tokens are still counted in the total + completion tokens for purposes of billing, output, and context window + limits. + prompt_tokens_details: type: object - description: The details for events with this `type`. + description: Breakdown of tokens used in the prompt. properties: - certificates: - type: array - items: - type: object - properties: - id: - type: string - description: The certificate ID. - name: - type: string - description: The name of the certificate. + audio_tokens: + type: integer + default: 0 + description: Audio input tokens present in the prompt. + cached_tokens: + type: integer + default: 0 + description: Cached tokens present in the prompt. + text_tokens: + type: integer + description: Text input tokens present in the prompt. + image_tokens: + type: integer + description: Image input tokens present in the prompt. + cache_write_tokens: + type: integer + default: 0 + description: The unadjusted number of prompt tokens written to cache. required: - - id - - type - - effective_at - x-oaiMeta: - name: The audit log object - example: | - { - "id": "req_xxx_20240101", - "type": "api_key.created", - "effective_at": 1720804090, - "actor": { - "type": "session", - "session": { - "user": { - "id": "user-xxx", - "email": "user@example.com" - }, - "ip_address": "127.0.0.1", - "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" - } - }, - "api_key.created": { - "id": "key_xxxx", - "data": { - "scopes": ["resource.operation"] - } - } - } - AuditLogActor: + - prompt_tokens + - completion_tokens + - total_tokens + CompoundFilter: + $recursiveAnchor: true type: object - description: The actor who performed the audit logged action. + additionalProperties: false + title: Compound Filter + description: Combine multiple filters using `and` or `or`. properties: type: type: string - description: The type of actor. Is either `session` or `api_key`. + description: 'Type of operation: `and` or `or`.' enum: - - session - - api_key - session: - $ref: '#/components/schemas/AuditLogActorSession' - api_key: - $ref: '#/components/schemas/AuditLogActorApiKey' - AuditLogActorApiKey: + - and + - or + filters: + type: array + description: Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`. + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $recursiveRef: '#' + required: + - type + - filters + x-oaiMeta: + name: CompoundFilter + ComputerAction: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/ClickParam' + - $ref: '#/components/schemas/DoubleClickAction' + - $ref: '#/components/schemas/DragParam' + - $ref: '#/components/schemas/KeyPressAction' + - $ref: '#/components/schemas/MoveParam' + - $ref: '#/components/schemas/ScreenshotParam' + - $ref: '#/components/schemas/ScrollParam' + - $ref: '#/components/schemas/TypeParam' + - $ref: '#/components/schemas/WaitParam' + ComputerActionList: + title: Computer Action List + type: array + description: | + Flattened batched actions for `computer_use`. Each action includes an + `type` discriminator and action-specific fields. + items: + $ref: '#/components/schemas/ComputerAction' + ComputerScreenshotImage: type: object - description: The API Key used to perform the audit logged action. + description: | + A computer screenshot image used with the computer use tool. properties: - id: - type: string - description: The tracking id of the API key. type: type: string - description: The type of API key. Can be either `user` or `service_account`. enum: - - user - - service_account - user: - $ref: '#/components/schemas/AuditLogActorUser' - service_account: - $ref: '#/components/schemas/AuditLogActorServiceAccount' - AuditLogActorServiceAccount: - type: object - description: The service account that performed the audit logged action. - properties: - id: + - computer_screenshot + default: computer_screenshot + description: "Specifies the event type. For a computer screenshot, this property is \nalways set to `computer_screenshot`.\n" + x-stainless-const: true + image_url: type: string - description: The service account id. - AuditLogActorSession: - type: object - description: The session in which the audit logged action was performed. - properties: - user: - $ref: '#/components/schemas/AuditLogActorUser' - ip_address: + format: uri + description: The URL of the screenshot image. + file_id: type: string - description: The IP address from which the action was performed. - AuditLogActorUser: + description: The identifier of an uploaded file that contains the screenshot. + required: + - type + ComputerToolCall: type: object - description: The user who performed the audit logged action. + title: Computer tool call + description: | + A tool call to a computer use tool. See the + [computer use guide](https://developers.openai.com/api/docs/guides/tools-computer-use) for more information. properties: + type: + type: string + description: The type of the computer call. Always `computer_call`. + enum: + - computer_call + default: computer_call id: type: string - description: The user id. - email: + description: The unique ID of the computer call. + call_id: type: string - description: The user email. - AuditLogEventType: - type: string - description: The event type. - enum: - - api_key.created - - api_key.updated - - api_key.deleted - - certificate.created - - certificate.updated - - certificate.deleted - - certificates.activated - - certificates.deactivated - - checkpoint.permission.created - - checkpoint.permission.deleted - - external_key.registered - - external_key.removed - - group.created - - group.updated - - group.deleted - - invite.sent - - invite.accepted - - invite.deleted - - ip_allowlist.created - - ip_allowlist.updated - - ip_allowlist.deleted - - ip_allowlist.config.activated - - ip_allowlist.config.deactivated - - login.succeeded - - login.failed - - logout.succeeded - - logout.failed - - organization.updated - - project.created - - project.updated - - project.archived - - project.deleted - - rate_limit.updated - - rate_limit.deleted - - resource.deleted - - tunnel.created - - tunnel.updated - - tunnel.deleted - - workload_identity_provider.created - - workload_identity_provider.updated - - workload_identity_provider.deleted - - workload_identity_provider_mapping.created - - workload_identity_provider_mapping.updated - - workload_identity_provider_mapping.deleted - - role.created - - role.updated - - role.deleted - - role.assignment.created - - role.assignment.deleted - - role.bound_to_resource - - role.unbound_from_resource - - scim.enabled - - scim.disabled - - service_account.created - - service_account.updated - - service_account.deleted - - user.added - - user.updated - - user.deleted - - tenant.metadata.updated - - tenant.microsoft_entra_mapping.upserted - - tenant.microsoft_entra_mapping.deleted - - tenant.workload_identity.provider.created - - tenant.workload_identity.provider.updated - - tenant.workload_identity.provider.archived - - tenant.workload_identity.mapping.created - - tenant.workload_identity.mapping.updated - - tenant.workload_identity.mapping.archived - - tenant.workload_identity.binding.created - - tenant.workload_identity.principal.provisioned - - tenant.workload_identity.access_token.issued - - tenant.admin_api_key.created - - tenant.admin_api_key.updated - - tenant.admin_api_key.deleted - - tenant.project_api_key.created - - tenant.trusted_access.business_verification.started - - tenant.trusted_access.application.submitted - - tenant.chatgpt_access_token.revoked - - tenant.migration.completed - - tenant.sso.migrated - - tenant.domains.migrated - - tenant.sso_connection.created - - tenant.sso_connection.updated - - tenant.sso_connection.deleted - - tenant.sso_connection.setup.started - - tenant.policy.created - - tenant.policy.updated - - tenant.policy.deleted - - tenant.policy.attached - - tenant.policy.detached - - tenant.principal_authentication_policy.resolved - - tenant.scim.setup.started - - tenant.scim.deletion.requested - - tenant.scim.directory.created - - tenant.product_access_policy.updated - - tenant.resource_share_grant.created - - tenant.resource_share_grant.updated - - tenant.resource_share_grant.accepted - - tenant.resource_share_grant.declined - - tenant.resource_share_grant.revoked - - tenant.resource_share_grant.deleted - - tenant.service_account.updated - - tenant.service_account.deleted - - tenant.service_account.token.revoked - - tenant.billing.overage_limit.updated - - tenant.billing.alerts.updated - - tenant.billing.info.updated - - tenant.usage_limit.workspace.updated - - tenant.usage_limit.group.updated - - tenant.usage_limit.user.updated - - tenant.usage_limit.increase_request.updated - - tenant.usage_limit.increase_request.resolved - - tenant.group.created - - tenant.group.updated - - tenant.group.deleted - - tenant.group.member.added - - tenant.group.member.removed - - tenant.migration_rollout.status.updated - - tenant.migration_rollout.tier.updated - - tenant.role.metadata.updated - - tenant.custom_role.created - - tenant.custom_role.updated - - tenant.custom_role.deleted - - tenant.role_assignment.created - - tenant.role_assignment.deleted - - tenant.resource_role_assignment.created - - tenant.resource_role_assignment.deleted - - tenant.resource_access.updated - - tenant.resource_access.deleted - - tenant.ads_account.onboarding.redemption - - tenant.session_policy.created - - tenant.session_policy.updated - - tenant.session_policy.deleted - - tenant.session_revocation.started - - tenant.third_party_app_policy.updated - - tenant.user.added - - tenant.user.updated - - tenant.user.removed - - tenant.user.looked_up - - tenant.user.invited - - tenant.membership.revoked - - tenant.api_organization_invite.upserted - - tenant.api_organization_invite.deleted - - tenant.chatgpt_workspace_invite.upserted - - tenant.membership.accepted - - tenant.membership.declined - - tenant.workspace_invite_email_settings.updated - AutoChunkingStrategyRequestParam: - type: object - title: Auto Chunking Strategy - description: The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`. - additionalProperties: false - properties: - type: + description: | + An identifier used when responding to the tool call with output. + action: + $ref: '#/components/schemas/LegacyComputerAction' + actions: + $ref: '#/components/schemas/ComputerActionList' + pending_safety_checks: + type: array + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + description: | + The pending safety checks for the computer call. + status: type: string - description: Always `auto`. + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. enum: - - auto - x-stainless-const: true + - in_progress + - completed + - incomplete required: - type - Batch: + - id + - call_id + - pending_safety_checks + - status + ComputerToolCallOutput: type: object + title: Computer tool call output + description: | + The output of a computer tool call. properties: - id: - type: string - object: + type: type: string + description: | + The type of the computer tool call output. Always `computer_call_output`. enum: - - batch - description: The object type, which is always `batch`. + - computer_call_output + default: computer_call_output x-stainless-const: true - endpoint: - type: string - description: The OpenAI API endpoint used by the batch. - model: + id: type: string description: | - Model ID used to process the batch, like `gpt-6-astra`. OpenAI - offers a wide range of models with different capabilities, performance - characteristics, and price points. Refer to the [model - guide](https://developers.openai.com/api/docs/models) to browse and compare available models. - errors: - type: object - properties: - object: - type: string - description: The object type, which is always `list`. - data: - type: array - items: - $ref: '#/components/schemas/BatchError' - input_file_id: - type: string - description: The ID of the input file for the batch. - completion_window: + The ID of the computer tool call output. + call_id: type: string - description: The time frame within which the batch should be processed. + description: | + The ID of the computer tool call that produced the output. + acknowledged_safety_checks: + type: array + description: | + The safety checks reported by the API that have been acknowledged by the + developer. + items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + output: + $ref: '#/components/schemas/ComputerScreenshotImage' status: type: string - description: The current status of the batch. + description: | + The status of the message input. One of `in_progress`, `completed`, or + `incomplete`. Populated when input items are returned via API. enum: - - validating - - failed - in_progress - - finalizing - completed - - expired - - cancelling - - cancelled - output_file_id: + - incomplete + required: + - type + - call_id + - output + ComputerToolCallOutputResource: + allOf: + - $ref: '#/components/schemas/ComputerToolCallOutput' + - type: object + properties: + id: + type: string + description: | + The unique ID of the computer call tool output. + status: + description: | + The status of the message input. One of `in_progress`, `completed`, or + `incomplete`. Populated when input items are returned via API. + $ref: '#/components/schemas/ComputerCallOutputStatus' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + ContainerFileListResource: + type: object + properties: + object: + description: The type of object returned, must be 'list'. + const: list + data: + type: array + description: A list of container files. + items: + $ref: '#/components/schemas/ContainerFileResource' + first_id: type: string - description: The ID of the file containing the outputs of successfully executed requests. - error_file_id: + description: The ID of the first file in the list. + last_id: type: string - description: The ID of the file containing the outputs of requests with errors. + description: The ID of the last file in the list. + has_more: + type: boolean + description: Whether there are more files available. + required: + - object + - data + - first_id + - last_id + - has_more + ContainerFileResource: + type: object + title: The container file object + properties: + id: + type: string + description: Unique identifier for the file. + object: + type: string + description: The type of this object (`container.file`). + const: container.file + container_id: + type: string + description: The container this file belongs to. created_at: type: integer format: unixtime - description: The Unix timestamp (in seconds) for when the batch was created. - in_progress_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the batch started processing. - expires_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the batch will expire. - finalizing_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the batch started finalizing. - completed_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the batch was completed. - failed_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the batch failed. - expired_at: + description: Unix timestamp (in seconds) when the file was created. + bytes: type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the batch expired. - cancelling_at: + description: Size of the file in bytes. + path: + type: string + description: Path of the file in the container. + source: + type: string + description: Source of the file (e.g., `user`, `assistant`). + required: + - id + - object + - created_at + - bytes + - container_id + - path + - source + x-oaiMeta: + name: The container file object + example: | + { + "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", + "object": "container.file", + "created_at": 1747848842, + "bytes": 880, + "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", + "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", + "source": "user" + } + ContainerListResource: + type: object + properties: + object: + description: The type of object returned, must be 'list'. + const: list + data: + type: array + description: A list of containers. + items: + $ref: '#/components/schemas/ContainerResource' + first_id: + type: string + description: The ID of the first container in the list. + last_id: + type: string + description: The ID of the last container in the list. + has_more: + type: boolean + description: Whether there are more containers available. + required: + - object + - data + - first_id + - last_id + - has_more + ContainerResource: + type: object + title: The container object + properties: + id: + type: string + description: Unique identifier for the container. + object: + type: string + description: The type of this object. + name: + type: string + description: Name of the container. + created_at: type: integer format: unixtime - description: The Unix timestamp (in seconds) for when the batch started cancelling. - cancelled_at: + description: Unix timestamp (in seconds) when the container was created. + status: + type: string + description: Status of the container (e.g., active, deleted). + last_active_at: type: integer format: unixtime - description: The Unix timestamp (in seconds) for when the batch was cancelled. - request_counts: - $ref: '#/components/schemas/BatchRequestCounts' - usage: + description: Unix timestamp (in seconds) when the container was last active. + expires_after: type: object description: | - Represents token usage details including input tokens, output tokens, a - breakdown of output tokens, and the total tokens used. Only populated on - batches created after September 7, 2025. + The container will expire after this time period. + The anchor is the reference point for the expiration. + The minutes is the number of minutes after the anchor before the container expires. properties: - input_tokens: - type: integer - description: The number of input tokens. - input_tokens_details: - type: object - description: A detailed breakdown of the input tokens. - properties: - cached_tokens: - type: integer - description: | - The number of tokens that were retrieved from the cache. [More on - prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching). - required: - - cached_tokens - output_tokens: - type: integer - description: The number of output tokens. - output_tokens_details: - type: object - description: A detailed breakdown of the output tokens. - properties: - reasoning_tokens: - type: integer - description: The number of reasoning tokens. - required: - - reasoning_tokens - total_tokens: + anchor: + type: string + description: The reference point for the expiration. + enum: + - last_active_at + minutes: type: integer - description: The total number of tokens used. + description: The number of minutes after the anchor before the container expires. + memory_limit: + type: string + description: The memory limit configured for the container. + enum: + - 1g + - 4g + - 16g + - 64g + network_policy: + description: Network access policy for the container. + type: object + properties: + type: + type: string + description: The network policy mode. + enum: + - allowlist + - disabled + allowed_domains: + type: array + description: Allowed outbound domains when `type` is `allowlist`. + items: + type: string required: - - input_tokens - - input_tokens_details - - output_tokens - - output_tokens_details - - total_tokens - metadata: - $ref: '#/components/schemas/Metadata' + - type required: - id - object - - endpoint - - input_file_id - - completion_window + - name + - created_at - status + - id + - name - created_at + - status x-oaiMeta: - name: The batch object + name: The container object example: | { - "id": "batch_abc123", - "object": "batch", - "endpoint": "/v1/chat/completions", - "model": "gpt-6-astra", - "errors": null, - "input_file_id": "file-abc123", - "completion_window": "24h", - "status": "completed", - "output_file_id": "file-cvaTdG", - "error_file_id": "file-HOWS94", - "created_at": 1711471533, - "in_progress_at": 1711471538, - "expires_at": 1711557933, - "finalizing_at": 1711493133, - "completed_at": 1711493163, - "failed_at": null, - "expired_at": null, - "cancelling_at": null, - "cancelled_at": null, - "request_counts": { - "total": 100, - "completed": 95, - "failed": 5 - }, - "usage": { - "input_tokens": 1500, - "input_tokens_details": { - "cached_tokens": 1024 - }, - "output_tokens": 500, - "output_tokens_details": { - "reasoning_tokens": 300 - }, - "total_tokens": 2000 - }, - "metadata": { - "customer_id": "user_123456789", - "batch_description": "Nightly eval job", - } + "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", + "object": "container", + "created_at": 1747844794, + "status": "running", + "expires_after": { + "anchor": "last_active_at", + "minutes": 20 + }, + "last_active_at": 1747844794, + "memory_limit": "1g", + "name": "My Container" } - BatchError: + Content: + description: | + Multi-modal input and output contents. + anyOf: + - title: Input content types + $ref: '#/components/schemas/InputContent' + - title: Output content types + $ref: '#/components/schemas/OutputContent' + ConversationItem: + title: Conversation item + description: A single item within a conversation. The set of possible types are the same as the `output` type of a [Response object](https://developers.openai.com/api/reference/resources/responses#%28resource%29%20responses%20%3E%20%28model%29%20response%20%3E%20%28schema%29%20%3E%20%28property%29%20output). + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/Message' + - $ref: '#/components/schemas/FunctionToolCallResource' + - $ref: '#/components/schemas/FunctionToolCallOutputResource' + - $ref: '#/components/schemas/FileSearchToolCall' + - $ref: '#/components/schemas/WebSearchToolCall' + - $ref: '#/components/schemas/ImageGenToolCall' + - $ref: '#/components/schemas/ComputerToolCall' + - $ref: '#/components/schemas/ComputerToolCallOutputResource' + - $ref: '#/components/schemas/ToolSearchCall' + - $ref: '#/components/schemas/ToolSearchOutput' + - $ref: '#/components/schemas/AdditionalTools' + - $ref: '#/components/schemas/ResponseConfigurationUpdate' + - $ref: '#/components/schemas/ReasoningItem' + - $ref: '#/components/schemas/Program' + - $ref: '#/components/schemas/ProgramOutput' + - $ref: '#/components/schemas/CompactionBody' + - $ref: '#/components/schemas/CodeInterpreterToolCall' + - $ref: '#/components/schemas/LocalShellToolCall' + - $ref: '#/components/schemas/LocalShellToolCallOutput' + - $ref: '#/components/schemas/FunctionShellCall' + - $ref: '#/components/schemas/FunctionShellCallOutput' + - $ref: '#/components/schemas/ApplyPatchToolCall' + - $ref: '#/components/schemas/ApplyPatchToolCallOutput' + - $ref: '#/components/schemas/MCPListTools' + - $ref: '#/components/schemas/MCPApprovalRequest' + - $ref: '#/components/schemas/MCPApprovalResponseResource' + - $ref: '#/components/schemas/MCPToolCall' + - $ref: '#/components/schemas/CustomToolCall' + - $ref: '#/components/schemas/CustomToolCallOutput' + ConversationItemList: type: object + title: The conversation item list + description: A list of Conversation items. properties: - code: + object: + x-stainless-const: true + description: The type of object returned, must be `list`. + const: list + data: + type: array + description: A list of conversation items. + items: + $ref: '#/components/schemas/ConversationItem' + has_more: + type: boolean + description: Whether there are more items available. + first_id: type: string - description: An error code identifying the error type. - message: + description: The ID of the first item in the list. + last_id: type: string - description: A human-readable message providing more details about the error. - param: - anyOf: - - type: string - description: The name of the parameter that caused the error, if applicable. - - type: 'null' - line: - anyOf: - - type: integer - description: The line number of the input file where the error occurred, if applicable. - - type: 'null' - BatchFileExpirationAfter: + description: The ID of the last item in the list. + required: + - object + - data + - has_more + - first_id + - last_id + x-oaiMeta: + name: The item list + group: conversations + ConversationParam: + description: | + The conversation that this response belongs to. Items from this conversation are prepended to `input_items` for this response request. + Input items and output items from this response are automatically added to this conversation after this response completes. + anyOf: + - type: string + title: Conversation ID + description: | + The unique ID of the conversation. + - $ref: '#/components/schemas/ConversationParam-2' + CostsResult: type: object - title: File expiration policy - description: The expiration policy for the output and/or error file that are generated for a batch. + description: The aggregated costs details of the specific time bucket. properties: - anchor: - description: 'Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`. Note that the anchor is the file creation time, not the time the batch is created.' + object: type: string enum: - - created_at + - organization.costs.result x-stainless-const: true - seconds: - description: The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days). - type: integer - format: int64 - minimum: 3600 - maximum: 2592000 - required: - - anchor - - seconds - BatchRequestCounts: - type: object - properties: - total: - type: integer - description: Total number of requests in the batch. - completed: - type: integer - description: Number of requests that have been completed successfully. - failed: - type: integer - description: Number of requests that have failed. + amount: + type: object + description: The monetary value in its associated currency. + properties: + value: + type: number + description: The numeric value of the cost. + currency: + type: string + description: Lowercase ISO-4217 currency e.g. "usd" + line_item: + anyOf: + - type: string + description: When `group_by=line_item`, this field provides the line item of the grouped costs result. + - type: 'null' + project_id: + anyOf: + - type: string + description: When `group_by=project_id`, this field provides the project ID of the grouped costs result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. + - type: 'null' + quantity: + anyOf: + - type: number + description: When `group_by=line_item`, this field provides the quantity of the grouped costs result. + - type: 'null' + quantity_unit: + description: The unit of the `quantity` value. If no single supported unit applies to the result, this field is `null`. + anyOf: + - type: string + - type: string + enum: + - tokens + - 1000_tokens + - duration_seconds + - duration_minutes + - duration_hours + - gibibyte_hours + - images + - characters + - type: 'null' required: - - total - - completed - - failed - description: The request counts for different statuses within the batch. - Certificate: + - object + x-oaiMeta: + name: Costs object + example: | + { + "object": "organization.costs.result", + "amount": { + "value": 0.06, + "currency": "usd" + }, + "line_item": "gpt-6-astra, input_tokens", + "project_id": "proj_abc", + "quantity": 10000, + "quantity_unit": "tokens" + } + CreateAssistantRequest: type: object - description: Represents an individual `certificate` uploaded to the organization. + additionalProperties: false properties: - object: - type: string - enum: - - certificate - - organization.certificate - - organization.project.certificate + model: description: | - The object type. - - - If creating, updating, or getting a specific certificate, the object type is `certificate`. - - If listing, activating, or deactivating certificates for the organization, the object type is `organization.certificate`. - - If listing, activating, or deactivating certificates for a project, the object type is `organization.project.certificate`. - x-stainless-const: true - id: - type: string - description: The identifier, which can be referenced in API endpoints + ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them. + example: gpt-5 + anyOf: + - type: string + - $ref: '#/components/schemas/AssistantSupportedModels' + x-oaiTypeLabel: string name: anyOf: - - type: string + - description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + - type: 'null' + description: + anyOf: + - description: | + The description of the assistant. The maximum length is 512 characters. + type: string + maxLength: 512 + - type: 'null' + instructions: + anyOf: + - description: | + The system instructions that the assistant uses. The maximum length is 256,000 characters. + type: string + maxLength: 256000 + - type: 'null' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + tools: + description: | + A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`. + default: [] + type: array + maxItems: 128 + items: + $ref: '#/components/schemas/AssistantTool' + tool_resources: + anyOf: + - type: object + description: | + A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: | + A helper to create a [vector store](https://developers.openai.com/api/reference/resources/vector_stores) with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](https://developers.openai.com/api/reference/resources/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files. + maxItems: 100000000 + items: + type: string + chunking_strategy: + type: object + description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. + anyOf: + - type: object + title: Auto Chunking Strategy + description: The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`. + additionalProperties: false + properties: + type: + type: string + description: Always `auto`. + enum: + - auto + x-stainless-const: true + required: + - type + - type: object + title: Static Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `static`. + enum: + - static + x-stainless-const: true + static: + type: object + additionalProperties: false + properties: + max_chunk_size_tokens: + type: integer + minimum: 100 + maximum: 4096 + description: The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`. + chunk_overlap_tokens: + type: integer + description: | + The number of tokens that overlap between chunks. The default value is `400`. + + Note that the overlap must not exceed half of `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + required: + - type + - static + discriminator: + propertyName: type + metadata: + $ref: '#/components/schemas/Metadata' + anyOf: + - required: + - vector_store_ids + - required: + - vector_stores + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + anyOf: + - description: | + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + - type: 'null' + top_p: + anyOf: + - type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + description: | + An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + + We generally recommend altering this or temperature but not both. + - type: 'null' + response_format: + anyOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' - type: 'null' - description: The name of the certificate. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the certificate was uploaded. - certificate_details: - type: object - properties: - valid_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the certificate becomes valid. - expires_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the certificate expires. - content: - type: string - description: The content of the certificate in PEM format. - active: - type: boolean - description: Whether the certificate is currently active at the specified scope. Not returned when getting details for a specific certificate. required: - - object - - id - - name - - created_at - - certificate_details - x-oaiMeta: - name: The certificate object - example: | - { - "object": "certificate", - "id": "cert_abc", - "name": "My Certificate", - "created_at": 1234567, - "certificate_details": { - "valid_at": 1234567, - "expires_at": 12345678, - "content": "-----BEGIN CERTIFICATE----- MIIGAjCCA...6znFlOW+ -----END CERTIFICATE-----" - } - } - ChatCompletionAllowedTools: + - model + CreateBatchRequest: type: object - title: Allowed tools - description: | - Constrains the tools available to the model to a pre-defined set. + required: + - input_file_id + - endpoint + - completion_window properties: - mode: + input_file_id: type: string - enum: - - auto - - required description: | - Constrains the tools available to the model to a pre-defined set. - - `auto` allows the model to pick from among the allowed tools and generate a - message. + The ID of an uploaded file that contains requests for the new batch. - `required` requires the model to call one or more of the allowed tools. - tools: - type: array - description: | - A list of tool definitions that the model should be allowed to call. + See [upload file](https://developers.openai.com/api/reference/resources/files/methods/create) for how to upload a file. - For the Chat Completions API, the list of tool definitions might look like: - ```json - [ - { "type": "function", "function": { "name": "get_weather" } }, - { "type": "function", "function": { "name": "get_time" } } - ] - ``` - items: - type: object - x-oaiExpandable: false - description: | - A tool definition that the model should be allowed to call. - additionalProperties: true - required: - - mode - - tools - ChatCompletionAllowedToolsChoice: - type: object - title: Allowed tools - description: | - Constrains the tools available to the model to a pre-defined set. - properties: - type: - type: string - enum: - - allowed_tools - description: Allowed tool configuration type. Always `allowed_tools`. - x-stainless-const: true - allowed_tools: - $ref: '#/components/schemas/ChatCompletionAllowedTools' - required: - - type - - allowed_tools - ChatCompletionDeleted: - type: object - properties: - object: + Your input file must be formatted as a [JSONL file](https://developers.openai.com/api/docs/guides/batch#1-prepare-your-batch-file), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 200 MB in size. + endpoint: type: string - description: The type of object being deleted. enum: - - chat.completion.deleted - x-stainless-const: true - id: - type: string - description: The ID of the chat completion that was deleted. - deleted: - type: boolean - description: Whether the chat completion was deleted. - required: - - object - - id - - deleted - ChatCompletionFunctionCallOption: - type: object - description: | - Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. - properties: - name: - type: string - description: The name of the function to call. - required: - - name - x-stainless-variantName: function_call_option - ChatCompletionFunctions: - type: object - deprecated: true - properties: - description: - type: string - description: A description of what the function does, used by the model to choose when and how to call the function. - name: - type: string - description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - parameters: - $ref: '#/components/schemas/FunctionParameters' - required: - - name - ChatCompletionList: - type: object - title: ChatCompletionList - description: | - An object representing a list of Chat Completions. - properties: - object: + - /v1/responses + - /v1/chat/completions + - /v1/embeddings + - /v1/completions + - /v1/moderations + - /v1/images/generations + - /v1/images/edits + - /v1/videos + description: The endpoint to be used for all requests in the batch. Currently `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, `/v1/moderations`, `/v1/images/generations`, `/v1/images/edits`, and `/v1/videos` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch. + completion_window: type: string enum: - - list - default: list - description: | - The type of this object. It is always set to "list". - x-stainless-const: true - data: - type: array - description: | - An array of chat completion objects. - items: - $ref: '#/components/schemas/CreateChatCompletionResponse' - first_id: - type: string - description: The identifier of the first chat completion in the data array. - last_id: - type: string - description: The identifier of the last chat completion in the data array. - has_more: - type: boolean - description: Indicates whether there are more Chat Completions available. - required: - - object - - data - - first_id - - last_id - - has_more - x-oaiMeta: - name: The chat completion list object - group: chat - example: | - { - "object": "list", - "data": [ - { - "object": "chat.completion", - "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", - "model": "gpt-6-astra", - "created": 1738960610, - "request_id": "req_ded8ab984ec4bf840f37566c1011c417", - "tool_choice": null, - "usage": { - "total_tokens": 31, - "completion_tokens": 18, - "prompt_tokens": 13 - }, - "seed": 4944116822809979520, - "top_p": 1.0, - "temperature": 1.0, - "presence_penalty": 0.0, - "frequency_penalty": 0.0, - "system_fingerprint": "fp_50cad350e4", - "input_user": null, - "service_tier": "default", - "tools": null, - "metadata": {}, - "choices": [ - { - "index": 0, - "message": { - "content": "Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark.", - "role": "assistant", - "tool_calls": null, - "function_call": null - }, - "finish_reason": "stop", - "logprobs": null - } - ], - "response_format": null - } - ], - "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", - "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2", - "has_more": false - } - ChatCompletionMessageCustomToolCall: + - 24h + description: The time frame within which the batch should be processed. Currently only `24h` is supported. + metadata: + $ref: '#/components/schemas/Metadata' + output_expires_after: + $ref: '#/components/schemas/BatchFileExpirationAfter' + CreateChatCompletionRequest: + allOf: + - $ref: '#/components/schemas/CreateModelResponseProperties' + - type: object + properties: + messages: + description: | + A list of messages comprising the conversation so far. Depending on the + [model](https://developers.openai.com/api/docs/models) you use, different message types (modalities) are + supported, like [text](https://developers.openai.com/api/docs/guides/text), + [images](https://developers.openai.com/api/docs/guides/images-vision), and [audio](https://developers.openai.com/api/docs/guides/audio). + type: array + minItems: 1 + items: + $ref: '#/components/schemas/ChatCompletionRequestMessage' + model: + description: | + Model ID used to generate the response, like `gpt-6-astra` or `o3`. OpenAI + offers a wide range of models with different capabilities, performance + characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) + to browse and compare available models. + $ref: '#/components/schemas/ModelIdsShared' + service_tier: + $ref: '#/components/schemas/ServiceTier' + modalities: + $ref: '#/components/schemas/ResponseModalities' + verbosity: + $ref: '#/components/schemas/Verbosity' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + max_completion_tokens: + description: | + An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](https://developers.openai.com/api/docs/guides/reasoning). + type: integer + nullable: true + frequency_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: | + Number between -2.0 and 2.0. Positive values penalize new tokens based on + their existing frequency in the text so far, decreasing the model's + likelihood to repeat the same line verbatim. + presence_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: | + Number between -2.0 and 2.0. Positive values penalize new tokens based on + whether they appear in the text so far, increasing the model's likelihood + to talk about new topics. + web_search_options: + type: object + title: Web search + description: | + This tool searches the web for relevant results to use in a response. + Learn more about the [web search tool](https://developers.openai.com/api/docs/guides/tools-web-search). + properties: + user_location: + type: object + nullable: true + required: + - type + - approximate + description: | + Approximate location parameters for the search. + properties: + type: + type: string + description: | + The type of location approximation. Always `approximate`. + enum: + - approximate + x-stainless-const: true + approximate: + $ref: '#/components/schemas/WebSearchLocation' + search_context_size: + $ref: '#/components/schemas/WebSearchContextSize' + top_logprobs: + description: | + An integer between 0 and 20 specifying the maximum number of most likely + tokens to return at each token position, each with an associated log + probability. In some cases, the number of returned tokens may be fewer than + requested. + `logprobs` must be set to `true` if this parameter is used. + type: integer + minimum: 0 + maximum: 20 + nullable: true + response_format: + description: | + An object specifying the format that the model must output. + + Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + Structured Outputs which ensures the model will match your supplied JSON + schema. Learn more in the [Structured Outputs + guide](https://developers.openai.com/api/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables the older JSON mode, which + ensures the message the model generates is valid JSON. Using `json_schema` + is preferred for models that support it. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/ResponseFormatJsonSchema' + - $ref: '#/components/schemas/ResponseFormatJsonObject' + audio: + type: object + nullable: true + description: | + Parameters for audio output. Required when audio output is requested with + `modalities: ["audio"]`. [Learn more](https://developers.openai.com/api/docs/guides/audio). + required: + - voice + - format + properties: + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + description: | + The voice the model uses to respond. Supported built-in voices are + `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, + `sage`, `shimmer`, `marin`, and `cedar`. You may also provide a + custom voice object with an `id`, for example `{ "id": "voice_1234" }`. + format: + type: string + enum: + - wav + - aac + - mp3 + - flac + - opus + - pcm16 + description: | + Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, + `opus`, or `pcm16`. + store: + type: boolean + default: false + nullable: true + description: | + Whether or not to store the output of this chat completion request for + use in our [model distillation](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#distilling-from-a-larger-model) or + [evals](https://developers.openai.com/api/docs/guides/evals) products. + + Supports text and image inputs. Note: image inputs over 8MB will be dropped. + moderation: + anyOf: + - $ref: '#/components/schemas/ModerationParam' + description: | + Configuration for running moderation on the request input and generated output. + - type: 'null' + stream: + description: | + If set to true, the model response data will be streamed to the client + as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + See the [Streaming section below](https://developers.openai.com/api/reference/resources/chat/subresources/completions/streaming-events) + for more information, along with the [streaming responses](https://developers.openai.com/api/docs/guides/streaming-responses) + guide for more information on how to handle the streaming events. + type: boolean + nullable: true + default: false + stop: + $ref: '#/components/schemas/StopConfiguration' + logit_bias: + type: object + x-oaiTypeLabel: map + default: null + nullable: true + additionalProperties: + type: integer + description: | + Modify the likelihood of specified tokens appearing in the completion. + + Accepts a JSON object that maps tokens (specified by their token ID in the + tokenizer) to an associated bias value from -100 to 100. Mathematically, + the bias is added to the logits generated by the model prior to sampling. + The exact effect will vary per model, but values between -1 and 1 should + decrease or increase likelihood of selection; values like -100 or 100 + should result in a ban or exclusive selection of the relevant token. + logprobs: + description: | + Whether to return log probabilities of the output tokens or not. If true, + returns the log probabilities of each output token returned in the + `content` of `message`. + type: boolean + default: false + nullable: true + max_tokens: + description: | + The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated in the + chat completion. This value can be used to control + [costs](https://openai.com/api/pricing/) for text generated via API. + + This value is now deprecated in favor of `max_completion_tokens`, and is + not compatible with [o-series models](https://developers.openai.com/api/docs/guides/reasoning). + type: integer + nullable: true + deprecated: true + n: + type: integer + minimum: 1 + maximum: 128 + default: 1 + example: 1 + nullable: true + description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. + prediction: + nullable: true + description: | + Configuration for a [Predicted Output](https://developers.openai.com/api/docs/guides/predicted-outputs), + which can greatly improve response times when large parts of the model + response are known ahead of time. This is most common when you are + regenerating a file with only minor changes to most of the content. + anyOf: + - $ref: '#/components/schemas/PredictionContent' + discriminator: + propertyName: type + seed: + type: integer + minimum: -9.223372036854776e18 + maximum: 9.223372036854776e18 + nullable: true + deprecated: true + description: | + This feature is in Beta. + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + x-oaiMeta: + beta: true + stream_options: + $ref: '#/components/schemas/ChatCompletionStreamOptions' + tools: + type: array + description: | + A list of tools the model may call. You can provide either + [custom tools](https://developers.openai.com/api/docs/guides/function-calling#custom-tools) or + [function tools](https://developers.openai.com/api/docs/guides/function-calling). + items: + anyOf: + - $ref: '#/components/schemas/ChatCompletionTool' + - $ref: '#/components/schemas/CustomToolChatCompletions' + x-stainless-naming: + python: + model_name: chat_completion_tool_union + param_model_name: chat_completion_tool_union_param + discriminator: + propertyName: type + x-stainless-go-variant-constructor: + naming: chat_completion_{variant}_tool + tool_choice: + $ref: '#/components/schemas/ChatCompletionToolChoiceOption' + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + function_call: + deprecated: true + description: | + Deprecated in favor of `tool_choice`. + + Controls which (if any) function is called by the model. + + `none` means the model will not call a function and instead generates a + message. + + `auto` means the model can pick between generating a message or calling a + function. + + Specifying a particular function via `{"name": "my_function"}` forces the + model to call that function. + + `none` is the default when no functions are present. `auto` is the default + if functions are present. + anyOf: + - type: string + description: | + `none` means the model will not call a function and instead generates a message. `auto` means the model can pick between generating a message or calling a function. + enum: + - none + - auto + title: function call mode + - $ref: '#/components/schemas/ChatCompletionFunctionCallOption' + functions: + deprecated: true + description: | + Deprecated in favor of `tools`. + + A list of functions the model may generate JSON inputs for. + type: array + minItems: 1 + maxItems: 128 + items: + $ref: '#/components/schemas/ChatCompletionFunctions' + required: + - model + - messages + CreateChatCompletionResponse: type: object - title: Custom tool call - description: | - A call to a custom tool created by the model. + description: Represents a chat completion response returned by model, based on the provided input. properties: id: type: string - description: The ID of the tool call. - type: - type: string - enum: - - custom - description: The type of the tool. Always `custom`. - x-stainless-const: true - custom: - type: object - description: The custom tool that the model called. - properties: - name: - type: string - description: The name of the custom tool to call. - input: - type: string - description: The input for the custom tool call generated by the model. - required: - - name - - input - required: - - id - - type - - custom - ChatCompletionMessageList: - type: object - title: ChatCompletionMessageList - description: | - An object representing a list of chat completion messages. - properties: - object: - type: string - enum: - - list - default: list - description: | - The type of this object. It is always set to "list". - x-stainless-const: true - data: + description: A unique identifier for the chat completion. + choices: type: array - description: | - An array of chat completion message objects. + description: A list of chat completion choices. Can be more than one if `n` is greater than 1. items: - allOf: - - $ref: '#/components/schemas/ChatCompletionResponseMessage' - - type: object - required: - - id - properties: - id: - type: string - description: The identifier of the chat message. - content_parts: - anyOf: - - type: array - description: | - If a content parts array was provided, this is an array of `text` and `image_url` parts. - Otherwise, null. - items: + type: object + required: + - finish_reason + - index + - message + - logprobs + properties: + finish_reason: + type: string + description: | + The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `length` if the maximum number of tokens specified in the request was reached, + `content_filter` if content was omitted due to a flag from our content filters, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + Read the [Model Spec](https://model-spec.openai.com/2025-12-18.html) for more. + enum: + - stop + - length + - tool_calls + - content_filter + - function_call + index: + type: integer + description: The index of the choice in the list of choices. + message: + $ref: '#/components/schemas/ChatCompletionResponseMessage' + logprobs: + anyOf: + - description: Log probability information for the choice. + type: object + properties: + content: anyOf: - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartImage' - - type: 'null' - first_id: + - description: A list of message content tokens with log probability information. + type: array + items: + $ref: '#/components/schemas/ChatCompletionTokenLogprob' + - type: 'null' + refusal: + anyOf: + - description: A list of message refusal tokens with log probability information. + type: array + items: + $ref: '#/components/schemas/ChatCompletionTokenLogprob' + - type: 'null' + required: + - content + - refusal + - type: 'null' + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the chat completion was created. + model: type: string - description: The identifier of the first chat message in the data array. - last_id: + description: The model used for the chat completion. + metadata: + $ref: '#/components/schemas/Metadata' + service_tier: + $ref: '#/components/schemas/ServiceTier' + system_fingerprint: type: string - description: The identifier of the last chat message in the data array. - has_more: - type: boolean - description: Indicates whether there are more chat messages available. + deprecated: true + description: | + This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + object: + type: string + description: The object type, which is always `chat.completion`. + enum: + - chat.completion + x-stainless-const: true + usage: + $ref: '#/components/schemas/CompletionUsage' + moderation: + anyOf: + - $ref: '#/components/schemas/ChatCompletionModeration' + description: | + Moderation results for the request input and generated output, if moderated + completions were requested. + - type: 'null' required: + - choices + - created + - id + - model - object - - data - - first_id - - last_id - - has_more x-oaiMeta: - name: The chat completion message list object + name: The chat completion object group: chat example: | { - "object": "list", - "data": [ + "id": "chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG", + "object": "chat.completion", + "created": 1741570283, + "model": "gpt-6-astra", + "choices": [ { - "id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", - "role": "user", - "content": "write a haiku about ai", - "name": null, - "content_parts": null + "index": 0, + "message": { + "role": "assistant", + "content": "The image shows a wooden boardwalk path running through a lush green field or meadow. The sky is bright blue with some scattered clouds, giving the scene a serene and peaceful atmosphere. Trees and shrubs are visible in the background.", + "refusal": null, + "annotations": [] + }, + "logprobs": null, + "finish_reason": "stop" } ], - "first_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", - "last_id": "chatcmpl-AyPNinnUqUDYo9SAdA52NobMflmj2-0", - "has_more": false + "usage": { + "prompt_tokens": 1117, + "completion_tokens": 46, + "total_tokens": 1163, + "prompt_tokens_details": { + "cached_tokens": 0, + "audio_tokens": 0 + }, + "completion_tokens_details": { + "reasoning_tokens": 0, + "audio_tokens": 0, + "accepted_prediction_tokens": 0, + "rejected_prediction_tokens": 0 + } + }, + "service_tier": "default", + "system_fingerprint": "fp_fc9f1d7035" } - ChatCompletionMessageToolCall: + CreateChatCompletionStreamResponse: type: object - title: Function tool call description: | - A call to a function tool created by the model. - properties: - id: - type: string - description: The ID of the tool call. - type: - type: string - enum: - - function - description: The type of the tool. Currently, only `function` is supported. - x-stainless-const: true - function: - type: object - description: The function that the model called. - properties: - name: - type: string - description: The name of the function to call. - arguments: - type: string - description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. - required: - - name - - arguments - required: - - id - - type - - function - ChatCompletionMessageToolCallChunk: - type: object + Represents a streamed chunk of a chat completion response returned + by the model, based on the provided input. + [Learn more](https://developers.openai.com/api/docs/guides/streaming-responses). properties: - index: - type: integer id: type: string - description: The ID of the tool call. - type: - type: string - enum: - - function - description: The type of the tool. Currently, only `function` is supported. - x-stainless-const: true - function: - type: object - properties: - name: - type: string - description: The name of the function to call. - arguments: - type: string - description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. - required: - - index - ChatCompletionMessageToolCalls: - type: array - description: The tool calls generated by the model, such as function calls. - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/ChatCompletionMessageToolCall' - - $ref: '#/components/schemas/ChatCompletionMessageCustomToolCall' - x-stainless-naming: - python: - model_name: chat_completion_message_tool_call_union - param_model_name: chat_completion_message_tool_call_union_param - x-stainless-go-variant-constructor: skip - ChatCompletionModalities: - anyOf: - - type: array - description: | - Output types that you would like the model to generate for this request. - Most models are capable of generating text, which is the default: - - `["text"]` - - The `gpt-4o-audio-preview` model can also be used to [generate audio](https://developers.openai.com/api/docs/guides/audio). To - request that this model generate both text and audio responses, you can - use: - - `["text", "audio"]` - items: - type: string - enum: - - text - - audio - - type: 'null' - ChatCompletionModeration: - type: object - description: Moderation results or errors for the request input and generated output. - properties: - input: - description: Moderation for the request input. - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/ChatCompletionModerationResults' - - $ref: '#/components/schemas/ChatCompletionModerationError' - output: - description: Moderation for the generated output. - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/ChatCompletionModerationResults' - - $ref: '#/components/schemas/ChatCompletionModerationError' - required: - - input - - output - ChatCompletionModerationError: - type: object - description: An error produced while attempting moderation. - properties: - type: - type: string - enum: - - error - description: The object type, which is always `error`. - x-stainless-const: true - code: - type: string - description: The error code. - message: - type: string - description: The error message. - required: - - type - - code - - message - ChatCompletionModerationResults: - type: object - description: Successful moderation results for the request input or generated output. - properties: - type: - type: string - enum: - - moderation_results - description: The object type, which is always `moderation_results`. - x-stainless-const: true - model: - type: string - description: The moderation model used to generate the results. - results: + description: A unique identifier for the chat completion. Each chunk has the same ID. + choices: type: array - description: A list of moderation results. + description: | + A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the + last chunk if you set `stream_options: {"include_usage": true}`. items: - $ref: '#/components/schemas/ModerationResultBody' - required: - - type - - model - - results - ChatCompletionNamedToolChoice: - type: object - title: Function tool choice - description: Specifies a tool the model should use. Use to force the model to call a specific function. - properties: - type: - type: string - enum: - - function - description: For function calling, the type is always `function`. - x-stainless-const: true - function: - type: object - properties: - name: - type: string - description: The name of the function to call. - required: - - name - required: - - type - - function - ChatCompletionNamedToolChoiceCustom: - type: object - title: Custom tool choice - description: Specifies a tool the model should use. Use to force the model to call a specific custom tool. - properties: - type: - type: string - enum: - - custom - description: For custom tool calling, the type is always `custom`. - x-stainless-const: true - custom: - type: object - properties: - name: - type: string - description: The name of the custom tool to call. - required: - - name - required: - - type - - custom - ChatCompletionRequestAssistantMessage: - type: object - title: Assistant message - description: | - Messages sent by the model in response to user messages. - properties: - content: - anyOf: - - description: | - The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified. - anyOf: - - type: string - description: The contents of the assistant message. - title: Text content - - type: array - description: An array of content parts with a defined type. Can be one or more of type `text`, or exactly one of type `refusal`. - title: Array of content parts - items: - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessageContentPart' - minItems: 1 - - type: 'null' - refusal: - anyOf: - - type: string - description: The refusal message by the assistant. - - type: 'null' - role: + type: object + required: + - delta + - finish_reason + - index + properties: + delta: + $ref: '#/components/schemas/ChatCompletionStreamResponseDelta' + logprobs: + description: Log probability information for the choice. + type: object + nullable: true + properties: + content: + description: A list of message content tokens with log probability information. + type: array + items: + $ref: '#/components/schemas/ChatCompletionTokenLogprob' + nullable: true + refusal: + description: A list of message refusal tokens with log probability information. + type: array + items: + $ref: '#/components/schemas/ChatCompletionTokenLogprob' + nullable: true + required: + - content + - refusal + finish_reason: + type: string + description: | + The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `length` if the maximum number of tokens specified in the request was reached, + `content_filter` if content was omitted due to a flag from our content filters, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + enum: + - stop + - length + - tool_calls + - content_filter + - function_call + nullable: true + index: + type: integer + description: The index of the choice in the list of choices. + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp. + model: + type: string + description: The model to generate the completion. + obfuscation: + type: string + description: | + An obfuscation string added to normalize the size of streamed chunks as a + mitigation to certain side-channel attacks. The field is included by + default and omitted when `stream_options.include_obfuscation` is `false`. + service_tier: + $ref: '#/components/schemas/ServiceTier' + system_fingerprint: + type: string + deprecated: true + description: | + This fingerprint represents the backend configuration that the model runs with. + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + object: type: string + description: The object type, which is always `chat.completion.chunk`. enum: - - assistant - description: The role of the messages author, in this case `assistant`. + - chat.completion.chunk x-stainless-const: true - name: - type: string - description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. - audio: + usage: + $ref: '#/components/schemas/CompletionUsage' + nullable: true + description: | + An optional field that will only be present when you set + `stream_options: {"include_usage": true}` in your request. When present, it + contains a null value **except for the last chunk** which contains the + token usage statistics for the entire request. + + **NOTE:** If the stream is interrupted or cancelled, you may not + receive the final usage chunk which contains the total token usage for + the request. + moderation: anyOf: - - type: object + - $ref: '#/components/schemas/ChatCompletionModeration' description: | - Data about a previous audio response from the model. - [Learn more](https://developers.openai.com/api/docs/guides/audio). - required: - - id - properties: - id: - type: string - description: | - Unique identifier for a previous audio response from the model. - - type: 'null' - tool_calls: - $ref: '#/components/schemas/ChatCompletionMessageToolCalls' - function_call: - anyOf: - - type: object - deprecated: true - description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. - properties: - arguments: - type: string - description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. - name: - type: string - description: The name of the function to call. - required: - - arguments - - name + Moderation results for the request input and generated output. Present + on the moderation chunk when moderated completions are requested. - type: 'null' required: - - role - x-stainless-soft-required: - - content - ChatCompletionRequestAssistantMessageContentPart: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartRefusal' - ChatCompletionRequestDeveloperMessage: + - choices + - created + - id + - model + - object + x-oaiMeta: + name: The chat completion chunk object + group: chat + example: | + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-6-astra", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}],"obfuscation":"r4N7vQ2m"} + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-6-astra", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}],"obfuscation":"p9K3xT6w"} + + .... + + {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-6-astra", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"obfuscation":""} + CreateCompletionRequest: type: object - title: Developer message - description: | - Developer-provided instructions that the model should follow, regardless of - messages sent by the user. With o1 models and newer, `developer` messages - replace the previous `system` messages. properties: - content: - description: The contents of the developer message. + model: + description: | + ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them. anyOf: - type: string - description: The contents of the developer message. - title: Text content + - type: string + enum: + - gpt-3.5-turbo-instruct + - davinci-002 + - babbage-002 + title: Preset + x-oaiTypeLabel: string + prompt: + description: | + The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. + + Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. + anyOf: + - type: string + default: '' + example: This is a test. - type: array - description: An array of content parts with a defined type. For developer messages, only type `text` is supported. - title: Array of content parts items: - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + type: string + default: '' + example: This is a test. + title: Array of strings + - type: array minItems: 1 - role: + items: + type: integer + title: Array of tokens + - type: array + minItems: 1 + items: + type: array + minItems: 1 + items: + type: integer + title: Array of token arrays + nullable: true + best_of: + type: integer + default: 1 + minimum: 0 + maximum: 20 + nullable: true + description: | + Generates `best_of` completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed. + + When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. + + **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. + echo: + type: boolean + default: false + nullable: true + description: | + Echo back the prompt in addition to the completion + frequency_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: | + Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. + + [See more information about frequency and presence penalties.](https://developers.openai.com/api/docs/guides/text) + logit_bias: + type: object + x-oaiTypeLabel: map + default: null + nullable: true + additionalProperties: + type: integer + description: | + Modify the likelihood of specified tokens appearing in the completion. + + Accepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](https://platform.openai.com/tokenizer?view=bpe) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. + + As an example, you can pass `{"50256": -100}` to prevent the <|endoftext|> token from being generated. + logprobs: + type: integer + minimum: 0 + maximum: 5 + default: null + nullable: true + description: | + Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. + + The maximum value for `logprobs` is 5. + max_tokens: + type: integer + minimum: 0 + default: 16 + example: 16 + nullable: true + description: | + The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated in the completion. + + The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + n: + type: integer + minimum: 1 + maximum: 128 + default: 1 + example: 1 + nullable: true + description: | + How many completions to generate for each prompt. + + **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. + presence_penalty: + type: number + default: 0 + minimum: -2 + maximum: 2 + nullable: true + description: | + Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. + + [See more information about frequency and presence penalties.](https://developers.openai.com/api/docs/guides/text) + seed: + type: integer + format: int64 + nullable: true + description: | + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + stop: + $ref: '#/components/schemas/StopConfiguration' + stream: + description: | + Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). + type: boolean + nullable: true + default: false + stream_options: + $ref: '#/components/schemas/ChatCompletionStreamOptions' + suffix: + description: | + The suffix that comes after a completion of inserted text. + + This parameter is only supported for `gpt-3.5-turbo-instruct`. + default: null + nullable: true type: string - enum: - - developer - description: The role of the messages author, in this case `developer`. - x-stainless-const: true - name: + example: test. + temperature: + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + nullable: true + description: | + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + + We generally recommend altering this or `top_p` but not both. + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + nullable: true + description: | + An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + + We generally recommend altering this or `temperature` but not both. + user: type: string - description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + example: user-1234 + description: | + A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). required: - - content - - role - x-stainless-naming: - go: - variant_constructor: DeveloperMessage - ChatCompletionRequestFunctionMessage: + - model + - prompt + CreateCompletionResponse: type: object - title: Function message - deprecated: true + description: | + Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint). properties: - role: + id: type: string - enum: - - function - description: The role of the messages author, in this case `function`. - x-stainless-const: true - content: - anyOf: - - type: string - description: The contents of the function message. - - type: 'null' - name: + description: A unique identifier for the completion. + choices: + type: array + description: The list of completion choices the model generated for the input prompt. + items: + type: object + required: + - finish_reason + - index + - logprobs + - text + properties: + finish_reason: + type: string + description: | + The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `length` if the maximum number of tokens specified in the request was reached, + or `content_filter` if content was omitted due to a flag from our content filters. + enum: + - stop + - length + - content_filter + index: + type: integer + logprobs: + anyOf: + - type: object + properties: + text_offset: + type: array + items: + type: integer + token_logprobs: + type: array + items: + type: number + tokens: + type: array + items: + type: string + top_logprobs: + type: array + items: + type: object + additionalProperties: + type: number + - type: 'null' + text: + type: string + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the completion was created. + model: type: string - description: The name of the function to call. - required: - - role - - content - - name - ChatCompletionRequestMessage: - discriminator: - propertyName: role - anyOf: - - $ref: '#/components/schemas/ChatCompletionRequestDeveloperMessage' - - $ref: '#/components/schemas/ChatCompletionRequestSystemMessage' - - $ref: '#/components/schemas/ChatCompletionRequestUserMessage' - - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage' - - $ref: '#/components/schemas/ChatCompletionRequestToolMessage' - - $ref: '#/components/schemas/ChatCompletionRequestFunctionMessage' - ChatCompletionRequestMessageContentPartAudio: - type: object - title: Audio content part - description: | - Learn about [audio inputs](https://developers.openai.com/api/docs/guides/audio). - properties: - type: + description: The model used for completion. + system_fingerprint: type: string - enum: - - input_audio - description: The type of the content part. Always `input_audio`. - x-stainless-const: true - input_audio: - type: object - properties: - data: - type: string - description: Base64 encoded audio data. - format: - type: string - enum: - - wav - - mp3 - description: | - The format of the encoded audio data. Currently supports "wav" and "mp3". - required: - - data - - format - prompt_cache_breakpoint: - $ref: '#/components/schemas/PromptCacheBreakpointParam' - required: - - type - - input_audio - x-stainless-naming: - go: - variant_constructor: InputAudioContentPart - ChatCompletionRequestMessageContentPartFile: - type: object - title: File content part - description: | - Learn about [file inputs](https://developers.openai.com/api/docs/guides/text) for text generation. - properties: - type: + description: | + This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + object: type: string + description: The object type, which is always "text_completion" enum: - - file - description: The type of the content part. Always `file`. + - text_completion x-stainless-const: true - file: - type: object - properties: - filename: - type: string - description: | - The name of the file, used when passing the file to the model as a - string. - file_data: - type: string - description: | - The base64 encoded file data, used when passing the file to the model - as a string. - file_id: - type: string - description: | - The ID of an uploaded file to use as input. - x-stainless-naming: - java: - type_name: FileObject - kotlin: - type_name: FileObject - prompt_cache_breakpoint: - $ref: '#/components/schemas/PromptCacheBreakpointParam' + usage: + $ref: '#/components/schemas/CompletionUsage' required: - - type - - file - x-stainless-naming: - go: - variant_constructor: FileContentPart - ChatCompletionRequestMessageContentPartImage: + - id + - object + - created + - model + - choices + x-oaiMeta: + name: The completion object + legacy: true + example: | + { + "id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7", + "object": "text_completion", + "created": 1589478378, + "model": "gpt-3.5-turbo-instruct", + "choices": [ + { + "text": "\n\nThis is indeed a test", + "index": 0, + "logprobs": null, + "finish_reason": "length" + } + ], + "usage": { + "prompt_tokens": 5, + "completion_tokens": 7, + "total_tokens": 12 + } + } + CreateContainerBody: type: object - title: Image content part - description: | - Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision). properties: - type: + name: type: string - enum: - - image_url - description: The type of the content part. - x-stainless-const: true - image_url: + description: Name of the container to create. + file_ids: + type: array + description: IDs of files to copy to the container. + items: + type: string + expires_after: type: object + description: Container expiration time in seconds relative to the 'anchor' time. properties: - url: - type: string - description: Either a URL of the image or the base64 encoded image data. - format: uri - detail: + anchor: type: string - description: Specifies the detail level of the image. Learn more in the [Vision guide](https://developers.openai.com/api/docs/guides/images-vision#choose-an-image-detail-level). enum: - - auto - - low - - high - default: auto + - last_active_at + description: Time anchor for the expiration time. Currently only 'last_active_at' is supported. + minutes: + type: integer required: - - url - prompt_cache_breakpoint: - $ref: '#/components/schemas/PromptCacheBreakpointParam' - required: - - type - - image_url - x-stainless-naming: - go: - variant_constructor: ImageContentPart - ChatCompletionRequestMessageContentPartRefusal: - type: object - title: Refusal content part - properties: - type: + - anchor + - minutes + skills: + type: array + description: An optional list of skills referenced by id or inline data. + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/SkillReferenceParam' + - $ref: '#/components/schemas/InlineSkillParam' + memory_limit: type: string enum: - - refusal - description: The type of the content part. - x-stainless-const: true - refusal: - type: string - description: The refusal message generated by the model. + - 1g + - 4g + - 16g + - 64g + description: Optional memory limit for the container. Defaults to "1g". + network_policy: + description: Network access policy for the container. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' + - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' required: - - type - - refusal - ChatCompletionRequestMessageContentPartText: + - name + CreateContainerFileBody: type: object - title: Text content part - description: | - Learn about [text inputs](https://developers.openai.com/api/docs/guides/text). properties: - type: + file_id: type: string - enum: - - text - description: The type of the content part. - x-stainless-const: true - text: + description: Name of the file to create. + file: + description: | + The File object (not file name) to be uploaded. type: string - description: The text content. - prompt_cache_breakpoint: - $ref: '#/components/schemas/PromptCacheBreakpointParam' - required: - - type - - text - x-stainless-naming: - go: - variant_constructor: TextContentPart - ChatCompletionRequestSystemMessage: + format: binary + required: [] + CreateEmbeddingRequest: type: object - title: System message - description: | - Developer-provided instructions that the model should follow, regardless of - messages sent by the user. With o1 models and newer, use `developer` messages - for this purpose instead. + additionalProperties: false properties: - content: - description: The contents of the system message. + input: + description: | + Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. In addition to the per-input token limit, all embedding models enforce a maximum of 300,000 tokens summed across all inputs in a single request. + example: The quick brown fox jumped over the lazy dog anyOf: - type: string - description: The contents of the system message. - title: Text content + title: string + description: The string that will be turned into an embedding. + default: '' + example: This is a test. - type: array - description: An array of content parts with a defined type. For system messages, only type `text` is supported. - title: Array of content parts - items: - $ref: '#/components/schemas/ChatCompletionRequestSystemMessageContentPart' + title: Array of strings + description: The array of strings that will be turned into an embedding. minItems: 1 - role: - type: string - enum: - - system - description: The role of the messages author, in this case `system`. - x-stainless-const: true - name: - type: string - description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. - required: - - content - - role - x-stainless-naming: - go: - variant_constructor: SystemMessage - ChatCompletionRequestSystemMessageContentPart: - anyOf: - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' - ChatCompletionRequestToolMessage: - type: object - title: Tool message - properties: - role: - type: string - enum: - - tool - description: The role of the messages author, in this case `tool`. - x-stainless-const: true - content: - description: The contents of the tool message. - anyOf: - - type: string - description: The contents of the tool message. - title: Text content + maxItems: 2048 + items: + type: string + default: '' + example: '[''This is a test.'']' - type: array - description: An array of content parts with a defined type. For tool messages, only type `text` is supported. - title: Array of content parts + title: Array of tokens + description: The array of integers that will be turned into an embedding. + minItems: 1 + maxItems: 2048 items: - $ref: '#/components/schemas/ChatCompletionRequestToolMessageContentPart' + type: integer + - type: array + title: Array of token arrays + description: The array of arrays containing integers that will be turned into an embedding. minItems: 1 - tool_call_id: - type: string - description: Tool call that this message is responding to. - required: - - role - - content - - tool_call_id - x-stainless-naming: - go: - variant_constructor: ToolMessage - ChatCompletionRequestToolMessageContentPart: - anyOf: - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' - ChatCompletionRequestUserMessage: - type: object - title: User message - description: | - Messages sent by an end user, containing prompts or additional context - information. - properties: - content: + maxItems: 2048 + items: + type: array + minItems: 1 + items: + type: integer + model: description: | - The contents of the user message. + ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them. + example: text-embedding-3-small anyOf: - type: string - description: The text contents of the message. - title: Text content - - type: array - description: An array of content parts with a defined type. Supported options differ based on the [model](https://developers.openai.com/api/docs/models) being used to generate the response. Can contain text, image, or audio inputs. - title: Array of content parts - items: - $ref: '#/components/schemas/ChatCompletionRequestUserMessageContentPart' - minItems: 1 - role: + - type: string + enum: + - text-embedding-ada-002 + - text-embedding-3-small + - text-embedding-3-large + x-stainless-nominal: false + x-oaiTypeLabel: string + encoding_format: + description: The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/). + example: float + default: float type: string enum: - - user - description: The role of the messages author, in this case `user`. - x-stainless-const: true - name: + - float + - base64 + dimensions: + description: | + The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models. + type: integer + minimum: 1 + user: type: string - description: An optional name for the participant. Provides the model information to differentiate between participants of the same role. + example: user-1234 + description: | + A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). required: - - content - - role - x-stainless-naming: - go: - variant_constructor: UserMessage - ChatCompletionRequestUserMessageContentPart: - anyOf: - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartImage' - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartAudio' - - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartFile' - discriminator: - propertyName: type - ChatCompletionResponseMessage: + - model + - input + CreateEmbeddingResponse: type: object - description: A chat completion message generated by the model. properties: - content: - anyOf: - - type: string - description: The contents of the message. - - type: 'null' - refusal: - anyOf: - - type: string - description: The refusal message generated by the model. - - type: 'null' - tool_calls: - $ref: '#/components/schemas/ChatCompletionMessageToolCalls' - annotations: + data: type: array - description: | - Annotations for the message, when applicable, as when using the - [web search tool](https://developers.openai.com/api/docs/guides/tools-web-search). + description: The list of embeddings generated by the model. items: - type: object - description: | - A URL citation when using web search. - required: - - type - - url_citation - properties: - type: - type: string - description: The type of the URL citation. Always `url_citation`. - enum: - - url_citation - x-stainless-const: true - url_citation: - type: object - description: A URL citation when using web search. - required: - - end_index - - start_index - - url - - title - properties: - end_index: - type: integer - description: The index of the last character of the URL citation in the message. - start_index: - type: integer - description: The index of the first character of the URL citation in the message. - url: - type: string - format: uri - description: The URL of the web resource. - title: - type: string - description: The title of the web resource. - role: + $ref: '#/components/schemas/Embedding' + model: + type: string + description: The name of the model used to generate the embedding. + object: type: string + description: The object type, which is always "list". enum: - - assistant - description: The role of the author of this message. + - list x-stainless-const: true - function_call: + usage: type: object - deprecated: true - description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + description: The usage information for the request. properties: - arguments: - type: string - description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. - name: - type: string - description: The name of the function to call. + prompt_tokens: + type: integer + description: The number of tokens used by the prompt. + total_tokens: + type: integer + description: The total number of tokens used by the request. required: - - name - - arguments - audio: + - prompt_tokens + - total_tokens + required: + - object + - model + - data + - usage + CreateEvalCompletionsRunDataSource: + type: object + title: CompletionsRunDataSource + description: | + A CompletionsRunDataSource object describing a model sampling configuration. + properties: + type: + type: string + enum: + - completions + default: completions + description: The type of run data source. Always `completions`. + input_messages: + description: Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace. anyOf: - type: object - description: | - If the audio output modality is requested, this object contains data - about the audio response from the model. [Learn more](https://developers.openai.com/api/docs/guides/audio). - required: - - id - - expires_at - - data - - transcript + title: TemplateInputMessages properties: - id: + type: type: string - description: Unique identifier for this audio response. - expires_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) for when this audio response will - no longer be accessible on the server for use in multi-turn - conversations. - data: + enum: + - template + description: The type of input messages. Always `template`. + template: + type: array + description: A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}. + items: + anyOf: + - $ref: '#/components/schemas/EasyInputMessage' + - $ref: '#/components/schemas/EvalItem' + required: + - type + - template + - type: object + title: ItemReferenceInputMessages + properties: + type: type: string - description: | - Base64 encoded audio bytes generated by the model, in the format - specified in the request. - transcript: + enum: + - item_reference + description: The type of input messages. Always `item_reference`. + item_reference: type: string - description: Transcript of the audio generated by the model. - - type: 'null' - required: - - role - - content - - refusal - ChatCompletionRole: - type: string - description: The role of the author of a message - enum: - - developer - - system - - user - - assistant - - tool - - function - ChatCompletionStreamOptions: - anyOf: - - description: | - Options for streaming response. Only set this when you set `stream: true`. - type: object - properties: - include_usage: - type: boolean - description: | - If set, an additional chunk will be streamed before the `data: [DONE]` - message. The `usage` field on this chunk shows the token usage statistics - for the entire request, and the `choices` field will always be an empty - array. - - All other chunks will also include a `usage` field, but with a null - value. **NOTE:** If the stream is interrupted, you may not receive the - final usage chunk which contains the total token usage for the request. - include_obfuscation: - type: boolean - description: | - When true, stream obfuscation will be enabled. Stream obfuscation adds - random characters to an `obfuscation` field on streaming delta events to - normalize payload sizes as a mitigation to certain side-channel attacks. - These obfuscation fields are included by default, but add a small amount - of overhead to the data stream. You can set `include_obfuscation` to - false to optimize for bandwidth if you trust the network links between - your application and the OpenAI API. - - type: 'null' - ChatCompletionStreamResponseDelta: - type: object - description: A chat completion delta generated by streamed model responses. - properties: - content: - anyOf: - - type: string - description: The contents of the chunk message. - - type: 'null' - function_call: - deprecated: true + description: A reference to a variable in the `item` namespace. Ie, "item.input_trajectory" + required: + - type + - item_reference + discriminator: + propertyName: type + sampling_params: type: object - description: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. properties: - arguments: - type: string - description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. - name: - type: string - description: The name of the function to call. - tool_calls: - type: array - items: - $ref: '#/components/schemas/ChatCompletionMessageToolCallChunk' - role: - type: string - enum: - - developer - - system - - user - - assistant - - tool - description: The role of the author of this message. - refusal: - anyOf: - - type: string - description: The refusal message generated by the model. - - type: 'null' - ChatCompletionTokenLogprob: - type: object - properties: - token: - description: The token. + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + temperature: + type: number + description: A higher temperature increases randomness in the outputs. + default: 1 + max_completion_tokens: + type: integer + description: The maximum number of tokens in the generated output. + top_p: + type: number + description: An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + default: 1 + seed: + type: integer + description: A seed value to initialize the randomness, during sampling. + default: 42 + response_format: + description: | + An object specifying the format that the model must output. + + Setting to `{ "type": "json_schema", "json_schema": {...} }` enables + Structured Outputs which ensures the model will match your supplied JSON + schema. Learn more in the [Structured Outputs + guide](https://developers.openai.com/api/docs/guides/structured-outputs). + + Setting to `{ "type": "json_object" }` enables the older JSON mode, which + ensures the message the model generates is valid JSON. Using `json_schema` + is preferred for models that support it. + anyOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/ResponseFormatJsonSchema' + - $ref: '#/components/schemas/ResponseFormatJsonObject' + tools: + type: array + description: | + A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. + items: + $ref: '#/components/schemas/ChatCompletionTool' + model: type: string - logprob: - description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. - type: number - bytes: + description: The name of the model to use for generating completions (e.g. "o3-mini"). + source: + description: Determines what populates the `item` namespace in this run's data source. anyOf: - - description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. - type: array - items: - type: integer - - type: 'null' - top_logprobs: - description: List of the most likely tokens and their log probability, at this token position. The number of entries may be fewer than the requested `top_logprobs`. - type: array - items: - type: object - properties: - token: - description: The token. - type: string - logprob: - description: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely. - type: number - bytes: - anyOf: - - description: A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. - type: array - items: - type: integer - - type: 'null' - required: - - token - - logprob - - bytes + - $ref: '#/components/schemas/EvalJsonlFileContentSource' + - $ref: '#/components/schemas/EvalJsonlFileIdSource' + - $ref: '#/components/schemas/EvalStoredCompletionsSource' + discriminator: + propertyName: type required: - - token - - logprob - - bytes - - top_logprobs - ChatCompletionTool: + - type + - source + x-oaiMeta: + name: The completions data source object used to configure an individual run + group: eval runs + example: | + { + "name": "gpt-6-astra", + "data_source": { + "type": "completions", + "input_messages": { + "type": "item_reference", + "item_reference": "item.input" + }, + "model": "gpt-6-astra", + "source": { + "type": "stored_completions", + "model": "gpt-6-astra" + } + } + } + CreateEvalCustomDataSourceConfig: type: object - title: Function tool + title: CustomDataSourceConfig description: | - A function tool that can be used to generate a response. + A CustomDataSourceConfig object that defines the schema for the data source used for the evaluation runs. + This schema is used to define the shape of the data that will be: + - Used to define your testing criteria and + - What data is required when creating a run properties: type: type: string enum: - - function - description: The type of the tool. Currently, only `function` is supported. + - custom + default: custom + description: The type of data source. Always `custom`. x-stainless-const: true - function: - $ref: '#/components/schemas/FunctionObject' + item_schema: + type: object + description: The json schema for each row in the data source. + additionalProperties: true + include_sample_schema: + type: boolean + default: false + description: Whether the eval should expect you to populate the sample namespace (ie, by generating responses off of your data source) required: + - item_schema - type - - function - ChatCompletionToolChoiceOption: - description: | - Controls which (if any) tool is called by the model. - `none` means the model will not call any tool and instead generates a message. - `auto` means the model can pick between generating a message or calling one or more tools. - `required` means the model must call one or more tools. - Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. - - `none` is the default when no tools are present. `auto` is the default if tools are present. - anyOf: - - type: string - title: Auto - description: | - `none` means the model will not call any tool and instead generates a message. `auto` means the model can pick between generating a message or calling one or more tools. `required` means the model must call one or more tools. - enum: - - none - - auto - - required - - $ref: '#/components/schemas/ChatCompletionAllowedToolsChoice' - - $ref: '#/components/schemas/ChatCompletionNamedToolChoice' - - $ref: '#/components/schemas/ChatCompletionNamedToolChoiceCustom' - x-stainless-go-variant-constructor: - naming: tool_choice_option_{variant} - ChunkingStrategyRequestParam: + x-oaiMeta: + name: The eval file data source config object + group: evals + example: | + { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "age": {"type": "integer"} + }, + "required": ["name", "age"] + }, + "include_sample_schema": true + } + CreateEvalItem: + title: CreateEvalItem + description: A chat message that makes up the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}. type: object - description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty. + x-oaiMeta: + name: The chat message object used to configure an individual run anyOf: - - $ref: '#/components/schemas/AutoChunkingStrategyRequestParam' - - $ref: '#/components/schemas/StaticChunkingStrategyRequestParam' - discriminator: - propertyName: type - CodeInterpreterFileOutput: + - type: object + title: SimpleInputMessage + properties: + role: + type: string + description: The role of the message (e.g. "system", "assistant", "user"). + content: + type: string + description: The content of the message. + required: + - role + - content + - $ref: '#/components/schemas/EvalItem' + CreateEvalJsonlRunDataSource: type: object - title: Code interpreter file output + title: JsonlRunDataSource + description: "A JsonlRunDataSource object with that specifies a JSONL file that matches the eval \n" + properties: + type: + type: string + enum: + - jsonl + default: jsonl + description: The type of data source. Always `jsonl`. + x-stainless-const: true + source: + description: Determines what populates the `item` namespace in the data source. + anyOf: + - $ref: '#/components/schemas/EvalJsonlFileContentSource' + - $ref: '#/components/schemas/EvalJsonlFileIdSource' + discriminator: + propertyName: type + required: + - type + - source + x-oaiMeta: + name: The file data source object for the eval run configuration + group: evals + example: | + { + "type": "jsonl", + "source": { + "type": "file_id", + "id": "file-9GYS6xbkWgWhmE7VoLUWFg" + } + } + CreateEvalLabelModelGrader: + type: object + title: LabelModelGrader description: | - The output of a code interpreter tool call that is a file. + A LabelModelGrader object which uses a model to assign labels to each item + in the evaluation. properties: type: + description: The object type, which is always `label_model`. type: string enum: - - files - description: | - The type of the code interpreter file output. Always `files`. + - label_model x-stainless-const: true - files: + name: + type: string + description: The name of the grader. + model: + type: string + description: The model to use for the evaluation. Must support structured outputs. + input: type: array + description: A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}. items: - type: object - properties: - mime_type: - type: string - description: | - The MIME type of the file. - file_id: - type: string - description: | - The ID of the file. - required: - - mime_type - - file_id + $ref: '#/components/schemas/CreateEvalItem' + labels: + type: array + items: + type: string + description: The labels to classify to each item in the evaluation. + passing_labels: + type: array + items: + type: string + description: The labels that indicate a passing result. Must be a subset of labels. required: - type - - files - CodeInterpreterTextOutput: + - model + - input + - passing_labels + - labels + - name + x-oaiMeta: + name: The eval label model grader object + group: evals + example: | + { + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "role": "system", + "content": "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" + }, + { + "role": "user", + "content": "Statement: {{item.response}}" + } + ], + "passing_labels": ["positive"], + "labels": ["positive", "neutral", "negative"], + "name": "Sentiment label grader" + } + CreateEvalLogsDataSourceConfig: type: object - title: Code interpreter text output + title: LogsDataSourceConfig description: | - The output of a code interpreter tool call that is text. + A data source config which specifies the metadata property of your logs query. + This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. properties: type: type: string enum: - logs - description: | - The type of the code interpreter text output. Always `logs`. + default: logs + description: The type of data source. Always `logs`. x-stainless-const: true - logs: - type: string - description: | - The logs of the code interpreter tool call. + metadata: + type: object + description: Metadata filters for the logs data source. + additionalProperties: true required: - type - - logs - CodeInterpreterTool: + x-oaiMeta: + name: The logs data source object for evals + group: evals + example: | + { + "type": "logs", + "metadata": { + "use_case": "customer_support_agent" + } + } + CreateEvalRequest: type: object - title: Code interpreter + title: CreateEvalRequest + properties: + name: + type: string + description: The name of the evaluation. + metadata: + $ref: '#/components/schemas/Metadata' + data_source_config: + type: object + description: The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation. + anyOf: + - $ref: '#/components/schemas/CreateEvalCustomDataSourceConfig' + - $ref: '#/components/schemas/CreateEvalLogsDataSourceConfig' + - $ref: '#/components/schemas/CreateEvalStoredCompletionsDataSourceConfig' + discriminator: + propertyName: type + testing_criteria: + type: array + description: A list of graders for all eval runs in this group. Graders can reference variables in the data source using double curly braces notation, like `{{item.variable_name}}`. To reference the model's output, use the `sample` namespace (ie, `{{sample.output_text}}`). + items: + anyOf: + - $ref: '#/components/schemas/CreateEvalLabelModelGrader' + - $ref: '#/components/schemas/EvalGraderStringCheck' + - $ref: '#/components/schemas/EvalGraderTextSimilarity' + - $ref: '#/components/schemas/EvalGraderPython' + - $ref: '#/components/schemas/EvalGraderScoreModel' + discriminator: + propertyName: type + required: + - data_source_config + - testing_criteria + CreateEvalResponsesRunDataSource: + type: object + title: CreateEvalResponsesRunDataSource description: | - A tool that runs Python code to help generate a response to a prompt. + A ResponsesRunDataSource object describing a model sampling configuration. properties: type: type: string enum: - - code_interpreter - description: | - The type of the code interpreter tool. Always `code_interpreter`. - x-stainless-const: true - container: - description: | - The code interpreter container. Can be a container ID or an object that - specifies uploaded file IDs to make available to your code, along with an - optional `memory_limit` setting. + - responses + default: responses + description: The type of run data source. Always `responses`. + input_messages: + description: Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace. anyOf: - - type: string - description: The container ID. - - $ref: '#/components/schemas/CodeInterpreterContainerAuto' - allowed_callers: + - type: object + title: InputMessagesTemplate + properties: + type: + type: string + enum: + - template + description: The type of input messages. Always `template`. + template: + type: array + description: A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}. + items: + anyOf: + - type: object + title: ChatMessage + properties: + role: + type: string + description: The role of the message (e.g. "system", "assistant", "user"). + content: + type: string + description: The content of the message. + required: + - role + - content + - $ref: '#/components/schemas/EvalItem' + required: + - type + - template + - type: object + title: InputMessagesItemReference + properties: + type: + type: string + enum: + - item_reference + description: The type of input messages. Always `item_reference`. + item_reference: + type: string + description: A reference to a variable in the `item` namespace. Ie, "item.name" + required: + - type + - item_reference + discriminator: + propertyName: type + sampling_params: + type: object + properties: + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + temperature: + type: number + description: A higher temperature increases randomness in the outputs. + default: 1 + max_completion_tokens: + type: integer + description: The maximum number of tokens in the generated output. + top_p: + type: number + description: An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + default: 1 + seed: + type: integer + description: A seed value to initialize the randomness, during sampling. + default: 42 + tools: + type: array + description: | + An array of tools the model may call while generating a response. You + can specify which tool to use by setting the `tool_choice` parameter. + + The two categories of tools you can provide the model are: + + - **Built-in tools**: Tools that are provided by OpenAI that extend the + model's capabilities, like [web search](https://developers.openai.com/api/docs/guides/tools-web-search) + or [file search](https://developers.openai.com/api/docs/guides/tools-file-search). Learn more about + [built-in tools](https://developers.openai.com/api/docs/guides/tools). + - **Function calls (custom tools)**: Functions that are defined by you, + enabling the model to call your own code. Learn more about + [function calling](https://developers.openai.com/api/docs/guides/function-calling). + items: + $ref: '#/components/schemas/Tool' + text: + type: object + description: | + Configuration options for a text response from the model. Can be plain + text or structured JSON data. Learn more: + - [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text) + - [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs) + properties: + format: + $ref: '#/components/schemas/TextResponseFormatConfiguration' + model: + type: string + description: The name of the model to use for generating completions (e.g. "o3-mini"). + source: + description: Determines what populates the `item` namespace in this run's data source. anyOf: - - type: array - minItems: 1 - items: - $ref: '#/components/schemas/CallableToolAllowedCaller' - description: The tool invocation context(s). - - type: 'null' + - $ref: '#/components/schemas/EvalJsonlFileContentSource' + - $ref: '#/components/schemas/EvalJsonlFileIdSource' + - $ref: '#/components/schemas/EvalResponsesSource' + discriminator: + propertyName: type + required: + - type + - source + x-oaiMeta: + name: The completions data source object used to configure an individual run + group: eval runs + example: | + { + "name": "gpt-6-astra", + "data_source": { + "type": "responses", + "input_messages": { + "type": "item_reference", + "item_reference": "item.input" + }, + "model": "gpt-6-astra", + "source": { + "type": "responses", + "model": "gpt-6-astra" + } + } + } + CreateEvalRunRequest: + type: object + title: CreateEvalRunRequest + properties: + name: + type: string + description: The name of the run. + metadata: + $ref: '#/components/schemas/Metadata' + data_source: + type: object + description: Details about the run's data source. + anyOf: + - $ref: '#/components/schemas/CreateEvalJsonlRunDataSource' + - $ref: '#/components/schemas/CreateEvalCompletionsRunDataSource' + - $ref: '#/components/schemas/CreateEvalResponsesRunDataSource' required: - - type - - container - CodeInterpreterToolCall: + - data_source + CreateEvalStoredCompletionsDataSourceConfig: type: object - title: Code interpreter tool call + title: StoredCompletionsDataSourceConfig description: | - A tool call to run code. + Deprecated in favor of LogsDataSourceConfig. properties: type: type: string enum: - - code_interpreter_call - default: code_interpreter_call + - stored_completions + default: stored_completions + description: The type of data source. Always `stored_completions`. x-stainless-const: true - description: | - The type of the code interpreter tool call. Always `code_interpreter_call`. - id: - type: string - description: | - The unique ID of the code interpreter tool call. - status: - type: string - enum: - - in_progress - - completed - - incomplete - - interpreting - - failed - description: | - The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`. - container_id: - type: string - description: | - The ID of the container used to run the code. - code: - anyOf: - - type: string - description: | - The code to run, or null if not available. - - type: 'null' - outputs: - anyOf: - - type: array - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/CodeInterpreterOutputLogs' - - $ref: '#/components/schemas/CodeInterpreterOutputImage' - discriminator: - propertyName: type - description: | - The outputs generated by the code interpreter, such as logs or images. - Can be null if no outputs are available. - - type: 'null' + metadata: + type: object + description: Metadata filters for the stored completions data source. + additionalProperties: true required: - type - - id - - status - - container_id - - code - - outputs - ComparisonFilter: + deprecated: true + x-oaiMeta: + name: The stored completions data source object for evals + group: evals + example: | + { + "type": "stored_completions", + "metadata": { + "use_case": "customer_support_agent" + } + } + CreateFileRequest: type: object additionalProperties: false - title: Comparison Filter - description: | - A filter used to compare a specified attribute key to a given value using a defined comparison operation. properties: - type: - type: string - default: eq - enum: - - eq - - ne - - gt - - gte - - lt - - lte - - in - - nin + file: description: | - Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`. - - `eq`: equals - - `ne`: not equal - - `gt`: greater than - - `gte`: greater than or equal - - `lt`: less than - - `lte`: less than or equal - - `in`: in - - `nin`: not in - key: + The File object (not file name) to be uploaded. type: string - description: The key to compare against the value. - value: - description: The value to compare against the attribute key; supports string, number, or boolean types. - anyOf: - - type: string - - type: number - - type: boolean - - type: array - items: - $ref: '#/components/schemas/ComparisonFilterValueItems' + format: binary + x-oaiMeta: + exampleFilePath: fine-tune.jsonl + purpose: + $ref: '#/components/schemas/FilePurpose' + description: | + The intended purpose of the uploaded file. One of: + - `assistants`: Used in the Assistants API + - `batch`: Used in the Batch API + - `fine-tune`: Used for fine-tuning + - `vision`: Images used for vision fine-tuning + - `user_data`: Flexible file type for any purpose + - `evals`: Used for eval data sets + expires_after: + $ref: '#/components/schemas/FileExpirationAfter' required: - - type - - key - - value - x-oaiMeta: - name: ComparisonFilter - CompleteUploadRequest: + - file + - purpose + CreateFineTuningCheckpointPermissionRequest: type: object additionalProperties: false properties: - part_ids: + project_ids: type: array - description: | - The ordered list of Part IDs. + description: The project identifiers to grant access to. items: type: string - md5: - description: | - The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect. - type: string required: - - part_ids - CompletionUsage: + - project_ids + CreateFineTuningJobRequest: type: object - description: Usage statistics for the completion request. properties: - completion_tokens: - type: integer - default: 0 - description: Number of tokens in the generated completion. - prompt_tokens: - type: integer - default: 0 - description: Number of tokens in the prompt. - total_tokens: - type: integer - default: 0 - description: Total number of tokens used in the request (prompt + completion). - completion_tokens_details: + model: + description: | + The name of the model to fine-tune. You can select one of the + [supported models](https://developers.openai.com/api/docs/guides/model-optimization#fine-tuning-methods). + example: gpt-4o-mini + anyOf: + - type: string + - type: string + enum: + - babbage-002 + - davinci-002 + - gpt-3.5-turbo + - gpt-4o-mini + title: Preset + x-oaiTypeLabel: string + training_file: + description: | + The ID of an uploaded file that contains training data. + + See [upload file](https://developers.openai.com/api/reference/resources/files/methods/create) for how to upload a file. + + Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`. + + The contents of the file should differ depending on if the model uses the [chat](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data), [completions](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data) format, or if the fine-tuning method uses the [preference](https://developers.openai.com/api/docs/guides/direct-preference-optimization) format. + + See the [fine-tuning guide](https://developers.openai.com/api/docs/guides/model-optimization) for more details. + type: string + example: file-abc123 + hyperparameters: type: object - description: Breakdown of tokens used in a completion. + description: | + The hyperparameters used for the fine-tuning job. + This value is now deprecated in favor of `method`, and should be passed in under the `method` parameter. properties: - accepted_prediction_tokens: - type: integer - default: 0 + batch_size: description: | - When using Predicted Outputs, the number of tokens in the - prediction that appeared in the completion. - audio_tokens: - type: integer - default: 0 - description: Audio input tokens generated by the model. - reasoning_tokens: - type: integer - default: 0 - description: Tokens generated by the model for reasoning. - text_tokens: - type: integer - description: Text output tokens generated by the model. - rejected_prediction_tokens: - type: integer - default: 0 + Number of examples in each batch. A larger batch size means that model parameters + are updated less frequently, but with lower variance. + default: auto + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + title: Auto + - type: integer + minimum: 1 + maximum: 256 + learning_rate_multiplier: description: | - When using Predicted Outputs, the number of tokens in the - prediction that did not appear in the completion. However, like - reasoning tokens, these tokens are still counted in the total - completion tokens for purposes of billing, output, and context window - limits. - prompt_tokens_details: - type: object - description: Breakdown of tokens used in the prompt. - properties: - audio_tokens: - type: integer - default: 0 - description: Audio input tokens present in the prompt. - cached_tokens: - type: integer - default: 0 - description: Cached tokens present in the prompt. - text_tokens: - type: integer - description: Text input tokens present in the prompt. - image_tokens: - type: integer - description: Image input tokens present in the prompt. - cache_write_tokens: - type: integer - default: 0 - description: The unadjusted number of prompt tokens written to cache. + Scaling factor for the learning rate. A smaller learning rate may be useful to avoid + overfitting. + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + title: Auto + - type: number + minimum: 0 + exclusiveMinimum: true + n_epochs: + description: | + The number of epochs to train the model for. An epoch refers to one full cycle + through the training dataset. + default: auto + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + title: Auto + - type: integer + minimum: 1 + maximum: 50 + deprecated: true + suffix: + description: | + A string of up to 64 characters that will be added to your fine-tuned model name. + + For example, a `suffix` of "custom-model-name" would produce a model name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. + type: string + minLength: 1 + maxLength: 64 + default: null + nullable: true + validation_file: + description: | + The ID of an uploaded file that contains validation data. + + If you provide this file, the data is used to generate validation + metrics periodically during fine-tuning. These metrics can be viewed in + the fine-tuning results file. + The same data should not be present in both train and validation files. + + Your dataset must be formatted as a JSONL file. You must upload your file with the purpose `fine-tune`. + + See the [fine-tuning guide](https://developers.openai.com/api/docs/guides/model-optimization) for more details. + type: string + nullable: true + example: file-abc123 + integrations: + type: array + description: A list of integrations to enable for your fine-tuning job. + nullable: true + items: + type: object + required: + - type + - wandb + properties: + type: + description: | + The type of integration to enable. Currently, only "wandb" (Weights and Biases) is supported. + anyOf: + - type: string + enum: + - wandb + x-stainless-const: true + wandb: + type: object + description: | + The settings for your integration with Weights and Biases. This payload specifies the project that + metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags + to your run, and set a default entity (team, username, etc) to be associated with your run. + required: + - project + properties: + project: + description: | + The name of the project that the new run will be created under. + type: string + example: my-wandb-project + name: + description: | + A display name to set for the run. If not set, we will use the Job ID as the name. + nullable: true + type: string + entity: + description: | + The entity to use for the run. This allows you to set the team or username of the WandB user that you would + like associated with the run. If not set, the default entity for the registered WandB API key is used. + nullable: true + type: string + tags: + description: | + A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some + default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}". + type: array + items: + type: string + example: custom-tag + seed: + description: | + The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases. + If a seed is not specified, one will be generated for you. + type: integer + nullable: true + minimum: 0 + maximum: 2147483647 + example: 42 + method: + $ref: '#/components/schemas/FineTuneMethod' + metadata: + $ref: '#/components/schemas/Metadata' required: - - prompt_tokens - - completion_tokens - - total_tokens - CompoundFilter: - $recursiveAnchor: true + - model + - training_file + CreateGroupBody: type: object - additionalProperties: false - title: Compound Filter - description: Combine multiple filters using `and` or `or`. + description: Request payload for creating a new group in the organization. properties: - type: + name: + type: string + description: Human readable name for the group. + minLength: 1 + maxLength: 255 + required: + - name + x-oaiMeta: + example: | + { + "name": "Support Team" + } + CreateGroupUserBody: + type: object + description: Request payload for adding a user to a group. + properties: + user_id: + type: string + description: Identifier of the user to add to the group. + required: + - user_id + x-oaiMeta: + example: | + { + "user_id": "user_abc123" + } + CreateImageEditRequest: + type: object + properties: + image: + anyOf: + - type: string + format: binary + - type: array + maxItems: 16 + items: + type: string + format: binary + description: | + The image(s) to edit. Must be a supported image file or an array of images. + + For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, + `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, + `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, + `gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`), each image + should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to + 16 images. + + For `dall-e-2`, you can only provide one image, and it should be a square + `png` file less than 4MB. + x-oaiMeta: + exampleFilePath: otter.png + prompt: + description: A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2`, and 32000 characters for the GPT image models. + type: string + example: A cute baby sea otter wearing a beret + mask: + description: An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + type: string + format: binary + x-oaiMeta: + exampleFilePath: mask.png + background: + type: string + enum: + - transparent + - opaque + - auto + default: auto + example: transparent + nullable: true + description: | + Allows to set transparency for the background of the generated image(s). Must + be one of `transparent`, `opaque`, or `auto` (default value). When `auto` is + used, the model will automatically determine the best background for the + image. + + `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their + `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds. + Transparent backgrounds are available for supported GPT Image models. For + `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When + using `transparent`, set the output format to `png` or `webp`. + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-2 + - gpt-image-2-2026-04-21 + - gpt-image-2.5-sunburst + - gpt-image-2.5-sunburst-2026-09-08 + - gpt-image-2.5-flare + - gpt-image-2.5-flare-2026-09-08 + - gpt-image-1.5 + - chatgpt-image-latest + - dall-e-2 + x-stainless-const: true + x-oaiTypeLabel: string + description: The model to use for image generation. One of `dall-e-2` or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`). Defaults to `gpt-image-1.5`. + nullable: true + example: gpt-image-2 + n: + type: integer + minimum: 1 + maximum: 10 + default: 1 + example: 1 + nullable: true + description: The number of images to generate. Must be between 1 and 10. + size: + anyOf: + - type: string + - type: string + enum: + - 256x256 + - 512x512 + - 1024x1024 + - 1536x1024 + - 1024x1536 + - auto + description: The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. + nullable: true + response_format: type: string - description: 'Type of operation: `and` or `or`.' enum: - - and - - or - filters: - type: array - description: Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`. - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/ComparisonFilter' - - $recursiveRef: '#' - required: - - type - - filters - x-oaiMeta: - name: CompoundFilter - ComputerAction: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/ClickParam' - - $ref: '#/components/schemas/DoubleClickAction' - - $ref: '#/components/schemas/DragParam' - - $ref: '#/components/schemas/KeyPressAction' - - $ref: '#/components/schemas/MoveParam' - - $ref: '#/components/schemas/ScreenshotParam' - - $ref: '#/components/schemas/ScrollParam' - - $ref: '#/components/schemas/TypeParam' - - $ref: '#/components/schemas/WaitParam' - ComputerActionList: - title: Computer Action List - type: array - description: | - Flattened batched actions for `computer_use`. Each action includes an - `type` discriminator and action-specific fields. - items: - $ref: '#/components/schemas/ComputerAction' - ComputerScreenshotImage: - type: object - description: | - A computer screenshot image used with the computer use tool. - properties: - type: + - url + - b64_json + example: url + nullable: true + description: The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models always return base64-encoded images. + output_format: type: string enum: - - computer_screenshot - default: computer_screenshot - description: "Specifies the event type. For a computer screenshot, this property is \nalways set to `computer_screenshot`.\n" - x-stainless-const: true - image_url: + - png + - jpeg + - webp + default: png + example: png + nullable: true + description: | + The format in which the generated images are returned. This parameter is + only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. + The default value is `png`. + output_compression: + type: integer + default: 100 + example: 100 + nullable: true + description: | + The compression level (0-100%) for the generated images. This parameter + is only supported for the GPT image models with the `webp` or `jpeg` output + formats, and defaults to 100. + user: type: string - format: uri - description: The URL of the screenshot image. - file_id: + example: user-1234 + description: | + A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). + input_fidelity: + anyOf: + - $ref: '#/components/schemas/InputFidelity' + - type: 'null' + description: Controls fidelity to the original input image(s). This parameter is supported for GPT image models that support input fidelity. `gpt-image-2` and `gpt-image-2-2026-04-21` ignore this parameter. + stream: + type: boolean + default: false + example: false + nullable: true + description: | + Edit the image in streaming mode. Defaults to `false`. See the + [Image generation guide](https://developers.openai.com/api/docs/guides/image-generation) for more information. + partial_images: + $ref: '#/components/schemas/PartialImages' + quality: type: string - description: The identifier of an uploaded file that contains the screenshot. + enum: + - standard + - low + - medium + - high + - xhigh + - max + - auto + default: auto + example: high + nullable: true + description: | + The quality of the image that will be generated for GPT image models. The GPT image models support `low`, `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, also support `xhigh` and `max`. Defaults to `auto`. required: - - type - ComputerToolCall: + - prompt + - image + CreateImageRequest: type: object - title: Computer tool call - description: | - A tool call to a computer use tool. See the - [computer use guide](https://developers.openai.com/api/docs/guides/tools-computer-use) for more information. properties: - type: + prompt: + description: A text description of the desired image(s). The maximum length is 32000 characters for the GPT image models, 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`. + type: string + example: A cute baby sea otter + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-2 + - gpt-image-2-2026-04-21 + - gpt-image-2.5-sunburst + - gpt-image-2.5-sunburst-2026-09-08 + - gpt-image-2.5-flare + - gpt-image-2.5-flare-2026-09-08 + - gpt-image-1.5 + - chatgpt-image-latest + - dall-e-2 + - dall-e-3 + x-stainless-nominal: false + x-oaiTypeLabel: string + description: The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`). Defaults to `dall-e-2` unless a parameter specific to the GPT image models is used. + nullable: true + example: gpt-image-2 + n: + type: integer + minimum: 1 + maximum: 10 + default: 1 + example: 1 + nullable: true + description: The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. + quality: type: string - description: The type of the computer call. Always `computer_call`. enum: - - computer_call - default: computer_call - id: + - standard + - hd + - low + - medium + - high + - xhigh + - max + - auto + default: auto + example: medium + nullable: true + description: | + The quality of the image that will be generated. + + - `auto` (default value) will automatically select the best quality for the given + model. + - `high`, `medium` and `low` are supported for the GPT image models. + - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08` + snapshots, also support `xhigh` and `max`. + - `hd` and `standard` are supported for `dall-e-3`. + - `standard` is the only option for `dall-e-2`. + response_format: type: string - description: The unique ID of the computer call. - call_id: + enum: + - url + - b64_json + default: url + example: url + nullable: true + description: The format in which generated images with `dall-e-2` and `dall-e-3` are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported for the GPT image models, which always return base64-encoded images. + output_format: type: string + enum: + - png + - jpeg + - webp + default: png + example: png + nullable: true + description: The format in which the generated images are returned. This parameter is only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. + output_compression: + type: integer + default: 100 + example: 100 + nullable: true + description: The compression level (0-100%) for the generated images. This parameter is only supported for the GPT image models with the `webp` or `jpeg` output formats, and defaults to 100. + stream: + type: boolean + default: false + example: false + nullable: true description: | - An identifier used when responding to the tool call with output. - action: - $ref: '#/components/schemas/LegacyComputerAction' - actions: - $ref: '#/components/schemas/ComputerActionList' - pending_safety_checks: - type: array - items: - $ref: '#/components/schemas/ComputerCallSafetyCheckParam' - description: | - The pending safety checks for the computer call. - status: + Generate the image in streaming mode. Defaults to `false`. See the + [Image generation guide](https://developers.openai.com/api/docs/guides/image-generation) for more information. + This parameter is only supported for the GPT image models. + partial_images: + $ref: '#/components/schemas/PartialImages' + size: + anyOf: + - type: string + - type: string + enum: + - auto + - 1024x1024 + - 1536x1024 + - 1024x1536 + - 256x256 + - 512x512 + - 1792x1024 + - 1024x1792 + description: The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. + nullable: true + moderation: + type: string + enum: + - low + - auto + default: auto + example: low + nullable: true + description: Control the content-moderation level for images generated by the GPT image models. Must be either `low` for less restrictive filtering or `auto` (default value). + background: type: string + enum: + - transparent + - opaque + - auto + default: auto + example: transparent + nullable: true description: | - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. + Allows to set transparency for the background of the generated image(s). Must + be one of `transparent`, `opaque`, or `auto` (default value). When `auto` is + used, the model will automatically determine the best background for the + image. + + `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their + `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds. + Transparent backgrounds are available for supported GPT Image models. For + `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When + using `transparent`, set the output format to `png` or `webp`. + style: + type: string enum: - - in_progress - - completed - - incomplete + - vivid + - natural + default: vivid + example: vivid + nullable: true + description: The style of the generated images. This parameter is only supported for `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. + user: + type: string + example: user-1234 + description: | + A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). required: - - type - - id - - call_id - - pending_safety_checks - - status - ComputerToolCallOutput: + - prompt + CreateImageVariationRequest: type: object - title: Computer tool call output - description: | - The output of a computer tool call. properties: - type: + image: + description: The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. + type: string + format: binary + x-oaiMeta: + exampleFilePath: otter.png + model: + anyOf: + - type: string + - type: string + enum: + - dall-e-2 + x-stainless-const: true + x-oaiTypeLabel: string + description: The model to use for image generation. Only `dall-e-2` is supported at this time. + nullable: true + n: + type: integer + minimum: 1 + maximum: 10 + default: 1 + example: 1 + nullable: true + description: The number of images to generate. Must be between 1 and 10. + response_format: type: string - description: | - The type of the computer tool call output. Always `computer_call_output`. enum: - - computer_call_output - default: computer_call_output - x-stainless-const: true - id: + - url + - b64_json + default: url + example: url + nullable: true + description: The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. + size: type: string - description: | - The ID of the computer tool call output. - call_id: + enum: + - 256x256 + - 512x512 + - 1024x1024 + default: 1024x1024 + example: 1024x1024 + nullable: true + description: The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + user: type: string + example: user-1234 description: | - The ID of the computer tool call that produced the output. - acknowledged_safety_checks: - type: array - description: | - The safety checks reported by the API that have been acknowledged by the - developer. - items: - $ref: '#/components/schemas/ComputerCallSafetyCheckParam' - output: - $ref: '#/components/schemas/ComputerScreenshotImage' - status: + A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). + required: + - image + CreateMessageRequest: + type: object + additionalProperties: false + required: + - role + - content + properties: + role: type: string - description: | - The status of the message input. One of `in_progress`, `completed`, or - `incomplete`. Populated when input items are returned via API. enum: - - in_progress - - completed - - incomplete - required: - - type - - call_id - - output - ComputerToolCallOutputResource: + - user + - assistant + description: | + The role of the entity that is creating the message. Allowed values include: + - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. + - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation. + content: + anyOf: + - type: string + description: The text contents of the message. + title: Text content + - type: array + description: An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](https://developers.openai.com/api/docs/models). + title: Array of content parts + items: + anyOf: + - $ref: '#/components/schemas/MessageContentImageFileObject' + - $ref: '#/components/schemas/MessageContentImageUrlObject' + - $ref: '#/components/schemas/MessageRequestContentTextObject' + discriminator: + propertyName: type + minItems: 1 + attachments: + anyOf: + - type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + description: The tools to add this file to. + type: array + items: + anyOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearchTypeOnly' + discriminator: + propertyName: type + description: A list of files attached to the message, and the tools they should be added to. + required: + - file_id + - tools + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + CreateModelResponseProperties: allOf: - - $ref: '#/components/schemas/ComputerToolCallOutput' + - $ref: '#/components/schemas/ModelResponseProperties' - type: object properties: - id: - type: string - description: | - The unique ID of the computer call tool output. - status: - description: | - The status of the message input. One of `in_progress`, `completed`, or - `incomplete`. Populated when input items are returned via API. - $ref: '#/components/schemas/ComputerCallOutputStatus' - created_by: - type: string + prompt_cache_options: + $ref: '#/components/schemas/PromptCacheOptionsParam' + top_logprobs: description: | - The identifier of the actor that created the item. - required: - - id - - status - ContainerFileListResource: + An integer between 0 and 20 specifying the maximum number of most likely + tokens to return at each token position, each with an associated log + probability. In some cases, the number of returned tokens may be fewer than + requested. + type: integer + minimum: 0 + maximum: 20 + CreateModerationRequest: type: object properties: - object: - description: The type of object returned, must be 'list'. - const: list - data: - type: array - description: A list of container files. - items: - $ref: '#/components/schemas/ContainerFileResource' - first_id: - type: string - description: The ID of the first file in the list. - last_id: - type: string - description: The ID of the last file in the list. - has_more: - type: boolean - description: Whether there are more files available. + input: + description: | + Input (or inputs) to classify. Can be a single string, an array of strings, or + an array of multi-modal input objects similar to other models. + anyOf: + - type: string + description: A string of text to classify for moderation. + default: '' + example: I want to kill them. + - type: array + description: An array of strings to classify for moderation. + items: + type: string + default: '' + example: I want to kill them. + - type: array + description: An array of multi-modal inputs to the moderation model. + items: + anyOf: + - $ref: '#/components/schemas/ModerationImageURLInput' + description: An object describing an image to classify. + - $ref: '#/components/schemas/ModerationTextInput' + description: An object describing text to classify. + discriminator: + propertyName: type + title: Moderation Multi Modal Array + model: + description: | + The content moderation model you would like to use. Learn more in + [the moderation guide](https://developers.openai.com/api/docs/guides/moderation), and learn about + available models [here](https://developers.openai.com/api/docs/guides/moderation). + nullable: false + x-oaiTypeLabel: string + anyOf: + - type: string + - type: string + enum: + - omni-moderation-latest + - omni-moderation-2024-09-26 + - text-moderation-latest + - text-moderation-stable + x-stainless-nominal: false required: - - object - - data - - first_id - - last_id - - has_more - ContainerFileResource: + - input + CreateModerationResponse: type: object - title: The container file object + description: Represents if a given text input is potentially harmful. properties: id: type: string - description: Unique identifier for the file. - object: - type: string - description: The type of this object (`container.file`). - const: container.file - container_id: - type: string - description: The container this file belongs to. - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) when the file was created. - bytes: - type: integer - description: Size of the file in bytes. - path: - type: string - description: Path of the file in the container. - source: + description: The unique identifier for the moderation request. + model: type: string - description: Source of the file (e.g., `user`, `assistant`). + description: The model used to generate the moderation results. + results: + type: array + description: A list of moderation objects. + items: + type: object + properties: + flagged: + type: boolean + description: Whether any of the below categories are flagged. + categories: + type: object + description: A list of the categories, and whether they are flagged or not. + properties: + hate: + type: boolean + description: Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment. + hate/threatening: + type: boolean + description: Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. + harassment: + type: boolean + description: Content that expresses, incites, or promotes harassing language towards any target. + harassment/threatening: + type: boolean + description: Harassment content that also includes violence or serious harm towards any target. + illicit: + anyOf: + - type: boolean + description: Content that includes instructions or advice that facilitate the planning or execution of wrongdoing, or that gives advice or instruction on how to commit illicit acts. For example, "how to shoplift" would fit this category. + - type: 'null' + illicit/violent: + anyOf: + - type: boolean + description: Content that includes instructions or advice that facilitate the planning or execution of wrongdoing that also includes violence, or that gives advice or instruction on the procurement of any weapon. + - type: 'null' + self-harm: + type: boolean + description: Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders. + self-harm/intent: + type: boolean + description: Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders. + self-harm/instructions: + type: boolean + description: Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts. + sexual: + type: boolean + description: Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness). + sexual/minors: + type: boolean + description: Sexual content that includes an individual who is under 18 years old. + violence: + type: boolean + description: Content that depicts death, violence, or physical injury. + violence/graphic: + type: boolean + description: Content that depicts death, violence, or physical injury in graphic detail. + required: + - hate + - hate/threatening + - harassment + - harassment/threatening + - illicit + - illicit/violent + - self-harm + - self-harm/intent + - self-harm/instructions + - sexual + - sexual/minors + - violence + - violence/graphic + category_scores: + type: object + description: A list of the categories along with their scores as predicted by model. + properties: + hate: + type: number + description: The score for the category 'hate'. + hate/threatening: + type: number + description: The score for the category 'hate/threatening'. + harassment: + type: number + description: The score for the category 'harassment'. + harassment/threatening: + type: number + description: The score for the category 'harassment/threatening'. + illicit: + type: number + description: The score for the category 'illicit'. + illicit/violent: + type: number + description: The score for the category 'illicit/violent'. + self-harm: + type: number + description: The score for the category 'self-harm'. + self-harm/intent: + type: number + description: The score for the category 'self-harm/intent'. + self-harm/instructions: + type: number + description: The score for the category 'self-harm/instructions'. + sexual: + type: number + description: The score for the category 'sexual'. + sexual/minors: + type: number + description: The score for the category 'sexual/minors'. + violence: + type: number + description: The score for the category 'violence'. + violence/graphic: + type: number + description: The score for the category 'violence/graphic'. + required: + - hate + - hate/threatening + - harassment + - harassment/threatening + - illicit + - illicit/violent + - self-harm + - self-harm/intent + - self-harm/instructions + - sexual + - sexual/minors + - violence + - violence/graphic + category_applied_input_types: + type: object + description: A list of the categories along with the input type(s) that the score applies to. + properties: + hate: + type: array + description: The applied input type(s) for the category 'hate'. + items: + type: string + enum: + - text + x-stainless-const: true + hate/threatening: + type: array + description: The applied input type(s) for the category 'hate/threatening'. + items: + type: string + enum: + - text + x-stainless-const: true + harassment: + type: array + description: The applied input type(s) for the category 'harassment'. + items: + type: string + enum: + - text + x-stainless-const: true + harassment/threatening: + type: array + description: The applied input type(s) for the category 'harassment/threatening'. + items: + type: string + enum: + - text + x-stainless-const: true + illicit: + type: array + description: The applied input type(s) for the category 'illicit'. + items: + type: string + enum: + - text + x-stainless-const: true + illicit/violent: + type: array + description: The applied input type(s) for the category 'illicit/violent'. + items: + type: string + enum: + - text + x-stainless-const: true + self-harm: + type: array + description: The applied input type(s) for the category 'self-harm'. + items: + type: string + enum: + - text + - image + self-harm/intent: + type: array + description: The applied input type(s) for the category 'self-harm/intent'. + items: + type: string + enum: + - text + - image + self-harm/instructions: + type: array + description: The applied input type(s) for the category 'self-harm/instructions'. + items: + type: string + enum: + - text + - image + sexual: + type: array + description: The applied input type(s) for the category 'sexual'. + items: + type: string + enum: + - text + - image + sexual/minors: + type: array + description: The applied input type(s) for the category 'sexual/minors'. + items: + type: string + enum: + - text + x-stainless-const: true + violence: + type: array + description: The applied input type(s) for the category 'violence'. + items: + type: string + enum: + - text + - image + violence/graphic: + type: array + description: The applied input type(s) for the category 'violence/graphic'. + items: + type: string + enum: + - text + - image + required: + - hate + - hate/threatening + - harassment + - harassment/threatening + - illicit + - illicit/violent + - self-harm + - self-harm/intent + - self-harm/instructions + - sexual + - sexual/minors + - violence + - violence/graphic + required: + - flagged + - categories + - category_scores + - category_applied_input_types required: - id - - object - - created_at - - bytes - - container_id - - path - - source + - model + - results x-oaiMeta: - name: The container file object + name: The moderation object example: | { - "id": "cfile_682e0e8a43c88191a7978f477a09bdf5", - "object": "container.file", - "created_at": 1747848842, - "bytes": 880, - "container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04", - "path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json", - "source": "user" + "id": "modr-0d9740456c391e43c445bf0f010940c7", + "model": "omni-moderation-latest", + "results": [ + { + "flagged": true, + "categories": { + "harassment": true, + "harassment/threatening": true, + "sexual": false, + "hate": false, + "hate/threatening": false, + "illicit": false, + "illicit/violent": false, + "self-harm/intent": false, + "self-harm/instructions": false, + "self-harm": false, + "sexual/minors": false, + "violence": true, + "violence/graphic": true + }, + "category_scores": { + "harassment": 0.8189693396524255, + "harassment/threatening": 0.804985420696006, + "sexual": 1.573112165348997e-6, + "hate": 0.007562942636942845, + "hate/threatening": 0.004208854591835476, + "illicit": 0.030535955153511665, + "illicit/violent": 0.008925306722380033, + "self-harm/intent": 0.00023023930975076432, + "self-harm/instructions": 0.0002293869201073356, + "self-harm": 0.012598046106750154, + "sexual/minors": 2.212566909570261e-8, + "violence": 0.9999992735124786, + "violence/graphic": 0.843064871157054 + }, + "category_applied_input_types": { + "harassment": [ + "text" + ], + "harassment/threatening": [ + "text" + ], + "sexual": [ + "text", + "image" + ], + "hate": [ + "text" + ], + "hate/threatening": [ + "text" + ], + "illicit": [ + "text" + ], + "illicit/violent": [ + "text" + ], + "self-harm/intent": [ + "text", + "image" + ], + "self-harm/instructions": [ + "text", + "image" + ], + "self-harm": [ + "text", + "image" + ], + "sexual/minors": [ + "text" + ], + "violence": [ + "text", + "image" + ], + "violence/graphic": [ + "text", + "image" + ] + } + } + ] } - ContainerListResource: + CreateResponse: + allOf: + - $ref: '#/components/schemas/CreateModelResponseProperties' + - $ref: '#/components/schemas/ResponseProperties' + - type: object + properties: + prompt_cache_options: + $ref: '#/components/schemas/ResponsePromptCacheOptionsParam' + service_tier: + $ref: '#/components/schemas/ServiceTierResponses' + truncation: + deprecated: true + anyOf: + - type: string + description: | + The truncation strategy to use for the model response. + - `auto`: If the input to this Response exceeds + the model's context window size, the model will truncate the + response to fit the context window by dropping items from the beginning of the conversation. + - `disabled` (default): If the input size will exceed the context window + size for a model, the request will fail with a 400 error. + enum: + - auto + - disabled + default: disabled + - type: 'null' + reasoning: + anyOf: + - $ref: '#/components/schemas/Reasoning' + - type: 'null' + input: + $ref: '#/components/schemas/InputParam' + include: + anyOf: + - type: array + description: |- + Specify additional output data to include in the model response. Currently supported values are: + - `web_search_call.action.sources`: Include the sources of the web search tool call. + - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items. + - `computer_call_output.output.image_url`: Include image urls from the computer call output. + - `file_search_call.results`: Include the search results of the file search tool call. + - `message.input_image.image_url`: Include image urls from the input message. + - `message.output_text.logprobs`: Include logprobs with assistant messages. + - `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program). + items: + $ref: '#/components/schemas/IncludeEnum' + - type: 'null' + parallel_tool_calls: + anyOf: + - type: boolean + description: | + Whether to allow the model to run tool calls in parallel. + default: true + - type: 'null' + store: + anyOf: + - type: boolean + description: | + Whether to store the generated model response for later retrieval via + API. + Defaults to true when omitted. + If set to true, response data will be stored for at least 30 days, subject to the [data retention exceptions](https://developers.openai.com/api/docs/guides/your-data#v1responses). + default: true + - type: 'null' + instructions: + anyOf: + - type: string + description: | + A system (or developer) message inserted into the model's context. + + When using along with `previous_response_id`, the instructions from a previous + response will not be carried over to the next response. This makes it simple + to swap out system (or developer) messages in new responses. + - type: 'null' + moderation: + anyOf: + - $ref: '#/components/schemas/ModerationParam' + description: | + Configuration for running moderation on the input and output of this response. + - type: 'null' + stream: + anyOf: + - description: | + If set to true, the model response data will be streamed to the client + as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + See the [Streaming section below](https://developers.openai.com/api/reference/resources/responses/streaming-events) + for more information. + type: boolean + default: false + - type: 'null' + stream_options: + $ref: '#/components/schemas/ResponseStreamOptions' + conversation: + anyOf: + - $ref: '#/components/schemas/ConversationParam' + - type: 'null' + context_management: + anyOf: + - type: array + description: | + Context management configuration for this request. + minItems: 1 + items: + $ref: '#/components/schemas/ContextManagementParam' + - type: 'null' + max_output_tokens: + anyOf: + - description: | + An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](https://developers.openai.com/api/docs/guides/reasoning). + type: integer + minimum: 16 + - type: 'null' + CreateRunRequest: type: object + additionalProperties: false properties: - object: - description: The type of object returned, must be 'list'. - const: list - data: - type: array - description: A list of containers. - items: - $ref: '#/components/schemas/ContainerResource' - first_id: + assistant_id: + description: The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) to use to execute this run. type: string - description: The ID of the first container in the list. - last_id: + model: + description: The ID of the [Model](https://developers.openai.com/api/reference/resources/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used. + nullable: true + anyOf: + - type: string + - $ref: '#/components/schemas/AssistantSupportedModels' + x-oaiTypeLabel: string + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + instructions: + description: Overrides the [instructions](https://developers.openai.com/api/docs/assistants/migration) of the assistant. This is useful for modifying the behavior on a per-run basis. type: string - description: The ID of the last container in the list. - has_more: + nullable: true + additional_instructions: + description: Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions. + type: string + nullable: true + additional_messages: + description: Adds additional messages to the thread before creating the run. + type: array + items: + $ref: '#/components/schemas/CreateMessageRequest' + nullable: true + tools: + description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. + nullable: true + type: array + maxItems: 20 + items: + $ref: '#/components/schemas/AssistantTool' + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + nullable: true + description: | + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + nullable: true + description: | + An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + + We generally recommend altering this or temperature but not both. + stream: type: boolean - description: Whether there are more containers available. + nullable: true + description: | + If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message. + max_prompt_tokens: + type: integer + nullable: true + description: | + The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + minimum: 256 + max_completion_tokens: + type: integer + nullable: true + description: | + The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + minimum: 256 + truncation_strategy: + allOf: + - $ref: '#/components/schemas/TruncationObject' + - nullable: true + tool_choice: + allOf: + - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' + - nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true required: - - object - - data - - first_id - - last_id - - has_more - ContainerResource: + - assistant_id + CreateSpeechRequest: type: object - title: The container object + additionalProperties: false properties: - id: - type: string - description: Unique identifier for the container. - object: + model: + description: | + One of the available [TTS models](https://developers.openai.com/api/docs/guides/text-to-speech): `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`. + anyOf: + - type: string + - type: string + enum: + - tts-1 + - tts-1-hd + - gpt-4o-mini-tts + - gpt-4o-mini-tts-2025-12-15 + x-stainless-nominal: false + x-oaiTypeLabel: string + input: type: string - description: The type of this object. - name: + description: The text to generate audio for. The maximum length is 4096 characters. + maxLength: 4096 + instructions: type: string - description: Name of the container. - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) when the container was created. - status: + description: Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`. + maxLength: 4096 + voice: + description: 'The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the voices are available in the [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).' + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + response_format: + description: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`. + default: mp3 type: string - description: Status of the container (e.g., active, deleted). - last_active_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) when the container was last active. - expires_after: - type: object - description: | - The container will expire after this time period. - The anchor is the reference point for the expiration. - The minutes is the number of minutes after the anchor before the container expires. - properties: - anchor: - type: string - description: The reference point for the expiration. - enum: - - last_active_at - minutes: - type: integer - description: The number of minutes after the anchor before the container expires. - memory_limit: + enum: + - mp3 + - opus + - aac + - flac + - wav + - pcm + speed: + description: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default. + type: number + default: 1 + minimum: 0.25 + maximum: 4 + stream_format: + description: The format to stream the audio in. Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`. type: string - description: The memory limit configured for the container. + default: audio enum: - - 1g - - 4g - - 16g - - 64g - network_policy: - description: Network access policy for the container. - type: object - properties: - type: - type: string - description: The network policy mode. - enum: - - allowlist - - disabled - allowed_domains: - type: array - description: Allowed outbound domains when `type` is `allowlist`. - items: - type: string - required: - - type + - sse + - audio required: - - id - - object - - name - - created_at - - status - - id - - name - - created_at - - status - x-oaiMeta: - name: The container object - example: | - { - "id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863", - "object": "container", - "created_at": 1747844794, - "status": "running", - "expires_after": { - "anchor": "last_active_at", - "minutes": 20 - }, - "last_active_at": 1747844794, - "memory_limit": "1g", - "name": "My Container" - } - Content: - description: | - Multi-modal input and output contents. + - model + - input + - voice + CreateSpeechResponseStreamEvent: anyOf: - - title: Input content types - $ref: '#/components/schemas/InputContent' - - title: Output content types - $ref: '#/components/schemas/OutputContent' - ConversationItem: - title: Conversation item - description: A single item within a conversation. The set of possible types are the same as the `output` type of a [Response object](https://developers.openai.com/api/reference/resources/responses#%28resource%29%20responses%20%3E%20%28model%29%20response%20%3E%20%28schema%29%20%3E%20%28property%29%20output). + - $ref: '#/components/schemas/SpeechAudioDeltaEvent' + - $ref: '#/components/schemas/SpeechAudioDoneEvent' discriminator: propertyName: type - anyOf: - - $ref: '#/components/schemas/Message' - - $ref: '#/components/schemas/FunctionToolCallResource' - - $ref: '#/components/schemas/FunctionToolCallOutputResource' - - $ref: '#/components/schemas/FileSearchToolCall' - - $ref: '#/components/schemas/WebSearchToolCall' - - $ref: '#/components/schemas/ImageGenToolCall' - - $ref: '#/components/schemas/ComputerToolCall' - - $ref: '#/components/schemas/ComputerToolCallOutputResource' - - $ref: '#/components/schemas/ToolSearchCall' - - $ref: '#/components/schemas/ToolSearchOutput' - - $ref: '#/components/schemas/AdditionalTools' - - $ref: '#/components/schemas/ResponseConfigurationUpdate' - - $ref: '#/components/schemas/ReasoningItem' - - $ref: '#/components/schemas/Program' - - $ref: '#/components/schemas/ProgramOutput' - - $ref: '#/components/schemas/CompactionBody' - - $ref: '#/components/schemas/CodeInterpreterToolCall' - - $ref: '#/components/schemas/LocalShellToolCall' - - $ref: '#/components/schemas/LocalShellToolCallOutput' - - $ref: '#/components/schemas/FunctionShellCall' - - $ref: '#/components/schemas/FunctionShellCallOutput' - - $ref: '#/components/schemas/ApplyPatchToolCall' - - $ref: '#/components/schemas/ApplyPatchToolCallOutput' - - $ref: '#/components/schemas/MCPListTools' - - $ref: '#/components/schemas/MCPApprovalRequest' - - $ref: '#/components/schemas/MCPApprovalResponseResource' - - $ref: '#/components/schemas/MCPToolCall' - - $ref: '#/components/schemas/CustomToolCall' - - $ref: '#/components/schemas/CustomToolCallOutput' - ConversationItemList: + CreateSpendAlertBody: type: object - title: The conversation item list - description: A list of Conversation items. + description: Parameters for creating or updating a spend alert. properties: - object: - x-stainless-const: true - description: The type of object returned, must be `list`. - const: list - data: - type: array - description: A list of conversation items. - items: - $ref: '#/components/schemas/ConversationItem' - has_more: - type: boolean - description: Whether there are more items available. - first_id: + threshold_amount: + type: integer + minimum: 0 + description: The alert threshold amount, in cents. + currency: type: string - description: The ID of the first item in the list. - last_id: + enum: + - USD + description: The currency for the threshold amount. + interval: type: string - description: The ID of the last item in the list. + enum: + - month + description: The time interval for evaluating spend against the threshold. + notification_channel: + $ref: '#/components/schemas/SpendAlertNotificationChannel' required: - - object - - data - - has_more - - first_id - - last_id - x-oaiMeta: - name: The item list - group: conversations - ConversationParam: - description: | - The conversation that this response belongs to. Items from this conversation are prepended to `input_items` for this response request. - Input items and output items from this response are automatically added to this conversation after this response completes. - anyOf: - - type: string - title: Conversation ID - description: | - The unique ID of the conversation. - - $ref: '#/components/schemas/ConversationParam-2' - CostsResult: + - threshold_amount + - currency + - interval + - notification_channel + CreateThreadAndRunRequest: type: object - description: The aggregated costs details of the specific time bucket. + additionalProperties: false properties: - object: + assistant_id: + description: The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) to use to execute this run. type: string - enum: - - organization.costs.result - x-stainless-const: true - amount: - type: object - description: The monetary value in its associated currency. - properties: - value: - type: number - description: The numeric value of the cost. - currency: - type: string - description: Lowercase ISO-4217 currency e.g. "usd" - line_item: - anyOf: - - type: string - description: When `group_by=line_item`, this field provides the line item of the grouped costs result. - - type: 'null' - project_id: - anyOf: - - type: string - description: When `group_by=project_id`, this field provides the project ID of the grouped costs result. - - type: 'null' - api_key_id: - anyOf: - - type: string - description: When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result. - - type: 'null' - quantity: - anyOf: - - type: number - description: When `group_by=line_item`, this field provides the quantity of the grouped costs result. - - type: 'null' - quantity_unit: - description: The unit of the `quantity` value. If no single supported unit applies to the result, this field is `null`. + thread: + $ref: '#/components/schemas/CreateThreadRequest' + model: + description: The ID of the [Model](https://developers.openai.com/api/reference/resources/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used. + nullable: true anyOf: - type: string - type: string enum: - - tokens - - 1000_tokens - - duration_seconds - - duration_minutes - - duration_hours - - gibibyte_hours - - images - - characters - - type: 'null' + - gpt-5 + - gpt-5-mini + - gpt-5-nano + - gpt-5-2025-08-07 + - gpt-5-mini-2025-08-07 + - gpt-5-nano-2025-08-07 + - gpt-4.1 + - gpt-4.1-mini + - gpt-4.1-nano + - gpt-4.1-2025-04-14 + - gpt-4.1-mini-2025-04-14 + - gpt-4.1-nano-2025-04-14 + - gpt-4o + - gpt-4o-2024-11-20 + - gpt-4o-2024-08-06 + - gpt-4o-2024-05-13 + - gpt-4o-mini + - gpt-4o-mini-2024-07-18 + - gpt-4.5-preview + - gpt-4.5-preview-2025-02-27 + - gpt-4-turbo + - gpt-4-turbo-2024-04-09 + - gpt-4-0125-preview + - gpt-4-turbo-preview + - gpt-4-1106-preview + - gpt-4-vision-preview + - gpt-4 + - gpt-4-0314 + - gpt-4-0613 + - gpt-4-32k + - gpt-4-32k-0314 + - gpt-4-32k-0613 + - gpt-3.5-turbo + - gpt-3.5-turbo-16k + - gpt-3.5-turbo-0613 + - gpt-3.5-turbo-1106 + - gpt-3.5-turbo-0125 + - gpt-3.5-turbo-16k-0613 + x-oaiTypeLabel: string + instructions: + description: Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis. + type: string + nullable: true + tools: + description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. + nullable: true + type: array + maxItems: 20 + items: + $ref: '#/components/schemas/AssistantTool' + tool_resources: + type: object + description: | + A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: string + nullable: true + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + nullable: true + description: | + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + top_p: + type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + nullable: true + description: | + An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + + We generally recommend altering this or temperature but not both. + stream: + type: boolean + nullable: true + description: | + If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message. + max_prompt_tokens: + type: integer + nullable: true + description: | + The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + minimum: 256 + max_completion_tokens: + type: integer + nullable: true + description: | + The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. + minimum: 256 + truncation_strategy: + allOf: + - $ref: '#/components/schemas/TruncationObject' + - nullable: true + tool_choice: + allOf: + - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' + - nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true required: - - object - x-oaiMeta: - name: Costs object - example: | - { - "object": "organization.costs.result", - "amount": { - "value": 0.06, - "currency": "usd" - }, - "line_item": "gpt-6-astra, input_tokens", - "project_id": "proj_abc", - "quantity": 10000, - "quantity_unit": "tokens" - } - CreateAssistantRequest: + - assistant_id + CreateThreadRequest: type: object + description: | + Options to create a new thread. If no thread is provided when running a + request, an empty thread will be created. additionalProperties: false properties: - model: - description: | - ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them. - example: gpt-5 - anyOf: - - type: string - - $ref: '#/components/schemas/AssistantSupportedModels' - x-oaiTypeLabel: string - name: - anyOf: - - description: | - The name of the assistant. The maximum length is 256 characters. - type: string - maxLength: 256 - - type: 'null' - description: - anyOf: - - description: | - The description of the assistant. The maximum length is 512 characters. - type: string - maxLength: 512 - - type: 'null' - instructions: - anyOf: - - description: | - The system instructions that the assistant uses. The maximum length is 256,000 characters. - type: string - maxLength: 256000 - - type: 'null' - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - tools: - description: | - A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`. - default: [] + messages: + description: A list of [messages](https://developers.openai.com/api/docs/assistants/migration) to start the thread with. type: array - maxItems: 128 items: - $ref: '#/components/schemas/AssistantTool' + $ref: '#/components/schemas/CreateMessageRequest' tool_resources: anyOf: - type: object description: | - A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. properties: code_interpreter: type: object @@ -31476,3902 +37983,3561 @@ components: default: [] maxItems: 20 items: - type: string - file_search: - type: object - properties: - vector_store_ids: - type: array - description: | - The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. - maxItems: 1 - items: - type: string - vector_stores: - type: array - description: | - A helper to create a [vector store](https://developers.openai.com/api/reference/resources/vector_stores) with file_ids and attach it to this assistant. There can be a maximum of 1 vector store attached to the assistant. - maxItems: 1 - items: - type: object - properties: - file_ids: - type: array - description: | - A list of [file](https://developers.openai.com/api/reference/resources/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files. - maxItems: 100000000 - items: - type: string - chunking_strategy: - type: object - description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. - anyOf: - - type: object - title: Auto Chunking Strategy - description: The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`. - additionalProperties: false - properties: - type: - type: string - description: Always `auto`. - enum: - - auto - x-stainless-const: true - required: - - type - - type: object - title: Static Chunking Strategy - additionalProperties: false - properties: - type: - type: string - description: Always `static`. - enum: - - static - x-stainless-const: true - static: - type: object - additionalProperties: false - properties: - max_chunk_size_tokens: - type: integer - minimum: 100 - maximum: 4096 - description: The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`. - chunk_overlap_tokens: - type: integer - description: | - The number of tokens that overlap between chunks. The default value is `400`. - - Note that the overlap must not exceed half of `max_chunk_size_tokens`. - required: - - max_chunk_size_tokens - - chunk_overlap_tokens - required: - - type - - static - discriminator: - propertyName: type - metadata: - $ref: '#/components/schemas/Metadata' - anyOf: - - required: - - vector_store_ids - - required: - - vector_stores - - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - temperature: - anyOf: - - description: | - What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 - - type: 'null' - top_p: - anyOf: - - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 - description: | - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or temperature but not both. - - type: 'null' - response_format: - anyOf: - - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' - - type: 'null' - required: - - model - CreateBatchRequest: - type: object - required: - - input_file_id - - endpoint - - completion_window - properties: - input_file_id: - type: string - description: | - The ID of an uploaded file that contains requests for the new batch. - - See [upload file](https://developers.openai.com/api/reference/resources/files/methods/create) for how to upload a file. - - Your input file must be formatted as a [JSONL file](https://developers.openai.com/api/docs/guides/batch#1-prepare-your-batch-file), and must be uploaded with the purpose `batch`. The file can contain up to 50,000 requests, and can be up to 200 MB in size. - endpoint: - type: string - enum: - - /v1/responses - - /v1/chat/completions - - /v1/embeddings - - /v1/completions - - /v1/moderations - - /v1/images/generations - - /v1/images/edits - - /v1/videos - description: The endpoint to be used for all requests in the batch. Currently `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`, `/v1/moderations`, `/v1/images/generations`, `/v1/images/edits`, and `/v1/videos` are supported. Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch. - completion_window: - type: string - enum: - - 24h - description: The time frame within which the batch should be processed. Currently only `24h` is supported. - metadata: - $ref: '#/components/schemas/Metadata' - output_expires_after: - $ref: '#/components/schemas/BatchFileExpirationAfter' - CreateChatCompletionRequest: - allOf: - - $ref: '#/components/schemas/CreateModelResponseProperties' - - type: object - properties: - messages: - description: | - A list of messages comprising the conversation so far. Depending on the - [model](https://developers.openai.com/api/docs/models) you use, different message types (modalities) are - supported, like [text](https://developers.openai.com/api/docs/guides/text), - [images](https://developers.openai.com/api/docs/guides/images-vision), and [audio](https://developers.openai.com/api/docs/guides/audio). - type: array - minItems: 1 - items: - $ref: '#/components/schemas/ChatCompletionRequestMessage' - model: - description: | - Model ID used to generate the response, like `gpt-6-astra` or `o3`. OpenAI - offers a wide range of models with different capabilities, performance - characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) - to browse and compare available models. - $ref: '#/components/schemas/ModelIdsShared' - service_tier: - $ref: '#/components/schemas/ServiceTier' - modalities: - $ref: '#/components/schemas/ResponseModalities' - verbosity: - $ref: '#/components/schemas/Verbosity' - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - max_completion_tokens: - description: | - An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and [reasoning tokens](https://developers.openai.com/api/docs/guides/reasoning). - type: integer - nullable: true - frequency_penalty: - type: number - default: 0 - minimum: -2 - maximum: 2 - nullable: true - description: | - Number between -2.0 and 2.0. Positive values penalize new tokens based on - their existing frequency in the text so far, decreasing the model's - likelihood to repeat the same line verbatim. - presence_penalty: - type: number - default: 0 - minimum: -2 - maximum: 2 - nullable: true - description: | - Number between -2.0 and 2.0. Positive values penalize new tokens based on - whether they appear in the text so far, increasing the model's likelihood - to talk about new topics. - web_search_options: - type: object - title: Web search - description: | - This tool searches the web for relevant results to use in a response. - Learn more about the [web search tool](https://developers.openai.com/api/docs/guides/tools-web-search). - properties: - user_location: - type: object - nullable: true - required: - - type - - approximate - description: | - Approximate location parameters for the search. - properties: - type: - type: string - description: | - The type of location approximation. Always `approximate`. - enum: - - approximate - x-stainless-const: true - approximate: - $ref: '#/components/schemas/WebSearchLocation' - search_context_size: - $ref: '#/components/schemas/WebSearchContextSize' - top_logprobs: - description: | - An integer between 0 and 20 specifying the maximum number of most likely - tokens to return at each token position, each with an associated log - probability. In some cases, the number of returned tokens may be fewer than - requested. - `logprobs` must be set to `true` if this parameter is used. - type: integer - minimum: 0 - maximum: 20 - nullable: true - response_format: - description: | - An object specifying the format that the model must output. - - Setting to `{ "type": "json_schema", "json_schema": {...} }` enables - Structured Outputs which ensures the model will match your supplied JSON - schema. Learn more in the [Structured Outputs - guide](https://developers.openai.com/api/docs/guides/structured-outputs). - - Setting to `{ "type": "json_object" }` enables the older JSON mode, which - ensures the message the model generates is valid JSON. Using `json_schema` - is preferred for models that support it. - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/ResponseFormatText' - - $ref: '#/components/schemas/ResponseFormatJsonSchema' - - $ref: '#/components/schemas/ResponseFormatJsonObject' - audio: - type: object - nullable: true - description: | - Parameters for audio output. Required when audio output is requested with - `modalities: ["audio"]`. [Learn more](https://developers.openai.com/api/docs/guides/audio). - required: - - voice - - format - properties: - voice: - $ref: '#/components/schemas/VoiceIdsOrCustomVoice' - description: | - The voice the model uses to respond. Supported built-in voices are - `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, - `sage`, `shimmer`, `marin`, and `cedar`. You may also provide a - custom voice object with an `id`, for example `{ "id": "voice_1234" }`. - format: - type: string - enum: - - wav - - aac - - mp3 - - flac - - opus - - pcm16 - description: | - Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, - `opus`, or `pcm16`. - store: - type: boolean - default: false - nullable: true - description: | - Whether or not to store the output of this chat completion request for - use in our [model distillation](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#distilling-from-a-larger-model) or - [evals](https://developers.openai.com/api/docs/guides/evals) products. - - Supports text and image inputs. Note: image inputs over 8MB will be dropped. - moderation: - anyOf: - - $ref: '#/components/schemas/ModerationParam' - description: | - Configuration for running moderation on the request input and generated output. - - type: 'null' - stream: - description: | - If set to true, the model response data will be streamed to the client - as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). - See the [Streaming section below](https://developers.openai.com/api/reference/resources/chat/subresources/completions/streaming-events) - for more information, along with the [streaming responses](https://developers.openai.com/api/docs/guides/streaming-responses) - guide for more information on how to handle the streaming events. - type: boolean - nullable: true - default: false - stop: - $ref: '#/components/schemas/StopConfiguration' - logit_bias: - type: object - x-oaiTypeLabel: map - default: null - nullable: true - additionalProperties: - type: integer - description: | - Modify the likelihood of specified tokens appearing in the completion. - - Accepts a JSON object that maps tokens (specified by their token ID in the - tokenizer) to an associated bias value from -100 to 100. Mathematically, - the bias is added to the logits generated by the model prior to sampling. - The exact effect will vary per model, but values between -1 and 1 should - decrease or increase likelihood of selection; values like -100 or 100 - should result in a ban or exclusive selection of the relevant token. - logprobs: - description: | - Whether to return log probabilities of the output tokens or not. If true, - returns the log probabilities of each output token returned in the - `content` of `message`. - type: boolean - default: false - nullable: true - max_tokens: - description: | - The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated in the - chat completion. This value can be used to control - [costs](https://openai.com/api/pricing/) for text generated via API. - - This value is now deprecated in favor of `max_completion_tokens`, and is - not compatible with [o-series models](https://developers.openai.com/api/docs/guides/reasoning). - type: integer - nullable: true - deprecated: true - n: - type: integer - minimum: 1 - maximum: 128 - default: 1 - example: 1 - nullable: true - description: How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. - prediction: - nullable: true - description: | - Configuration for a [Predicted Output](https://developers.openai.com/api/docs/guides/predicted-outputs), - which can greatly improve response times when large parts of the model - response are known ahead of time. This is most common when you are - regenerating a file with only minor changes to most of the content. - anyOf: - - $ref: '#/components/schemas/PredictionContent' - discriminator: - propertyName: type - seed: - type: integer - minimum: -9.223372036854776e18 - maximum: 9.223372036854776e18 - nullable: true - deprecated: true - description: | - This feature is in Beta. - If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. - Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. - x-oaiMeta: - beta: true - stream_options: - $ref: '#/components/schemas/ChatCompletionStreamOptions' - tools: - type: array - description: | - A list of tools the model may call. You can provide either - [custom tools](https://developers.openai.com/api/docs/guides/function-calling#custom-tools) or - [function tools](https://developers.openai.com/api/docs/guides/function-calling). - items: - anyOf: - - $ref: '#/components/schemas/ChatCompletionTool' - - $ref: '#/components/schemas/CustomToolChatCompletions' - x-stainless-naming: - python: - model_name: chat_completion_tool_union - param_model_name: chat_completion_tool_union_param - discriminator: - propertyName: type - x-stainless-go-variant-constructor: - naming: chat_completion_{variant}_tool - tool_choice: - $ref: '#/components/schemas/ChatCompletionToolChoiceOption' - parallel_tool_calls: - $ref: '#/components/schemas/ParallelToolCalls' - function_call: - deprecated: true - description: | - Deprecated in favor of `tool_choice`. - - Controls which (if any) function is called by the model. - - `none` means the model will not call a function and instead generates a - message. - - `auto` means the model can pick between generating a message or calling a - function. - - Specifying a particular function via `{"name": "my_function"}` forces the - model to call that function. - - `none` is the default when no functions are present. `auto` is the default - if functions are present. - anyOf: - - type: string - description: | - `none` means the model will not call a function and instead generates a message. `auto` means the model can pick between generating a message or calling a function. - enum: - - none - - auto - title: function call mode - - $ref: '#/components/schemas/ChatCompletionFunctionCallOption' - functions: - deprecated: true - description: | - Deprecated in favor of `tools`. + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: string + vector_stores: + type: array + description: | + A helper to create a [vector store](https://developers.openai.com/api/reference/resources/vector_stores) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](https://developers.openai.com/api/reference/resources/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files. + maxItems: 100000000 + items: + type: string + chunking_strategy: + type: object + description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. + anyOf: + - type: object + title: Auto Chunking Strategy + description: The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`. + additionalProperties: false + properties: + type: + type: string + description: Always `auto`. + enum: + - auto + x-stainless-const: true + required: + - type + - type: object + title: Static Chunking Strategy + additionalProperties: false + properties: + type: + type: string + description: Always `static`. + enum: + - static + x-stainless-const: true + static: + type: object + additionalProperties: false + properties: + max_chunk_size_tokens: + type: integer + minimum: 100 + maximum: 4096 + description: The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`. + chunk_overlap_tokens: + type: integer + description: | + The number of tokens that overlap between chunks. The default value is `400`. - A list of functions the model may generate JSON inputs for. - type: array - minItems: 1 - maxItems: 128 - items: - $ref: '#/components/schemas/ChatCompletionFunctions' - required: - - model - - messages - CreateChatCompletionResponse: + Note that the overlap must not exceed half of `max_chunk_size_tokens`. + required: + - max_chunk_size_tokens + - chunk_overlap_tokens + required: + - type + - static + discriminator: + propertyName: type + metadata: + $ref: '#/components/schemas/Metadata' + anyOf: + - required: + - vector_store_ids + - required: + - vector_stores + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + CreateTranscriptionRequest: type: object - description: Represents a chat completion response returned by model, based on the provided input. + additionalProperties: false properties: - id: + file: + description: | + The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. + The request must include enough format metadata for the file to be identified. We recommend an extension-bearing filename and an appropriate content type. type: string - description: A unique identifier for the chat completion. - choices: - type: array - description: A list of chat completion choices. Can be more than one if `n` is greater than 1. - items: - type: object - required: - - finish_reason - - index - - message - - logprobs - properties: - finish_reason: - type: string - description: | - The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, - `length` if the maximum number of tokens specified in the request was reached, - `content_filter` if content was omitted due to a flag from our content filters, - `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. - Read the [Model Spec](https://model-spec.openai.com/2025-12-18.html) for more. - enum: - - stop - - length - - tool_calls - - content_filter - - function_call - index: - type: integer - description: The index of the choice in the list of choices. - message: - $ref: '#/components/schemas/ChatCompletionResponseMessage' - logprobs: - anyOf: - - description: Log probability information for the choice. - type: object - properties: - content: - anyOf: - - description: A list of message content tokens with log probability information. - type: array - items: - $ref: '#/components/schemas/ChatCompletionTokenLogprob' - - type: 'null' - refusal: - anyOf: - - description: A list of message refusal tokens with log probability information. - type: array - items: - $ref: '#/components/schemas/ChatCompletionTokenLogprob' - - type: 'null' - required: - - content - - refusal - - type: 'null' - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the chat completion was created. + x-oaiTypeLabel: file + format: binary + x-oaiMeta: + exampleFilePath: speech.mp3 model: + description: | + ID of the model to use. The options are `gpt-transcribe`, `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `whisper-1` (which is powered by our open source Whisper V2 model), and `gpt-4o-transcribe-diarize`. + example: gpt-4o-transcribe + anyOf: + - type: string + - type: string + enum: + - whisper-1 + - gpt-transcribe + - gpt-4o-transcribe + - gpt-4o-mini-transcribe + - gpt-4o-mini-transcribe-2025-12-15 + - gpt-4o-transcribe-diarize + x-stainless-const: true + x-stainless-nominal: false + x-oaiTypeLabel: string + language: + description: | + The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format will improve accuracy and latency. type: string - description: The model used for the chat completion. - metadata: - $ref: '#/components/schemas/Metadata' - service_tier: - $ref: '#/components/schemas/ServiceTier' - system_fingerprint: + languages: + description: | + Possible languages of the input audio, in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. Supported by `gpt-transcribe`. + type: array + minItems: 1 + items: + type: string + keywords: + description: | + Words or phrases to guide transcription of the input audio. Supported by `gpt-transcribe`. + type: array + items: + type: string + prompt: + description: | + An optional text to guide the model's style or continue a previous audio segment. The [prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting) should match the audio language. This field is not supported when using `gpt-4o-transcribe-diarize`. type: string - deprecated: true + response_format: + $ref: '#/components/schemas/AudioResponseFormat' + temperature: description: | - This fingerprint represents the backend configuration that the model runs with. + The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit. + type: number + default: 0 + include: + description: | + Additional information to include in the transcription response. + `logprobs` will return the log probabilities of the tokens in the + response to understand the model's confidence in the transcription. + `logprobs` only works with response_format set to `json` and only with + the models `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `gpt-4o-mini-transcribe-2025-12-15`. This field is not supported when using `gpt-4o-transcribe-diarize`. + type: array + items: + $ref: '#/components/schemas/TranscriptionInclude' + timestamp_granularities: + description: | + The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency. + This option is not available for `gpt-4o-transcribe-diarize`. + type: array + items: + type: string + enum: + - word + - segment + default: + - segment + stream: + anyOf: + - description: | + If set to true, the model response data will be streamed to the client + as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + See the [Streaming section of the Speech-to-Text guide](https://developers.openai.com/api/docs/guides/speech-to-text?lang=curl#streaming) + for more information. - Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. - object: + Note: Streaming is not supported for the `whisper-1` model and will be ignored. + type: boolean + default: false + - type: 'null' + chunking_strategy: + $ref: '#/components/schemas/TranscriptionChunkingStrategy' + known_speaker_names: + description: | + Optional list of speaker names that correspond to the audio samples provided in `known_speaker_references[]`. Each entry should be a short identifier (for example `customer` or `agent`). Up to 4 speakers are supported. + type: array + maxItems: 4 + items: + type: string + known_speaker_references: + description: | + Optional list of audio samples (as [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)) that contain known speaker references matching `known_speaker_names[]`. Each sample must be between 2 and 10 seconds, and can use any of the same input audio formats supported by `file`. + type: array + maxItems: 4 + items: + type: string + required: + - file + - model + CreateTranscriptionResponseDiarizedJson: + type: object + description: | + Represents a diarized transcription response returned by the model, including the combined transcript and speaker-segment annotations. + properties: + task: type: string - description: The object type, which is always `chat.completion`. + description: The type of task that was run. Always `transcribe`. enum: - - chat.completion + - transcribe x-stainless-const: true + duration: + type: number + format: double + description: Duration of the input audio in seconds. + text: + type: string + description: The concatenated transcript text for the entire audio input. + segments: + type: array + description: Segments of the transcript annotated with timestamps and speaker labels. + items: + $ref: '#/components/schemas/TranscriptionDiarizedSegment' usage: - $ref: '#/components/schemas/CompletionUsage' - moderation: + type: object + description: Token or duration usage statistics for the request. + discriminator: + propertyName: type anyOf: - - $ref: '#/components/schemas/ChatCompletionModeration' - description: | - Moderation results for the request input and generated output, if moderated - completions were requested. - - type: 'null' + - $ref: '#/components/schemas/TranscriptTextUsageTokens' + title: Token Usage + - $ref: '#/components/schemas/TranscriptTextUsageDuration' + title: Duration Usage required: - - choices - - created - - id - - model - - object + - task + - duration + - text + - segments x-oaiMeta: - name: The chat completion object - group: chat + name: The transcription object (Diarized JSON) + group: audio example: | { - "id": "chatcmpl-B9MHDbslfkBeAs8l4bebGdFOJ6PeG", - "object": "chat.completion", - "created": 1741570283, - "model": "gpt-6-astra", - "choices": [ + "task": "transcribe", + "duration": 42.7, + "text": "Agent: Thanks for calling OpenAI support.\nCustomer: Hi, I need help with diarization.", + "segments": [ { - "index": 0, - "message": { - "role": "assistant", - "content": "The image shows a wooden boardwalk path running through a lush green field or meadow. The sky is bright blue with some scattered clouds, giving the scene a serene and peaceful atmosphere. Trees and shrubs are visible in the background.", - "refusal": null, - "annotations": [] - }, - "logprobs": null, - "finish_reason": "stop" + "type": "transcript.text.segment", + "id": "seg_001", + "start": 0.0, + "end": 5.2, + "text": "Thanks for calling OpenAI support.", + "speaker": "agent" + }, + { + "type": "transcript.text.segment", + "id": "seg_002", + "start": 5.2, + "end": 12.8, + "text": "Hi, I need help with diarization.", + "speaker": "A" } ], "usage": { - "prompt_tokens": 1117, - "completion_tokens": 46, - "total_tokens": 1163, - "prompt_tokens_details": { - "cached_tokens": 0, - "audio_tokens": 0 - }, - "completion_tokens_details": { - "reasoning_tokens": 0, - "audio_tokens": 0, - "accepted_prediction_tokens": 0, - "rejected_prediction_tokens": 0 - } - }, - "service_tier": "default", - "system_fingerprint": "fp_fc9f1d7035" + "type": "duration", + "seconds": 43 + } } - CreateChatCompletionStreamResponse: + CreateTranscriptionResponseJson: type: object - description: | - Represents a streamed chunk of a chat completion response returned - by the model, based on the provided input. - [Learn more](https://developers.openai.com/api/docs/guides/streaming-responses). + description: Represents a transcription response returned by model, based on the provided input. properties: - id: + text: type: string - description: A unique identifier for the chat completion. Each chunk has the same ID. - choices: + description: The transcribed text. + languages: type: array description: | - A list of chat completion choices. Can contain more than one elements if `n` is greater than 1. Can also be empty for the - last chunk if you set `stream_options: {"include_usage": true}`. + The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected. + items: + $ref: '#/components/schemas/TranscriptionLanguage' + logprobs: + type: array + optional: true + description: | + The log probabilities of the tokens in the transcription. Only returned with the models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added to the `include` array. items: type: object - required: - - delta - - finish_reason - - index properties: - delta: - $ref: '#/components/schemas/ChatCompletionStreamResponseDelta' - logprobs: - description: Log probability information for the choice. - type: object - nullable: true - properties: - content: - description: A list of message content tokens with log probability information. - type: array - items: - $ref: '#/components/schemas/ChatCompletionTokenLogprob' - nullable: true - refusal: - description: A list of message refusal tokens with log probability information. - type: array - items: - $ref: '#/components/schemas/ChatCompletionTokenLogprob' - nullable: true - required: - - content - - refusal - finish_reason: + token: type: string - description: | - The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, - `length` if the maximum number of tokens specified in the request was reached, - `content_filter` if content was omitted due to a flag from our content filters, - `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. - enum: - - stop - - length - - tool_calls - - content_filter - - function_call - nullable: true - index: - type: integer - description: The index of the choice in the list of choices. - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp. - model: - type: string - description: The model to generate the completion. - obfuscation: - type: string - description: | - An obfuscation string added to normalize the size of streamed chunks as a - mitigation to certain side-channel attacks. The field is included by - default and omitted when `stream_options.include_obfuscation` is `false`. - service_tier: - $ref: '#/components/schemas/ServiceTier' - system_fingerprint: + description: The token in the transcription. + logprob: + type: number + description: The log probability of the token. + bytes: + type: array + items: + type: number + description: The bytes of the token. + usage: + type: object + description: Token usage statistics for the request. + anyOf: + - $ref: '#/components/schemas/TranscriptTextUsageTokens' + title: Token Usage + - $ref: '#/components/schemas/TranscriptTextUsageDuration' + title: Duration Usage + discriminator: + propertyName: type + required: + - text + x-oaiMeta: + name: The transcription object (JSON) + group: audio + example: | + { + "text": "Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.", + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 10, + "audio_tokens": 4 + }, + "output_tokens": 101, + "total_tokens": 115 + } + } + CreateTranscriptionResponseStreamEvent: + anyOf: + - $ref: '#/components/schemas/TranscriptTextSegmentEvent' + - $ref: '#/components/schemas/TranscriptTextDeltaEvent' + - $ref: '#/components/schemas/TranscriptTextDoneEvent' + discriminator: + propertyName: type + CreateTranscriptionResponseVerboseJson: + type: object + description: Represents a verbose json transcription response returned by model, based on the provided input. + properties: + language: type: string - deprecated: true - description: | - This fingerprint represents the backend configuration that the model runs with. - Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. - object: + description: The language of the input audio. + duration: + type: number + format: double + description: The duration of the input audio. + text: type: string - description: The object type, which is always `chat.completion.chunk`. - enum: - - chat.completion.chunk - x-stainless-const: true + description: The transcribed text. + words: + type: array + description: Extracted words and their corresponding timestamps. + items: + $ref: '#/components/schemas/TranscriptionWord' + segments: + type: array + description: Segments of the transcribed text and their corresponding details. + items: + $ref: '#/components/schemas/TranscriptionSegment' usage: - $ref: '#/components/schemas/CompletionUsage' - nullable: true - description: | - An optional field that will only be present when you set - `stream_options: {"include_usage": true}` in your request. When present, it - contains a null value **except for the last chunk** which contains the - token usage statistics for the entire request. - - **NOTE:** If the stream is interrupted or cancelled, you may not - receive the final usage chunk which contains the total token usage for - the request. - moderation: - anyOf: - - $ref: '#/components/schemas/ChatCompletionModeration' - description: | - Moderation results for the request input and generated output. Present - on the moderation chunk when moderated completions are requested. - - type: 'null' + $ref: '#/components/schemas/TranscriptTextUsageDuration' required: - - choices - - created - - id - - model - - object + - language + - duration + - text x-oaiMeta: - name: The chat completion chunk object - group: chat + name: The transcription object (Verbose JSON) + group: audio example: | - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-6-astra", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}],"obfuscation":"r4N7vQ2m"} - - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-6-astra", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}],"obfuscation":"p9K3xT6w"} - - .... - - {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-6-astra", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"obfuscation":""} - CreateCompletionRequest: + { + "task": "transcribe", + "language": "english", + "duration": 8.470000267028809, + "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.", + "segments": [ + { + "id": 0, + "seek": 0, + "start": 0.0, + "end": 3.319999933242798, + "text": " The beach was a popular spot on a hot summer day.", + "tokens": [ + 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530 + ], + "temperature": 0.0, + "avg_logprob": -0.2860786020755768, + "compression_ratio": 1.2363636493682861, + "no_speech_prob": 0.00985979475080967 + }, + ... + ], + "usage": { + "type": "duration", + "seconds": 9 + } + } + CreateTranslationRequest: type: object + additionalProperties: false properties: + file: + description: | + The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. The request must include enough format metadata for the file to be identified. We recommend an extension-bearing filename and an appropriate content type. + type: string + x-oaiTypeLabel: file + format: binary + x-oaiMeta: + exampleFilePath: speech.mp3 model: description: | - ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them. + ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available. + example: whisper-1 anyOf: - type: string - type: string enum: - - gpt-3.5-turbo-instruct - - davinci-002 - - babbage-002 - title: Preset + - whisper-1 + x-stainless-const: true x-oaiTypeLabel: string prompt: description: | - The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. - - Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. - anyOf: - - type: string - default: '' - example: This is a test. - - type: array - items: - type: string - default: '' - example: This is a test. - title: Array of strings - - type: array - minItems: 1 - items: - type: integer - title: Array of tokens - - type: array - minItems: 1 - items: - type: array - minItems: 1 - items: - type: integer - title: Array of token arrays - nullable: true - best_of: - type: integer - default: 1 - minimum: 0 - maximum: 20 - nullable: true + An optional text to guide the model's style or continue a previous audio segment. The [prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting) should be in English. + type: string + response_format: description: | - Generates `best_of` completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed. - - When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. - - **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. - echo: - type: boolean - default: false - nullable: true + The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. + type: string + enum: + - json + - text + - srt + - verbose_json + - vtt + default: json + temperature: description: | - Echo back the prompt in addition to the completion - frequency_penalty: + The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit. type: number default: 0 - minimum: -2 - maximum: 2 - nullable: true + required: + - file + - model + CreateTranslationResponseJson: + type: object + properties: + text: + type: string + required: + - text + CreateTranslationResponseVerboseJson: + type: object + properties: + language: + type: string + description: The language of the output translation (always `english`). + duration: + type: number + format: double + description: The duration of the input audio. + text: + type: string + description: The translated text. + segments: + type: array + description: Segments of the translated text and their corresponding details. + items: + $ref: '#/components/schemas/TranscriptionSegment' + required: + - language + - duration + - text + CreateUploadRequest: + type: object + additionalProperties: false + properties: + filename: description: | - Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - - [See more information about frequency and presence penalties.](https://developers.openai.com/api/docs/guides/text) - logit_bias: - type: object - x-oaiTypeLabel: map - default: null - nullable: true - additionalProperties: - type: integer + The name of the file to upload. + type: string + purpose: description: | - Modify the likelihood of specified tokens appearing in the completion. - - Accepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](https://platform.openai.com/tokenizer?view=bpe) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. + The intended purpose of the uploaded file. - As an example, you can pass `{"50256": -100}` to prevent the <|endoftext|> token from being generated. - logprobs: - type: integer - minimum: 0 - maximum: 5 - default: null - nullable: true + See the [documentation on File + purposes](https://developers.openai.com/api/reference/resources/files/methods/create#%28resource%29%20files%20%3E%20%28method%29%20create%20%3E%20%28params%29%200%20%3E%20%28param%29%20purpose%20%3E%20%28schema%29). + type: string + enum: + - assistants + - batch + - fine-tune + - vision + bytes: description: | - Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. - - The maximum value for `logprobs` is 5. - max_tokens: + The number of bytes in the file you are uploading. type: integer - minimum: 0 - default: 16 - example: 16 - nullable: true + mime_type: description: | - The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated in the completion. + The MIME type of the file. - The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. - n: - type: integer - minimum: 1 - maximum: 128 - default: 1 - example: 1 - nullable: true - description: | - How many completions to generate for each prompt. - **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. - presence_penalty: - type: number - default: 0 - minimum: -2 - maximum: 2 - nullable: true + This must fall within the supported MIME types for your file purpose. See + the supported MIME types for assistants and vision. + type: string + expires_after: + $ref: '#/components/schemas/FileExpirationAfter' + required: + - filename + - purpose + - bytes + - mime_type + CreateVectorStoreFileBatchRequest: + type: object + additionalProperties: false + properties: + file_ids: + description: A list of [File](https://developers.openai.com/api/reference/resources/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. If `attributes` or `chunking_strategy` are provided, they will be applied to all files in the batch. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `files`. + type: array + minItems: 1 + maxItems: 2000 + items: + type: string + files: + description: A list of objects that each include a `file_id` plus optional `attributes` or `chunking_strategy`. Use this when you need to override metadata for specific files. The global `attributes` or `chunking_strategy` will be ignored and must be specified for each file. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `file_ids`. + type: array + minItems: 1 + maxItems: 2000 + items: + $ref: '#/components/schemas/CreateVectorStoreFileRequest' + chunking_strategy: + $ref: '#/components/schemas/ChunkingStrategyRequestParam' + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + CreateVectorStoreFileRequest: + type: object + additionalProperties: false + properties: + file_id: + description: A [File](https://developers.openai.com/api/reference/resources/files) ID that the vector store should use. Useful for tools like `file_search` that can access files. For multi-file ingestion, we recommend [`file_batches`](https://developers.openai.com/api/reference/resources/vector_stores/subresources/file_batches/methods/create) to minimize per-vector-store write requests. + type: string + chunking_strategy: + $ref: '#/components/schemas/ChunkingStrategyRequestParam' + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + required: + - file_id + CreateVectorStoreRequest: + type: object + additionalProperties: false + properties: + file_ids: + description: A list of [File](https://developers.openai.com/api/reference/resources/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. + type: array + maxItems: 500 + items: + type: string + name: + description: The name of the vector store. + type: string + description: + description: A description for the vector store. Can be used to describe the vector store's purpose. + type: string + expires_after: + $ref: '#/components/schemas/VectorStoreExpirationAfter' + chunking_strategy: + $ref: '#/components/schemas/ChunkingStrategyRequestParam' + description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty. + metadata: + $ref: '#/components/schemas/Metadata' + CreateVoiceConsentRequest: + type: object + additionalProperties: false + properties: + name: + type: string + description: The label to use for this consent recording. + recording: + type: string + format: binary + x-oaiTypeLabel: file description: | - Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. + The consent audio recording file. Maximum size is 10 MiB. - [See more information about frequency and presence penalties.](https://developers.openai.com/api/docs/guides/text) - seed: - type: integer - format: int64 - nullable: true + Supported MIME types: + `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`. + language: + type: string + description: The BCP 47 language tag for the consent phrase (for example, `en-US`). + required: + - name + - recording + - language + CreateVoiceRequest: + type: object + additionalProperties: false + properties: + name: + type: string + description: The name of the new voice. + audio_sample: + type: string + format: binary + x-oaiTypeLabel: file description: | - If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + The sample audio recording file. Maximum size is 10 MiB. - Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. - stop: - $ref: '#/components/schemas/StopConfiguration' - stream: + Supported MIME types: + `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`. + consent: + type: string + description: The consent recording ID (for example, `cons_1234`). + required: + - name + - audio_sample + - consent + CustomToolCall: + type: object + title: Custom tool call + description: | + A call to a custom tool created by the model. + properties: + type: + type: string + enum: + - custom_tool_call + x-stainless-const: true description: | - Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). + The type of the custom tool call. Always `custom_tool_call`. + id: + type: string + description: | + The unique ID of the custom tool call in the OpenAI platform. + call_id: + type: string + description: | + An identifier used to map this custom tool call to a tool call output. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCaller' + - type: 'null' + namespace: + type: string + description: | + The namespace of the custom tool being called. + name: + type: string + description: | + The name of the custom tool being called. + input: + type: string + description: | + The input for the custom tool call generated by the model. + async: type: boolean - nullable: true - default: false - stream_options: - $ref: '#/components/schemas/ChatCompletionStreamOptions' - suffix: description: | - The suffix that comes after a completion of inserted text. - - This parameter is only supported for `gpt-3.5-turbo-instruct`. - default: null - nullable: true + Whether the custom tool call runs asynchronously. + required: + - type + - call_id + - name + - input + CustomToolCallOutput: + type: object + title: Custom tool call output + description: | + The output of a custom tool call from your code, being sent back to the model. + properties: + type: type: string - example: test. - temperature: - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 - nullable: true + enum: + - custom_tool_call_output + x-stainless-const: true description: | - What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - - We generally recommend altering this or `top_p` but not both. - top_p: - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 - nullable: true + The type of the custom tool call output. Always `custom_tool_call_output`. + id: + type: string description: | - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or `temperature` but not both. - user: + The unique ID of the custom tool call output in the OpenAI platform. + call_id: + type: string + description: | + The call ID, used to map this custom tool call output to a custom tool call. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCallerParam' + - type: 'null' + output: + description: | + The output from the custom tool call generated by your code. + Can be a string or an list of output content. + anyOf: + - type: string + description: | + A string of the output of the custom tool call. + title: string output + - type: array + items: + $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' + title: output content list + description: | + Text, image, or file output of the custom tool call. + required: + - type + - call_id + - output + CustomToolCallOutputResource: + title: ResponseCustomToolCallOutputItem + allOf: + - $ref: '#/components/schemas/CustomToolCallOutput' + - type: object + properties: + id: + type: string + description: | + The unique ID of the custom tool call output item. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallOutputStatusEnum' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + CustomToolCallResource: + title: ResponseCustomToolCallItem + allOf: + - $ref: '#/components/schemas/CustomToolCall' + - type: object + properties: + id: + type: string + description: | + The unique ID of the custom tool call item. + status: + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + $ref: '#/components/schemas/FunctionCallStatus' + created_by: + type: string + description: | + The identifier of the actor that created the item. + required: + - id + - status + CustomToolChatCompletions: + type: object + title: Custom tool + description: | + A custom tool that processes input using a specified format. + properties: + type: type: string - example: user-1234 + enum: + - custom + description: The type of the custom tool. Always `custom`. + x-stainless-const: true + custom: + type: object + title: Custom tool properties description: | - A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). + Properties of the custom tool. + properties: + name: + type: string + description: The name of the custom tool, used to identify it in tool calls. + description: + type: string + description: | + Optional description of the custom tool, used to provide more context. + format: + description: | + The input format for the custom tool. Default is unconstrained text. + anyOf: + - type: object + title: Text format + description: Unconstrained free-form text. + properties: + type: + type: string + enum: + - text + description: Unconstrained text format. Always `text`. + x-stainless-const: true + required: + - type + additionalProperties: false + - type: object + title: Grammar format + description: A grammar defined by the user. + properties: + type: + type: string + enum: + - grammar + description: Grammar format. Always `grammar`. + x-stainless-const: true + grammar: + type: object + title: Grammar format + description: Your chosen grammar. + properties: + definition: + type: string + description: The grammar definition. + syntax: + type: string + description: The syntax of the grammar definition. One of `lark` or `regex`. + enum: + - lark + - regex + required: + - definition + - syntax + required: + - type + - grammar + additionalProperties: false + discriminator: + propertyName: type + required: + - name required: - - model - - prompt - CreateCompletionResponse: + - type + - custom + DeleteAssistantResponse: type: object - description: | - Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint). properties: id: type: string - description: A unique identifier for the completion. - choices: - type: array - description: The list of completion choices the model generated for the input prompt. - items: - type: object - required: - - finish_reason - - index - - logprobs - - text - properties: - finish_reason: - type: string - description: | - The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, - `length` if the maximum number of tokens specified in the request was reached, - or `content_filter` if content was omitted due to a flag from our content filters. - enum: - - stop - - length - - content_filter - index: - type: integer - logprobs: - anyOf: - - type: object - properties: - text_offset: - type: array - items: - type: integer - token_logprobs: - type: array - items: - type: number - tokens: - type: array - items: - type: string - top_logprobs: - type: array - items: - type: object - additionalProperties: - type: number - - type: 'null' - text: - type: string - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the completion was created. - model: - type: string - description: The model used for completion. - system_fingerprint: - type: string - description: | - This fingerprint represents the backend configuration that the model runs with. - - Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + deleted: + type: boolean object: type: string - description: The object type, which is always "text_completion" enum: - - text_completion + - assistant.deleted x-stainless-const: true - usage: - $ref: '#/components/schemas/CompletionUsage' required: - id - object - - created - - model - - choices - x-oaiMeta: - name: The completion object - legacy: true - example: | - { - "id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7", - "object": "text_completion", - "created": 1589478378, - "model": "gpt-3.5-turbo-instruct", - "choices": [ - { - "text": "\n\nThis is indeed a test", - "index": 0, - "logprobs": null, - "finish_reason": "length" - } - ], - "usage": { - "prompt_tokens": 5, - "completion_tokens": 7, - "total_tokens": 12 - } - } - CreateContainerBody: + - deleted + DeleteCertificateResponse: type: object properties: - name: - type: string - description: Name of the container to create. - file_ids: - type: array - description: IDs of files to copy to the container. - items: - type: string - expires_after: - type: object - description: Container expiration time in seconds relative to the 'anchor' time. - properties: - anchor: - type: string - enum: - - last_active_at - description: Time anchor for the expiration time. Currently only 'last_active_at' is supported. - minutes: - type: integer - required: - - anchor - - minutes - skills: - type: array - description: An optional list of skills referenced by id or inline data. - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/SkillReferenceParam' - - $ref: '#/components/schemas/InlineSkillParam' - memory_limit: + object: + x-stainless-const: true + description: The object type, must be `certificate.deleted`. + const: certificate.deleted + id: type: string - enum: - - 1g - - 4g - - 16g - - 64g - description: Optional memory limit for the container. Defaults to "1g". - network_policy: - description: Network access policy for the container. - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' - - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' + description: The ID of the certificate that was deleted. required: - - name - CreateContainerFileBody: + - object + - id + DeleteFileResponse: type: object properties: - file_id: + id: type: string - description: Name of the file to create. - file: - description: | - The File object (not file name) to be uploaded. + object: type: string - format: binary - required: [] - CreateEmbeddingRequest: + enum: + - file + x-stainless-const: true + deleted: + type: boolean + required: + - id + - object + - deleted + DeleteFineTuningCheckpointPermissionResponse: type: object - additionalProperties: false properties: - input: - description: | - Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. In addition to the per-input token limit, all embedding models enforce a maximum of 300,000 tokens summed across all inputs in a single request. - example: The quick brown fox jumped over the lazy dog - anyOf: - - type: string - title: string - description: The string that will be turned into an embedding. - default: '' - example: This is a test. - - type: array - title: Array of strings - description: The array of strings that will be turned into an embedding. - minItems: 1 - maxItems: 2048 - items: - type: string - default: '' - example: '[''This is a test.'']' - - type: array - title: Array of tokens - description: The array of integers that will be turned into an embedding. - minItems: 1 - maxItems: 2048 - items: - type: integer - - type: array - title: Array of token arrays - description: The array of arrays containing integers that will be turned into an embedding. - minItems: 1 - maxItems: 2048 - items: - type: array - minItems: 1 - items: - type: integer - model: - description: | - ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them. - example: text-embedding-3-small - anyOf: - - type: string - - type: string - enum: - - text-embedding-ada-002 - - text-embedding-3-small - - text-embedding-3-large - x-stainless-nominal: false - x-oaiTypeLabel: string - encoding_format: - description: The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/). - example: float - default: float + id: type: string - enum: - - float - - base64 - dimensions: - description: | - The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models. - type: integer - minimum: 1 - user: + description: The ID of the fine-tuned model checkpoint permission that was deleted. + object: type: string - example: user-1234 - description: | - A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). + description: The object type, which is always "checkpoint.permission". + enum: + - checkpoint.permission + x-stainless-const: true + deleted: + type: boolean + description: Whether the fine-tuned model checkpoint permission was successfully deleted. required: - - model - - input - CreateEmbeddingResponse: + - id + - object + - deleted + DeleteMessageResponse: type: object properties: - data: - type: array - description: The list of embeddings generated by the model. - items: - $ref: '#/components/schemas/Embedding' - model: + id: type: string - description: The name of the model used to generate the embedding. + deleted: + type: boolean object: type: string - description: The object type, which is always "list". enum: - - list + - thread.message.deleted x-stainless-const: true - usage: - type: object - description: The usage information for the request. - properties: - prompt_tokens: - type: integer - description: The number of tokens used by the prompt. - total_tokens: - type: integer - description: The total number of tokens used by the request. - required: - - prompt_tokens - - total_tokens required: + - id - object - - model - - data - - usage - CreateEvalCompletionsRunDataSource: + - deleted + DeleteModelResponse: type: object - title: CompletionsRunDataSource - description: | - A CompletionsRunDataSource object describing a model sampling configuration. properties: - type: + id: + type: string + deleted: + type: boolean + object: + type: string + required: + - id + - object + - deleted + DeleteThreadResponse: + type: object + properties: + id: + type: string + deleted: + type: boolean + object: type: string enum: - - completions - default: completions - description: The type of run data source. Always `completions`. - input_messages: - description: Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace. - anyOf: - - type: object - title: TemplateInputMessages - properties: - type: - type: string - enum: - - template - description: The type of input messages. Always `template`. - template: - type: array - description: A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}. - items: - anyOf: - - $ref: '#/components/schemas/EasyInputMessage' - - $ref: '#/components/schemas/EvalItem' - required: - - type - - template - - type: object - title: ItemReferenceInputMessages - properties: - type: - type: string - enum: - - item_reference - description: The type of input messages. Always `item_reference`. - item_reference: - type: string - description: A reference to a variable in the `item` namespace. Ie, "item.input_trajectory" - required: - - type - - item_reference - discriminator: - propertyName: type - sampling_params: - type: object - properties: - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - temperature: - type: number - description: A higher temperature increases randomness in the outputs. - default: 1 - max_completion_tokens: - type: integer - description: The maximum number of tokens in the generated output. - top_p: - type: number - description: An alternative to temperature for nucleus sampling; 1.0 includes all tokens. - default: 1 - seed: - type: integer - description: A seed value to initialize the randomness, during sampling. - default: 42 - response_format: - description: | - An object specifying the format that the model must output. - - Setting to `{ "type": "json_schema", "json_schema": {...} }` enables - Structured Outputs which ensures the model will match your supplied JSON - schema. Learn more in the [Structured Outputs - guide](https://developers.openai.com/api/docs/guides/structured-outputs). - - Setting to `{ "type": "json_object" }` enables the older JSON mode, which - ensures the message the model generates is valid JSON. Using `json_schema` - is preferred for models that support it. - anyOf: - - $ref: '#/components/schemas/ResponseFormatText' - - $ref: '#/components/schemas/ResponseFormatJsonSchema' - - $ref: '#/components/schemas/ResponseFormatJsonObject' - tools: - type: array - description: | - A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. A max of 128 functions are supported. - items: - $ref: '#/components/schemas/ChatCompletionTool' - model: + - thread.deleted + x-stainless-const: true + required: + - id + - object + - deleted + DeleteVectorStoreFileResponse: + type: object + properties: + id: type: string - description: The name of the model to use for generating completions (e.g. "o3-mini"). - source: - description: Determines what populates the `item` namespace in this run's data source. - anyOf: - - $ref: '#/components/schemas/EvalJsonlFileContentSource' - - $ref: '#/components/schemas/EvalJsonlFileIdSource' - - $ref: '#/components/schemas/EvalStoredCompletionsSource' - discriminator: - propertyName: type + deleted: + type: boolean + object: + type: string + enum: + - vector_store.file.deleted + x-stainless-const: true required: - - type - - source - x-oaiMeta: - name: The completions data source object used to configure an individual run - group: eval runs - example: | - { - "name": "gpt-6-astra", - "data_source": { - "type": "completions", - "input_messages": { - "type": "item_reference", - "item_reference": "item.input" - }, - "model": "gpt-6-astra", - "source": { - "type": "stored_completions", - "model": "gpt-6-astra" - } - } - } - CreateEvalCustomDataSourceConfig: + - id + - object + - deleted + DeleteVectorStoreResponse: type: object - title: CustomDataSourceConfig - description: | - A CustomDataSourceConfig object that defines the schema for the data source used for the evaluation runs. - This schema is used to define the shape of the data that will be: - - Used to define your testing criteria and - - What data is required when creating a run properties: - type: + id: + type: string + deleted: + type: boolean + object: type: string enum: - - custom - default: custom - description: The type of data source. Always `custom`. + - vector_store.deleted x-stainless-const: true - item_schema: - type: object - description: The json schema for each row in the data source. - additionalProperties: true - include_sample_schema: + required: + - id + - object + - deleted + DeletedConversation: + title: The deleted conversation object + allOf: + - $ref: '#/components/schemas/DeletedConversationResource' + x-oaiMeta: + name: The deleted conversation object + group: conversations + DeletedRoleAssignmentResource: + type: object + description: Confirmation payload returned after unassigning a role. + properties: + object: + type: string + description: Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + deleted: type: boolean - default: false - description: Whether the eval should expect you to populate the sample namespace (ie, by generating responses off of your data source) + description: Whether the assignment was removed. required: - - item_schema - - type + - object + - deleted x-oaiMeta: - name: The eval file data source config object - group: evals + name: Role assignment deletion confirmation example: | { - "type": "custom", - "item_schema": { - "type": "object", - "properties": { - "name": {"type": "string"}, - "age": {"type": "integer"} - }, - "required": ["name", "age"] - }, - "include_sample_schema": true + "object": "group.role.deleted", + "deleted": true } - CreateEvalItem: - title: CreateEvalItem - description: A chat message that makes up the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}. - type: object - x-oaiMeta: - name: The chat message object used to configure an individual run - anyOf: - - type: object - title: SimpleInputMessage - properties: - role: - type: string - description: The role of the message (e.g. "system", "assistant", "user"). - content: - type: string - description: The content of the message. - required: - - role - - content - - $ref: '#/components/schemas/EvalItem' - CreateEvalJsonlRunDataSource: + DoneEvent: type: object - title: JsonlRunDataSource - description: "A JsonlRunDataSource object with that specifies a JSONL file that matches the eval \n" properties: - type: + event: type: string enum: - - jsonl - default: jsonl - description: The type of data source. Always `jsonl`. + - done + x-stainless-const: true + data: + type: string + enum: + - '[DONE]' x-stainless-const: true - source: - description: Determines what populates the `item` namespace in the data source. - anyOf: - - $ref: '#/components/schemas/EvalJsonlFileContentSource' - - $ref: '#/components/schemas/EvalJsonlFileIdSource' - discriminator: - propertyName: type required: - - type - - source + - event + - data + description: Occurs when a stream ends. x-oaiMeta: - name: The file data source object for the eval run configuration - group: evals - example: | - { - "type": "jsonl", - "source": { - "type": "file_id", - "id": "file-9GYS6xbkWgWhmE7VoLUWFg" - } - } - CreateEvalLabelModelGrader: + dataDescription: '`data` is `[DONE]`' + EasyInputMessage: type: object - title: LabelModelGrader + title: Input message description: | - A LabelModelGrader object which uses a model to assign labels to each item - in the evaluation. + A message input to the model with a role indicating instruction following + hierarchy. Instructions given with the `developer` or `system` role take + precedence over instructions given with the `user` role. Messages with the + `assistant` role are presumed to have been generated by the model in previous + interactions. properties: + role: + type: string + description: | + The role of the message input. One of `user`, `assistant`, `system`, or + `developer`. + enum: + - user + - assistant + - system + - developer + content: + description: | + Text, image, or audio input to the model, used to generate a response. + Can also contain previous assistant responses. + anyOf: + - type: string + title: Text input + description: | + A text input to the model. + - $ref: '#/components/schemas/InputMessageContentList' + phase: + anyOf: + - $ref: '#/components/schemas/MessagePhase' + - type: 'null' type: - description: The object type, which is always `label_model`. type: string + description: | + The type of the message input. Always `message`. enum: - - label_model + - message x-stainless-const: true - name: - type: string - description: The name of the grader. + required: + - role + - content + EditImageBodyJsonParam: + type: object + description: | + JSON request body for image edits. + + Use `images` (array of `ImageRefParam`) instead of multipart `image` uploads. + You can reference images via external URLs, data URLs, or uploaded file IDs. + JSON edits support GPT image models only; DALL-E edits require multipart (`dall-e-2` only). + properties: model: - type: string - description: The model to use for the evaluation. Must support structured outputs. - input: - type: array - description: A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}. - items: - $ref: '#/components/schemas/CreateEvalItem' - labels: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1.5 + - gpt-image-2 + - gpt-image-2-2026-04-21 + - gpt-image-2.5-sunburst + - gpt-image-2.5-sunburst-2026-09-08 + - gpt-image-2.5-flare + - gpt-image-2.5-flare-2026-09-08 + - gpt-image-1 + - gpt-image-1-mini + - chatgpt-image-latest + - type: 'null' + x-oaiTypeLabel: string + default: gpt-image-1.5 + example: gpt-image-1.5 + description: The GPT image model to use for image editing, including `gpt-image-2`, its dated snapshot `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`. + images: type: array + minItems: 1 + maxItems: 16 + description: | + Input image references to edit. + For GPT image models, you can provide up to 16 images. items: - type: string - description: The labels to classify to each item in the evaluation. - passing_labels: + $ref: '#/components/schemas/ImageRefParam' + mask: + $ref: '#/components/schemas/ImageRefParam' + prompt: + type: string + minLength: 1 + maxLength: 32000 + example: Add a watercolor effect and keep the subject centered + description: A text description of the desired image edit. + n: + anyOf: + - type: integer + minimum: 1 + maximum: 10 + - type: 'null' + default: 1 + example: 1 + description: The number of edited images to generate. + quality: + anyOf: + - type: string + enum: + - low + - medium + - high + - xhigh + - max + - auto + - type: 'null' + default: auto + example: high + description: | + Output quality for GPT image models. The GPT image models support `low`, `medium`, + and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their + `2026-09-08` snapshots, also support `xhigh` and `max`. Defaults to `auto`. + input_fidelity: + anyOf: + - type: string + enum: + - high + - low + - type: 'null' + description: Controls fidelity to the original input image(s). This parameter is supported for GPT image models that support input fidelity. `gpt-image-2` and `gpt-image-2-2026-04-21` ignore this parameter. + size: + anyOf: + - type: string + - type: string + enum: + - auto + - 1024x1024 + - 1536x1024 + - 1024x1536 + - type: 'null' + default: auto + example: 1024x1024 + description: The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. + user: + type: string + example: user-1234 + description: | + A unique identifier representing your end-user, which can help OpenAI + monitor and detect abuse. + output_format: + anyOf: + - type: string + enum: + - png + - jpeg + - webp + - type: 'null' + default: png + example: png + description: Output image format. Supported for GPT image models. + output_compression: + anyOf: + - type: integer + minimum: 0 + maximum: 100 + - type: 'null' + example: 100 + description: Compression level for `jpeg` or `webp` output. + moderation: + anyOf: + - type: string + enum: + - low + - auto + - type: 'null' + default: auto + example: auto + description: Moderation level for GPT image models. + background: + anyOf: + - type: string + enum: + - transparent + - opaque + - auto + - type: 'null' + default: auto + example: transparent + description: Set the background of the generated image output. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds. Transparent backgrounds are available for supported GPT Image models. For `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`, set the output format to `png` or `webp`. + stream: + anyOf: + - type: boolean + - type: 'null' + default: false + example: false + description: Stream partial image results as events. + partial_images: + $ref: '#/components/schemas/PartialImages' + required: + - images + - prompt + Embedding: + type: object + description: | + Represents an embedding vector returned by embedding endpoint. + properties: + index: + type: integer + description: The index of the embedding in the list of embeddings. + embedding: type: array + description: | + The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](https://developers.openai.com/api/docs/guides/embeddings). items: - type: string - description: The labels that indicate a passing result. Must be a subset of labels. + type: number + format: float + object: + type: string + description: The object type, which is always "embedding". + enum: + - embedding + x-stainless-const: true required: - - type - - model - - input - - passing_labels - - labels - - name + - index + - object + - embedding x-oaiMeta: - name: The eval label model grader object - group: evals + name: The embedding object example: | { - "type": "label_model", - "model": "gpt-4o-2024-08-06", - "input": [ - { - "role": "system", - "content": "Classify the sentiment of the following statement as one of 'positive', 'neutral', or 'negative'" - }, - { - "role": "user", - "content": "Statement: {{item.response}}" - } + "object": "embedding", + "embedding": [ + 0.0023064255, + -0.009327292, + .... (1536 floats total for ada-002) + -0.0028842222, ], - "passing_labels": ["positive"], - "labels": ["positive", "neutral", "negative"], - "name": "Sentiment label grader" + "index": 0 } - CreateEvalLogsDataSourceConfig: + Error: type: object - title: LogsDataSourceConfig - description: | - A data source config which specifies the metadata property of your logs query. - This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. properties: + code: + anyOf: + - type: string + - type: 'null' + message: + type: string + param: + anyOf: + - type: string + - type: 'null' type: type: string + misalignment: + $ref: '#/components/schemas/MisalignmentErrorDetailsResource' + required: + - type + - message + - param + - code + ErrorEvent: + type: object + properties: + event: + type: string enum: - - logs - default: logs - description: The type of data source. Always `logs`. + - error x-stainless-const: true - metadata: - type: object - description: Metadata filters for the logs data source. - additionalProperties: true + data: + $ref: '#/components/schemas/Error' required: - - type + - event + - data + description: Occurs when an [error](https://developers.openai.com/api/docs/guides/error-codes#api-errors) occurs. This can happen due to an internal server error or a timeout. x-oaiMeta: - name: The logs data source object for evals - group: evals - example: | - { - "type": "logs", - "metadata": { - "use_case": "customer_support_agent" - } - } - CreateEvalRequest: + dataDescription: '`data` is an [error](https://developers.openai.com/api/docs/guides/error-codes#api-errors)' + ErrorResponse: type: object - title: CreateEvalRequest properties: + error: + $ref: '#/components/schemas/Error' + required: + - error + Eval: + type: object + title: Eval + description: | + An Eval object with a data source config and testing criteria. + An Eval represents a task to be done for your LLM integration. + Like: + - Improve the quality of my chatbot + - See how well my chatbot handles customer support + - Check if o4-mini is better at my usecase than gpt-6-astra + properties: + object: + type: string + enum: + - eval + default: eval + description: The object type. + x-stainless-const: true + id: + type: string + description: Unique identifier for the evaluation. name: type: string description: The name of the evaluation. - metadata: - $ref: '#/components/schemas/Metadata' + example: Chatbot effectiveness Evaluation data_source_config: type: object - description: The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation. + description: Configuration of data sources used in runs of the evaluation. anyOf: - - $ref: '#/components/schemas/CreateEvalCustomDataSourceConfig' - - $ref: '#/components/schemas/CreateEvalLogsDataSourceConfig' - - $ref: '#/components/schemas/CreateEvalStoredCompletionsDataSourceConfig' + - $ref: '#/components/schemas/EvalCustomDataSourceConfig' + - $ref: '#/components/schemas/EvalLogsDataSourceConfig' + - $ref: '#/components/schemas/EvalStoredCompletionsDataSourceConfig' discriminator: propertyName: type testing_criteria: + description: A list of testing criteria. type: array - description: A list of graders for all eval runs in this group. Graders can reference variables in the data source using double curly braces notation, like `{{item.variable_name}}`. To reference the model's output, use the `sample` namespace (ie, `{{sample.output_text}}`). items: anyOf: - - $ref: '#/components/schemas/CreateEvalLabelModelGrader' + - $ref: '#/components/schemas/EvalGraderLabelModel' - $ref: '#/components/schemas/EvalGraderStringCheck' - $ref: '#/components/schemas/EvalGraderTextSimilarity' - $ref: '#/components/schemas/EvalGraderPython' - $ref: '#/components/schemas/EvalGraderScoreModel' - discriminator: - propertyName: type + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the eval was created. + metadata: + $ref: '#/components/schemas/Metadata' required: + - id - data_source_config + - object - testing_criteria - CreateEvalResponsesRunDataSource: - type: object - title: CreateEvalResponsesRunDataSource - description: | - A ResponsesRunDataSource object describing a model sampling configuration. - properties: - type: - type: string - enum: - - responses - default: responses - description: The type of run data source. Always `responses`. - input_messages: - description: Used when sampling from a model. Dictates the structure of the messages passed into the model. Can either be a reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template with variable references to the `item` namespace. - anyOf: - - type: object - title: InputMessagesTemplate - properties: - type: - type: string - enum: - - template - description: The type of input messages. Always `template`. - template: - type: array - description: A list of chat messages forming the prompt or context. May include variable references to the `item` namespace, ie {{item.name}}. - items: - anyOf: - - type: object - title: ChatMessage - properties: - role: - type: string - description: The role of the message (e.g. "system", "assistant", "user"). - content: - type: string - description: The content of the message. - required: - - role - - content - - $ref: '#/components/schemas/EvalItem' - required: - - type - - template - - type: object - title: InputMessagesItemReference - properties: - type: - type: string - enum: - - item_reference - description: The type of input messages. Always `item_reference`. - item_reference: - type: string - description: A reference to a variable in the `item` namespace. Ie, "item.name" - required: - - type - - item_reference - discriminator: - propertyName: type - sampling_params: - type: object - properties: - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - temperature: - type: number - description: A higher temperature increases randomness in the outputs. - default: 1 - max_completion_tokens: - type: integer - description: The maximum number of tokens in the generated output. - top_p: - type: number - description: An alternative to temperature for nucleus sampling; 1.0 includes all tokens. - default: 1 - seed: - type: integer - description: A seed value to initialize the randomness, during sampling. - default: 42 - tools: - type: array - description: | - An array of tools the model may call while generating a response. You - can specify which tool to use by setting the `tool_choice` parameter. - - The two categories of tools you can provide the model are: - - - **Built-in tools**: Tools that are provided by OpenAI that extend the - model's capabilities, like [web search](https://developers.openai.com/api/docs/guides/tools-web-search) - or [file search](https://developers.openai.com/api/docs/guides/tools-file-search). Learn more about - [built-in tools](https://developers.openai.com/api/docs/guides/tools). - - **Function calls (custom tools)**: Functions that are defined by you, - enabling the model to call your own code. Learn more about - [function calling](https://developers.openai.com/api/docs/guides/function-calling). - items: - $ref: '#/components/schemas/Tool' - text: - type: object - description: | - Configuration options for a text response from the model. Can be plain - text or structured JSON data. Learn more: - - [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text) - - [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs) - properties: - format: - $ref: '#/components/schemas/TextResponseFormatConfiguration' - model: - type: string - description: The name of the model to use for generating completions (e.g. "o3-mini"). - source: - description: Determines what populates the `item` namespace in this run's data source. - anyOf: - - $ref: '#/components/schemas/EvalJsonlFileContentSource' - - $ref: '#/components/schemas/EvalJsonlFileIdSource' - - $ref: '#/components/schemas/EvalResponsesSource' - discriminator: - propertyName: type - required: - - type - - source + - name + - created_at + - metadata x-oaiMeta: - name: The completions data source object used to configure an individual run - group: eval runs + name: The eval object + group: evals example: | { - "name": "gpt-6-astra", - "data_source": { - "type": "responses", - "input_messages": { - "type": "item_reference", - "item_reference": "item.input" + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "item_schema": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] }, - "model": "gpt-6-astra", - "source": { - "type": "responses", - "model": "gpt-6-astra" + "include_sample_schema": true + }, + "testing_criteria": [ + { + "name": "My string check grader", + "type": "string_check", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq", } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": { + "test": "synthetics", } } - CreateEvalRunRequest: + EvalApiError: type: object - title: CreateEvalRunRequest + title: EvalApiError + description: | + An object representing an error response from the Eval API. properties: - name: + code: type: string - description: The name of the run. - metadata: - $ref: '#/components/schemas/Metadata' - data_source: - type: object - description: Details about the run's data source. - anyOf: - - $ref: '#/components/schemas/CreateEvalJsonlRunDataSource' - - $ref: '#/components/schemas/CreateEvalCompletionsRunDataSource' - - $ref: '#/components/schemas/CreateEvalResponsesRunDataSource' + description: The error code. + message: + type: string + description: The error message. required: - - data_source - CreateEvalStoredCompletionsDataSourceConfig: + - code + - message + x-oaiMeta: + name: The API error object + group: evals + example: | + { + "code": "internal_error", + "message": "The eval run failed due to an internal error." + } + EvalCustomDataSourceConfig: type: object - title: StoredCompletionsDataSourceConfig + title: CustomDataSourceConfig description: | - Deprecated in favor of LogsDataSourceConfig. + A CustomDataSourceConfig which specifies the schema of your `item` and optionally `sample` namespaces. + The response schema defines the shape of the data that will be: + - Used to define your testing criteria and + - What data is required when creating a run properties: type: type: string enum: - - stored_completions - default: stored_completions - description: The type of data source. Always `stored_completions`. + - custom + default: custom + description: The type of data source. Always `custom`. x-stainless-const: true - metadata: + schema: type: object - description: Metadata filters for the stored completions data source. + description: | + The json schema for the run data source items. + Learn how to build JSON schemas [here](https://json-schema.org/). additionalProperties: true required: - type - deprecated: true + - schema x-oaiMeta: - name: The stored completions data source object for evals + name: The eval custom data source config object group: evals example: | { - "type": "stored_completions", - "metadata": { - "use_case": "customer_support_agent" + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "label": {"type": "string"}, + }, + "required": ["label"] + } + }, + "required": ["item"] } } - CreateFileRequest: + EvalGraderLabelModel: type: object - additionalProperties: false - properties: - file: - description: | - The File object (not file name) to be uploaded. - type: string - format: binary - x-oaiMeta: - exampleFilePath: fine-tune.jsonl - purpose: - $ref: '#/components/schemas/FilePurpose' - description: | - The intended purpose of the uploaded file. One of: - - `assistants`: Used in the Assistants API - - `batch`: Used in the Batch API - - `fine-tune`: Used for fine-tuning - - `vision`: Images used for vision fine-tuning - - `user_data`: Flexible file type for any purpose - - `evals`: Used for eval data sets - expires_after: - $ref: '#/components/schemas/FileExpirationAfter' - required: - - file - - purpose - CreateFineTuningCheckpointPermissionRequest: + title: LabelModelGrader + allOf: + - $ref: '#/components/schemas/GraderLabelModel' + EvalGraderPython: type: object - additionalProperties: false - properties: - project_ids: - type: array - description: The project identifiers to grant access to. - items: - type: string - required: - - project_ids - CreateFineTuningJobRequest: + title: EvalGraderPython + allOf: + - $ref: '#/components/schemas/GraderPython' + - type: object + properties: + pass_threshold: + type: number + description: The threshold for the score. + x-oaiMeta: + name: Eval Python Grader + group: graders + example: | + { + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + "pass_threshold": 0.8 + } + EvalGraderScoreModel: type: object - properties: - model: - description: | - The name of the model to fine-tune. You can select one of the - [supported models](https://developers.openai.com/api/docs/guides/model-optimization#fine-tuning-methods). - example: gpt-4o-mini - anyOf: - - type: string - - type: string - enum: - - babbage-002 - - davinci-002 - - gpt-3.5-turbo - - gpt-4o-mini - title: Preset - x-oaiTypeLabel: string - training_file: - description: | - The ID of an uploaded file that contains training data. - - See [upload file](https://developers.openai.com/api/reference/resources/files/methods/create) for how to upload a file. - - Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`. - - The contents of the file should differ depending on if the model uses the [chat](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data), [completions](https://developers.openai.com/api/docs/guides/supervised-fine-tuning#formatting-your-data) format, or if the fine-tuning method uses the [preference](https://developers.openai.com/api/docs/guides/direct-preference-optimization) format. - - See the [fine-tuning guide](https://developers.openai.com/api/docs/guides/model-optimization) for more details. - type: string - example: file-abc123 - hyperparameters: - type: object - description: | - The hyperparameters used for the fine-tuning job. - This value is now deprecated in favor of `method`, and should be passed in under the `method` parameter. - properties: - batch_size: - description: | - Number of examples in each batch. A larger batch size means that model parameters - are updated less frequently, but with lower variance. - default: auto - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - title: Auto - - type: integer - minimum: 1 - maximum: 256 - learning_rate_multiplier: - description: | - Scaling factor for the learning rate. A smaller learning rate may be useful to avoid - overfitting. - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - title: Auto - - type: number - minimum: 0 - exclusiveMinimum: true - n_epochs: - description: | - The number of epochs to train the model for. An epoch refers to one full cycle - through the training dataset. - default: auto - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - title: Auto - - type: integer - minimum: 1 - maximum: 50 - deprecated: true - suffix: - description: | - A string of up to 64 characters that will be added to your fine-tuned model name. - - For example, a `suffix` of "custom-model-name" would produce a model name like `ft:gpt-4o-mini:openai:custom-model-name:7p4lURel`. - type: string - minLength: 1 - maxLength: 64 - default: null - nullable: true - validation_file: - description: | - The ID of an uploaded file that contains validation data. - - If you provide this file, the data is used to generate validation - metrics periodically during fine-tuning. These metrics can be viewed in - the fine-tuning results file. - The same data should not be present in both train and validation files. - - Your dataset must be formatted as a JSONL file. You must upload your file with the purpose `fine-tune`. - - See the [fine-tuning guide](https://developers.openai.com/api/docs/guides/model-optimization) for more details. - type: string - nullable: true - example: file-abc123 - integrations: - type: array - description: A list of integrations to enable for your fine-tuning job. - nullable: true - items: - type: object - required: - - type - - wandb - properties: - type: - description: | - The type of integration to enable. Currently, only "wandb" (Weights and Biases) is supported. - anyOf: - - type: string - enum: - - wandb - x-stainless-const: true - wandb: - type: object - description: | - The settings for your integration with Weights and Biases. This payload specifies the project that - metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags - to your run, and set a default entity (team, username, etc) to be associated with your run. - required: - - project - properties: - project: - description: | - The name of the project that the new run will be created under. - type: string - example: my-wandb-project - name: - description: | - A display name to set for the run. If not set, we will use the Job ID as the name. - nullable: true - type: string - entity: - description: | - The entity to use for the run. This allows you to set the team or username of the WandB user that you would - like associated with the run. If not set, the default entity for the registered WandB API key is used. - nullable: true - type: string - tags: - description: | - A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some - default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}". - type: array - items: - type: string - example: custom-tag - seed: - description: | - The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases. - If a seed is not specified, one will be generated for you. - type: integer - nullable: true - minimum: 0 - maximum: 2147483647 - example: 42 - method: - $ref: '#/components/schemas/FineTuneMethod' - metadata: - $ref: '#/components/schemas/Metadata' - required: - - model - - training_file - CreateGroupBody: + title: EvalGraderScoreModel + allOf: + - $ref: '#/components/schemas/GraderScoreModel' + - type: object + properties: + pass_threshold: + type: number + description: The threshold for the score. + EvalGraderStringCheck: + type: object + title: StringCheckGrader + allOf: + - $ref: '#/components/schemas/GraderStringCheck' + EvalGraderTextSimilarity: + type: object + title: EvalGraderTextSimilarity + allOf: + - $ref: '#/components/schemas/GraderTextSimilarity' + - type: object + properties: + pass_threshold: + type: number + description: The threshold for the score. + required: + - pass_threshold + x-oaiMeta: + name: Text Similarity Grader + group: graders + example: | + { + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "pass_threshold": 0.8, + "evaluation_metric": "fuzzy_match" + } + EvalItem: type: object - description: Request payload for creating a new group in the organization. + title: EvalItem + description: | + A message input to the model with a role indicating instruction following + hierarchy. Instructions given with the `developer` or `system` role take + precedence over instructions given with the `user` role. Messages with the + `assistant` role are presumed to have been generated by the model in previous + interactions. properties: - name: + role: type: string - description: Human readable name for the group. - minLength: 1 - maxLength: 255 + description: | + The role of the message input. One of `user`, `assistant`, `system`, or + `developer`. + enum: + - user + - assistant + - system + - developer + content: + $ref: '#/components/schemas/EvalItemContent' + type: + type: string + description: | + The type of the message input. Always `message`. + enum: + - message + x-stainless-const: true required: - - name - x-oaiMeta: - example: | - { - "name": "Support Team" - } - CreateGroupUserBody: + - role + - content + EvalItemContent: + title: Eval content + description: | + Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items. + anyOf: + - $ref: '#/components/schemas/EvalItemContentItem' + - $ref: '#/components/schemas/EvalItemContentArray' + EvalItemContentArray: + type: array + title: An array of Input text, Output text, Input image, and Input audio + description: | + A list of inputs, each of which may be either an input text, output text, input + image, or input audio object. + items: + $ref: '#/components/schemas/EvalItemContentItem' + EvalItemContentItem: + title: Eval content item + description: | + A single content item: input text, output text, input image, or input audio. + anyOf: + - $ref: '#/components/schemas/EvalItemContentText' + - $ref: '#/components/schemas/InputTextContent' + - $ref: '#/components/schemas/EvalItemContentOutputText' + - $ref: '#/components/schemas/EvalItemInputImage' + - $ref: '#/components/schemas/InputAudio' + x-stainless-naming: + ruby: + model_name: GraderInputItem + EvalItemContentOutputText: type: object - description: Request payload for adding a user to a group. + title: Output text + description: | + A text output from the model. properties: - user_id: + type: type: string - description: Identifier of the user to add to the group. + description: | + The type of the output text. Always `output_text`. + enum: + - output_text + x-stainless-const: true + text: + type: string + description: | + The text output from the model. required: - - user_id - x-oaiMeta: - example: | - { - "user_id": "user_abc123" - } - CreateImageEditRequest: + - type + - text + EvalItemContentText: + type: string + title: Text input + description: | + A text input to the model. + EvalItemInputImage: + title: Input image + description: An image input block used within EvalItem content arrays. type: object properties: - image: - anyOf: - - type: string - format: binary - - type: array - maxItems: 16 - items: - type: string - format: binary - description: | - The image(s) to edit. Must be a supported image file or an array of images. - - For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, - `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, - `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, - `gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`), each image - should be a `png`, `webp`, or `jpg` file less than 50MB. You can provide up to - 16 images. - - For `dall-e-2`, you can only provide one image, and it should be a square - `png` file less than 4MB. - x-oaiMeta: - exampleFilePath: otter.png - prompt: - description: A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2`, and 32000 characters for the GPT image models. - type: string - example: A cute baby sea otter wearing a beret - mask: - description: An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. - type: string - format: binary - x-oaiMeta: - exampleFilePath: mask.png - background: + type: type: string - enum: - - transparent - - opaque - - auto - default: auto - example: transparent - nullable: true description: | - Allows to set transparency for the background of the generated image(s). Must - be one of `transparent`, `opaque`, or `auto` (default value). When `auto` is - used, the model will automatically determine the best background for the - image. - - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their - `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds. - Transparent backgrounds are available for supported GPT Image models. For - `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When - using `transparent`, set the output format to `png` or `webp`. - model: - anyOf: - - type: string - - type: string - enum: - - gpt-image-1 - - gpt-image-1-mini - - gpt-image-2 - - gpt-image-2-2026-04-21 - - gpt-image-2.5-sunburst - - gpt-image-2.5-sunburst-2026-09-08 - - gpt-image-2.5-flare - - gpt-image-2.5-flare-2026-09-08 - - gpt-image-1.5 - - chatgpt-image-latest - - dall-e-2 - x-stainless-const: true - x-oaiTypeLabel: string - description: The model to use for image generation. One of `dall-e-2` or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`). Defaults to `gpt-image-1.5`. - nullable: true - example: gpt-image-2 - n: - type: integer - minimum: 1 - maximum: 10 - default: 1 - example: 1 - nullable: true - description: The number of images to generate. Must be between 1 and 10. - size: - anyOf: - - type: string - - type: string - enum: - - 256x256 - - 512x512 - - 1024x1024 - - 1536x1024 - - 1024x1536 - - auto - description: The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. - nullable: true - response_format: - type: string + The type of the image input. Always `input_image`. enum: - - url - - b64_json - example: url - nullable: true - description: The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models always return base64-encoded images. - output_format: + - input_image + x-stainless-const: true + image_url: type: string - enum: - - png - - jpeg - - webp - default: png - example: png - nullable: true - description: | - The format in which the generated images are returned. This parameter is - only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. - The default value is `png`. - output_compression: - type: integer - default: 100 - example: 100 - nullable: true + format: uri description: | - The compression level (0-100%) for the generated images. This parameter - is only supported for the GPT image models with the `webp` or `jpeg` output - formats, and defaults to 100. - user: + The URL of the image input. + detail: type: string - example: user-1234 - description: | - A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). - input_fidelity: - anyOf: - - $ref: '#/components/schemas/InputFidelity' - - type: 'null' - description: Controls fidelity to the original input image(s). This parameter is supported for GPT image models that support input fidelity. `gpt-image-2` and `gpt-image-2-2026-04-21` ignore this parameter. - stream: - type: boolean - default: false - example: false - nullable: true description: | - Edit the image in streaming mode. Defaults to `false`. See the - [Image generation guide](https://developers.openai.com/api/docs/guides/image-generation) for more information. - partial_images: - $ref: '#/components/schemas/PartialImages' - quality: + The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`. + required: + - type + - image_url + EvalJsonlFileContentSource: + type: object + title: EvalJsonlFileContentSource + properties: + type: type: string enum: - - standard - - low - - medium - - high - - xhigh - - max - - auto - default: auto - example: high - nullable: true - description: | - The quality of the image that will be generated for GPT image models. The GPT image models support `low`, `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, also support `xhigh` and `max`. Defaults to `auto`. + - file_content + default: file_content + description: The type of jsonl source. Always `file_content`. + x-stainless-const: true + content: + type: array + items: + type: object + properties: + item: + type: object + additionalProperties: true + sample: + type: object + additionalProperties: true + required: + - item + description: The content of the jsonl file. required: - - prompt - - image - CreateImageRequest: + - type + - content + EvalJsonlFileIdSource: type: object + title: EvalJsonlFileIdSource properties: - prompt: - description: A text description of the desired image(s). The maximum length is 32000 characters for the GPT image models, 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`. - type: string - example: A cute baby sea otter - model: - anyOf: - - type: string - - type: string - enum: - - gpt-image-1 - - gpt-image-1-mini - - gpt-image-2 - - gpt-image-2-2026-04-21 - - gpt-image-2.5-sunburst - - gpt-image-2.5-sunburst-2026-09-08 - - gpt-image-2.5-flare - - gpt-image-2.5-flare-2026-09-08 - - gpt-image-1.5 - - chatgpt-image-latest - - dall-e-2 - - dall-e-3 - x-stainless-nominal: false - x-oaiTypeLabel: string - description: The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or a GPT image model (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, `gpt-image-2.5-flare-2026-09-08`). Defaults to `dall-e-2` unless a parameter specific to the GPT image models is used. - nullable: true - example: gpt-image-2 - n: - type: integer - minimum: 1 - maximum: 10 - default: 1 - example: 1 - nullable: true - description: The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. - quality: + type: type: string enum: - - standard - - hd - - low - - medium - - high - - xhigh - - max - - auto - default: auto - example: medium - nullable: true - description: | - The quality of the image that will be generated. - - - `auto` (default value) will automatically select the best quality for the given - model. - - `high`, `medium` and `low` are supported for the GPT image models. - - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08` - snapshots, also support `xhigh` and `max`. - - `hd` and `standard` are supported for `dall-e-3`. - - `standard` is the only option for `dall-e-2`. - response_format: + - file_id + default: file_id + description: The type of jsonl source. Always `file_id`. + x-stainless-const: true + id: type: string - enum: - - url - - b64_json - default: url - example: url - nullable: true - description: The format in which generated images with `dall-e-2` and `dall-e-3` are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported for the GPT image models, which always return base64-encoded images. - output_format: + description: The identifier of the file. + required: + - type + - id + EvalList: + type: object + title: EvalList + description: | + An object representing a list of evals. + properties: + object: type: string enum: - - png - - jpeg - - webp - default: png - example: png - nullable: true - description: The format in which the generated images are returned. This parameter is only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`. - output_compression: - type: integer - default: 100 - example: 100 - nullable: true - description: The compression level (0-100%) for the generated images. This parameter is only supported for the GPT image models with the `webp` or `jpeg` output formats, and defaults to 100. - stream: - type: boolean - default: false - example: false - nullable: true + - list + default: list description: | - Generate the image in streaming mode. Defaults to `false`. See the - [Image generation guide](https://developers.openai.com/api/docs/guides/image-generation) for more information. - This parameter is only supported for the GPT image models. - partial_images: - $ref: '#/components/schemas/PartialImages' - size: - anyOf: - - type: string - - type: string - enum: - - auto - - 1024x1024 - - 1536x1024 - - 1024x1536 - - 256x256 - - 512x512 - - 1792x1024 - - 1024x1792 - description: The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. - nullable: true - moderation: - type: string - enum: - - low - - auto - default: auto - example: low - nullable: true - description: Control the content-moderation level for images generated by the GPT image models. Must be either `low` for less restrictive filtering or `auto` (default value). - background: - type: string - enum: - - transparent - - opaque - - auto - default: auto - example: transparent - nullable: true + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array description: | - Allows to set transparency for the background of the generated image(s). Must - be one of `transparent`, `opaque`, or `auto` (default value). When `auto` is - used, the model will automatically determine the best background for the - image. - - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their - `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds. - Transparent backgrounds are available for supported GPT Image models. For - `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When - using `transparent`, set the output format to `png` or `webp`. - style: + An array of eval objects. + items: + $ref: '#/components/schemas/Eval' + first_id: type: string - enum: - - vivid - - natural - default: vivid - example: vivid - nullable: true - description: The style of the generated images. This parameter is only supported for `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. - user: + description: The identifier of the first eval in the data array. + last_id: type: string - example: user-1234 - description: | - A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). + description: The identifier of the last eval in the data array. + has_more: + type: boolean + description: Indicates whether there are more evals available. required: - - prompt - CreateImageVariationRequest: + - object + - data + - first_id + - last_id + - has_more + x-oaiMeta: + name: The eval list object + group: evals + example: | + { + "object": "list", + "data": [ + { + "object": "eval", + "id": "eval_67abd54d9b0081909a86353f6fb9317a", + "data_source_config": { + "type": "custom", + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object", + "properties": { + "input": { + "type": "string" + }, + "ground_truth": { + "type": "string" + } + }, + "required": [ + "input", + "ground_truth" + ] + } + }, + "required": [ + "item" + ] + } + }, + "testing_criteria": [ + { + "name": "String check", + "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", + "type": "string_check", + "input": "{{item.input}}", + "reference": "{{item.ground_truth}}", + "operation": "eq" + } + ], + "name": "External Data Eval", + "created_at": 1739314509, + "metadata": {}, + } + ], + "first_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "last_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "has_more": true + } + EvalLogsDataSourceConfig: type: object + title: LogsDataSourceConfig + description: | + A LogsDataSourceConfig which specifies the metadata property of your logs query. + This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. + The schema returned by this data source config is used to defined what variables are available in your evals. + `item` and `sample` are both defined when using this data source config. properties: - image: - description: The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. - type: string - format: binary - x-oaiMeta: - exampleFilePath: otter.png - model: - anyOf: - - type: string - - type: string - enum: - - dall-e-2 - x-stainless-const: true - x-oaiTypeLabel: string - description: The model to use for image generation. Only `dall-e-2` is supported at this time. - nullable: true - n: - type: integer - minimum: 1 - maximum: 10 - default: 1 - example: 1 - nullable: true - description: The number of images to generate. Must be between 1 and 10. - response_format: - type: string - enum: - - url - - b64_json - default: url - example: url - nullable: true - description: The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. - size: + type: type: string enum: - - 256x256 - - 512x512 - - 1024x1024 - default: 1024x1024 - example: 1024x1024 - nullable: true - description: The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. - user: - type: string - example: user-1234 + - logs + default: logs + description: The type of data source. Always `logs`. + x-stainless-const: true + metadata: + $ref: '#/components/schemas/Metadata' + schema: + type: object description: | - A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). + The json schema for the run data source items. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true required: - - image - CreateMessageRequest: + - type + - schema + x-oaiMeta: + name: The logs data source object for evals + group: evals + example: | + { + "type": "logs", + "metadata": { + "language": "english" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + } + } + EvalResponsesSource: type: object - additionalProperties: false - required: - - role - - content + title: EvalResponsesSource + description: | + A EvalResponsesSource object describing a run data source configuration. properties: - role: + type: type: string enum: - - user - - assistant - description: | - The role of the entity that is creating the message. Allowed values include: - - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. - - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation. - content: + - responses + description: The type of run data source. Always `responses`. + metadata: + anyOf: + - type: object + description: Metadata filter for the responses. This is a query parameter used to select responses. + - type: 'null' + model: anyOf: - type: string - description: The text contents of the message. - title: Text content + description: The name of the model to find responses for. This is a query parameter used to select responses. + - type: 'null' + instructions_search: + anyOf: + - type: string + description: Optional string to search the 'instructions' field. This is a query parameter used to select responses. + - type: 'null' + created_after: + anyOf: + - type: integer + minimum: 0 + description: Only include items created after this timestamp (inclusive). This is a query parameter used to select responses. + - type: 'null' + created_before: + anyOf: + - type: integer + minimum: 0 + description: Only include items created before this timestamp (inclusive). This is a query parameter used to select responses. + - type: 'null' + reasoning_effort: + anyOf: + - $ref: '#/components/schemas/ReasoningEffort' + description: Optional reasoning effort parameter. This is a query parameter used to select responses. + - type: 'null' + temperature: + anyOf: + - type: number + description: Sampling temperature. This is a query parameter used to select responses. + - type: 'null' + top_p: + anyOf: + - type: number + description: Nucleus sampling parameter. This is a query parameter used to select responses. + - type: 'null' + users: + anyOf: - type: array - description: An array of content parts with a defined type, each can be of type `text` or images can be passed with `image_url` or `image_file`. Image types are only supported on [Vision-compatible models](https://developers.openai.com/api/docs/models). - title: Array of content parts items: - anyOf: - - $ref: '#/components/schemas/MessageContentImageFileObject' - - $ref: '#/components/schemas/MessageContentImageUrlObject' - - $ref: '#/components/schemas/MessageRequestContentTextObject' - discriminator: - propertyName: type - minItems: 1 - attachments: + type: string + description: List of user identifiers. This is a query parameter used to select responses. + - type: 'null' + tools: anyOf: - type: array items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - description: The tools to add this file to. - type: array - items: - anyOf: - - $ref: '#/components/schemas/AssistantToolsCode' - - $ref: '#/components/schemas/AssistantToolsFileSearchTypeOnly' - discriminator: - propertyName: type - description: A list of files attached to the message, and the tools they should be added to. - required: - - file_id - - tools + type: string + description: List of tool names. This is a query parameter used to select responses. - type: 'null' + required: + - type + x-oaiMeta: + name: The run data source object used to configure an individual run + group: eval runs + example: | + { + "type": "responses", + "model": "gpt-6-astra", + "users": ["user1", "user2"], + "tools": ["tool1", "tool2"], + "instructions_search": "You are a coding assistant" + } + EvalRun: + type: object + title: EvalRun + description: | + A schema representing an evaluation run. + properties: + object: + type: string + enum: + - eval.run + default: eval.run + description: The type of the object. Always "eval.run". + x-stainless-const: true + id: + type: string + description: Unique identifier for the evaluation run. + eval_id: + type: string + description: The identifier of the associated evaluation. + status: + type: string + description: The status of the evaluation run. + model: + type: string + description: The model that is evaluated, if applicable. + name: + type: string + description: The name of the evaluation run. + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the evaluation run was created. + report_url: + type: string + format: uri + description: The URL to the rendered evaluation run report on the UI dashboard. + result_counts: + type: object + description: Counters summarizing the outcomes of the evaluation run. + properties: + total: + type: integer + description: Total number of executed output items. + errored: + type: integer + description: Number of output items that resulted in an error. + failed: + type: integer + description: Number of output items that failed to pass the evaluation. + passed: + type: integer + description: Number of output items that passed the evaluation. + required: + - total + - errored + - failed + - passed + per_model_usage: + type: array + description: Usage statistics for each model during the evaluation run. + items: + type: object + properties: + model_name: + type: string + description: The name of the model. + x-stainless-naming: + python: + property_name: run_model_name + invocation_count: + type: integer + description: The number of invocations. + prompt_tokens: + type: integer + description: The number of prompt tokens used. + completion_tokens: + type: integer + description: The number of completion tokens generated. + total_tokens: + type: integer + description: The total number of tokens used. + cached_tokens: + type: integer + description: The number of tokens retrieved from cache. + required: + - model_name + - invocation_count + - prompt_tokens + - completion_tokens + - total_tokens + - cached_tokens + per_testing_criteria_results: + type: array + description: Results per testing criteria applied during the evaluation run. + items: + type: object + properties: + testing_criteria: + type: string + description: A description of the testing criteria. + passed: + type: integer + description: Number of tests passed for this criteria. + failed: + type: integer + description: Number of tests failed for this criteria. + required: + - testing_criteria + - passed + - failed + data_source: + type: object + description: Information about the run's data source. + anyOf: + - $ref: '#/components/schemas/CreateEvalJsonlRunDataSource' + - $ref: '#/components/schemas/CreateEvalCompletionsRunDataSource' + - $ref: '#/components/schemas/CreateEvalResponsesRunDataSource' + discriminator: + propertyName: type metadata: $ref: '#/components/schemas/Metadata' - CreateModelResponseProperties: - allOf: - - $ref: '#/components/schemas/ModelResponseProperties' - - type: object - properties: - prompt_cache_options: - $ref: '#/components/schemas/PromptCacheOptionsParam' - top_logprobs: - description: | - An integer between 0 and 20 specifying the maximum number of most likely - tokens to return at each token position, each with an associated log - probability. In some cases, the number of returned tokens may be fewer than - requested. - type: integer - minimum: 0 - maximum: 20 - CreateModerationRequest: + error: + $ref: '#/components/schemas/EvalApiError' + required: + - object + - id + - eval_id + - status + - model + - name + - created_at + - report_url + - result_counts + - per_model_usage + - per_testing_criteria_results + - data_source + - metadata + - error + x-oaiMeta: + name: The eval run object + group: evals + example: | + { + "object": "eval.run", + "id": "evalrun_67e57965b480819094274e3a32235e4c", + "eval_id": "eval_67e579652b548190aaa83ada4b125f47", + "report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47?run_id=evalrun_67e57965b480819094274e3a32235e4c", + "status": "queued", + "model": "gpt-6-astra", + "name": "gpt-6-astra", + "created_at": 1743092069, + "result_counts": { + "total": 0, + "errored": 0, + "failed": 0, + "passed": 0 + }, + "per_model_usage": null, + "per_testing_criteria_results": null, + "data_source": { + "type": "completions", + "source": { + "type": "file_content", + "content": [ + { + "item": { + "input": "Tech Company Launches Advanced Artificial Intelligence Platform", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Summit Addresses Climate Change Strategies", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Major Retailer Reports Record-Breaking Holiday Sales", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "National Team Qualifies for World Championship Finals", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Stock Markets Rally After Positive Economic Data Released", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "Global Manufacturer Announces Merger with Competitor", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Breakthrough in Renewable Energy Technology Unveiled", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "World Leaders Sign Historic Climate Agreement", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Professional Athlete Sets New Record in Championship Event", + "ground_truth": "Sports" + } + }, + { + "item": { + "input": "Financial Institutions Adapt to New Regulatory Requirements", + "ground_truth": "Business" + } + }, + { + "item": { + "input": "Tech Conference Showcases Advances in Artificial Intelligence", + "ground_truth": "Technology" + } + }, + { + "item": { + "input": "Global Markets Respond to Oil Price Fluctuations", + "ground_truth": "Markets" + } + }, + { + "item": { + "input": "International Cooperation Strengthened Through New Treaty", + "ground_truth": "World" + } + }, + { + "item": { + "input": "Sports League Announces Revised Schedule for Upcoming Season", + "ground_truth": "Sports" + } + } + ] + }, + "input_messages": { + "type": "template", + "template": [ + { + "type": "message", + "role": "developer", + "content": { + "type": "input_text", + "text": "Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\n\n# Steps\n\n1. Analyze the content of the news headline to understand its primary focus.\n2. Extract the subject matter, identifying any key indicators or keywords.\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\n4. Ensure only one category is selected per headline.\n\n# Output Format\n\nRespond with the chosen category as a single word. For instance: \"Technology\", \"Markets\", \"World\", \"Business\", or \"Sports\".\n\n# Examples\n\n**Input**: \"Apple Unveils New iPhone Model, Featuring Advanced AI Features\" \n**Output**: \"Technology\"\n\n**Input**: \"Global Stocks Mixed as Investors Await Central Bank Decisions\" \n**Output**: \"Markets\"\n\n**Input**: \"War in Ukraine: Latest Updates on Negotiation Status\" \n**Output**: \"World\"\n\n**Input**: \"Microsoft in Talks to Acquire Gaming Company for $2 Billion\" \n**Output**: \"Business\"\n\n**Input**: \"Manchester United Secures Win in Premier League Football Match\" \n**Output**: \"Sports\" \n\n# Notes\n\n- If the headline appears to fit into more than one category, choose the most dominant theme.\n- Keywords or phrases such as \"stocks\", \"company acquisition\", \"match\", or technological brands can be good indicators for classification.\n" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "{{item.input}}" + } + } + ] + }, + "model": "gpt-6-astra", + "sampling_params": { + "max_completions_tokens": 2048 + } + }, + "error": null, + "metadata": {} + } + EvalRunList: type: object + title: EvalRunList + description: | + An object representing a list of runs for an evaluation. properties: - input: + object: + type: string + enum: + - list + default: list description: | - Input (or inputs) to classify. Can be a single string, an array of strings, or - an array of multi-modal input objects similar to other models. - anyOf: - - type: string - description: A string of text to classify for moderation. - default: '' - example: I want to kill them. - - type: array - description: An array of strings to classify for moderation. - items: - type: string - default: '' - example: I want to kill them. - - type: array - description: An array of multi-modal inputs to the moderation model. - items: - anyOf: - - $ref: '#/components/schemas/ModerationImageURLInput' - description: An object describing an image to classify. - - $ref: '#/components/schemas/ModerationTextInput' - description: An object describing text to classify. - discriminator: - propertyName: type - title: Moderation Multi Modal Array - model: + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array description: | - The content moderation model you would like to use. Learn more in - [the moderation guide](https://developers.openai.com/api/docs/guides/moderation), and learn about - available models [here](https://developers.openai.com/api/docs/guides/moderation). - nullable: false - x-oaiTypeLabel: string - anyOf: - - type: string - - type: string - enum: - - omni-moderation-latest - - omni-moderation-2024-09-26 - - text-moderation-latest - - text-moderation-stable - x-stainless-nominal: false + An array of eval run objects. + items: + $ref: '#/components/schemas/EvalRun' + first_id: + type: string + description: The identifier of the first eval run in the data array. + last_id: + type: string + description: The identifier of the last eval run in the data array. + has_more: + type: boolean + description: Indicates whether there are more evals available. required: - - input - CreateModerationResponse: + - object + - data + - first_id + - last_id + - has_more + x-oaiMeta: + name: The eval run list object + group: evals + example: | + { + "object": "list", + "data": [ + { + "object": "eval.run", + "id": "evalrun_67b7fbdad46c819092f6fe7a14189620", + "eval_id": "eval_67b7fa9a81a88190ab4aa417e397ea21", + "report_url": "https://platform.openai.com/evaluations/eval_67b7fa9a81a88190ab4aa417e397ea21?run_id=evalrun_67b7fbdad46c819092f6fe7a14189620", + "status": "completed", + "model": "o3-mini", + "name": "Academic Assistant", + "created_at": 1740110812, + "result_counts": { + "total": 171, + "errored": 0, + "failed": 80, + "passed": 91 + }, + "per_model_usage": null, + "per_testing_criteria_results": [ + { + "testing_criteria": "String check grader", + "passed": 91, + "failed": 80 + } + ], + "run_data_source": { + "type": "completions", + "template_messages": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "You are a helpful assistant." + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Hello, can you help me with my homework?" + } + } + ], + "datasource_reference": null, + "model": "o3-mini", + "max_completion_tokens": null, + "seed": null, + "temperature": null, + "top_p": null + }, + "error": null, + "metadata": {"test": "synthetics"} + } + ], + "first_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "last_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "has_more": false + } + EvalRunOutputItem: type: object - description: Represents if a given text input is potentially harmful. + title: EvalRunOutputItem + description: | + A schema representing an evaluation run output item. properties: + object: + type: string + enum: + - eval.run.output_item + default: eval.run.output_item + description: The type of the object. Always "eval.run.output_item". + x-stainless-const: true id: type: string - description: The unique identifier for the moderation request. - model: + description: Unique identifier for the evaluation run output item. + run_id: type: string - description: The model used to generate the moderation results. + description: The identifier of the evaluation run associated with this output item. + eval_id: + type: string + description: The identifier of the evaluation group. + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the evaluation run was created. + status: + type: string + description: The status of the evaluation run. + datasource_item_id: + type: integer + description: The identifier for the data source item. + datasource_item: + type: object + description: Details of the input data source item. + additionalProperties: true results: type: array - description: A list of moderation objects. + description: A list of grader results for this output item. items: - type: object - properties: - flagged: - type: boolean - description: Whether any of the below categories are flagged. - categories: - type: object - description: A list of the categories, and whether they are flagged or not. - properties: - hate: - type: boolean - description: Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment. - hate/threatening: - type: boolean - description: Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. - harassment: - type: boolean - description: Content that expresses, incites, or promotes harassing language towards any target. - harassment/threatening: - type: boolean - description: Harassment content that also includes violence or serious harm towards any target. - illicit: - anyOf: - - type: boolean - description: Content that includes instructions or advice that facilitate the planning or execution of wrongdoing, or that gives advice or instruction on how to commit illicit acts. For example, "how to shoplift" would fit this category. - - type: 'null' - illicit/violent: - anyOf: - - type: boolean - description: Content that includes instructions or advice that facilitate the planning or execution of wrongdoing that also includes violence, or that gives advice or instruction on the procurement of any weapon. - - type: 'null' - self-harm: - type: boolean - description: Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders. - self-harm/intent: - type: boolean - description: Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders. - self-harm/instructions: - type: boolean - description: Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts. - sexual: - type: boolean - description: Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness). - sexual/minors: - type: boolean - description: Sexual content that includes an individual who is under 18 years old. - violence: - type: boolean - description: Content that depicts death, violence, or physical injury. - violence/graphic: - type: boolean - description: Content that depicts death, violence, or physical injury in graphic detail. - required: - - hate - - hate/threatening - - harassment - - harassment/threatening - - illicit - - illicit/violent - - self-harm - - self-harm/intent - - self-harm/instructions - - sexual - - sexual/minors - - violence - - violence/graphic - category_scores: + $ref: '#/components/schemas/EvalRunOutputItemResult' + sample: + type: object + description: A sample containing the input and output of the evaluation run. + properties: + input: + type: array + description: An array of input messages. + items: type: object - description: A list of the categories along with their scores as predicted by model. + description: An input message. properties: - hate: - type: number - description: The score for the category 'hate'. - hate/threatening: - type: number - description: The score for the category 'hate/threatening'. - harassment: - type: number - description: The score for the category 'harassment'. - harassment/threatening: - type: number - description: The score for the category 'harassment/threatening'. - illicit: - type: number - description: The score for the category 'illicit'. - illicit/violent: - type: number - description: The score for the category 'illicit/violent'. - self-harm: - type: number - description: The score for the category 'self-harm'. - self-harm/intent: - type: number - description: The score for the category 'self-harm/intent'. - self-harm/instructions: - type: number - description: The score for the category 'self-harm/instructions'. - sexual: - type: number - description: The score for the category 'sexual'. - sexual/minors: - type: number - description: The score for the category 'sexual/minors'. - violence: - type: number - description: The score for the category 'violence'. - violence/graphic: - type: number - description: The score for the category 'violence/graphic'. + role: + type: string + description: The role of the message sender (e.g., system, user, developer). + content: + type: string + description: The content of the message. required: - - hate - - hate/threatening - - harassment - - harassment/threatening - - illicit - - illicit/violent - - self-harm - - self-harm/intent - - self-harm/instructions - - sexual - - sexual/minors - - violence - - violence/graphic - category_applied_input_types: + - role + - content + output: + type: array + description: An array of output messages. + items: type: object - description: A list of the categories along with the input type(s) that the score applies to. properties: - hate: - type: array - description: The applied input type(s) for the category 'hate'. - items: - type: string - enum: - - text - x-stainless-const: true - hate/threatening: - type: array - description: The applied input type(s) for the category 'hate/threatening'. - items: - type: string - enum: - - text - x-stainless-const: true - harassment: - type: array - description: The applied input type(s) for the category 'harassment'. - items: - type: string - enum: - - text - x-stainless-const: true - harassment/threatening: - type: array - description: The applied input type(s) for the category 'harassment/threatening'. - items: - type: string - enum: - - text - x-stainless-const: true - illicit: - type: array - description: The applied input type(s) for the category 'illicit'. - items: - type: string - enum: - - text - x-stainless-const: true - illicit/violent: - type: array - description: The applied input type(s) for the category 'illicit/violent'. - items: - type: string - enum: - - text - x-stainless-const: true - self-harm: - type: array - description: The applied input type(s) for the category 'self-harm'. - items: - type: string - enum: - - text - - image - self-harm/intent: - type: array - description: The applied input type(s) for the category 'self-harm/intent'. - items: - type: string - enum: - - text - - image - self-harm/instructions: - type: array - description: The applied input type(s) for the category 'self-harm/instructions'. - items: - type: string - enum: - - text - - image - sexual: - type: array - description: The applied input type(s) for the category 'sexual'. - items: - type: string - enum: - - text - - image - sexual/minors: - type: array - description: The applied input type(s) for the category 'sexual/minors'. - items: - type: string - enum: - - text - x-stainless-const: true - violence: - type: array - description: The applied input type(s) for the category 'violence'. - items: - type: string - enum: - - text - - image - violence/graphic: - type: array - description: The applied input type(s) for the category 'violence/graphic'. - items: - type: string - enum: - - text - - image - required: - - hate - - hate/threatening - - harassment - - harassment/threatening - - illicit - - illicit/violent - - self-harm - - self-harm/intent - - self-harm/instructions - - sexual - - sexual/minors - - violence - - violence/graphic - required: - - flagged - - categories - - category_scores - - category_applied_input_types + role: + type: string + description: The role of the message (e.g. "system", "assistant", "user"). + content: + type: string + description: The content of the message. + finish_reason: + type: string + description: The reason why the sample generation was finished. + model: + type: string + description: The model used for generating the sample. + usage: + type: object + description: Token usage details for the sample. + properties: + total_tokens: + type: integer + description: The total number of tokens used. + completion_tokens: + type: integer + description: The number of completion tokens generated. + prompt_tokens: + type: integer + description: The number of prompt tokens used. + cached_tokens: + type: integer + description: The number of tokens retrieved from cache. + required: + - total_tokens + - completion_tokens + - prompt_tokens + - cached_tokens + error: + $ref: '#/components/schemas/EvalApiError' + temperature: + type: number + description: The sampling temperature used. + max_completion_tokens: + type: integer + description: The maximum number of tokens allowed for completion. + top_p: + type: number + description: The top_p value used for sampling. + seed: + type: integer + description: The seed used for generating the sample. + required: + - input + - output + - finish_reason + - model + - usage + - error + - temperature + - max_completion_tokens + - top_p + - seed required: + - object - id - - model + - run_id + - eval_id + - created_at + - status + - datasource_item_id + - datasource_item - results + - sample x-oaiMeta: - name: The moderation object + name: The eval run output item object + group: evals example: | { - "id": "modr-0d9740456c391e43c445bf0f010940c7", - "model": "omni-moderation-latest", + "object": "eval.run.output_item", + "id": "outputitem_67abd55eb6548190bb580745d5644a33", + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "created_at": 1739314509, + "status": "pass", + "datasource_item_id": 137, + "datasource_item": { + "teacher": "To grade essays, I only check for style, content, and grammar.", + "student": "I am a student who is trying to write the best essay." + }, "results": [ { - "flagged": true, - "categories": { - "harassment": true, - "harassment/threatening": true, - "sexual": false, - "hate": false, - "hate/threatening": false, - "illicit": false, - "illicit/violent": false, - "self-harm/intent": false, - "self-harm/instructions": false, - "self-harm": false, - "sexual/minors": false, - "violence": true, - "violence/graphic": true + "name": "String Check Grader", + "type": "string-check-grader", + "score": 1.0, + "passed": true, + } + ], + "sample": { + "input": [ + { + "role": "system", + "content": "You are an evaluator bot..." }, - "category_scores": { - "harassment": 0.8189693396524255, - "harassment/threatening": 0.804985420696006, - "sexual": 1.573112165348997e-6, - "hate": 0.007562942636942845, - "hate/threatening": 0.004208854591835476, - "illicit": 0.030535955153511665, - "illicit/violent": 0.008925306722380033, - "self-harm/intent": 0.00023023930975076432, - "self-harm/instructions": 0.0002293869201073356, - "self-harm": 0.012598046106750154, - "sexual/minors": 2.212566909570261e-8, - "violence": 0.9999992735124786, - "violence/graphic": 0.843064871157054 + { + "role": "user", + "content": "You are assessing..." + } + ], + "output": [ + { + "role": "assistant", + "content": "The rubric is not clear nor concise." + } + ], + "finish_reason": "stop", + "model": "gpt-6-astra", + "usage": { + "total_tokens": 521, + "completion_tokens": 2, + "prompt_tokens": 519, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 + } + } + EvalRunOutputItemList: + type: object + title: EvalRunOutputItemList + description: | + An object representing a list of output items for an evaluation run. + properties: + object: + type: string + enum: + - list + default: list + description: | + The type of this object. It is always set to "list". + x-stainless-const: true + data: + type: array + description: | + An array of eval run output item objects. + items: + $ref: '#/components/schemas/EvalRunOutputItem' + first_id: + type: string + description: The identifier of the first eval run output item in the data array. + last_id: + type: string + description: The identifier of the last eval run output item in the data array. + has_more: + type: boolean + description: Indicates whether there are more eval run output items available. + required: + - object + - data + - first_id + - last_id + - has_more + x-oaiMeta: + name: The eval run output item list object + group: evals + example: | + { + "object": "list", + "data": [ + { + "object": "eval.run.output_item", + "id": "outputitem_67abd55eb6548190bb580745d5644a33", + "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", + "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", + "created_at": 1739314509, + "status": "pass", + "datasource_item_id": 137, + "datasource_item": { + "teacher": "To grade essays, I only check for style, content, and grammar.", + "student": "I am a student who is trying to write the best essay." }, - "category_applied_input_types": { - "harassment": [ - "text" - ], - "harassment/threatening": [ - "text" - ], - "sexual": [ - "text", - "image" - ], - "hate": [ - "text" - ], - "hate/threatening": [ - "text" - ], - "illicit": [ - "text" - ], - "illicit/violent": [ - "text" - ], - "self-harm/intent": [ - "text", - "image" - ], - "self-harm/instructions": [ - "text", - "image" - ], - "self-harm": [ - "text", - "image" - ], - "sexual/minors": [ - "text" + "results": [ + { + "name": "String Check Grader", + "type": "string-check-grader", + "score": 1.0, + "passed": true, + } + ], + "sample": { + "input": [ + { + "role": "system", + "content": "You are an evaluator bot..." + }, + { + "role": "user", + "content": "You are assessing..." + } ], - "violence": [ - "text", - "image" + "output": [ + { + "role": "assistant", + "content": "The rubric is not clear nor concise." + } ], - "violence/graphic": [ - "text", - "image" - ] + "finish_reason": "stop", + "model": "gpt-6-astra", + "usage": { + "total_tokens": 521, + "completion_tokens": 2, + "prompt_tokens": 519, + "cached_tokens": 0 + }, + "error": null, + "temperature": 1.0, + "max_completion_tokens": 2048, + "top_p": 1.0, + "seed": 42 } - } - ] + }, + ], + "first_id": "outputitem_67abd55eb6548190bb580745d5644a33", + "last_id": "outputitem_67abd55eb6548190bb580745d5644a33", + "has_more": false } - CreateResponse: - allOf: - - $ref: '#/components/schemas/CreateModelResponseProperties' - - $ref: '#/components/schemas/ResponseProperties' - - type: object - properties: - prompt_cache_options: - $ref: '#/components/schemas/ResponsePromptCacheOptionsParam' - service_tier: - $ref: '#/components/schemas/ServiceTierResponses' - truncation: - deprecated: true - anyOf: - - type: string - description: | - The truncation strategy to use for the model response. - - `auto`: If the input to this Response exceeds - the model's context window size, the model will truncate the - response to fit the context window by dropping items from the beginning of the conversation. - - `disabled` (default): If the input size will exceed the context window - size for a model, the request will fail with a 400 error. - enum: - - auto - - disabled - default: disabled - - type: 'null' - reasoning: - anyOf: - - $ref: '#/components/schemas/Reasoning' - - type: 'null' - input: - $ref: '#/components/schemas/InputParam' - include: - anyOf: - - type: array - description: |- - Specify additional output data to include in the model response. Currently supported values are: - - `web_search_call.action.sources`: Include the sources of the web search tool call. - - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items. - - `computer_call_output.output.image_url`: Include image urls from the computer call output. - - `file_search_call.results`: Include the search results of the file search tool call. - - `message.input_image.image_url`: Include image urls from the input message. - - `message.output_text.logprobs`: Include logprobs with assistant messages. - - `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program). - items: - $ref: '#/components/schemas/IncludeEnum' - - type: 'null' - parallel_tool_calls: - anyOf: - - type: boolean - description: | - Whether to allow the model to run tool calls in parallel. - default: true - - type: 'null' - store: - anyOf: - - type: boolean - description: | - Whether to store the generated model response for later retrieval via - API. - Defaults to true when omitted. - If set to true, response data will be stored for at least 30 days, subject to the [data retention exceptions](https://developers.openai.com/api/docs/guides/your-data#v1responses). - default: true - - type: 'null' - instructions: - anyOf: - - type: string - description: | - A system (or developer) message inserted into the model's context. - - When using along with `previous_response_id`, the instructions from a previous - response will not be carried over to the next response. This makes it simple - to swap out system (or developer) messages in new responses. - - type: 'null' - moderation: - anyOf: - - $ref: '#/components/schemas/ModerationParam' - description: | - Configuration for running moderation on the input and output of this response. - - type: 'null' - stream: - anyOf: - - description: | - If set to true, the model response data will be streamed to the client - as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). - See the [Streaming section below](https://developers.openai.com/api/reference/resources/responses/streaming-events) - for more information. - type: boolean - default: false - - type: 'null' - stream_options: - $ref: '#/components/schemas/ResponseStreamOptions' - conversation: - anyOf: - - $ref: '#/components/schemas/ConversationParam' - - type: 'null' - context_management: - anyOf: - - type: array - description: | - Context management configuration for this request. - minItems: 1 - items: - $ref: '#/components/schemas/ContextManagementParam' - - type: 'null' - max_output_tokens: - anyOf: - - description: | - An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](https://developers.openai.com/api/docs/guides/reasoning). - type: integer - minimum: 16 - - type: 'null' - CreateRunRequest: + EvalRunOutputItemResult: type: object - additionalProperties: false + title: EvalRunOutputItemResult + description: | + A single grader result for an evaluation run output item. properties: - assistant_id: - description: The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) to use to execute this run. + name: type: string - model: - description: The ID of the [Model](https://developers.openai.com/api/reference/resources/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used. - nullable: true - anyOf: - - type: string - - $ref: '#/components/schemas/AssistantSupportedModels' - x-oaiTypeLabel: string - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - instructions: - description: Overrides the [instructions](https://developers.openai.com/api/docs/assistants/migration) of the assistant. This is useful for modifying the behavior on a per-run basis. + description: The name of the grader. + type: type: string - nullable: true - additional_instructions: - description: Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions. + description: The grader type (for example, "string-check-grader"). + score: + type: number + description: The numeric score produced by the grader. + passed: + type: boolean + description: Whether the grader considered the output a pass. + sample: + anyOf: + - type: object + additionalProperties: true + - type: 'null' + description: Optional sample or intermediate data produced by the grader. + additionalProperties: true + required: + - name + - score + - passed + EvalStoredCompletionsDataSourceConfig: + type: object + title: StoredCompletionsDataSourceConfig + description: | + Deprecated in favor of LogsDataSourceConfig. + properties: + type: type: string - nullable: true - additional_messages: - description: Adds additional messages to the thread before creating the run. - type: array - items: - $ref: '#/components/schemas/CreateMessageRequest' - nullable: true - tools: - description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. - nullable: true - type: array - maxItems: 20 - items: - $ref: '#/components/schemas/AssistantTool' + enum: + - stored_completions + default: stored_completions + description: The type of data source. Always `stored_completions`. + x-stainless-const: true metadata: $ref: '#/components/schemas/Metadata' - temperature: - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 - nullable: true - description: | - What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - top_p: - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 - nullable: true - description: | - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or temperature but not both. - stream: - type: boolean - nullable: true - description: | - If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message. - max_prompt_tokens: - type: integer - nullable: true - description: | - The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - minimum: 256 - max_completion_tokens: - type: integer - nullable: true + schema: + type: object description: | - The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - minimum: 256 - truncation_strategy: - allOf: - - $ref: '#/components/schemas/TruncationObject' - - nullable: true - tool_choice: - allOf: - - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' - - nullable: true - parallel_tool_calls: - $ref: '#/components/schemas/ParallelToolCalls' - response_format: - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' - nullable: true + The json schema for the run data source items. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true required: - - assistant_id - CreateSpeechRequest: + - type + - schema + deprecated: true + x-oaiMeta: + name: The stored completions data source object for evals + group: evals + example: | + { + "type": "stored_completions", + "metadata": { + "language": "english" + }, + "schema": { + "type": "object", + "properties": { + "item": { + "type": "object" + }, + "sample": { + "type": "object" + } + }, + "required": [ + "item", + "sample" + } + } + EvalStoredCompletionsSource: type: object - additionalProperties: false + title: StoredCompletionsRunDataSource + description: | + A StoredCompletionsRunDataSource configuration describing a set of filters properties: + type: + type: string + enum: + - stored_completions + default: stored_completions + description: The type of source. Always `stored_completions`. + x-stainless-const: true + metadata: + $ref: '#/components/schemas/Metadata' model: - description: | - One of the available [TTS models](https://developers.openai.com/api/docs/guides/text-to-speech): `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`. anyOf: - type: string - - type: string - enum: - - tts-1 - - tts-1-hd - - gpt-4o-mini-tts - - gpt-4o-mini-tts-2025-12-15 - x-stainless-nominal: false - x-oaiTypeLabel: string - input: - type: string - description: The text to generate audio for. The maximum length is 4096 characters. - maxLength: 4096 - instructions: - type: string - description: Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`. - maxLength: 4096 - voice: - description: 'The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the voices are available in the [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).' - $ref: '#/components/schemas/VoiceIdsOrCustomVoice' - response_format: - description: The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`. - default: mp3 - type: string - enum: - - mp3 - - opus - - aac - - flac - - wav - - pcm - speed: - description: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default. - type: number - default: 1 - minimum: 0.25 - maximum: 4 - stream_format: - description: The format to stream the audio in. Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`. - type: string - default: audio - enum: - - sse - - audio + description: An optional model to filter by (e.g., 'gpt-6-astra'). + - type: 'null' + created_after: + anyOf: + - type: integer + description: An optional Unix timestamp to filter items created after this time. + - type: 'null' + created_before: + anyOf: + - type: integer + description: An optional Unix timestamp to filter items created before this time. + - type: 'null' + limit: + anyOf: + - type: integer + description: An optional maximum number of items to return. + - type: 'null' required: - - model - - input - - voice - CreateSpeechResponseStreamEvent: - anyOf: - - $ref: '#/components/schemas/SpeechAudioDeltaEvent' - - $ref: '#/components/schemas/SpeechAudioDoneEvent' - discriminator: - propertyName: type - CreateSpendAlertBody: + - type + x-oaiMeta: + name: The stored completions data source object used to configure an individual run + group: eval runs + example: | + { + "type": "stored_completions", + "model": "gpt-6-astra", + "created_after": 1668124800, + "created_before": 1668124900, + "limit": 100, + "metadata": {} + } + FileExpirationAfter: type: object - description: Parameters for creating or updating a spend alert. + title: File expiration policy + description: The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted. properties: - threshold_amount: - type: integer - minimum: 0 - description: The alert threshold amount, in cents. - currency: - type: string - enum: - - USD - description: The currency for the threshold amount. - interval: + anchor: + description: 'Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`.' type: string enum: - - month - description: The time interval for evaluating spend against the threshold. - notification_channel: - $ref: '#/components/schemas/SpendAlertNotificationChannel' + - created_at + x-stainless-const: true + seconds: + description: The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days). + type: integer + format: int64 + minimum: 3600 + maximum: 2592000 required: - - threshold_amount - - currency - - interval - - notification_channel - CreateThreadAndRunRequest: + - anchor + - seconds + FilePath: type: object - additionalProperties: false + title: File path + description: | + A path to a file. properties: - assistant_id: - description: The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) to use to execute this run. + type: type: string - thread: - $ref: '#/components/schemas/CreateThreadRequest' - model: - description: The ID of the [Model](https://developers.openai.com/api/reference/resources/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used. - nullable: true - anyOf: - - type: string - - type: string - enum: - - gpt-5 - - gpt-5-mini - - gpt-5-nano - - gpt-5-2025-08-07 - - gpt-5-mini-2025-08-07 - - gpt-5-nano-2025-08-07 - - gpt-4.1 - - gpt-4.1-mini - - gpt-4.1-nano - - gpt-4.1-2025-04-14 - - gpt-4.1-mini-2025-04-14 - - gpt-4.1-nano-2025-04-14 - - gpt-4o - - gpt-4o-2024-11-20 - - gpt-4o-2024-08-06 - - gpt-4o-2024-05-13 - - gpt-4o-mini - - gpt-4o-mini-2024-07-18 - - gpt-4.5-preview - - gpt-4.5-preview-2025-02-27 - - gpt-4-turbo - - gpt-4-turbo-2024-04-09 - - gpt-4-0125-preview - - gpt-4-turbo-preview - - gpt-4-1106-preview - - gpt-4-vision-preview - - gpt-4 - - gpt-4-0314 - - gpt-4-0613 - - gpt-4-32k - - gpt-4-32k-0314 - - gpt-4-32k-0613 - - gpt-3.5-turbo - - gpt-3.5-turbo-16k - - gpt-3.5-turbo-0613 - - gpt-3.5-turbo-1106 - - gpt-3.5-turbo-0125 - - gpt-3.5-turbo-16k-0613 - x-oaiTypeLabel: string - instructions: - description: Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis. + description: | + The type of the file path. Always `file_path`. + enum: + - file_path + x-stainless-const: true + file_id: type: string - nullable: true - tools: - description: Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. - nullable: true - type: array - maxItems: 20 - items: - $ref: '#/components/schemas/AssistantTool' - tool_resources: - type: object description: | - A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - properties: - code_interpreter: - type: object - properties: - file_ids: - type: array - description: | - A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. - default: [] - maxItems: 20 - items: - type: string - file_search: - type: object - properties: - vector_store_ids: - type: array - description: | - The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. - maxItems: 1 - items: - type: string - nullable: true - metadata: - $ref: '#/components/schemas/Metadata' - temperature: - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 - nullable: true + The ID of the file. + index: + type: integer description: | - What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - top_p: + The index of the file in the list of files. + required: + - type + - file_id + - index + FileSearchRanker: + type: string + description: The ranker to use for the file search. If not specified will use the `auto` ranker. + enum: + - auto + - default_2024_08_21 + FileSearchRankingOptions: + title: File search tool call ranking options + type: object + description: | + The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. + + See the [file search tool documentation](https://developers.openai.com/api/docs/guides/tools-file-search#retrieval-customization) for more information. + properties: + ranker: + $ref: '#/components/schemas/FileSearchRanker' + score_threshold: type: number + description: The score threshold for the file search. All values must be a floating point number between 0 and 1. minimum: 0 maximum: 1 - default: 1 - example: 1 - nullable: true - description: | - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or temperature but not both. - stream: - type: boolean - nullable: true - description: | - If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message. - max_prompt_tokens: - type: integer - nullable: true - description: | - The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - minimum: 256 - max_completion_tokens: - type: integer - nullable: true - description: | - The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - minimum: 256 - truncation_strategy: - allOf: - - $ref: '#/components/schemas/TruncationObject' - - nullable: true - tool_choice: - allOf: - - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' - - nullable: true - parallel_tool_calls: - $ref: '#/components/schemas/ParallelToolCalls' - response_format: - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' - nullable: true required: - - assistant_id - CreateThreadRequest: + - score_threshold + FileSearchToolCall: type: object + title: File search tool call description: | - Options to create a new thread. If no thread is provided when running a - request, an empty thread will be created. - additionalProperties: false + The results of a file search tool call. See the + [file search guide](https://developers.openai.com/api/docs/guides/tools-file-search) for more information. properties: - messages: - description: A list of [messages](https://developers.openai.com/api/docs/assistants/migration) to start the thread with. + id: + type: string + description: | + The unique ID of the file search tool call. + type: + type: string + enum: + - file_search_call + description: | + The type of the file search tool call. Always `file_search_call`. + x-stainless-const: true + status: + type: string + description: | + The status of the file search tool call. One of `in_progress`, + `searching`, `incomplete` or `failed`, + enum: + - in_progress + - searching + - completed + - incomplete + - failed + queries: type: array items: - $ref: '#/components/schemas/CreateMessageRequest' - tool_resources: + type: string + description: | + The queries used to search for files. + results: anyOf: - - type: object + - type: array description: | - A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - properties: - code_interpreter: - type: object - properties: - file_ids: - type: array - description: | - A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. - default: [] - maxItems: 20 - items: - type: string - file_search: - type: object - properties: - vector_store_ids: - type: array - description: | - The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread. - maxItems: 1 - items: - type: string - vector_stores: - type: array - description: | - A helper to create a [vector store](https://developers.openai.com/api/reference/resources/vector_stores) with file_ids and attach it to this thread. There can be a maximum of 1 vector store attached to the thread. - maxItems: 1 - items: - type: object - properties: - file_ids: - type: array - description: | - A list of [file](https://developers.openai.com/api/reference/resources/files) IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files. - maxItems: 100000000 - items: - type: string - chunking_strategy: - type: object - description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. - anyOf: - - type: object - title: Auto Chunking Strategy - description: The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`. - additionalProperties: false - properties: - type: - type: string - description: Always `auto`. - enum: - - auto - x-stainless-const: true - required: - - type - - type: object - title: Static Chunking Strategy - additionalProperties: false - properties: - type: - type: string - description: Always `static`. - enum: - - static - x-stainless-const: true - static: - type: object - additionalProperties: false - properties: - max_chunk_size_tokens: - type: integer - minimum: 100 - maximum: 4096 - description: The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`. - chunk_overlap_tokens: - type: integer - description: | - The number of tokens that overlap between chunks. The default value is `400`. - - Note that the overlap must not exceed half of `max_chunk_size_tokens`. - required: - - max_chunk_size_tokens - - chunk_overlap_tokens - required: - - type - - static - discriminator: - propertyName: type - metadata: - $ref: '#/components/schemas/Metadata' - anyOf: - - required: - - vector_store_ids - - required: - - vector_stores + The results of the file search tool call. + items: + type: object + properties: + file_id: + type: string + description: | + The unique ID of the file. + text: + type: string + description: | + The text that was retrieved from the file. + filename: + type: string + description: | + The name of the file. + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + score: + type: number + format: float + description: | + The relevance score of the file - a value between 0 and 1. - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - CreateTranscriptionRequest: + required: + - id + - type + - status + - queries + FineTuneChatCompletionRequestAssistantMessage: + allOf: + - type: object + title: Assistant message + deprecated: false + properties: + weight: + type: integer + enum: + - 0 + - 1 + description: Controls whether the assistant message is trained against (0 or 1) + - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage' + required: + - role + FineTuneDPOHyperparameters: type: object - additionalProperties: false + description: The hyperparameters used for the DPO fine-tuning job. properties: - file: + beta: description: | - The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. - The request must include enough format metadata for the file to be identified. We recommend an extension-bearing filename and an appropriate content type. - type: string - x-oaiTypeLabel: file - format: binary - x-oaiMeta: - exampleFilePath: speech.mp3 - model: + The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model. + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0 + maximum: 2 + exclusiveMinimum: true + batch_size: description: | - ID of the model to use. The options are `gpt-transcribe`, `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `whisper-1` (which is powered by our open source Whisper V2 model), and `gpt-4o-transcribe-diarize`. - example: gpt-4o-transcribe + Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. + default: auto anyOf: - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 256 + learning_rate_multiplier: + description: | + Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. + anyOf: - type: string enum: - - whisper-1 - - gpt-transcribe - - gpt-4o-transcribe - - gpt-4o-mini-transcribe - - gpt-4o-mini-transcribe-2025-12-15 - - gpt-4o-transcribe-diarize + - auto x-stainless-const: true - x-stainless-nominal: false - x-oaiTypeLabel: string - language: + - type: number + minimum: 0 + exclusiveMinimum: true + n_epochs: description: | - The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format will improve accuracy and latency. + The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. + default: auto + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 50 + FineTuneDPOMethod: + type: object + description: Configuration for the DPO fine-tuning method. + properties: + hyperparameters: + $ref: '#/components/schemas/FineTuneDPOHyperparameters' + FineTuneMethod: + type: object + description: The method used for fine-tuning. + properties: + type: type: string - languages: + description: The type of method. Is either `supervised`, `dpo`, or `reinforcement`. + enum: + - supervised + - dpo + - reinforcement + supervised: + $ref: '#/components/schemas/FineTuneSupervisedMethod' + dpo: + $ref: '#/components/schemas/FineTuneDPOMethod' + reinforcement: + $ref: '#/components/schemas/FineTuneReinforcementMethod' + required: + - type + FineTuneReinforcementHyperparameters: + type: object + description: The hyperparameters used for the reinforcement fine-tuning job. + properties: + batch_size: description: | - Possible languages of the input audio, in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format. Supported by `gpt-transcribe`. - type: array - minItems: 1 - items: - type: string - keywords: + Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. + default: auto + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 256 + learning_rate_multiplier: description: | - Words or phrases to guide transcription of the input audio. Supported by `gpt-transcribe`. - type: array - items: - type: string - prompt: + Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0 + exclusiveMinimum: true + n_epochs: description: | - An optional text to guide the model's style or continue a previous audio segment. The [prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting) should match the audio language. This field is not supported when using `gpt-4o-transcribe-diarize`. + The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. + default: auto + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 50 + reasoning_effort: + description: | + Level of reasoning effort. type: string - response_format: - $ref: '#/components/schemas/AudioResponseFormat' - temperature: + enum: + - default + - low + - medium + - high + default: default + compute_multiplier: description: | - The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit. - type: number - default: 0 - include: + Multiplier on amount of compute used for exploring search space during training. + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0.00001 + maximum: 10 + exclusiveMinimum: true + eval_interval: description: | - Additional information to include in the transcription response. - `logprobs` will return the log probabilities of the tokens in the - response to understand the model's confidence in the transcription. - `logprobs` only works with response_format set to `json` and only with - the models `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `gpt-4o-mini-transcribe-2025-12-15`. This field is not supported when using `gpt-4o-transcribe-diarize`. - type: array - items: - $ref: '#/components/schemas/TranscriptionInclude' - timestamp_granularities: + The number of training steps between evaluation runs. + default: auto + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + eval_samples: description: | - The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency. - This option is not available for `gpt-4o-transcribe-diarize`. - type: array - items: - type: string + Number of evaluation samples to generate per training step. + default: auto + anyOf: + - type: string enum: - - word - - segment - default: - - segment - stream: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + FineTuneReinforcementMethod: + type: object + description: Configuration for the reinforcement fine-tuning method. + properties: + grader: + type: object + description: The grader used for the fine-tuning job. anyOf: - - description: | - If set to true, the model response data will be streamed to the client - as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). - See the [Streaming section of the Speech-to-Text guide](https://developers.openai.com/api/docs/guides/speech-to-text?lang=curl#streaming) - for more information. - - Note: Streaming is not supported for the `whisper-1` model and will be ignored. - type: boolean - default: false - - type: 'null' - chunking_strategy: - $ref: '#/components/schemas/TranscriptionChunkingStrategy' - known_speaker_names: + - $ref: '#/components/schemas/GraderStringCheck' + - $ref: '#/components/schemas/GraderTextSimilarity' + - $ref: '#/components/schemas/GraderPython' + - $ref: '#/components/schemas/GraderScoreModel' + - $ref: '#/components/schemas/GraderMulti' + hyperparameters: + $ref: '#/components/schemas/FineTuneReinforcementHyperparameters' + required: + - grader + FineTuneSupervisedHyperparameters: + type: object + description: The hyperparameters used for the fine-tuning job. + properties: + batch_size: description: | - Optional list of speaker names that correspond to the audio samples provided in `known_speaker_references[]`. Each entry should be a short identifier (for example `customer` or `agent`). Up to 4 speakers are supported. - type: array - maxItems: 4 - items: - type: string - known_speaker_references: + Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. + default: auto + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 256 + learning_rate_multiplier: description: | - Optional list of audio samples (as [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)) that contain known speaker references matching `known_speaker_names[]`. Each sample must be between 2 and 10 seconds, and can use any of the same input audio formats supported by `file`. - type: array - maxItems: 4 - items: - type: string - required: - - file - - model - CreateTranscriptionResponseDiarizedJson: + Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: number + minimum: 0 + exclusiveMinimum: true + n_epochs: + description: | + The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. + default: auto + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 50 + FineTuneSupervisedMethod: type: object + description: Configuration for the supervised fine-tuning method. + properties: + hyperparameters: + $ref: '#/components/schemas/FineTuneSupervisedHyperparameters' + FineTuningCheckpointPermission: + type: object + title: FineTuningCheckpointPermission description: | - Represents a diarized transcription response returned by the model, including the combined transcript and speaker-segment annotations. + The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint. properties: - task: + id: type: string - description: The type of task that was run. Always `transcribe`. + description: The permission identifier, which can be referenced in the API endpoints. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the permission was created. + project_id: + type: string + description: The project identifier that the permission is for. + object: + type: string + description: The object type, which is always "checkpoint.permission". enum: - - transcribe + - checkpoint.permission x-stainless-const: true - duration: - type: number - format: double - description: Duration of the input audio in seconds. - text: - type: string - description: The concatenated transcript text for the entire audio input. - segments: - type: array - description: Segments of the transcript annotated with timestamps and speaker labels. - items: - $ref: '#/components/schemas/TranscriptionDiarizedSegment' - usage: - type: object - description: Token or duration usage statistics for the request. - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/TranscriptTextUsageTokens' - title: Token Usage - - $ref: '#/components/schemas/TranscriptTextUsageDuration' - title: Duration Usage required: - - task - - duration - - text - - segments + - created_at + - id + - object + - project_id x-oaiMeta: - name: The transcription object (Diarized JSON) - group: audio + name: The fine-tuned model checkpoint permission object example: | { - "task": "transcribe", - "duration": 42.7, - "text": "Agent: Thanks for calling OpenAI support.\nCustomer: Hi, I need help with diarization.", - "segments": [ - { - "type": "transcript.text.segment", - "id": "seg_001", - "start": 0.0, - "end": 5.2, - "text": "Thanks for calling OpenAI support.", - "speaker": "agent" - }, - { - "type": "transcript.text.segment", - "id": "seg_002", - "start": 5.2, - "end": 12.8, - "text": "Hi, I need help with diarization.", - "speaker": "A" - } - ], - "usage": { - "type": "duration", - "seconds": 43 - } + "object": "checkpoint.permission", + "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", + "created_at": 1712211699, + "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" } - CreateTranscriptionResponseJson: + FineTuningIntegration: type: object - description: Represents a transcription response returned by model, based on the provided input. + title: Fine-Tuning Job Integration + required: + - type + - wandb properties: - text: + type: type: string - description: The transcribed text. - languages: - type: array - description: | - The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected. - items: - $ref: '#/components/schemas/TranscriptionLanguage' - logprobs: - type: array - optional: true + description: The type of the integration being enabled for the fine-tuning job + enum: + - wandb + x-stainless-const: true + wandb: + type: object description: | - The log probabilities of the tokens in the transcription. Only returned with the models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added to the `include` array. - items: - type: object - properties: - token: + The settings for your integration with Weights and Biases. This payload specifies the project that + metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags + to your run, and set a default entity (team, username, etc) to be associated with your run. + required: + - project + properties: + project: + description: | + The name of the project that the new run will be created under. + type: string + example: my-wandb-project + name: + anyOf: + - description: | + A display name to set for the run. If not set, we will use the Job ID as the name. type: string - description: The token in the transcription. - logprob: - type: number - description: The log probability of the token. - bytes: - type: array - items: - type: number - description: The bytes of the token. - usage: - type: object - description: Token usage statistics for the request. - anyOf: - - $ref: '#/components/schemas/TranscriptTextUsageTokens' - title: Token Usage - - $ref: '#/components/schemas/TranscriptTextUsageDuration' - title: Duration Usage - discriminator: - propertyName: type - required: - - text - x-oaiMeta: - name: The transcription object (JSON) - group: audio - example: | - { - "text": "Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.", - "usage": { - "type": "tokens", - "input_tokens": 14, - "input_token_details": { - "text_tokens": 10, - "audio_tokens": 4 - }, - "output_tokens": 101, - "total_tokens": 115 - } - } - CreateTranscriptionResponseStreamEvent: - anyOf: - - $ref: '#/components/schemas/TranscriptTextSegmentEvent' - - $ref: '#/components/schemas/TranscriptTextDeltaEvent' - - $ref: '#/components/schemas/TranscriptTextDoneEvent' - discriminator: - propertyName: type - CreateTranscriptionResponseVerboseJson: + - type: 'null' + entity: + anyOf: + - description: | + The entity to use for the run. This allows you to set the team or username of the WandB user that you would + like associated with the run. If not set, the default entity for the registered WandB API key is used. + type: string + - type: 'null' + tags: + description: | + A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some + default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}". + type: array + items: + type: string + example: custom-tag + FineTuningJob: type: object - description: Represents a verbose json transcription response returned by model, based on the provided input. + title: FineTuningJob + description: | + The `fine_tuning.job` object represents a fine-tuning job that has been created through the API. properties: - language: + id: + type: string + description: The object identifier, which can be referenced in the API endpoints. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the fine-tuning job was created. + error: + anyOf: + - type: object + description: For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure. + properties: + code: + type: string + description: A machine-readable error code. + message: + type: string + description: A human-readable error message. + param: + anyOf: + - type: string + description: The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific. + - type: 'null' + required: + - code + - message + - param + - type: 'null' + fine_tuned_model: + anyOf: + - type: string + description: The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running. + - type: 'null' + finished_at: + anyOf: + - type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running. + - type: 'null' + hyperparameters: + type: object + description: The hyperparameters used for the fine-tuning job. This value will only be returned when running `supervised` jobs. + properties: + batch_size: + anyOf: + - description: | + Number of examples in each batch. A larger batch size means that model parameters + are updated less frequently, but with lower variance. + default: auto + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + - type: integer + minimum: 1 + maximum: 256 + title: Auto + - type: 'null' + title: Manual + learning_rate_multiplier: + description: | + Scaling factor for the learning rate. A smaller learning rate may be useful to avoid + overfitting. + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + title: Auto + - type: number + minimum: 0 + exclusiveMinimum: true + n_epochs: + description: | + The number of epochs to train the model for. An epoch refers to one full cycle + through the training dataset. + default: auto + anyOf: + - type: string + enum: + - auto + x-stainless-const: true + title: Auto + - type: integer + minimum: 1 + maximum: 50 + model: type: string - description: The language of the input audio. - duration: - type: number - format: double - description: The duration of the input audio. - text: + description: The base model that is being fine-tuned. + object: type: string - description: The transcribed text. - words: - type: array - description: Extracted words and their corresponding timestamps. - items: - $ref: '#/components/schemas/TranscriptionWord' - segments: + description: The object type, which is always "fine_tuning.job". + enum: + - fine_tuning.job + x-stainless-const: true + organization_id: + type: string + description: The organization that owns the fine-tuning job. + result_files: type: array - description: Segments of the transcribed text and their corresponding details. + description: The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](https://developers.openai.com/api/reference/resources/files/methods/content). items: - $ref: '#/components/schemas/TranscriptionSegment' - usage: - $ref: '#/components/schemas/TranscriptTextUsageDuration' + type: string + example: file-abc123 + status: + type: string + description: The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. + enum: + - validating_files + - queued + - running + - succeeded + - failed + - cancelled + trained_tokens: + anyOf: + - type: integer + description: The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running. + - type: 'null' + training_file: + type: string + description: The file ID used for training. You can retrieve the training data with the [Files API](https://developers.openai.com/api/reference/resources/files/methods/content). + validation_file: + anyOf: + - type: string + description: The file ID used for validation. You can retrieve the validation results with the [Files API](https://developers.openai.com/api/reference/resources/files/methods/content). + - type: 'null' + integrations: + anyOf: + - type: array + description: A list of integrations to enable for this fine-tuning job. + maxItems: 5 + items: + anyOf: + - $ref: '#/components/schemas/FineTuningIntegration' + discriminator: + propertyName: type + - type: 'null' + seed: + type: integer + description: The seed used for the fine-tuning job. + estimated_finish: + anyOf: + - type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running. + - type: 'null' + method: + $ref: '#/components/schemas/FineTuneMethod' + metadata: + $ref: '#/components/schemas/Metadata' required: - - language - - duration - - text + - created_at + - error + - finished_at + - fine_tuned_model + - hyperparameters + - id + - model + - object + - organization_id + - result_files + - status + - trained_tokens + - training_file + - validation_file + - seed x-oaiMeta: - name: The transcription object (Verbose JSON) - group: audio + name: The fine-tuning job object example: | { - "task": "transcribe", - "language": "english", - "duration": 8.470000267028809, - "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.", - "segments": [ - { - "id": 0, - "seek": 0, - "start": 0.0, - "end": 3.319999933242798, - "text": " The beach was a popular spot on a hot summer day.", - "tokens": [ - 50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530 - ], - "temperature": 0.0, - "avg_logprob": -0.2860786020755768, - "compression_ratio": 1.2363636493682861, - "no_speech_prob": 0.00985979475080967 - }, - ... + "object": "fine_tuning.job", + "id": "ftjob-abc123", + "model": "davinci-002", + "created_at": 1692661014, + "finished_at": 1692661190, + "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", + "organization_id": "org-123", + "result_files": [ + "file-abc123" ], - "usage": { - "type": "duration", - "seconds": 9 + "status": "succeeded", + "validation_file": null, + "training_file": "file-abc123", + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + }, + "trained_tokens": 5768, + "integrations": [], + "seed": 0, + "estimated_finish": 0, + "method": { + "type": "supervised", + "supervised": { + "hyperparameters": { + "n_epochs": 4, + "batch_size": 1, + "learning_rate_multiplier": 1.0 + } + } + }, + "metadata": { + "key": "value" } } - CreateTranslationRequest: + FineTuningJobCheckpoint: type: object - additionalProperties: false + title: FineTuningJobCheckpoint + description: | + The `fine_tuning.job.checkpoint` object represents a model checkpoint for a fine-tuning job that is ready to use. properties: - file: - description: | - The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. The request must include enough format metadata for the file to be identified. We recommend an extension-bearing filename and an appropriate content type. + id: type: string - x-oaiTypeLabel: file - format: binary - x-oaiMeta: - exampleFilePath: speech.mp3 - model: - description: | - ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available. - example: whisper-1 - anyOf: - - type: string - - type: string - enum: - - whisper-1 - x-stainless-const: true - x-oaiTypeLabel: string - prompt: - description: | - An optional text to guide the model's style or continue a previous audio segment. The [prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting) should be in English. + description: The checkpoint identifier, which can be referenced in the API endpoints. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the checkpoint was created. + fine_tuned_model_checkpoint: type: string - response_format: - description: | - The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. + description: The name of the fine-tuned checkpoint model that is created. + step_number: + type: integer + description: The step number that the checkpoint was created at. + metrics: + type: object + description: Metrics at the step number during the fine-tuning job. + properties: + step: + type: number + train_loss: + type: number + train_mean_token_accuracy: + type: number + valid_loss: + type: number + valid_mean_token_accuracy: + type: number + full_valid_loss: + type: number + full_valid_mean_token_accuracy: + type: number + fine_tuning_job_id: type: string - enum: - - json - - text - - srt - - verbose_json - - vtt - default: json - temperature: - description: | - The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit. - type: number - default: 0 - required: - - file - - model - CreateTranslationResponseJson: - type: object - properties: - text: + description: The name of the fine-tuning job that this checkpoint was created from. + object: type: string + description: The object type, which is always "fine_tuning.job.checkpoint". + enum: + - fine_tuning.job.checkpoint + x-stainless-const: true required: - - text - CreateTranslationResponseVerboseJson: + - created_at + - fine_tuning_job_id + - fine_tuned_model_checkpoint + - id + - metrics + - object + - step_number + x-oaiMeta: + name: The fine-tuning job checkpoint object + example: | + { + "object": "fine_tuning.job.checkpoint", + "id": "ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P", + "created_at": 1712211699, + "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom_suffix:9ABel2dg:ckpt-step-88", + "fine_tuning_job_id": "ftjob-fpbNQ3H1GrMehXRf8cO97xTN", + "metrics": { + "step": 88, + "train_loss": 0.478, + "train_mean_token_accuracy": 0.924, + "valid_loss": 10.112, + "valid_mean_token_accuracy": 0.145, + "full_valid_loss": 0.567, + "full_valid_mean_token_accuracy": 0.944 + }, + "step_number": 88 + } + FineTuningJobEvent: type: object + description: Fine-tuning job event object properties: - language: - type: string - description: The language of the output translation (always `english`). - duration: - type: number - format: double - description: The duration of the input audio. - text: + object: type: string - description: The translated text. - segments: - type: array - description: Segments of the translated text and their corresponding details. - items: - $ref: '#/components/schemas/TranscriptionSegment' - required: - - language - - duration - - text - CreateUploadRequest: - type: object - additionalProperties: false - properties: - filename: - description: | - The name of the file to upload. + description: The object type, which is always "fine_tuning.job.event". + enum: + - fine_tuning.job.event + x-stainless-const: true + id: type: string - purpose: - description: | - The intended purpose of the uploaded file. - - See the [documentation on File - purposes](https://developers.openai.com/api/reference/resources/files/methods/create#%28resource%29%20files%20%3E%20%28method%29%20create%20%3E%20%28params%29%200%20%3E%20%28param%29%20purpose%20%3E%20%28schema%29). + description: The object identifier. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the fine-tuning job was created. + level: type: string + description: The log level of the event. enum: - - assistants - - batch - - fine-tune - - vision - bytes: - description: | - The number of bytes in the file you are uploading. - type: integer - mime_type: - description: | - The MIME type of the file. - - - This must fall within the supported MIME types for your file purpose. See - the supported MIME types for assistants and vision. + - info + - warn + - error + message: type: string - expires_after: - $ref: '#/components/schemas/FileExpirationAfter' - required: - - filename - - purpose - - bytes - - mime_type - CreateVectorStoreFileBatchRequest: - type: object - additionalProperties: false - properties: - file_ids: - description: A list of [File](https://developers.openai.com/api/reference/resources/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. If `attributes` or `chunking_strategy` are provided, they will be applied to all files in the batch. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `files`. - type: array - minItems: 1 - maxItems: 2000 - items: - type: string - files: - description: A list of objects that each include a `file_id` plus optional `attributes` or `chunking_strategy`. Use this when you need to override metadata for specific files. The global `attributes` or `chunking_strategy` will be ignored and must be specified for each file. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `file_ids`. - type: array - minItems: 1 - maxItems: 2000 - items: - $ref: '#/components/schemas/CreateVectorStoreFileRequest' - chunking_strategy: - $ref: '#/components/schemas/ChunkingStrategyRequestParam' - attributes: - $ref: '#/components/schemas/VectorStoreFileAttributes' - CreateVectorStoreFileRequest: - type: object - additionalProperties: false - properties: - file_id: - description: A [File](https://developers.openai.com/api/reference/resources/files) ID that the vector store should use. Useful for tools like `file_search` that can access files. For multi-file ingestion, we recommend [`file_batches`](https://developers.openai.com/api/reference/resources/vector_stores/subresources/file_batches/methods/create) to minimize per-vector-store write requests. + description: The message of the event. + type: type: string - chunking_strategy: - $ref: '#/components/schemas/ChunkingStrategyRequestParam' - attributes: - $ref: '#/components/schemas/VectorStoreFileAttributes' + description: The type of event. + enum: + - message + - metrics + data: + type: object + description: The data associated with the event. required: - - file_id - CreateVectorStoreRequest: + - id + - object + - created_at + - level + - message + x-oaiMeta: + name: The fine-tuning job event object + example: | + { + "object": "fine_tuning.job.event", + "id": "ftevent-abc123" + "created_at": 1677610602, + "level": "info", + "message": "Created fine-tuning job", + "data": {}, + "type": "message" + } + FunctionAndCustomToolCallOutput: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/InputTextContent' + - $ref: '#/components/schemas/InputImageContent' + - $ref: '#/components/schemas/InputFileContent' + FunctionObject: type: object - additionalProperties: false properties: - file_ids: - description: A list of [File](https://developers.openai.com/api/reference/resources/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. - type: array - maxItems: 500 - items: - type: string - name: - description: The name of the vector store. - type: string description: - description: A description for the vector store. Can be used to describe the vector store's purpose. - type: string - expires_after: - $ref: '#/components/schemas/VectorStoreExpirationAfter' - chunking_strategy: - $ref: '#/components/schemas/ChunkingStrategyRequestParam' - description: The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy. Only applicable if `file_ids` is non-empty. - metadata: - $ref: '#/components/schemas/Metadata' - CreateVoiceConsentRequest: - type: object - additionalProperties: false - properties: - name: - type: string - description: The label to use for this consent recording. - recording: - type: string - format: binary - x-oaiTypeLabel: file - description: | - The consent audio recording file. Maximum size is 10 MiB. - - Supported MIME types: - `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`. - language: type: string - description: The BCP 47 language tag for the consent phrase (for example, `en-US`). - required: - - name - - recording - - language - CreateVoiceRequest: - type: object - additionalProperties: false - properties: + description: A description of what the function does, used by the model to choose when and how to call the function. name: type: string - description: The name of the new voice. - audio_sample: - type: string - format: binary - x-oaiTypeLabel: file - description: | - The sample audio recording file. Maximum size is 10 MiB. - - Supported MIME types: - `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`. - consent: - type: string - description: The consent recording ID (for example, `cons_1234`). + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + parameters: + $ref: '#/components/schemas/FunctionParameters' + strict: + anyOf: + - type: boolean + default: false + description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://developers.openai.com/api/docs/guides/function-calling). + - type: 'null' required: - name - - audio_sample - - consent - CustomToolCall: + FunctionParameters: type: object - title: Custom tool call + description: |- + The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://developers.openai.com/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + Omitting `parameters` defines a function with an empty parameter list. + additionalProperties: true + FunctionToolCall: + type: object + title: Function tool call description: | - A call to a custom tool created by the model. + A tool call to run a function. See the + [function calling guide](https://developers.openai.com/api/docs/guides/function-calling) for more information. properties: - type: + id: type: string - enum: - - custom_tool_call - x-stainless-const: true description: | - The type of the custom tool call. Always `custom_tool_call`. - id: + The unique ID of the function tool call. + type: type: string + enum: + - function_call description: | - The unique ID of the custom tool call in the OpenAI platform. + The type of the function tool call. Always `function_call`. + x-stainless-const: true call_id: type: string description: | - An identifier used to map this custom tool call to a tool call output. + The unique ID of the function tool call generated by the model. caller: anyOf: - $ref: '#/components/schemas/ToolCallCaller' @@ -35379,78 +41545,103 @@ components: namespace: type: string description: | - The namespace of the custom tool being called. + The namespace of the function to run. name: type: string description: | - The name of the custom tool being called. - input: + The name of the function to run. + arguments: type: string description: | - The input for the custom tool call generated by the model. + A JSON string of the arguments to pass to the function. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete async: type: boolean description: | - Whether the custom tool call runs asynchronously. + Whether the function tool call runs asynchronously. required: - type - call_id - name - - input - CustomToolCallOutput: + - arguments + FunctionToolCallOutput: type: object - title: Custom tool call output + title: Function tool call output description: | - The output of a custom tool call from your code, being sent back to the model. + The output of a function tool call. properties: + id: + type: string + description: | + The unique ID of the function tool call output. Populated when this item + is returned via API. type: type: string enum: - - custom_tool_call_output + - function_call_output + description: | + The type of the function tool call output. Always `function_call_output`. x-stainless-const: true + call_id: + type: string description: | - The type of the custom tool call output. Always `custom_tool_call_output`. - id: + The unique ID of the function tool call generated by the model. + name: type: string description: | - The unique ID of the custom tool call output in the OpenAI platform. - call_id: + The name of the tool that produced the output. + namespace: type: string description: | - The call ID, used to map this custom tool call output to a custom tool call. + The namespace of the tool that produced the output. caller: anyOf: - $ref: '#/components/schemas/ToolCallCallerParam' - type: 'null' output: description: | - The output from the custom tool call generated by your code. + The output from the function call generated by your code. Can be a string or an list of output content. anyOf: - type: string description: | - A string of the output of the custom tool call. + A string of the output of the function call. title: string output - type: array items: $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' title: output content list description: | - Text, image, or file output of the custom tool call. + Text, image, or file output of the function call. + status: + type: string + description: | + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete required: - type - - call_id - output - CustomToolCallOutputResource: - title: ResponseCustomToolCallOutputItem + FunctionToolCallOutputResource: allOf: - - $ref: '#/components/schemas/CustomToolCallOutput' + - $ref: '#/components/schemas/FunctionToolCallOutput' - type: object properties: id: type: string description: | - The unique ID of the custom tool call output item. + The unique ID of the function call tool output. status: description: | The status of the item. One of `in_progress`, `completed`, or @@ -35463,16 +41654,15 @@ components: required: - id - status - CustomToolCallResource: - title: ResponseCustomToolCallItem + FunctionToolCallResource: allOf: - - $ref: '#/components/schemas/CustomToolCall' + - $ref: '#/components/schemas/FunctionToolCall' - type: object properties: id: type: string description: | - The unique ID of the custom tool call item. + The unique ID of the function tool call. status: description: | The status of the item. One of `in_progress`, `completed`, or @@ -35485,1764 +41675,1814 @@ components: required: - id - status - CustomToolChatCompletions: + GraderLabelModel: type: object - title: Custom tool + title: LabelModelGrader description: | - A custom tool that processes input using a specified format. + A LabelModelGrader object which uses a model to assign labels to each item + in the evaluation. properties: type: + description: The object type, which is always `label_model`. type: string enum: - - custom - description: The type of the custom tool. Always `custom`. + - label_model x-stainless-const: true - custom: - type: object - title: Custom tool properties - description: | - Properties of the custom tool. - properties: - name: - type: string - description: The name of the custom tool, used to identify it in tool calls. - description: - type: string - description: | - Optional description of the custom tool, used to provide more context. - format: - description: | - The input format for the custom tool. Default is unconstrained text. - anyOf: - - type: object - title: Text format - description: Unconstrained free-form text. - properties: - type: - type: string - enum: - - text - description: Unconstrained text format. Always `text`. - x-stainless-const: true - required: - - type - additionalProperties: false - - type: object - title: Grammar format - description: A grammar defined by the user. - properties: - type: - type: string - enum: - - grammar - description: Grammar format. Always `grammar`. - x-stainless-const: true - grammar: - type: object - title: Grammar format - description: Your chosen grammar. - properties: - definition: - type: string - description: The grammar definition. - syntax: - type: string - description: The syntax of the grammar definition. One of `lark` or `regex`. - enum: - - lark - - regex - required: - - definition - - syntax - required: - - type - - grammar - additionalProperties: false - discriminator: - propertyName: type - required: - - name + name: + type: string + description: The name of the grader. + model: + type: string + description: The model to use for the evaluation. Must support structured outputs. + input: + type: array + items: + $ref: '#/components/schemas/EvalItem' + labels: + type: array + items: + type: string + description: The labels to assign to each item in the evaluation. + passing_labels: + type: array + items: + type: string + description: The labels that indicate a passing result. Must be a subset of labels. required: - type - - custom - DeleteAssistantResponse: + - model + - input + - passing_labels + - labels + - name + x-oaiMeta: + name: Label Model Grader + group: graders + example: | + { + "name": "First label grader", + "type": "label_model", + "model": "gpt-4o-2024-08-06", + "input": [ + { + "type": "message", + "role": "system", + "content": { + "type": "input_text", + "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" + } + }, + { + "type": "message", + "role": "user", + "content": { + "type": "input_text", + "text": "Statement: {{item.response}}" + } + } + ], + "passing_labels": [ + "positive" + ], + "labels": [ + "positive", + "neutral", + "negative" + ] + } + GraderMulti: type: object + title: MultiGrader + description: A MultiGrader object combines the output of multiple graders to produce a single score. properties: - id: - type: string - deleted: - type: boolean - object: + type: type: string enum: - - assistant.deleted + - multi + default: multi + description: The object type, which is always `multi`. x-stainless-const: true + name: + type: string + description: The name of the grader. + graders: + anyOf: + - $ref: '#/components/schemas/GraderStringCheck' + - $ref: '#/components/schemas/GraderTextSimilarity' + - $ref: '#/components/schemas/GraderPython' + - $ref: '#/components/schemas/GraderScoreModel' + - $ref: '#/components/schemas/GraderLabelModel' + calculate_output: + type: string + description: A formula to calculate the output based on grader results. required: - - id - - object - - deleted - DeleteCertificateResponse: + - name + - type + - graders + - calculate_output + x-oaiMeta: + name: Multi Grader + group: graders + example: | + { + "type": "multi", + "name": "example multi grader", + "graders": [ + { + "type": "text_similarity", + "name": "example text similarity grader", + "input": "The graded text", + "reference": "The reference text", + "evaluation_metric": "fuzzy_match" + }, + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + ], + "calculate_output": "0.5 * text_similarity_score + 0.5 * string_check_score)" + } + GraderPython: type: object + title: PythonGrader + description: | + A PythonGrader object that runs a python script on the input. properties: - object: + type: + type: string + enum: + - python + description: The object type, which is always `python`. x-stainless-const: true - description: The object type, must be `certificate.deleted`. - const: certificate.deleted - id: + name: type: string - description: The ID of the certificate that was deleted. + description: The name of the grader. + source: + type: string + description: The source code of the python script. + image_tag: + type: string + description: The image tag to use for the python script. required: - - object - - id - DeleteFileResponse: + - type + - name + - source + x-oaiMeta: + name: Python Grader + group: graders + example: | + { + "type": "python", + "name": "Example python grader", + "image_tag": "2025-05-08", + "source": """ + def grade(sample: dict, item: dict) -> float: + \""" + Returns 1.0 if `output_text` equals `label`, otherwise 0.0. + \""" + output = sample.get("output_text") + label = item.get("label") + return 1.0 if output == label else 0.0 + """, + } + GraderScoreModel: type: object + title: ScoreModelGrader + description: | + A ScoreModelGrader object that uses a model to assign a score to the input. properties: - id: - type: string - object: + type: type: string enum: - - file + - score_model + description: The object type, which is always `score_model`. x-stainless-const: true - deleted: - type: boolean + name: + type: string + description: The name of the grader. + model: + type: string + description: The model to use for the evaluation. + sampling_params: + type: object + description: The sampling parameters for the model. + properties: + seed: + anyOf: + - type: integer + description: | + A seed value to initialize the randomness, during sampling. + - type: 'null' + top_p: + anyOf: + - type: number + default: 1 + example: 1 + description: | + An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + - type: 'null' + temperature: + anyOf: + - type: number + description: | + A higher temperature increases randomness in the outputs. + - type: 'null' + max_completions_tokens: + anyOf: + - type: integer + minimum: 1 + description: | + The maximum number of tokens the grader model may generate in its response. + - type: 'null' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + input: + type: array + items: + $ref: '#/components/schemas/EvalItem' + description: | + The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings. + range: + type: array + items: + type: number + min_items: 2 + max_items: 2 + description: The range of the score. Defaults to `[0, 1]`. required: - - id - - object - - deleted - DeleteFineTuningCheckpointPermissionResponse: + - type + - name + - input + - model + x-oaiMeta: + name: Score Model Grader + group: graders + example: | + { + "type": "score_model", + "name": "Example score model grader", + "input": [ + { + "role": "user", + "content": [ + { + "type": "input_text", + "text": ( + "Score how close the reference answer is to the model answer. Score 1.0 if they are the same and 0.0 if they are different." + " Return just a floating point score\n\n" + " Reference answer: {{item.label}}\n\n" + " Model answer: {{sample.output_text}}" + ) + }, + { + "type": "input_image", + "image_url": "https://example.com/reference.png", + "file_id": null, + "detail": "auto" + } + ], + } + ], + "model": "gpt-5-mini", + "sampling_params": { + "temperature": 1, + "top_p": 1, + "seed": 42, + "max_completions_tokens": 32768, + "reasoning_effort": "medium" + }, + } + GraderStringCheck: type: object + title: StringCheckGrader + description: | + A StringCheckGrader object that performs a string comparison between input and reference using a specified operation. properties: - id: - type: string - description: The ID of the fine-tuned model checkpoint permission that was deleted. - object: + type: type: string - description: The object type, which is always "checkpoint.permission". enum: - - checkpoint.permission + - string_check + description: The object type, which is always `string_check`. x-stainless-const: true - deleted: - type: boolean - description: Whether the fine-tuned model checkpoint permission was successfully deleted. + name: + type: string + description: The name of the grader. + input: + type: string + description: The input text. This may include template strings. + reference: + type: string + description: The reference text. This may include template strings. + operation: + type: string + enum: + - eq + - ne + - like + - ilike + description: The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`. required: - - id - - object - - deleted - DeleteMessageResponse: + - type + - name + - input + - reference + - operation + x-oaiMeta: + name: String Check Grader + group: graders + example: | + { + "type": "string_check", + "name": "Example string check grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "operation": "eq" + } + GraderTextSimilarity: type: object + title: TextSimilarityGrader + description: | + A TextSimilarityGrader object which grades text based on similarity metrics. properties: - id: - type: string - deleted: - type: boolean - object: + type: type: string enum: - - thread.message.deleted + - text_similarity + default: text_similarity + description: The type of grader. x-stainless-const: true - required: - - id - - object - - deleted - DeleteModelResponse: - type: object - properties: - id: + name: type: string - deleted: - type: boolean - object: + description: The name of the grader. + input: type: string - required: - - id - - object - - deleted - DeleteThreadResponse: - type: object - properties: - id: + description: The text being graded. + reference: type: string - deleted: - type: boolean - object: + description: The text being graded against. + evaluation_metric: type: string enum: - - thread.deleted - x-stainless-const: true + - cosine + - fuzzy_match + - bleu + - gleu + - meteor + - rouge_1 + - rouge_2 + - rouge_3 + - rouge_4 + - rouge_5 + - rouge_l + description: "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n" required: - - id - - object - - deleted - DeleteVectorStoreFileResponse: + - type + - name + - input + - reference + - evaluation_metric + x-oaiMeta: + name: Text Similarity Grader + group: graders + example: | + { + "type": "text_similarity", + "name": "Example text similarity grader", + "input": "{{sample.output_text}}", + "reference": "{{item.label}}", + "evaluation_metric": "fuzzy_match" + } + Group: type: object + description: Summary information about a group returned in role assignment responses. properties: - id: - type: string - deleted: - type: boolean object: type: string enum: - - vector_store.file.deleted + - group + description: Always `group`. x-stainless-const: true - required: - - id - - object - - deleted - DeleteVectorStoreResponse: - type: object - properties: id: type: string - deleted: - type: boolean - object: + description: Identifier for the group. + name: type: string - enum: - - vector_store.deleted - x-stainless-const: true + description: Display name of the group. + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the group was created. + scim_managed: + type: boolean + description: Whether the group is managed through SCIM. required: - - id - object - - deleted - DeletedConversation: - title: The deleted conversation object - allOf: - - $ref: '#/components/schemas/DeletedConversationResource' + - id + - name + - created_at + - scim_managed x-oaiMeta: - name: The deleted conversation object - group: conversations - DeletedRoleAssignmentResource: + name: The group object + example: | + { + "object": "group", + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "scim_managed": false + } + GroupDeletedResource: type: object - description: Confirmation payload returned after unassigning a role. + description: Confirmation payload returned after deleting a group. properties: object: type: string - description: Identifier for the deleted assignment, such as `group.role.deleted` or `user.role.deleted`. + enum: + - group.deleted + description: Always `group.deleted`. + x-stainless-const: true + id: + type: string + description: Identifier of the deleted group. deleted: type: boolean - description: Whether the assignment was removed. + description: Whether the group was deleted. required: - object + - id - deleted x-oaiMeta: - name: Role assignment deletion confirmation example: | { - "object": "group.role.deleted", + "object": "group.deleted", + "id": "group_01J1F8ABCDXYZ", "deleted": true } - DoneEvent: + GroupListResource: type: object + description: Paginated list of organization groups. properties: - event: + object: type: string enum: - - done + - list + description: Always `list`. x-stainless-const: true data: - type: string - enum: - - '[DONE]' - x-stainless-const: true - required: - - event - - data - description: Occurs when a stream ends. - x-oaiMeta: - dataDescription: '`data` is `[DONE]`' - EasyInputMessage: - type: object - title: Input message - description: | - A message input to the model with a role indicating instruction following - hierarchy. Instructions given with the `developer` or `system` role take - precedence over instructions given with the `user` role. Messages with the - `assistant` role are presumed to have been generated by the model in previous - interactions. - properties: - role: - type: string - description: | - The role of the message input. One of `user`, `assistant`, `system`, or - `developer`. - enum: - - user - - assistant - - system - - developer - content: - description: | - Text, image, or audio input to the model, used to generate a response. - Can also contain previous assistant responses. + type: array + description: Groups returned in the current page. + items: + $ref: '#/components/schemas/GroupResponse' + has_more: + type: boolean + description: Whether additional groups are available when paginating. + next: + description: Cursor to fetch the next page of results, or `null` if there are no more results. anyOf: - type: string - title: Text input - description: | - A text input to the model. - - $ref: '#/components/schemas/InputMessageContentList' - phase: - anyOf: - - $ref: '#/components/schemas/MessagePhase' - type: 'null' - type: - type: string - description: | - The type of the message input. Always `message`. - enum: - - message - x-stainless-const: true required: - - role - - content - EditImageBodyJsonParam: + - object + - data + - has_more + - next + x-oaiMeta: + name: Group list + example: | + { + "object": "list", + "data": [ + { + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "is_scim_managed": false + }, + { + "id": "group_01J1F8PQRMNO", + "name": "Sales", + "created_at": 1711472599, + "is_scim_managed": true + } + ], + "has_more": false, + "next": null + } + GroupMemberUser: type: object - description: | - JSON request body for image edits. - - Use `images` (array of `ImageRefParam`) instead of multipart `image` uploads. - You can reference images via external URLs, data URLs, or uploaded file IDs. - JSON edits support GPT image models only; DALL-E edits require multipart (`dall-e-2` only). + description: Details about a user returned from an organization group membership lookup. properties: - model: - anyOf: - - type: string - - type: string - enum: - - gpt-image-1.5 - - gpt-image-2 - - gpt-image-2-2026-04-21 - - gpt-image-2.5-sunburst - - gpt-image-2.5-sunburst-2026-09-08 - - gpt-image-2.5-flare - - gpt-image-2.5-flare-2026-09-08 - - gpt-image-1 - - gpt-image-1-mini - - chatgpt-image-latest - - type: 'null' - x-oaiTypeLabel: string - default: gpt-image-1.5 - example: gpt-image-1.5 - description: The GPT image model to use for image editing, including `gpt-image-2`, its dated snapshot `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`. - images: - type: array - minItems: 1 - maxItems: 16 - description: | - Input image references to edit. - For GPT image models, you can provide up to 16 images. - items: - $ref: '#/components/schemas/ImageRefParam' - mask: - $ref: '#/components/schemas/ImageRefParam' - prompt: + id: type: string - minLength: 1 - maxLength: 32000 - example: Add a watercolor effect and keep the subject centered - description: A text description of the desired image edit. - n: - anyOf: - - type: integer - minimum: 1 - maximum: 10 - - type: 'null' - default: 1 - example: 1 - description: The number of edited images to generate. - quality: - anyOf: - - type: string - enum: - - low - - medium - - high - - xhigh - - max - - auto - - type: 'null' - default: auto - example: high - description: | - Output quality for GPT image models. The GPT image models support `low`, `medium`, - and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their - `2026-09-08` snapshots, also support `xhigh` and `max`. Defaults to `auto`. - input_fidelity: - anyOf: - - type: string - enum: - - high - - low - - type: 'null' - description: Controls fidelity to the original input image(s). This parameter is supported for GPT image models that support input fidelity. `gpt-image-2` and `gpt-image-2-2026-04-21` ignore this parameter. - size: - anyOf: - - type: string - - type: string - enum: - - auto - - 1024x1024 - - 1536x1024 - - 1024x1536 - - type: 'null' - default: auto - example: 1024x1024 - description: The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. - user: + description: Identifier for the user. + name: type: string - example: user-1234 - description: | - A unique identifier representing your end-user, which can help OpenAI - monitor and detect abuse. - output_format: - anyOf: - - type: string - enum: - - png - - jpeg - - webp - - type: 'null' - default: png - example: png - description: Output image format. Supported for GPT image models. - output_compression: - anyOf: - - type: integer - minimum: 0 - maximum: 100 - - type: 'null' - example: 100 - description: Compression level for `jpeg` or `webp` output. - moderation: + description: Display name of the user. + email: + description: Email address of the user, or `null` for users without an email. anyOf: - type: string - enum: - - low - - auto - type: 'null' - default: auto - example: auto - description: Moderation level for GPT image models. - background: + picture: + description: URL of the user's profile picture, if available. anyOf: - type: string - enum: - - transparent - - opaque - - auto - type: 'null' - default: auto - example: transparent - description: Set the background of the generated image output. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds. Transparent backgrounds are available for supported GPT Image models. For `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When using `transparent`, set the output format to `png` or `webp`. - stream: + is_service_account: + description: Whether the user is a service account. anyOf: - type: boolean - type: 'null' - default: false - example: false - description: Stream partial image results as events. - partial_images: - $ref: '#/components/schemas/PartialImages' + user_type: + type: string + enum: + - user + - tenant_user + description: The type of user. required: - - images - - prompt - Embedding: + - id + - name + - email + - picture + - is_service_account + - user_type + x-oaiMeta: + name: The group member user object + example: | + { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com", + "picture": null, + "is_service_account": false, + "user_type": "user" + } + GroupResourceWithSuccess: type: object - description: | - Represents an embedding vector returned by embedding endpoint. + description: Response returned after updating a group. properties: - index: + id: + type: string + description: Identifier for the group. + name: + type: string + description: Updated display name for the group. + created_at: type: integer - description: The index of the embedding in the list of embeddings. - embedding: - type: array - description: | - The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](https://developers.openai.com/api/docs/guides/embeddings). - items: - type: number - format: float + format: unixtime + description: Unix timestamp (in seconds) when the group was created. + is_scim_managed: + type: boolean + description: Whether the group is managed through SCIM and controlled by your identity provider. + required: + - id + - name + - created_at + - is_scim_managed + x-oaiMeta: + example: | + { + "id": "group_01J1F8ABCDXYZ", + "name": "Escalations", + "created_at": 1711471533, + "is_scim_managed": false + } + GroupResponse: + type: object + description: Details about an organization group. + properties: + id: + type: string + description: Identifier for the group. + name: + type: string + description: Display name of the group. + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the group was created. + is_scim_managed: + type: boolean + description: Whether the group is managed through SCIM and controlled by your identity provider. + group_type: + type: string + enum: + - group + - tenant_group + description: The type of the group. + required: + - id + - name + - created_at + - is_scim_managed + - group_type + x-oaiMeta: + name: Group + example: | + { + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "is_scim_managed": false, + "group_type": "group" + } + GroupRoleAssignment: + type: object + description: Role assignment linking a group to a role. + properties: object: type: string - description: The object type, which is always "embedding". enum: - - embedding + - group.role + description: Always `group.role`. x-stainless-const: true + group: + $ref: '#/components/schemas/Group' + role: + $ref: '#/components/schemas/Role' required: - - index - object - - embedding + - group + - role x-oaiMeta: - name: The embedding object + name: The group role object example: | { - "object": "embedding", - "embedding": [ - 0.0023064255, - -0.009327292, - .... (1536 floats total for ada-002) - -0.0028842222, - ], - "index": 0 + "object": "group.role", + "group": { + "object": "group", + "id": "group_01J1F8ABCDXYZ", + "name": "Support Team", + "created_at": 1711471533, + "scim_managed": false + }, + "role": { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } } - Error: + GroupUser: type: object + description: Represents an individual user returned when inspecting group membership. properties: - code: - anyOf: - - type: string - - type: 'null' - message: + id: type: string - param: + description: The identifier, which can be referenced in API endpoints + name: + type: string + description: The name of the user. + email: anyOf: - type: string - type: 'null' - type: - type: string - misalignment: - $ref: '#/components/schemas/MisalignmentErrorDetailsResource' + description: The email address of the user. required: - - type - - message - - param - - code - ErrorEvent: + - id + - name + - email + GroupUserAssignment: type: object + description: Confirmation payload returned after adding a user to a group. properties: - event: + object: type: string enum: - - error + - group.user + description: Always `group.user`. x-stainless-const: true - data: - $ref: '#/components/schemas/Error' + user_id: + type: string + description: Identifier of the user that was added. + group_id: + type: string + description: Identifier of the group the user was added to. required: - - event - - data - description: Occurs when an [error](https://developers.openai.com/api/docs/guides/error-codes#api-errors) occurs. This can happen due to an internal server error or a timeout. + - object + - user_id + - group_id x-oaiMeta: - dataDescription: '`data` is an [error](https://developers.openai.com/api/docs/guides/error-codes#api-errors)' - ErrorResponse: - type: object - properties: - error: - $ref: '#/components/schemas/Error' - required: - - error - Eval: + name: The group user object + example: | + { + "object": "group.user", + "user_id": "user_abc123", + "group_id": "group_01J1F8ABCDXYZ" + } + GroupUserDeletedResource: type: object - title: Eval - description: | - An Eval object with a data source config and testing criteria. - An Eval represents a task to be done for your LLM integration. - Like: - - Improve the quality of my chatbot - - See how well my chatbot handles customer support - - Check if o4-mini is better at my usecase than gpt-6-astra + description: Confirmation payload returned after removing a user from a group. properties: object: type: string enum: - - eval - default: eval - description: The object type. + - group.user.deleted + description: Always `group.user.deleted`. x-stainless-const: true - id: - type: string - description: Unique identifier for the evaluation. - name: - type: string - description: The name of the evaluation. - example: Chatbot effectiveness Evaluation - data_source_config: - type: object - description: Configuration of data sources used in runs of the evaluation. - anyOf: - - $ref: '#/components/schemas/EvalCustomDataSourceConfig' - - $ref: '#/components/schemas/EvalLogsDataSourceConfig' - - $ref: '#/components/schemas/EvalStoredCompletionsDataSourceConfig' - discriminator: - propertyName: type - testing_criteria: - description: A list of testing criteria. - type: array - items: - anyOf: - - $ref: '#/components/schemas/EvalGraderLabelModel' - - $ref: '#/components/schemas/EvalGraderStringCheck' - - $ref: '#/components/schemas/EvalGraderTextSimilarity' - - $ref: '#/components/schemas/EvalGraderPython' - - $ref: '#/components/schemas/EvalGraderScoreModel' - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the eval was created. - metadata: - $ref: '#/components/schemas/Metadata' + deleted: + type: boolean + description: Whether the group membership was removed. required: - - id - - data_source_config - object - - testing_criteria - - name - - created_at - - metadata + - deleted x-oaiMeta: - name: The eval object - group: evals + name: Group user deletion confirmation example: | { - "object": "eval", - "id": "eval_67abd54d9b0081909a86353f6fb9317a", - "data_source_config": { - "type": "custom", - "item_schema": { - "type": "object", - "properties": { - "label": {"type": "string"}, - }, - "required": ["label"] - }, - "include_sample_schema": true - }, - "testing_criteria": [ - { - "name": "My string check grader", - "type": "string_check", - "input": "{{sample.output_text}}", - "reference": "{{item.label}}", - "operation": "eq", - } - ], - "name": "External Data Eval", - "created_at": 1739314509, - "metadata": { - "test": "synthetics", - } + "object": "group.user.deleted", + "deleted": true } - EvalApiError: + HostedToolPermission: type: object - title: EvalApiError - description: | - An object representing an error response from the Eval API. + description: Permission state for a single hosted tool on a project. properties: - code: + enabled: + type: boolean + description: Whether the hosted tool is enabled for the project. + required: + - enabled + HostedToolPermissionUpdate: + type: object + properties: + enabled: + type: boolean + description: Whether to enable the hosted tool for the project. + required: + - enabled + Image: + type: object + description: Represents the content or the URL of an image generated by the OpenAI API. + properties: + b64_json: type: string - description: The error code. - message: + description: The base64-encoded JSON of the generated image. Returned by default for the GPT image models, and only present if `response_format` is set to `b64_json` for `dall-e-2` and `dall-e-3`. + url: type: string - description: The error message. - required: - - code - - message - x-oaiMeta: - name: The API error object - group: evals - example: | - { - "code": "internal_error", - "message": "The eval run failed due to an internal error." - } - EvalCustomDataSourceConfig: + format: uri + description: When using `dall-e-2` or `dall-e-3`, the URL of the generated image if `response_format` is set to `url` (default value). Unsupported for the GPT image models. + revised_prompt: + type: string + description: For `dall-e-3` only, the revised prompt that was used to generate the image. + ImageEditCompletedEvent: type: object - title: CustomDataSourceConfig description: | - A CustomDataSourceConfig which specifies the schema of your `item` and optionally `sample` namespaces. - The response schema defines the shape of the data that will be: - - Used to define your testing criteria and - - What data is required when creating a run + Emitted when image editing has completed and the final image is available. properties: type: type: string + description: | + The type of the event. Always `image_edit.completed`. enum: - - custom - default: custom - description: The type of data source. Always `custom`. + - image_edit.completed x-stainless-const: true - schema: - type: object + b64_json: + type: string description: | - The json schema for the run data source items. - Learn how to build JSON schemas [here](https://json-schema.org/). - additionalProperties: true + Base64-encoded final edited image data, suitable for rendering as an image. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + anyOf: + - type: string + - type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. + quality: + type: string + description: | + The quality setting for the edited image. + enum: + - low + - medium + - high + - xhigh + - max + - auto + background: + type: string + description: | + The background setting for the edited image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the edited image. + enum: + - png + - webp + - jpeg + usage: + $ref: '#/components/schemas/ImagesUsage' required: - type - - schema + - b64_json + - created_at + - size + - quality + - background + - output_format + - usage x-oaiMeta: - name: The eval custom data source config object - group: evals + name: image_edit.completed + group: images example: | { - "type": "custom", - "schema": { - "type": "object", - "properties": { - "item": { - "type": "object", - "properties": { - "label": {"type": "string"}, - }, - "required": ["label"] - } - }, - "required": ["item"] + "type": "image_edit.completed", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "usage": { + "total_tokens": 100, + "input_tokens": 50, + "output_tokens": 50, + "input_tokens_details": { + "text_tokens": 10, + "image_tokens": 40 + } } } - EvalGraderLabelModel: - type: object - title: LabelModelGrader - allOf: - - $ref: '#/components/schemas/GraderLabelModel' - EvalGraderPython: - type: object - title: EvalGraderPython - allOf: - - $ref: '#/components/schemas/GraderPython' - - type: object - properties: - pass_threshold: - type: number - description: The threshold for the score. - x-oaiMeta: - name: Eval Python Grader - group: graders - example: | - { - "type": "python", - "name": "Example python grader", - "image_tag": "2025-05-08", - "source": """ - def grade(sample: dict, item: dict) -> float: - \""" - Returns 1.0 if `output_text` equals `label`, otherwise 0.0. - \""" - output = sample.get("output_text") - label = item.get("label") - return 1.0 if output == label else 0.0 - """, - "pass_threshold": 0.8 - } - EvalGraderScoreModel: - type: object - title: EvalGraderScoreModel - allOf: - - $ref: '#/components/schemas/GraderScoreModel' - - type: object - properties: - pass_threshold: - type: number - description: The threshold for the score. - EvalGraderStringCheck: - type: object - title: StringCheckGrader - allOf: - - $ref: '#/components/schemas/GraderStringCheck' - EvalGraderTextSimilarity: - type: object - title: EvalGraderTextSimilarity - allOf: - - $ref: '#/components/schemas/GraderTextSimilarity' - - type: object - properties: - pass_threshold: - type: number - description: The threshold for the score. - required: - - pass_threshold - x-oaiMeta: - name: Text Similarity Grader - group: graders - example: | - { - "type": "text_similarity", - "name": "Example text similarity grader", - "input": "{{sample.output_text}}", - "reference": "{{item.label}}", - "pass_threshold": 0.8, - "evaluation_metric": "fuzzy_match" - } - EvalItem: + ImageEditPartialImageEvent: type: object - title: EvalItem description: | - A message input to the model with a role indicating instruction following - hierarchy. Instructions given with the `developer` or `system` role take - precedence over instructions given with the `user` role. Messages with the - `assistant` role are presumed to have been generated by the model in previous - interactions. + Emitted when a partial image is available during image editing streaming. properties: - role: + type: type: string description: | - The role of the message input. One of `user`, `assistant`, `system`, or - `developer`. + The type of the event. Always `image_edit.partial_image`. enum: - - user - - assistant - - system - - developer - content: - $ref: '#/components/schemas/EvalItemContent' - type: + - image_edit.partial_image + x-stainless-const: true + b64_json: type: string description: | - The type of the message input. Always `message`. + Base64-encoded partial image data, suitable for rendering as an image. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + anyOf: + - type: string + - type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. + quality: + type: string + description: | + The quality setting for the requested edited image. enum: - - message - x-stainless-const: true + - low + - medium + - high + - xhigh + - max + - auto + background: + type: string + description: | + The background setting for the requested edited image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the requested edited image. + enum: + - png + - webp + - jpeg + partial_image_index: + type: integer + description: | + 0-based index for the partial image (streaming). required: - - role - - content - EvalItemContent: - title: Eval content - description: | - Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items. - anyOf: - - $ref: '#/components/schemas/EvalItemContentItem' - - $ref: '#/components/schemas/EvalItemContentArray' - EvalItemContentArray: - type: array - title: An array of Input text, Output text, Input image, and Input audio - description: | - A list of inputs, each of which may be either an input text, output text, input - image, or input audio object. - items: - $ref: '#/components/schemas/EvalItemContentItem' - EvalItemContentItem: - title: Eval content item - description: | - A single content item: input text, output text, input image, or input audio. + - type + - b64_json + - created_at + - size + - quality + - background + - output_format + - partial_image_index + x-oaiMeta: + name: image_edit.partial_image + group: images + example: | + { + "type": "image_edit.partial_image", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "partial_image_index": 0 + } + ImageEditStreamEvent: anyOf: - - $ref: '#/components/schemas/EvalItemContentText' - - $ref: '#/components/schemas/InputTextContent' - - $ref: '#/components/schemas/EvalItemContentOutputText' - - $ref: '#/components/schemas/EvalItemInputImage' - - $ref: '#/components/schemas/InputAudio' - x-stainless-naming: - ruby: - model_name: GraderInputItem - EvalItemContentOutputText: + - $ref: '#/components/schemas/ImageEditPartialImageEvent' + - $ref: '#/components/schemas/ImageEditCompletedEvent' + discriminator: + propertyName: type + ImageGenCompletedEvent: type: object - title: Output text description: | - A text output from the model. + Emitted when image generation has completed and the final image is available. properties: type: type: string description: | - The type of the output text. Always `output_text`. + The type of the event. Always `image_generation.completed`. enum: - - output_text + - image_generation.completed x-stainless-const: true - text: + b64_json: type: string description: | - The text output from the model. - required: - - type - - text - EvalItemContentText: - type: string - title: Text input - description: | - A text input to the model. - EvalItemInputImage: - title: Input image - description: An image input block used within EvalItem content arrays. - type: object - properties: - type: + Base64-encoded image data, suitable for rendering as an image. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + anyOf: + - type: string + - type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. + quality: type: string description: | - The type of the image input. Always `input_image`. + The quality setting for the generated image. enum: - - input_image - x-stainless-const: true - image_url: + - low + - medium + - high + - xhigh + - max + - auto + background: type: string - format: uri description: | - The URL of the image input. - detail: + The background setting for the generated image. + enum: + - transparent + - opaque + - auto + output_format: type: string description: | - The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`. + The output format for the generated image. + enum: + - png + - webp + - jpeg + usage: + $ref: '#/components/schemas/ImagesUsage' required: - type - - image_url - EvalJsonlFileContentSource: + - b64_json + - created_at + - size + - quality + - background + - output_format + - usage + x-oaiMeta: + name: image_generation.completed + group: images + example: | + { + "type": "image_generation.completed", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "usage": { + "total_tokens": 100, + "input_tokens": 50, + "output_tokens": 50, + "input_tokens_details": { + "text_tokens": 10, + "image_tokens": 40 + } + } + } + ImageGenPartialImageEvent: type: object - title: EvalJsonlFileContentSource + description: | + Emitted when a partial image is available during image generation streaming. properties: type: type: string + description: | + The type of the event. Always `image_generation.partial_image`. enum: - - file_content - default: file_content - description: The type of jsonl source. Always `file_content`. + - image_generation.partial_image x-stainless-const: true - content: - type: array - items: - type: object - properties: - item: - type: object - additionalProperties: true - sample: - type: object - additionalProperties: true - required: - - item - description: The content of the jsonl file. + b64_json: + type: string + description: | + Base64-encoded partial image data, suitable for rendering as an image. + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp when the event was created. + size: + anyOf: + - type: string + - type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. + quality: + type: string + description: | + The quality setting for the requested image. + enum: + - low + - medium + - high + - xhigh + - max + - auto + background: + type: string + description: | + The background setting for the requested image. + enum: + - transparent + - opaque + - auto + output_format: + type: string + description: | + The output format for the requested image. + enum: + - png + - webp + - jpeg + partial_image_index: + type: integer + description: | + 0-based index for the partial image (streaming). required: - type - - content - EvalJsonlFileIdSource: + - b64_json + - created_at + - size + - quality + - background + - output_format + - partial_image_index + x-oaiMeta: + name: image_generation.partial_image + group: images + example: | + { + "type": "image_generation.partial_image", + "b64_json": "...", + "created_at": 1620000000, + "size": "1024x1024", + "quality": "high", + "background": "transparent", + "output_format": "png", + "partial_image_index": 0 + } + ImageGenStreamEvent: + anyOf: + - $ref: '#/components/schemas/ImageGenPartialImageEvent' + - $ref: '#/components/schemas/ImageGenCompletedEvent' + discriminator: + propertyName: type + ImageGenTool: type: object - title: EvalJsonlFileIdSource + title: Image generation tool + description: | + A tool that generates images using the GPT image models. properties: type: type: string enum: - - file_id - default: file_id - description: The type of jsonl source. Always `file_id`. + - image_generation + description: | + The type of the image generation tool. Always `image_generation`. x-stainless-const: true - id: + model: + anyOf: + - type: string + - type: string + enum: + - gpt-image-1 + - gpt-image-1-mini + - gpt-image-2 + - gpt-image-2-2026-04-21 + - gpt-image-2.5-sunburst + - gpt-image-2.5-sunburst-2026-09-08 + - gpt-image-2.5-flare + - gpt-image-2.5-flare-2026-09-08 + - gpt-image-1.5 + - chatgpt-image-latest + description: | + The image generation model to use. One of `gpt-image-1`, + `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, + `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, + `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, + `gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`. Default: + `gpt-image-1`. + default: gpt-image-1 + quality: type: string - description: The identifier of the file. + enum: + - low + - medium + - high + - xhigh + - max + - auto + description: | + The quality of the generated image. The GPT image models support `low`, + `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, + including their `2026-09-08` snapshots, also support `xhigh` and `max`. + Default: `auto`. + default: auto + size: + anyOf: + - type: string + - type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + - auto + description: The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. + default: auto + output_format: + type: string + enum: + - png + - webp + - jpeg + description: | + The output format of the generated image. One of `png`, `webp`, or + `jpeg`. Default: `png`. + default: png + output_compression: + type: integer + minimum: 0 + maximum: 100 + description: | + Compression level for the output image. Default: 100. + default: 100 + moderation: + type: string + enum: + - auto + - low + description: | + Moderation level for the generated image. Default: `auto`. + default: auto + background: + type: string + enum: + - transparent + - opaque + - auto + description: | + Allows to set transparency for the background of the generated image(s). Must + be one of `transparent`, `opaque`, or `auto` (default value). When `auto` is + used, the model will automatically determine the best background for the + image. + + `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their + `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds. + Transparent backgrounds are available for supported GPT Image models. For + `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When + using `transparent`, set the output format to `png` or `webp`. + default: auto + input_fidelity: + anyOf: + - $ref: '#/components/schemas/InputFidelity' + - type: 'null' + description: Controls fidelity to the original input image(s). This parameter is supported for GPT image models that support input fidelity. `gpt-image-2` and `gpt-image-2-2026-04-21` ignore this parameter. + input_image_mask: + type: object + description: | + Optional mask for inpainting. Contains `image_url` + (string, optional) and `file_id` (string, optional). + properties: + image_url: + type: string + description: | + Base64-encoded mask image. + file_id: + type: string + description: | + File ID for the mask image. + required: [] + additionalProperties: false + partial_images: + type: integer + minimum: 0 + maximum: 3 + description: | + Number of partial images to generate in streaming mode, from 0 (default value) to 3. + default: 0 + action: + description: | + Whether to generate a new image or edit an existing image. Default: `auto`. + $ref: '#/components/schemas/ImageGenActionEnum' required: - type - - id - EvalList: + ImageRefParam: type: object - title: EvalList description: | - An object representing a list of evals. + Reference an input image by either URL or uploaded file ID. + Provide exactly one of `image_url` or `file_id`. properties: - object: + image_url: type: string - enum: - - list - default: list - description: | - The type of this object. It is always set to "list". - x-stainless-const: true + format: uri + maxLength: 20971520 + description: A fully qualified URL or base64-encoded data URL. + example: https://example.com/source-image.png + file_id: + type: string + description: The File API ID of an uploaded image to use as input. + example: file-abc123 + anyOf: + - required: + - image_url + - required: + - file_id + not: + required: + - image_url + - file_id + additionalProperties: false + ImagesResponse: + type: object + title: Image generation response + description: The response from the image generation endpoint. + properties: + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the image was created. data: type: array - description: | - An array of eval objects. + description: The list of generated images. items: - $ref: '#/components/schemas/Eval' - first_id: + $ref: '#/components/schemas/Image' + background: type: string - description: The identifier of the first eval in the data array. - last_id: + description: The background parameter used for the image generation. Either `transparent` or `opaque`. + enum: + - transparent + - opaque + output_format: type: string - description: The identifier of the last eval in the data array. - has_more: - type: boolean - description: Indicates whether there are more evals available. - required: - - object - - data - - first_id - - last_id - - has_more - x-oaiMeta: - name: The eval list object - group: evals - example: | - { - "object": "list", - "data": [ - { - "object": "eval", - "id": "eval_67abd54d9b0081909a86353f6fb9317a", - "data_source_config": { - "type": "custom", - "schema": { - "type": "object", - "properties": { - "item": { - "type": "object", - "properties": { - "input": { - "type": "string" - }, - "ground_truth": { - "type": "string" - } - }, - "required": [ - "input", - "ground_truth" - ] - } - }, - "required": [ - "item" - ] - } - }, - "testing_criteria": [ - { - "name": "String check", - "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2", - "type": "string_check", - "input": "{{item.input}}", - "reference": "{{item.ground_truth}}", - "operation": "eq" - } - ], - "name": "External Data Eval", - "created_at": 1739314509, - "metadata": {}, - } - ], - "first_id": "eval_67abd54d9b0081909a86353f6fb9317a", - "last_id": "eval_67abd54d9b0081909a86353f6fb9317a", - "has_more": true - } - EvalLogsDataSourceConfig: - type: object - title: LogsDataSourceConfig - description: | - A LogsDataSourceConfig which specifies the metadata property of your logs query. - This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. - The schema returned by this data source config is used to defined what variables are available in your evals. - `item` and `sample` are both defined when using this data source config. - properties: - type: + description: The output format of the image generation. Either `png`, `webp`, or `jpeg`. + enum: + - png + - webp + - jpeg + size: + anyOf: + - type: string + - type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. + quality: type: string + description: The quality of the image generated. One of `low`, `medium`, `high`, `xhigh`, or `max`. enum: - - logs - default: logs - description: The type of data source. Always `logs`. - x-stainless-const: true - metadata: - $ref: '#/components/schemas/Metadata' - schema: - type: object - description: | - The json schema for the run data source items. - Learn how to build JSON schemas [here](https://json-schema.org/). - additionalProperties: true + - low + - medium + - high + - xhigh + - max + usage: + $ref: '#/components/schemas/ImageGenUsage' required: - - type - - schema + - created x-oaiMeta: - name: The logs data source object for evals - group: evals + name: The image generation response + group: images example: | { - "type": "logs", - "metadata": { - "language": "english" - }, - "schema": { - "type": "object", - "properties": { - "item": { - "type": "object" - }, - "sample": { - "type": "object" - } - }, - "required": [ - "item", - "sample" + "created": 1713833628, + "data": [ + { + "b64_json": "..." + } + ], + "background": "transparent", + "output_format": "png", + "size": "1024x1024", + "quality": "high", + "usage": { + "total_tokens": 100, + "input_tokens": 50, + "output_tokens": 50, + "input_tokens_details": { + "text_tokens": 10, + "image_tokens": 40 } + } } - EvalResponsesSource: + ImagesUsage: type: object - title: EvalResponsesSource description: | - A EvalResponsesSource object describing a run data source configuration. + For the GPT image models only, the token usage information for the image generation. + required: + - total_tokens + - input_tokens + - output_tokens + - input_tokens_details + properties: + total_tokens: + type: integer + description: | + The total number of tokens (images and text) used for the image generation. + input_tokens: + type: integer + description: The number of tokens (images and text) in the input prompt. + output_tokens: + type: integer + description: The number of image tokens in the output image. + input_tokens_details: + type: object + description: The input tokens detailed information for the image generation. + required: + - text_tokens + - image_tokens + properties: + text_tokens: + type: integer + description: The number of text tokens in the input prompt. + image_tokens: + type: integer + description: The number of image tokens in the input prompt. + InputAudio: + type: object + title: Input audio + description: | + An audio input to the model. properties: type: type: string + description: | + The type of the input item. Always `input_audio`. enum: - - responses - description: The type of run data source. Always `responses`. - metadata: - anyOf: - - type: object - description: Metadata filter for the responses. This is a query parameter used to select responses. - - type: 'null' - model: - anyOf: - - type: string - description: The name of the model to find responses for. This is a query parameter used to select responses. - - type: 'null' - instructions_search: - anyOf: - - type: string - description: Optional string to search the 'instructions' field. This is a query parameter used to select responses. - - type: 'null' - created_after: - anyOf: - - type: integer - minimum: 0 - description: Only include items created after this timestamp (inclusive). This is a query parameter used to select responses. - - type: 'null' - created_before: - anyOf: - - type: integer - minimum: 0 - description: Only include items created before this timestamp (inclusive). This is a query parameter used to select responses. - - type: 'null' - reasoning_effort: - anyOf: - - $ref: '#/components/schemas/ReasoningEffort' - description: Optional reasoning effort parameter. This is a query parameter used to select responses. - - type: 'null' - temperature: - anyOf: - - type: number - description: Sampling temperature. This is a query parameter used to select responses. - - type: 'null' - top_p: - anyOf: - - type: number - description: Nucleus sampling parameter. This is a query parameter used to select responses. - - type: 'null' - users: - anyOf: - - type: array - items: + - input_audio + x-stainless-const: true + input_audio: + type: object + properties: + data: type: string - description: List of user identifiers. This is a query parameter used to select responses. - - type: 'null' - tools: - anyOf: - - type: array - items: + description: | + Base64-encoded audio data. + format: type: string - description: List of tool names. This is a query parameter used to select responses. - - type: 'null' + description: | + The format of the audio data. Currently supported formats are `mp3` and + `wav`. + enum: + - mp3 + - wav + required: + - data + - format required: - type - x-oaiMeta: - name: The run data source object used to configure an individual run - group: eval runs - example: | - { - "type": "responses", - "model": "gpt-6-astra", - "users": ["user1", "user2"], - "tools": ["tool1", "tool2"], - "instructions_search": "You are a coding assistant" - } - EvalRun: + - input_audio + InputContent: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/InputTextContent' + - $ref: '#/components/schemas/InputImageContent' + - $ref: '#/components/schemas/InputFileContent' + InputItem: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/EasyInputMessage' + - type: object + title: Item + description: | + An item representing part of the context for the response to be + generated by the model. Can contain text, images, and audio inputs, + as well as previous assistant responses and tool call outputs. + $ref: '#/components/schemas/Item' + - $ref: '#/components/schemas/CompactionTriggerItemParam' + - $ref: '#/components/schemas/ItemReferenceParam' + - $ref: '#/components/schemas/ProgramItemParam' + - $ref: '#/components/schemas/ProgramOutputItemParam' + InputMessage: type: object - title: EvalRun + title: Input message description: | - A schema representing an evaluation run. + A message input to the model with a role indicating instruction following + hierarchy. Instructions given with the `developer` or `system` role take + precedence over instructions given with the `user` role. properties: - object: + type: type: string + description: | + The type of the message input. Always set to `message`. enum: - - eval.run - default: eval.run - description: The type of the object. Always "eval.run". + - message x-stainless-const: true - id: - type: string - description: Unique identifier for the evaluation run. - eval_id: - type: string - description: The identifier of the associated evaluation. - status: - type: string - description: The status of the evaluation run. - model: - type: string - description: The model that is evaluated, if applicable. - name: - type: string - description: The name of the evaluation run. - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) when the evaluation run was created. - report_url: + role: type: string - format: uri - description: The URL to the rendered evaluation run report on the UI dashboard. - result_counts: - type: object - description: Counters summarizing the outcomes of the evaluation run. - properties: - total: - type: integer - description: Total number of executed output items. - errored: - type: integer - description: Number of output items that resulted in an error. - failed: - type: integer - description: Number of output items that failed to pass the evaluation. - passed: - type: integer - description: Number of output items that passed the evaluation. - required: - - total - - errored - - failed - - passed - per_model_usage: - type: array - description: Usage statistics for each model during the evaluation run. - items: - type: object - properties: - model_name: - type: string - description: The name of the model. - x-stainless-naming: - python: - property_name: run_model_name - invocation_count: - type: integer - description: The number of invocations. - prompt_tokens: - type: integer - description: The number of prompt tokens used. - completion_tokens: - type: integer - description: The number of completion tokens generated. - total_tokens: - type: integer - description: The total number of tokens used. - cached_tokens: - type: integer - description: The number of tokens retrieved from cache. - required: - - model_name - - invocation_count - - prompt_tokens - - completion_tokens - - total_tokens - - cached_tokens - per_testing_criteria_results: - type: array - description: Results per testing criteria applied during the evaluation run. - items: - type: object - properties: - testing_criteria: - type: string - description: A description of the testing criteria. - passed: - type: integer - description: Number of tests passed for this criteria. - failed: - type: integer - description: Number of tests failed for this criteria. - required: - - testing_criteria - - passed - - failed - data_source: - type: object - description: Information about the run's data source. - anyOf: - - $ref: '#/components/schemas/CreateEvalJsonlRunDataSource' - - $ref: '#/components/schemas/CreateEvalCompletionsRunDataSource' - - $ref: '#/components/schemas/CreateEvalResponsesRunDataSource' - discriminator: - propertyName: type - metadata: - $ref: '#/components/schemas/Metadata' - error: - $ref: '#/components/schemas/EvalApiError' - required: - - object - - id - - eval_id - - status - - model - - name - - created_at - - report_url - - result_counts - - per_model_usage - - per_testing_criteria_results - - data_source - - metadata - - error - x-oaiMeta: - name: The eval run object - group: evals - example: | - { - "object": "eval.run", - "id": "evalrun_67e57965b480819094274e3a32235e4c", - "eval_id": "eval_67e579652b548190aaa83ada4b125f47", - "report_url": "https://platform.openai.com/evaluations/eval_67e579652b548190aaa83ada4b125f47?run_id=evalrun_67e57965b480819094274e3a32235e4c", - "status": "queued", - "model": "gpt-6-astra", - "name": "gpt-6-astra", - "created_at": 1743092069, - "result_counts": { - "total": 0, - "errored": 0, - "failed": 0, - "passed": 0 - }, - "per_model_usage": null, - "per_testing_criteria_results": null, - "data_source": { - "type": "completions", - "source": { - "type": "file_content", - "content": [ - { - "item": { - "input": "Tech Company Launches Advanced Artificial Intelligence Platform", - "ground_truth": "Technology" - } - }, - { - "item": { - "input": "Central Bank Increases Interest Rates Amid Inflation Concerns", - "ground_truth": "Markets" - } - }, - { - "item": { - "input": "International Summit Addresses Climate Change Strategies", - "ground_truth": "World" - } - }, - { - "item": { - "input": "Major Retailer Reports Record-Breaking Holiday Sales", - "ground_truth": "Business" - } - }, - { - "item": { - "input": "National Team Qualifies for World Championship Finals", - "ground_truth": "Sports" - } - }, - { - "item": { - "input": "Stock Markets Rally After Positive Economic Data Released", - "ground_truth": "Markets" - } - }, - { - "item": { - "input": "Global Manufacturer Announces Merger with Competitor", - "ground_truth": "Business" - } - }, - { - "item": { - "input": "Breakthrough in Renewable Energy Technology Unveiled", - "ground_truth": "Technology" - } - }, - { - "item": { - "input": "World Leaders Sign Historic Climate Agreement", - "ground_truth": "World" - } - }, - { - "item": { - "input": "Professional Athlete Sets New Record in Championship Event", - "ground_truth": "Sports" - } - }, - { - "item": { - "input": "Financial Institutions Adapt to New Regulatory Requirements", - "ground_truth": "Business" - } - }, - { - "item": { - "input": "Tech Conference Showcases Advances in Artificial Intelligence", - "ground_truth": "Technology" - } - }, - { - "item": { - "input": "Global Markets Respond to Oil Price Fluctuations", - "ground_truth": "Markets" - } - }, - { - "item": { - "input": "International Cooperation Strengthened Through New Treaty", - "ground_truth": "World" - } - }, - { - "item": { - "input": "Sports League Announces Revised Schedule for Upcoming Season", - "ground_truth": "Sports" - } - } - ] - }, - "input_messages": { - "type": "template", - "template": [ - { - "type": "message", - "role": "developer", - "content": { - "type": "input_text", - "text": "Categorize a given news headline into one of the following topics: Technology, Markets, World, Business, or Sports.\n\n# Steps\n\n1. Analyze the content of the news headline to understand its primary focus.\n2. Extract the subject matter, identifying any key indicators or keywords.\n3. Use the identified indicators to determine the most suitable category out of the five options: Technology, Markets, World, Business, or Sports.\n4. Ensure only one category is selected per headline.\n\n# Output Format\n\nRespond with the chosen category as a single word. For instance: \"Technology\", \"Markets\", \"World\", \"Business\", or \"Sports\".\n\n# Examples\n\n**Input**: \"Apple Unveils New iPhone Model, Featuring Advanced AI Features\" \n**Output**: \"Technology\"\n\n**Input**: \"Global Stocks Mixed as Investors Await Central Bank Decisions\" \n**Output**: \"Markets\"\n\n**Input**: \"War in Ukraine: Latest Updates on Negotiation Status\" \n**Output**: \"World\"\n\n**Input**: \"Microsoft in Talks to Acquire Gaming Company for $2 Billion\" \n**Output**: \"Business\"\n\n**Input**: \"Manchester United Secures Win in Premier League Football Match\" \n**Output**: \"Sports\" \n\n# Notes\n\n- If the headline appears to fit into more than one category, choose the most dominant theme.\n- Keywords or phrases such as \"stocks\", \"company acquisition\", \"match\", or technological brands can be good indicators for classification.\n" - } - }, - { - "type": "message", - "role": "user", - "content": { - "type": "input_text", - "text": "{{item.input}}" - } - } - ] - }, - "model": "gpt-6-astra", - "sampling_params": { - "max_completions_tokens": 2048 - } - }, - "error": null, - "metadata": {} - } - EvalRunList: - type: object - title: EvalRunList + description: | + The role of the message input. One of `user`, `system`, or `developer`. + enum: + - user + - system + - developer + status: + type: string + description: | + The status of item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + content: + $ref: '#/components/schemas/InputMessageContentList' + required: + - role + - content + InputMessageContentList: + type: array + title: Input item content list + description: "A list of one or many input items to the model, containing different content \ntypes.\n" + items: + $ref: '#/components/schemas/InputContent' + InputMessageResource: + allOf: + - $ref: '#/components/schemas/InputMessage' + - type: object + properties: + id: + type: string + description: | + The unique ID of the message input. + required: + - id + - type + InputParam: description: | - An object representing a list of runs for an evaluation. + Text, image, or file inputs to the model, used to generate a response. + + Learn more: + - [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text) + - [Image inputs](https://developers.openai.com/api/docs/guides/images-vision) + - [File inputs](https://developers.openai.com/api/docs/guides/file-inputs) + - [Conversation state](https://developers.openai.com/api/docs/guides/conversation-state) + - [Function calling](https://developers.openai.com/api/docs/guides/function-calling) + anyOf: + - type: string + title: Text input + description: | + A text input to the model, equivalent to a text input with the + `user` role. + - type: array + title: Input item list + description: | + A list of one or many input items to the model, containing + different content types. + items: + $ref: '#/components/schemas/InputItem' + Invite: + type: object + description: Represents an individual `invite` to the organization. properties: object: type: string enum: - - list - default: list - description: | - The type of this object. It is always set to "list". + - organization.invite + description: The object type, which is always `organization.invite` x-stainless-const: true - data: - type: array - description: | - An array of eval run objects. - items: - $ref: '#/components/schemas/EvalRun' - first_id: + id: type: string - description: The identifier of the first eval run in the data array. - last_id: + description: The identifier, which can be referenced in API endpoints + email: type: string - description: The identifier of the last eval run in the data array. - has_more: - type: boolean - description: Indicates whether there are more evals available. + description: The email address of the individual to whom the invite was sent + role: + type: string + enum: + - owner + - reader + description: '`owner` or `reader`' + status: + type: string + enum: + - accepted + - expired + - pending + description: '`accepted`,`expired`, or `pending`' + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the invite was sent. + expires_at: + anyOf: + - type: integer + format: unixtime + - type: 'null' + description: The Unix timestamp (in seconds) of when the invite expires. + accepted_at: + anyOf: + - type: integer + format: unixtime + - type: 'null' + description: The Unix timestamp (in seconds) of when the invite was accepted. + projects: + type: array + description: The projects that were granted membership upon acceptance of the invite. + items: + type: object + properties: + id: + type: string + description: Project's public ID + role: + type: string + enum: + - member + - owner + description: Project membership role + required: + - id + - role required: - object - - data - - first_id - - last_id - - has_more + - id + - email + - role + - status + - created_at + - projects x-oaiMeta: - name: The eval run list object - group: evals + name: The invite object example: | { - "object": "list", - "data": [ + "object": "organization.invite", + "id": "invite-abc", + "email": "user@example.com", + "role": "owner", + "status": "accepted", + "created_at": 1711471533, + "expires_at": 1711471533, + "accepted_at": 1711471533, + "projects": [ { - "object": "eval.run", - "id": "evalrun_67b7fbdad46c819092f6fe7a14189620", - "eval_id": "eval_67b7fa9a81a88190ab4aa417e397ea21", - "report_url": "https://platform.openai.com/evaluations/eval_67b7fa9a81a88190ab4aa417e397ea21?run_id=evalrun_67b7fbdad46c819092f6fe7a14189620", - "status": "completed", - "model": "o3-mini", - "name": "Academic Assistant", - "created_at": 1740110812, - "result_counts": { - "total": 171, - "errored": 0, - "failed": 80, - "passed": 91 - }, - "per_model_usage": null, - "per_testing_criteria_results": [ - { - "testing_criteria": "String check grader", - "passed": 91, - "failed": 80 - } - ], - "run_data_source": { - "type": "completions", - "template_messages": [ - { - "type": "message", - "role": "system", - "content": { - "type": "input_text", - "text": "You are a helpful assistant." - } - }, - { - "type": "message", - "role": "user", - "content": { - "type": "input_text", - "text": "Hello, can you help me with my homework?" - } - } - ], - "datasource_reference": null, - "model": "o3-mini", - "max_completion_tokens": null, - "seed": null, - "temperature": null, - "top_p": null - }, - "error": null, - "metadata": {"test": "synthetics"} + "id": "project-xyz", + "role": "member" } - ], - "first_id": "evalrun_67abd54d60ec8190832b46859da808f7", - "last_id": "evalrun_67abd54d60ec8190832b46859da808f7", - "has_more": false + ] } - EvalRunOutputItem: + InviteDeleteResponse: type: object - title: EvalRunOutputItem - description: | - A schema representing an evaluation run output item. properties: object: type: string enum: - - eval.run.output_item - default: eval.run.output_item - description: The type of the object. Always "eval.run.output_item". + - organization.invite.deleted + description: The object type, which is always `organization.invite.deleted` x-stainless-const: true id: type: string - description: Unique identifier for the evaluation run output item. - run_id: - type: string - description: The identifier of the evaluation run associated with this output item. - eval_id: - type: string - description: The identifier of the evaluation group. - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) when the evaluation run was created. - status: + deleted: + type: boolean + required: + - object + - id + - deleted + InviteListResponse: + type: object + properties: + object: type: string - description: The status of the evaluation run. - datasource_item_id: - type: integer - description: The identifier for the data source item. - datasource_item: - type: object - description: Details of the input data source item. - additionalProperties: true - results: + enum: + - list + description: The object type, which is always `list` + x-stainless-const: true + data: type: array - description: A list of grader results for this output item. items: - $ref: '#/components/schemas/EvalRunOutputItemResult' - sample: - type: object - description: A sample containing the input and output of the evaluation run. - properties: - input: - type: array - description: An array of input messages. - items: - type: object - description: An input message. - properties: - role: - type: string - description: The role of the message sender (e.g., system, user, developer). - content: - type: string - description: The content of the message. - required: - - role - - content - output: - type: array - description: An array of output messages. - items: - type: object - properties: - role: - type: string - description: The role of the message (e.g. "system", "assistant", "user"). - content: - type: string - description: The content of the message. - finish_reason: - type: string - description: The reason why the sample generation was finished. - model: - type: string - description: The model used for generating the sample. - usage: - type: object - description: Token usage details for the sample. - properties: - total_tokens: - type: integer - description: The total number of tokens used. - completion_tokens: - type: integer - description: The number of completion tokens generated. - prompt_tokens: - type: integer - description: The number of prompt tokens used. - cached_tokens: - type: integer - description: The number of tokens retrieved from cache. - required: - - total_tokens - - completion_tokens - - prompt_tokens - - cached_tokens - error: - $ref: '#/components/schemas/EvalApiError' - temperature: - type: number - description: The sampling temperature used. - max_completion_tokens: - type: integer - description: The maximum number of tokens allowed for completion. - top_p: - type: number - description: The top_p value used for sampling. - seed: - type: integer - description: The seed used for generating the sample. - required: - - input - - output - - finish_reason - - model - - usage - - error - - temperature - - max_completion_tokens - - top_p - - seed + $ref: '#/components/schemas/Invite' + first_id: + anyOf: + - type: string + - type: 'null' + description: The first `invite_id` in the retrieved `list` + last_id: + anyOf: + - type: string + - type: 'null' + description: The last `invite_id` in the retrieved `list` + has_more: + type: boolean + description: The `has_more` property is used for pagination to indicate there are additional results. required: - object - - id - - run_id - - eval_id - - created_at - - status - - datasource_item_id - - datasource_item - - results - - sample + - data + - has_more + InviteProjectGroupBody: + type: object + description: Request payload for granting a group access to a project. + properties: + group_id: + type: string + description: Identifier of the group to add to the project. + role: + type: string + description: Identifier of the project role to grant to the group. + required: + - group_id + - role x-oaiMeta: - name: The eval run output item object - group: evals example: | { - "object": "eval.run.output_item", - "id": "outputitem_67abd55eb6548190bb580745d5644a33", - "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", - "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", - "created_at": 1739314509, - "status": "pass", - "datasource_item_id": 137, - "datasource_item": { - "teacher": "To grade essays, I only check for style, content, and grammar.", - "student": "I am a student who is trying to write the best essay." - }, - "results": [ - { - "name": "String Check Grader", - "type": "string-check-grader", - "score": 1.0, - "passed": true, - } - ], - "sample": { - "input": [ - { - "role": "system", - "content": "You are an evaluator bot..." - }, - { - "role": "user", - "content": "You are assessing..." - } - ], - "output": [ - { - "role": "assistant", - "content": "The rubric is not clear nor concise." - } - ], - "finish_reason": "stop", - "model": "gpt-6-astra", - "usage": { - "total_tokens": 521, - "completion_tokens": 2, - "prompt_tokens": 519, - "cached_tokens": 0 - }, - "error": null, - "temperature": 1.0, - "max_completion_tokens": 2048, - "top_p": 1.0, - "seed": 42 - } + "group_id": "group_01J1F8ABCDXYZ", + "role": "role_01J1F8PROJ" } - EvalRunOutputItemList: + InviteRequest: + type: object + properties: + email: + type: string + description: Send an email to this address + role: + type: string + enum: + - reader + - owner + description: '`owner` or `reader`' + projects: + type: array + description: An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one. + items: + type: object + properties: + id: + type: string + description: Project's public ID + role: + type: string + enum: + - member + - owner + description: Project membership role + required: + - id + - role + required: + - email + - role + Item: + type: object + description: | + Content item used to generate a response. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/InputMessage' + - $ref: '#/components/schemas/OutputMessage' + - $ref: '#/components/schemas/FileSearchToolCall' + - $ref: '#/components/schemas/ComputerToolCall' + - $ref: '#/components/schemas/ComputerCallOutputItemParam' + - $ref: '#/components/schemas/WebSearchToolCall' + - $ref: '#/components/schemas/FunctionToolCall' + - $ref: '#/components/schemas/FunctionCallOutputItemParam' + - $ref: '#/components/schemas/ToolSearchCallItemParam' + - $ref: '#/components/schemas/ToolSearchOutputItemParam' + - $ref: '#/components/schemas/AdditionalToolsItemParam' + - $ref: '#/components/schemas/ResponseConfigurationUpdateItemParam' + - $ref: '#/components/schemas/ReasoningItem' + - $ref: '#/components/schemas/CompactionSummaryItemParam' + - $ref: '#/components/schemas/ImageGenToolCall' + - $ref: '#/components/schemas/CodeInterpreterToolCall' + - $ref: '#/components/schemas/LocalShellToolCall' + - $ref: '#/components/schemas/LocalShellToolCallOutput' + - $ref: '#/components/schemas/FunctionShellCallItemParam' + - $ref: '#/components/schemas/FunctionShellCallOutputItemParam' + - $ref: '#/components/schemas/ApplyPatchToolCallItemParam' + - $ref: '#/components/schemas/ApplyPatchToolCallOutputItemParam' + - $ref: '#/components/schemas/MCPListTools' + - $ref: '#/components/schemas/MCPApprovalRequest' + - $ref: '#/components/schemas/MCPApprovalResponse' + - $ref: '#/components/schemas/MCPToolCall' + - $ref: '#/components/schemas/CustomToolCallOutput' + - $ref: '#/components/schemas/CustomToolCall' + ItemResource: + description: | + Content item used to generate a response. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/InputMessageResource' + - $ref: '#/components/schemas/OutputMessage' + - $ref: '#/components/schemas/FileSearchToolCall' + - $ref: '#/components/schemas/ComputerToolCall' + - $ref: '#/components/schemas/ComputerToolCallOutputResource' + - $ref: '#/components/schemas/WebSearchToolCall' + - $ref: '#/components/schemas/FunctionToolCallResource' + - $ref: '#/components/schemas/FunctionToolCallOutputResource' + - $ref: '#/components/schemas/ToolSearchCall' + - $ref: '#/components/schemas/ToolSearchOutput' + - $ref: '#/components/schemas/AdditionalTools' + - $ref: '#/components/schemas/ResponseConfigurationUpdate' + - $ref: '#/components/schemas/ReasoningItem' + - $ref: '#/components/schemas/Program' + - $ref: '#/components/schemas/ProgramOutput' + - $ref: '#/components/schemas/CompactionBody' + - $ref: '#/components/schemas/ImageGenToolCall' + - $ref: '#/components/schemas/CodeInterpreterToolCall' + - $ref: '#/components/schemas/LocalShellToolCall' + - $ref: '#/components/schemas/LocalShellToolCallOutput' + - $ref: '#/components/schemas/FunctionShellCall' + - $ref: '#/components/schemas/FunctionShellCallOutput' + - $ref: '#/components/schemas/ApplyPatchToolCall' + - $ref: '#/components/schemas/ApplyPatchToolCallOutput' + - $ref: '#/components/schemas/MCPListTools' + - $ref: '#/components/schemas/MCPApprovalRequest' + - $ref: '#/components/schemas/MCPApprovalResponseResource' + - $ref: '#/components/schemas/MCPToolCall' + - $ref: '#/components/schemas/CustomToolCallResource' + - $ref: '#/components/schemas/CustomToolCallOutputResource' + ListAssistantsResponse: type: object - title: EvalRunOutputItemList - description: | - An object representing a list of output items for an evaluation run. properties: object: type: string - enum: - - list - default: list - description: | - The type of this object. It is always set to "list". - x-stainless-const: true + example: list data: type: array - description: | - An array of eval run output item objects. items: - $ref: '#/components/schemas/EvalRunOutputItem' + $ref: '#/components/schemas/AssistantObject' first_id: type: string - description: The identifier of the first eval run output item in the data array. + example: asst_abc123 last_id: type: string - description: The identifier of the last eval run output item in the data array. + example: asst_abc456 has_more: type: boolean - description: Indicates whether there are more eval run output items available. + example: false required: - object - data @@ -37250,2813 +43490,2862 @@ components: - last_id - has_more x-oaiMeta: - name: The eval run output item list object - group: evals + name: List assistants response object + group: chat example: | { "object": "list", "data": [ { - "object": "eval.run.output_item", - "id": "outputitem_67abd55eb6548190bb580745d5644a33", - "run_id": "evalrun_67abd54d60ec8190832b46859da808f7", - "eval_id": "eval_67abd54d9b0081909a86353f6fb9317a", - "created_at": 1739314509, - "status": "pass", - "datasource_item_id": 137, - "datasource_item": { - "teacher": "To grade essays, I only check for style, content, and grammar.", - "student": "I am a student who is trying to write the best essay." - }, - "results": [ - { - "name": "String Check Grader", - "type": "string-check-grader", - "score": 1.0, - "passed": true, - } - ], - "sample": { - "input": [ - { - "role": "system", - "content": "You are an evaluator bot..." - }, - { - "role": "user", - "content": "You are assessing..." - } - ], - "output": [ - { - "role": "assistant", - "content": "The rubric is not clear nor concise." - } - ], - "finish_reason": "stop", - "model": "gpt-6-astra", - "usage": { - "total_tokens": 521, - "completion_tokens": 2, - "prompt_tokens": 519, - "cached_tokens": 0 - }, - "error": null, - "temperature": 1.0, - "max_completion_tokens": 2048, - "top_p": 1.0, - "seed": 42 - } + "id": "asst_abc123", + "object": "assistant", + "created_at": 1698982736, + "name": "Coding Tutor", + "description": null, + "model": "gpt-5", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + }, + { + "id": "asst_abc456", + "object": "assistant", + "created_at": 1698982718, + "name": "My Assistant", + "description": null, + "model": "gpt-5", + "instructions": "You are a helpful assistant designed to make me better at coding!", + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" }, + { + "id": "asst_abc789", + "object": "assistant", + "created_at": 1698982643, + "name": null, + "description": null, + "model": "gpt-5", + "instructions": null, + "tools": [], + "tool_resources": {}, + "metadata": {}, + "top_p": 1.0, + "temperature": 1.0, + "response_format": "auto" + } ], - "first_id": "outputitem_67abd55eb6548190bb580745d5644a33", - "last_id": "outputitem_67abd55eb6548190bb580745d5644a33", + "first_id": "asst_abc123", + "last_id": "asst_abc789", "has_more": false } - EvalRunOutputItemResult: + ListAuditLogsResponse: type: object - title: EvalRunOutputItemResult - description: | - A single grader result for an evaluation run output item. properties: - name: + object: type: string - description: The name of the grader. - type: + enum: + - list + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/AuditLog' + first_id: + anyOf: + - type: string + - type: 'null' + example: audit_log-defb456h8dks + last_id: + anyOf: + - type: string + - type: 'null' + example: audit_log-hnbkd8s93s + has_more: + type: boolean + required: + - object + - data + - has_more + ListBatchesResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Batch' + first_id: type: string - description: The grader type (for example, "string-check-grader"). - score: - type: number - description: The numeric score produced by the grader. - passed: + example: batch_abc123 + last_id: + type: string + example: batch_abc456 + has_more: type: boolean - description: Whether the grader considered the output a pass. - sample: + object: + type: string + enum: + - list + x-stainless-const: true + required: + - object + - data + - has_more + ListCertificatesResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/OrganizationCertificate' + first_id: anyOf: - - type: object - additionalProperties: true + - type: string - type: 'null' - description: Optional sample or intermediate data produced by the grader. - additionalProperties: true + example: cert_abc + last_id: + anyOf: + - type: string + - type: 'null' + example: cert_abc + has_more: + type: boolean + object: + type: string + enum: + - list + x-stainless-const: true required: - - name - - score - - passed - EvalStoredCompletionsDataSourceConfig: + - object + - data + - has_more + - first_id + - last_id + ListFilesResponse: type: object - title: StoredCompletionsDataSourceConfig - description: | - Deprecated in favor of LogsDataSourceConfig. properties: - type: + object: + type: string + example: list + data: + type: array + items: + $ref: '#/components/schemas/OpenAIFile' + first_id: + type: string + example: file-abc123 + last_id: + type: string + example: file-abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + ListFineTuningCheckpointPermissionResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/FineTuningCheckpointPermission' + object: type: string enum: - - stored_completions - default: stored_completions - description: The type of data source. Always `stored_completions`. + - list x-stainless-const: true - metadata: - $ref: '#/components/schemas/Metadata' - schema: - type: object - description: | - The json schema for the run data source items. - Learn how to build JSON schemas [here](https://json-schema.org/). - additionalProperties: true + first_id: + anyOf: + - type: string + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: + type: boolean required: - - type - - schema - deprecated: true - x-oaiMeta: - name: The stored completions data source object for evals - group: evals - example: | - { - "type": "stored_completions", - "metadata": { - "language": "english" - }, - "schema": { - "type": "object", - "properties": { - "item": { - "type": "object" - }, - "sample": { - "type": "object" - } - }, - "required": [ - "item", - "sample" - } - } - EvalStoredCompletionsSource: + - object + - data + - has_more + ListFineTuningJobCheckpointsResponse: type: object - title: StoredCompletionsRunDataSource - description: | - A StoredCompletionsRunDataSource configuration describing a set of filters properties: - type: + data: + type: array + items: + $ref: '#/components/schemas/FineTuningJobCheckpoint' + object: type: string enum: - - stored_completions - default: stored_completions - description: The type of source. Always `stored_completions`. + - list x-stainless-const: true - metadata: - $ref: '#/components/schemas/Metadata' - model: + first_id: anyOf: - type: string - description: An optional model to filter by (e.g., 'gpt-6-astra'). - type: 'null' - created_after: + last_id: anyOf: - - type: integer - description: An optional Unix timestamp to filter items created after this time. + - type: string - type: 'null' - created_before: + has_more: + type: boolean + required: + - object + - data + - has_more + ListFineTuningJobEventsResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/FineTuningJobEvent' + object: + type: string + enum: + - list + x-stainless-const: true + has_more: + type: boolean + required: + - object + - data + - has_more + ListMessagesResponse: + properties: + object: + type: string + example: list + data: + type: array + items: + $ref: '#/components/schemas/MessageObject' + first_id: + type: string + example: msg_abc123 + last_id: + type: string + example: msg_abc123 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + ListModelsResponse: + type: object + properties: + object: + type: string + enum: + - list + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/Model' + required: + - object + - data + ListPaginatedFineTuningJobsResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/FineTuningJob' + has_more: + type: boolean + object: + type: string + enum: + - list + x-stainless-const: true + required: + - object + - data + - has_more + ListProjectCertificatesResponse: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/OrganizationProjectCertificate' + first_id: anyOf: - - type: integer - description: An optional Unix timestamp to filter items created before this time. + - type: string - type: 'null' - limit: + example: cert_abc + last_id: anyOf: - - type: integer - description: An optional maximum number of items to return. + - type: string - type: 'null' + example: cert_abc + has_more: + type: boolean + object: + type: string + enum: + - list + x-stainless-const: true required: - - type - x-oaiMeta: - name: The stored completions data source object used to configure an individual run - group: eval runs - example: | - { - "type": "stored_completions", - "model": "gpt-6-astra", - "created_after": 1668124800, - "created_before": 1668124900, - "limit": 100, - "metadata": {} - } - FileExpirationAfter: + - object + - data + - has_more + - first_id + - last_id + ListRunStepsResponse: + properties: + object: + type: string + example: list + data: + type: array + items: + $ref: '#/components/schemas/RunStepObject' + first_id: + type: string + example: step_abc123 + last_id: + type: string + example: step_abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + ListRunsResponse: type: object - title: File expiration policy - description: The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted. properties: - anchor: - description: 'Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`.' + object: type: string - enum: - - created_at - x-stainless-const: true - seconds: - description: The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days). - type: integer - format: int64 - minimum: 3600 - maximum: 2592000 + example: list + data: + type: array + items: + $ref: '#/components/schemas/RunObject' + first_id: + type: string + example: run_abc123 + last_id: + type: string + example: run_abc456 + has_more: + type: boolean + example: false required: - - anchor - - seconds - FilePath: - type: object - title: File path - description: | - A path to a file. + - object + - data + - first_id + - last_id + - has_more + ListVectorStoreFilesResponse: properties: - type: + object: type: string - description: | - The type of the file path. Always `file_path`. - enum: - - file_path - x-stainless-const: true - file_id: + example: list + data: + type: array + items: + $ref: '#/components/schemas/VectorStoreFileObject' + first_id: type: string - description: | - The ID of the file. - index: - type: integer - description: | - The index of the file in the list of files. + example: file-abc123 + last_id: + type: string + example: file-abc456 + has_more: + type: boolean + example: false required: - - type - - file_id - - index - FileSearchRanker: - type: string - description: The ranker to use for the file search. If not specified will use the `auto` ranker. - enum: - - auto - - default_2024_08_21 - FileSearchRankingOptions: - title: File search tool call ranking options + - object + - data + - first_id + - last_id + - has_more + ListVectorStoresResponse: + properties: + object: + type: string + example: list + data: + type: array + items: + $ref: '#/components/schemas/VectorStoreObject' + first_id: + type: string + example: vs_abc123 + last_id: + type: string + example: vs_abc456 + has_more: + type: boolean + example: false + required: + - object + - data + - first_id + - last_id + - has_more + LiveCallAcceptRequest: type: object - description: | - The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - - See the [file search tool documentation](https://developers.openai.com/api/docs/guides/tools-file-search#retrieval-customization) for more information. + description: Accept an incoming SIP call with Live startup configuration. properties: - ranker: - $ref: '#/components/schemas/FileSearchRanker' - score_threshold: - type: number - description: The score threshold for the file search. All values must be a floating point number between 0 and 1. - minimum: 0 - maximum: 1 + session: + $ref: '#/components/schemas/LiveCallAcceptSession' + description: Model and startup configuration for the Live session that answers the incoming SIP call. required: - - score_threshold - FileSearchToolCall: + - session + additionalProperties: false + LiveCallAcceptSession: type: object - title: File search tool call - description: | - The results of a file search tool call. See the - [file search guide](https://developers.openai.com/api/docs/guides/tools-file-search) for more information. + description: Startup configuration for accepting an incoming Live SIP call. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when writing frontend and backend instructions. properties: - id: - type: string - description: | - The unique ID of the file search tool call. + model: + $ref: '#/components/schemas/ModelIdsLive' + description: The Live model to use for the accepted call. + minLength: 1 + instructions: + $ref: '#/components/schemas/instructions' + audio: + $ref: '#/components/schemas/LiveMediaSessionAudioParam' + description: Startup audio output configuration. SIP negotiates the media format; audio.format is only accepted for primary WebSockets. Voice cannot change after startup. + delegation: + $ref: '#/components/schemas/delegation' + store: + $ref: '#/components/schemas/store' + input: + $ref: '#/components/schemas/input' type: type: string enum: - - file_search_call - description: | - The type of the file search tool call. Always `file_search_call`. + - live + default: live x-stainless-const: true - status: - type: string - description: | - The status of the file search tool call. One of `in_progress`, - `searching`, `incomplete` or `failed`, - enum: - - in_progress - - searching - - completed - - incomplete - - failed - queries: - type: array - items: - type: string - description: | - The queries used to search for files. - results: - anyOf: - - type: array - description: | - The results of the file search tool call. - items: - type: object - properties: - file_id: - type: string - description: | - The unique ID of the file. - text: - type: string - description: | - The text that was retrieved from the file. - filename: - type: string - description: | - The name of the file. - attributes: - $ref: '#/components/schemas/VectorStoreFileAttributes' - score: - type: number - format: float - description: | - The relevance score of the file - a value between 0 and 1. - - type: 'null' + description: The session type. Always `live`. required: - - id + - model - type - - status - - queries - FineTuneChatCompletionRequestAssistantMessage: - allOf: - - type: object - title: Assistant message - deprecated: false - properties: - weight: - type: integer - enum: - - 0 - - 1 - description: Controls whether the assistant message is trained against (0 or 1) - - $ref: '#/components/schemas/ChatCompletionRequestAssistantMessage' + additionalProperties: false + LiveCallReferRequest: + type: object + description: Parameters used to transfer a Live SIP call to another destination. + properties: + target_uri: + $ref: '#/components/schemas/target_uri' + minLength: 1 + pattern: \S + description: Nonblank URI for the SIP Refer-To header, such as tel:+14155550123 or sip:agent@example.com. required: - - role - FineTuneDPOHyperparameters: + - target_uri + additionalProperties: false + LiveCallRejectRequest: type: object - description: The hyperparameters used for the DPO fine-tuning job. + description: Parameters used to reject an incoming Live SIP call. properties: - beta: - description: | - The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model. - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: number - minimum: 0 - maximum: 2 - exclusiveMinimum: true - batch_size: - description: | - Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. - default: auto - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 256 - learning_rate_multiplier: - description: | - Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: number - minimum: 0 - exclusiveMinimum: true - n_epochs: - description: | - The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. - default: auto - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 50 - FineTuneDPOMethod: + status_code: + type: integer + minimum: 300 + maximum: 699 + description: SIP rejection status sent to the caller. This field is required. + example: 486 + required: + - status_code + additionalProperties: false + LiveClientEvent: + description: Client events for Live. Initialize a primary WebSocket with session.start and wait for session.started. WebRTC creation already starts the session. Audio append is primary WebSocket-only. See the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) before writing frontend instructions and delegation policies. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveSessionStartEvent' + - $ref: '#/components/schemas/LiveSessionUpdateParam' + - $ref: '#/components/schemas/LiveInputAudioAppendEvent' + - $ref: '#/components/schemas/LiveInputAudioMuteParam' + - $ref: '#/components/schemas/LiveInputAudioUnmuteParam' + - $ref: '#/components/schemas/LiveInstructionsAppendParam' + - $ref: '#/components/schemas/LiveThinkingAppendParam' + - $ref: '#/components/schemas/LiveCommentaryAppendParam' + - $ref: '#/components/schemas/LiveResponseItemCreateParam' + - $ref: '#/components/schemas/LiveResponseCreateParam' + - $ref: '#/components/schemas/LiveSessionCloseParam' + LiveConnectParams: type: object - description: Configuration for the DPO fine-tuning method. + x-stainless-empty-object: true + description: Primary Live WebSocket connections accept no query parameters. Supply the model and startup configuration in the first session.start event. + properties: {} + additionalProperties: false + LiveCreateRequest: + type: object + description: Create a Live WebRTC session with JSON session configuration and an SDP offer. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) before choosing frontend and backend instructions. The request starts the session; do not send session.start on the data channel. properties: - hyperparameters: - $ref: '#/components/schemas/FineTuneDPOHyperparameters' - FineTuneMethod: + session: + $ref: '#/components/schemas/LiveMediaSessionCreateParams' + description: Startup configuration for the Live session. + transport: + $ref: '#/components/schemas/LiveWebRTCTransport' + description: WebRTC transport with the browser's SDP offer. + required: + - session + - transport + additionalProperties: false + LiveCreateResponse: type: object - description: The method used for fine-tuning. + description: The created Live session identifier and WebRTC answer. Apply transport.sdp as the peer's remote answer and wait for session.started on the data channel before sending commands. properties: - type: - type: string - description: The type of method. Is either `supervised`, `dpo`, or `reinforcement`. - enum: - - supervised - - dpo - - reinforcement - supervised: - $ref: '#/components/schemas/FineTuneSupervisedMethod' - dpo: - $ref: '#/components/schemas/FineTuneDPOMethod' - reinforcement: - $ref: '#/components/schemas/FineTuneReinforcementMethod' + session: + type: object + description: The newly created Live session. Use its ID for session controls and sideband connections. + properties: + id: + type: string + description: Opaque session identifier. Preserve the returned value unchanged, including its prefix. + required: + - id + transport: + $ref: '#/components/schemas/LiveWebRTCTransport' + description: WebRTC transport with the SDP answer. required: - - type - FineTuneReinforcementHyperparameters: + - session + - transport + LiveForkClientEvent: + description: Client events for a Live fork WebSocket. First send session.start with an overrides object (which may be empty), then wait for session.started before sending other commands. The model and conversation are inherited from the stored session. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveForkSessionStartEvent' + - $ref: '#/components/schemas/LiveSessionUpdateParam' + - $ref: '#/components/schemas/LiveInputAudioAppendEvent' + - $ref: '#/components/schemas/LiveInputAudioMuteParam' + - $ref: '#/components/schemas/LiveInputAudioUnmuteParam' + - $ref: '#/components/schemas/LiveInstructionsAppendParam' + - $ref: '#/components/schemas/LiveThinkingAppendParam' + - $ref: '#/components/schemas/LiveCommentaryAppendParam' + - $ref: '#/components/schemas/LiveResponseItemCreateParam' + - $ref: '#/components/schemas/LiveResponseCreateParam' + - $ref: '#/components/schemas/LiveSessionCloseParam' + LiveForkPathParams: type: object - description: The hyperparameters used for the reinforcement fine-tuning job. + description: Identifies the stored Live session whose conversation and configuration are used to create a fork. + required: + - session_id properties: - batch_size: - description: | - Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. - default: auto - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 256 - learning_rate_multiplier: - description: | - Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: number - minimum: 0 - exclusiveMinimum: true - n_epochs: - description: | - The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. - default: auto - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 50 - reasoning_effort: - description: | - Level of reasoning effort. + session_id: type: string - enum: - - default - - low - - medium - - high - default: default - compute_multiplier: - description: | - Multiplier on amount of compute used for exploring search space during training. - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: number - minimum: 0.00001 - maximum: 10 - exclusiveMinimum: true - eval_interval: - description: | - The number of training steps between evaluation runs. - default: auto - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - eval_samples: - description: | - Number of evaluation samples to generate per training step. - default: auto - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - FineTuneReinforcementMethod: + description: The ID of the stored Live session to fork. + LiveForkRequest: type: object - description: Configuration for the reinforcement fine-tuning method. + description: Fork a stored Live session onto a new WebRTC connection. Omit session or send an empty object to inherit its configuration. properties: - grader: - type: object - description: The grader used for the fine-tuning job. - anyOf: - - $ref: '#/components/schemas/GraderStringCheck' - - $ref: '#/components/schemas/GraderTextSimilarity' - - $ref: '#/components/schemas/GraderPython' - - $ref: '#/components/schemas/GraderScoreModel' - - $ref: '#/components/schemas/GraderMulti' - hyperparameters: - $ref: '#/components/schemas/FineTuneReinforcementHyperparameters' + session: + $ref: '#/components/schemas/LiveMediaSessionForkParams' + description: Optional configuration overrides for the new Live session. Omit this object or send an empty object to inherit the stored session's settings. + transport: + $ref: '#/components/schemas/LiveWebRTCTransport' + description: WebRTC transport with an SDP offer for the new connection to the forked session. + required: + - transport + additionalProperties: false + LiveForkServerEvent: + $ref: '#/components/schemas/LiveServerEvent' + LiveMediaSessionAudioParam: + type: object + description: Startup audio output configuration. WebRTC and SIP negotiate the media format; audio.format is only accepted for primary WebSockets. Voice cannot change after startup. + properties: + output: + $ref: '#/components/schemas/LiveInitialSessionAudioOutputParam' + additionalProperties: false + LiveMediaSessionCreateParams: + type: object + description: Startup configuration for a Live media session. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when writing frontend instructions and the backend prompt under delegation.responses.instructions. + properties: + model: + $ref: '#/components/schemas/ModelIdsLive' + instructions: + $ref: '#/components/schemas/instructions' + audio: + $ref: '#/components/schemas/LiveMediaSessionAudioParam' + description: Startup audio configuration. WebRTC and SIP negotiate their audio format on the media transport. + delegation: + $ref: '#/components/schemas/delegation' + store: + $ref: '#/components/schemas/store' + input: + $ref: '#/components/schemas/input' + client: + $ref: '#/components/schemas/LiveClientConfigParam' required: - - grader - FineTuneSupervisedHyperparameters: + - model + additionalProperties: false + LiveMediaSessionForkParams: type: object - description: The hyperparameters used for the fine-tuning job. + description: Optional overrides for a stored Live session. Omitted settings are inherited. The model, voice, frontend instructions, and prior conversation come from the stored session. WebRTC negotiates its audio format; audio.format is only supported on WebSocket forks. properties: - batch_size: - description: | - Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance. - default: auto - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 256 - learning_rate_multiplier: - description: | - Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting. - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: number - minimum: 0 - exclusiveMinimum: true - n_epochs: - description: | - The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. - default: auto - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 50 - FineTuneSupervisedMethod: + store: + $ref: '#/components/schemas/properties-store' + delegation: + $ref: '#/components/schemas/LiveResponsesDelegationUpdateParam' + client: + $ref: '#/components/schemas/LiveClientConfigParam' + additionalProperties: false + LiveServerEvent: + description: Server events for Live. Response lifecycle events are wrapped inside response.event; dispatch the nested event by its full type and tolerate new response event types. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when designing the conversation and delegation policy. + discriminator: + propertyName: type + allOf: + - $ref: '#/components/schemas/LiveServerEvent-2' + LiveSidebandClientEvent: + description: Client events accepted by an attached Live sideband WebSocket. The session is already started; send audio over the primary connection. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveSessionUpdateParam' + - $ref: '#/components/schemas/LiveInputAudioMuteParam' + - $ref: '#/components/schemas/LiveInputAudioUnmuteParam' + - $ref: '#/components/schemas/LiveInstructionsAppendParam' + - $ref: '#/components/schemas/LiveThinkingAppendParam' + - $ref: '#/components/schemas/LiveCommentaryAppendParam' + - $ref: '#/components/schemas/LiveResponseItemCreateParam' + - $ref: '#/components/schemas/LiveResponseCreateParam' + - $ref: '#/components/schemas/LiveSessionCloseParam' + LiveSidebandConnectParams: type: object - description: Configuration for the supervised fine-tuning method. + description: Connection options for a sideband WebSocket attached to an existing Live session. properties: - hyperparameters: - $ref: '#/components/schemas/FineTuneSupervisedHyperparameters' - FineTuningCheckpointPermission: + graceful_close: + type: boolean + description: Opt in to the graceful WebSocket closing handshake when the session ends. The server may also enable this behavior by default. + additionalProperties: false + LiveSidebandPathParams: type: object - title: FineTuningCheckpointPermission - description: | - The `checkpoint.permission` object represents a permission for a fine-tuned model checkpoint. + description: Identifies the Live session to observe and control through a sideband WebSocket. + required: + - session_id properties: - id: - type: string - description: The permission identifier, which can be referenced in the API endpoints. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the permission was created. - project_id: + session_id: type: string - description: The project identifier that the permission is for. - object: + description: The ID of the existing Live session to attach to. + LiveSidebandServerEvent: + description: Server events received by an attached Live sideband WebSocket. Audio deltas are delivered over the primary connection. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveSessionStarted' + - $ref: '#/components/schemas/LiveSessionUpdated' + - $ref: '#/components/schemas/LiveInputAudioMuted' + - $ref: '#/components/schemas/LiveInputAudioUnmuted' + - $ref: '#/components/schemas/LiveInstructionsAppended' + - $ref: '#/components/schemas/LiveThinkingAppended' + - $ref: '#/components/schemas/LiveCommentaryAppended' + - $ref: '#/components/schemas/LiveInputTranscriptDelta' + - $ref: '#/components/schemas/LiveOutputTranscriptDelta' + - $ref: '#/components/schemas/LiveDelegationCreated' + - $ref: '#/components/schemas/LiveResponseEvent' + - $ref: '#/components/schemas/LiveSessionUsageUpdated' + - $ref: '#/components/schemas/LiveSessionClosed' + - $ref: '#/components/schemas/LiveErrorEvent' + - $ref: '#/components/schemas/LiveInfoEvent' + LiveWebRTCTransport: + type: object + description: WebRTC transport carrying the offer SDP in a creation request or answer SDP in its response. + properties: + type: type: string - description: The object type, which is always "checkpoint.permission". + description: The transport used for the Live session. Always `webrtc`. enum: - - checkpoint.permission + - webrtc x-stainless-const: true - required: - - created_at - - id - - object - - project_id - x-oaiMeta: - name: The fine-tuned model checkpoint permission object - example: | - { - "object": "checkpoint.permission", - "id": "cp_zc4Q7MP6XxulcVzj4MZdwsAB", - "created_at": 1712211699, - "project_id": "proj_abGMw1llN8IrBb6SvvY5A1iH" - } - FineTuningIntegration: - type: object - title: Fine-Tuning Job Integration + sdp: + type: string + minLength: 1 + description: Session Description Protocol message for the WebRTC connection. required: - type - - wandb + - sdp + additionalProperties: false + LocalShellToolCall: + type: object + title: Local shell call + description: | + A tool call to run a command on the local shell. properties: type: type: string - description: The type of the integration being enabled for the fine-tuning job enum: - - wandb + - local_shell_call + description: | + The type of the local shell call. Always `local_shell_call`. x-stainless-const: true - wandb: - type: object + id: + type: string description: | - The settings for your integration with Weights and Biases. This payload specifies the project that - metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags - to your run, and set a default entity (team, username, etc) to be associated with your run. - required: - - project - properties: - project: - description: | - The name of the project that the new run will be created under. - type: string - example: my-wandb-project - name: - anyOf: - - description: | - A display name to set for the run. If not set, we will use the Job ID as the name. - type: string - - type: 'null' - entity: - anyOf: - - description: | - The entity to use for the run. This allows you to set the team or username of the WandB user that you would - like associated with the run. If not set, the default entity for the registered WandB API key is used. - type: string - - type: 'null' - tags: - description: | - A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some - default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}". - type: array - items: - type: string - example: custom-tag - FineTuningJob: + The unique ID of the local shell call. + call_id: + type: string + description: | + The unique ID of the local shell tool call generated by the model. + action: + $ref: '#/components/schemas/LocalShellExecAction' + status: + type: string + enum: + - in_progress + - completed + - incomplete + description: | + The status of the local shell call. + required: + - type + - id + - call_id + - action + - status + LocalShellToolCallOutput: type: object - title: FineTuningJob + title: Local shell call output description: | - The `fine_tuning.job` object represents a fine-tuning job that has been created through the API. + The output of a local shell tool call. properties: - id: - type: string - description: The object identifier, which can be referenced in the API endpoints. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the fine-tuning job was created. - error: - anyOf: - - type: object - description: For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure. - properties: - code: - type: string - description: A machine-readable error code. - message: - type: string - description: A human-readable error message. - param: - anyOf: - - type: string - description: The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific. - - type: 'null' - required: - - code - - message - - param - - type: 'null' - fine_tuned_model: - anyOf: - - type: string - description: The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running. - - type: 'null' - finished_at: - anyOf: - - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running. - - type: 'null' - hyperparameters: - type: object - description: The hyperparameters used for the fine-tuning job. This value will only be returned when running `supervised` jobs. - properties: - batch_size: - anyOf: - - description: | - Number of examples in each batch. A larger batch size means that model parameters - are updated less frequently, but with lower variance. - default: auto - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - - type: integer - minimum: 1 - maximum: 256 - title: Auto - - type: 'null' - title: Manual - learning_rate_multiplier: - description: | - Scaling factor for the learning rate. A smaller learning rate may be useful to avoid - overfitting. - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - title: Auto - - type: number - minimum: 0 - exclusiveMinimum: true - n_epochs: - description: | - The number of epochs to train the model for. An epoch refers to one full cycle - through the training dataset. - default: auto - anyOf: - - type: string - enum: - - auto - x-stainless-const: true - title: Auto - - type: integer - minimum: 1 - maximum: 50 - model: - type: string - description: The base model that is being fine-tuned. - object: + type: type: string - description: The object type, which is always "fine_tuning.job". enum: - - fine_tuning.job + - local_shell_call_output + description: | + The type of the local shell tool call output. Always `local_shell_call_output`. x-stainless-const: true - organization_id: - type: string - description: The organization that owns the fine-tuning job. - result_files: - type: array - description: The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](https://developers.openai.com/api/reference/resources/files/methods/content). - items: - type: string - example: file-abc123 - status: + id: type: string - description: The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. - enum: - - validating_files - - queued - - running - - succeeded - - failed - - cancelled - trained_tokens: - anyOf: - - type: integer - description: The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running. - - type: 'null' - training_file: + description: | + The unique ID of the local shell tool call generated by the model. + output: type: string - description: The file ID used for training. You can retrieve the training data with the [Files API](https://developers.openai.com/api/reference/resources/files/methods/content). - validation_file: + description: | + A JSON string of the output of the local shell tool call. + status: anyOf: - type: string - description: The file ID used for validation. You can retrieve the validation results with the [Files API](https://developers.openai.com/api/reference/resources/files/methods/content). - - type: 'null' - integrations: - anyOf: - - type: array - description: A list of integrations to enable for this fine-tuning job. - maxItems: 5 - items: - anyOf: - - $ref: '#/components/schemas/FineTuningIntegration' - discriminator: - propertyName: type - - type: 'null' - seed: - type: integer - description: The seed used for the fine-tuning job. - estimated_finish: - anyOf: - - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running. + enum: + - in_progress + - completed + - incomplete + description: | + The status of the item. One of `in_progress`, `completed`, or `incomplete`. - type: 'null' - method: - $ref: '#/components/schemas/FineTuneMethod' - metadata: - $ref: '#/components/schemas/Metadata' required: - - created_at - - error - - finished_at - - fine_tuned_model - - hyperparameters - id - - model - - object - - organization_id - - result_files - - status - - trained_tokens - - training_file - - validation_file - - seed - x-oaiMeta: - name: The fine-tuning job object - example: | - { - "object": "fine_tuning.job", - "id": "ftjob-abc123", - "model": "davinci-002", - "created_at": 1692661014, - "finished_at": 1692661190, - "fine_tuned_model": "ft:davinci-002:my-org:custom_suffix:7q8mpxmy", - "organization_id": "org-123", - "result_files": [ - "file-abc123" - ], - "status": "succeeded", - "validation_file": null, - "training_file": "file-abc123", - "hyperparameters": { - "n_epochs": 4, - "batch_size": 1, - "learning_rate_multiplier": 1.0 - }, - "trained_tokens": 5768, - "integrations": [], - "seed": 0, - "estimated_finish": 0, - "method": { - "type": "supervised", - "supervised": { - "hyperparameters": { - "n_epochs": 4, - "batch_size": 1, - "learning_rate_multiplier": 1.0 - } - } - }, - "metadata": { - "key": "value" - } - } - FineTuningJobCheckpoint: + - type + - call_id + - output + LogProbProperties: type: object - title: FineTuningJobCheckpoint description: | - The `fine_tuning.job.checkpoint` object represents a model checkpoint for a fine-tuning job that is ready to use. + A log probability object. properties: - id: - type: string - description: The checkpoint identifier, which can be referenced in the API endpoints. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the checkpoint was created. - fine_tuned_model_checkpoint: - type: string - description: The name of the fine-tuned checkpoint model that is created. - step_number: - type: integer - description: The step number that the checkpoint was created at. - metrics: - type: object - description: Metrics at the step number during the fine-tuning job. - properties: - step: - type: number - train_loss: - type: number - train_mean_token_accuracy: - type: number - valid_loss: - type: number - valid_mean_token_accuracy: - type: number - full_valid_loss: - type: number - full_valid_mean_token_accuracy: - type: number - fine_tuning_job_id: + token: type: string - description: The name of the fine-tuning job that this checkpoint was created from. - object: + description: | + The token that was used to generate the log probability. + logprob: + type: number + description: | + The log probability of the token. + bytes: + type: array + items: + type: integer + description: | + The bytes that were used to generate the log probability. + required: + - token + - logprob + - bytes + MCPApprovalRequest: + type: object + title: MCP approval request + description: | + A request for human approval of a tool invocation. + properties: + type: type: string - description: The object type, which is always "fine_tuning.job.checkpoint". enum: - - fine_tuning.job.checkpoint + - mcp_approval_request + description: | + The type of the item. Always `mcp_approval_request`. x-stainless-const: true + id: + type: string + description: | + The unique ID of the approval request. + server_label: + type: string + description: | + The label of the MCP server making the request. + name: + type: string + description: | + The name of the tool to run. + arguments: + type: string + description: | + A JSON string of arguments for the tool. required: - - created_at - - fine_tuning_job_id - - fine_tuned_model_checkpoint + - type - id - - metrics - - object - - step_number - x-oaiMeta: - name: The fine-tuning job checkpoint object - example: | - { - "object": "fine_tuning.job.checkpoint", - "id": "ftckpt_qtZ5Gyk4BLq1SfLFWp3RtO3P", - "created_at": 1712211699, - "fine_tuned_model_checkpoint": "ft:gpt-4o-mini-2024-07-18:my-org:custom_suffix:9ABel2dg:ckpt-step-88", - "fine_tuning_job_id": "ftjob-fpbNQ3H1GrMehXRf8cO97xTN", - "metrics": { - "step": 88, - "train_loss": 0.478, - "train_mean_token_accuracy": 0.924, - "valid_loss": 10.112, - "valid_mean_token_accuracy": 0.145, - "full_valid_loss": 0.567, - "full_valid_mean_token_accuracy": 0.944 - }, - "step_number": 88 - } - FineTuningJobEvent: + - server_label + - name + - arguments + MCPApprovalResponse: type: object - description: Fine-tuning job event object + title: MCP approval response + description: | + A response to an MCP approval request. properties: - object: + type: type: string - description: The object type, which is always "fine_tuning.job.event". enum: - - fine_tuning.job.event + - mcp_approval_response + description: | + The type of the item. Always `mcp_approval_response`. x-stainless-const: true id: + anyOf: + - type: string + description: | + The unique ID of the approval response + - type: 'null' + approval_request_id: type: string - description: The object identifier. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the fine-tuning job was created. - level: + description: | + The ID of the approval request being answered. + approve: + type: boolean + description: | + Whether the request was approved. + reason: + anyOf: + - type: string + description: | + Optional reason for the decision. + - type: 'null' + required: + - type + - request_id + - approve + - approval_request_id + MCPApprovalResponseResource: + type: object + title: MCP approval response + description: | + A response to an MCP approval request. + properties: + type: type: string - description: The log level of the event. enum: - - info - - warn - - error - message: + - mcp_approval_response + description: | + The type of the item. Always `mcp_approval_response`. + x-stainless-const: true + id: type: string - description: The message of the event. + description: | + The unique ID of the approval response + approval_request_id: + type: string + description: | + The ID of the approval request being answered. + approve: + type: boolean + description: | + Whether the request was approved. + reason: + anyOf: + - type: string + description: | + Optional reason for the decision. + - type: 'null' + required: + - type + - id + - request_id + - approve + - approval_request_id + MCPListTools: + type: object + title: MCP list tools + description: | + A list of tools available on an MCP server. + properties: type: type: string - description: The type of event. enum: - - message - - metrics - data: - type: object - description: The data associated with the event. + - mcp_list_tools + description: | + The type of the item. Always `mcp_list_tools`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the list. + server_label: + type: string + description: | + The label of the MCP server. + tools: + type: array + items: + $ref: '#/components/schemas/MCPListToolsTool' + description: | + The tools available on the server. + error: + anyOf: + - type: string + description: | + Error message if the server could not list tools. + - type: 'null' required: + - type - id - - object - - created_at - - level - - message - x-oaiMeta: - name: The fine-tuning job event object - example: | - { - "object": "fine_tuning.job.event", - "id": "ftevent-abc123" - "created_at": 1677610602, - "level": "info", - "message": "Created fine-tuning job", - "data": {}, - "type": "message" - } - FunctionAndCustomToolCallOutput: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/InputTextContent' - - $ref: '#/components/schemas/InputImageContent' - - $ref: '#/components/schemas/InputFileContent' - FunctionObject: + - server_label + - tools + MCPListToolsTool: type: object + title: MCP list tools tool + description: | + A tool available on an MCP server. properties: - description: - type: string - description: A description of what the function does, used by the model to choose when and how to call the function. name: type: string - description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - parameters: - $ref: '#/components/schemas/FunctionParameters' - strict: + description: | + The name of the tool. + description: anyOf: - - type: boolean - default: false - description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://developers.openai.com/api/docs/guides/function-calling). + - type: string + description: | + The description of the tool. + - type: 'null' + input_schema: + type: object + description: | + The JSON schema describing the tool's input. + annotations: + anyOf: + - type: object + description: | + Additional annotations about the tool. - type: 'null' required: - name - FunctionParameters: - type: object - description: |- - The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://developers.openai.com/api/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - additionalProperties: true - FunctionToolCall: + - input_schema + MCPTool: type: object - title: Function tool call + title: MCP tool description: | - A tool call to run a function. See the - [function calling guide](https://developers.openai.com/api/docs/guides/function-calling) for more information. + Give the model access to additional tools via remote Model Context Protocol + (MCP) servers. [Learn more about MCP](https://developers.openai.com/api/docs/guides/tools-connectors-mcp). properties: - id: + type: + type: string + enum: + - mcp + description: The type of the MCP tool. Always `mcp`. + x-stainless-const: true + server_label: type: string description: | - The unique ID of the function tool call. - type: + A label for this MCP server, used to identify it in tool calls. + server_url: + type: string + format: uri + description: | + The URL for the MCP server. One of `server_url`, `connector_id`, or + `tunnel_id` must be provided. + connector_id: type: string enum: - - function_call + - connector_dropbox + - connector_gmail + - connector_googlecalendar + - connector_googledrive + - connector_microsoftteams + - connector_outlookcalendar + - connector_outlookemail + - connector_sharepoint description: | - The type of the function tool call. Always `function_call`. - x-stainless-const: true - call_id: + Identifier for service connectors, like those available in ChatGPT. One of + `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more + about service connectors [here](https://developers.openai.com/api/docs/guides/tools-connectors-mcp#connectors). + + Currently supported `connector_id` values are: + + - Dropbox: `connector_dropbox` + - Gmail: `connector_gmail` + - Google Calendar: `connector_googlecalendar` + - Google Drive: `connector_googledrive` + - Microsoft Teams: `connector_microsoftteams` + - Outlook Calendar: `connector_outlookcalendar` + - Outlook Email: `connector_outlookemail` + - SharePoint: `connector_sharepoint` + tunnel_id: + type: string + pattern: ^tunnel_[a-z0-9]{32}$ + description: | + The Secure MCP Tunnel ID to use instead of a direct server URL. One of + `server_url`, `connector_id`, or `tunnel_id` must be provided. + authorization: type: string description: | - The unique ID of the function tool call generated by the model. - caller: + An OAuth access token that can be used with a remote MCP server, either + with a custom MCP server URL or a service connector. Your application + must handle the OAuth authorization flow and provide the token here. + server_description: + type: string + description: | + Optional description of the MCP server, used to provide more context. + headers: anyOf: - - $ref: '#/components/schemas/ToolCallCaller' + - type: object + additionalProperties: + type: string + description: | + Optional HTTP headers to send to the MCP server. Use for authentication + or other purposes. - type: 'null' - namespace: + allowed_tools: + anyOf: + - description: | + List of allowed tool names or a filter object. + anyOf: + - type: array + title: MCP allowed tools + description: A string array of allowed tool names + items: + type: string + - $ref: '#/components/schemas/MCPToolFilter' + - type: 'null' + allowed_callers: + anyOf: + - type: array + minItems: 1 + items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + description: The tool invocation context(s). + - type: 'null' + require_approval: + anyOf: + - description: Specify which of the MCP server's tools require approval. + default: always + anyOf: + - type: object + title: MCP tool approval filter + description: | + Specify which of the MCP server's tools require approval. Can be + `always`, `never`, or a filter object associated with tools + that require approval. + properties: + always: + $ref: '#/components/schemas/MCPToolFilter' + never: + $ref: '#/components/schemas/MCPToolFilter' + additionalProperties: false + - type: string + title: MCP tool approval setting + description: | + Specify a single approval policy for all tools. One of `always` or + `never`. When set to `always`, all tools will require approval. When + set to `never`, all tools will not require approval. + enum: + - always + - never + - type: 'null' + defer_loading: + type: boolean + description: | + Whether this MCP tool is deferred and discovered via tool search. + required: + - type + - server_label + MCPToolCall: + type: object + title: MCP tool call + description: | + An invocation of a tool on an MCP server. + properties: + type: type: string + enum: + - mcp_call description: | - The namespace of the function to run. + The type of the item. Always `mcp_call`. + x-stainless-const: true + id: + type: string + description: | + The unique ID of the tool call. + server_label: + type: string + description: | + The label of the MCP server running the tool. name: type: string description: | - The name of the function to run. + The name of the tool that was run. arguments: type: string description: | - A JSON string of the arguments to pass to the function. + A JSON string of the arguments passed to the tool. + output: + anyOf: + - type: string + description: | + The output from the tool call. + - type: 'null' + error: + description: The error from the tool call, if any. + anyOf: + - $ref: '#/components/schemas/MCPToolCallError' + - type: 'null' status: - type: string - description: | - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. - enum: - - in_progress - - completed - - incomplete - async: - type: boolean + $ref: '#/components/schemas/MCPToolCallStatus' description: | - Whether the function tool call runs asynchronously. + The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`. + approval_request_id: + anyOf: + - type: string + description: | + Unique identifier for the MCP tool call approval request. + Include this value in a subsequent `mcp_approval_response` input to approve or reject the corresponding tool call. + - type: 'null' required: - type - - call_id + - id + - server_label - name - arguments - FunctionToolCallOutput: + MCPToolCallError: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/MCPProtocolError' + - $ref: '#/components/schemas/MCPToolExecutionError' + - $ref: '#/components/schemas/HTTPError' + MCPToolFilter: + type: object + title: MCP tool filter + description: | + A filter object to specify which tools are allowed. + properties: + tool_names: + type: array + title: MCP allowed tools + items: + type: string + description: List of allowed tool names. + read_only: + type: boolean + description: | + Indicates whether or not a tool modifies data or is read-only. If an + MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), + it will match this filter. + required: [] + additionalProperties: false + MessageContentImageFileObject: + title: Image file + type: object + description: References an image [File](https://developers.openai.com/api/reference/resources/files) in the content of a message. + properties: + type: + description: Always `image_file`. + type: string + enum: + - image_file + x-stainless-const: true + image_file: + type: object + properties: + file_id: + description: The [File](https://developers.openai.com/api/reference/resources/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. + type: string + detail: + type: string + description: Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. + enum: + - auto + - low + - high + default: auto + required: + - file_id + required: + - type + - image_file + MessageContentImageUrlObject: + title: Image URL + type: object + description: References an image URL in the content of a message. + properties: + type: + type: string + enum: + - image_url + description: The type of the content part. + x-stainless-const: true + image_url: + type: object + properties: + url: + type: string + description: 'The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.' + format: uri + detail: + type: string + description: Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` + enum: + - auto + - low + - high + default: auto + required: + - url + required: + - type + - image_url + MessageContentRefusalObject: + title: Refusal type: object - title: Function tool call output - description: | - The output of a function tool call. + description: The refusal content generated by the assistant. properties: - id: - type: string - description: | - The unique ID of the function tool call output. Populated when this item - is returned via API. type: + description: Always `refusal`. type: string enum: - - function_call_output - description: | - The type of the function tool call output. Always `function_call_output`. + - refusal x-stainless-const: true - call_id: - type: string - description: | - The unique ID of the function tool call generated by the model. - name: - type: string - description: | - The name of the tool that produced the output. - namespace: - type: string - description: | - The namespace of the tool that produced the output. - caller: - anyOf: - - $ref: '#/components/schemas/ToolCallCallerParam' - - type: 'null' - output: - description: | - The output from the function call generated by your code. - Can be a string or an list of output content. - anyOf: - - type: string - description: | - A string of the output of the function call. - title: string output - - type: array - items: - $ref: '#/components/schemas/FunctionAndCustomToolCallOutput' - title: output content list - description: | - Text, image, or file output of the function call. - status: + refusal: type: string - description: | - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. - enum: - - in_progress - - completed - - incomplete required: - type - - output - FunctionToolCallOutputResource: - allOf: - - $ref: '#/components/schemas/FunctionToolCallOutput' - - type: object - properties: - id: - type: string - description: | - The unique ID of the function call tool output. - status: - description: | - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. - $ref: '#/components/schemas/FunctionCallOutputStatusEnum' - created_by: - type: string - description: | - The identifier of the actor that created the item. - required: - - id - - status - FunctionToolCallResource: - allOf: - - $ref: '#/components/schemas/FunctionToolCall' - - type: object - properties: - id: - type: string - description: | - The unique ID of the function tool call. - status: - description: | - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. - $ref: '#/components/schemas/FunctionCallStatus' - created_by: - type: string - description: | - The identifier of the actor that created the item. - required: - - id - - status - GraderLabelModel: + - refusal + MessageContentTextAnnotationsFileCitationObject: + title: File citation type: object - title: LabelModelGrader - description: | - A LabelModelGrader object which uses a model to assign labels to each item - in the evaluation. + description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. properties: type: - description: The object type, which is always `label_model`. + description: Always `file_citation`. type: string enum: - - label_model + - file_citation x-stainless-const: true - name: - type: string - description: The name of the grader. - model: + text: + description: The text in the message content that needs to be replaced. type: string - description: The model to use for the evaluation. Must support structured outputs. - input: - type: array - items: - $ref: '#/components/schemas/EvalItem' - labels: - type: array - items: - type: string - description: The labels to assign to each item in the evaluation. - passing_labels: - type: array - items: - type: string - description: The labels that indicate a passing result. Must be a subset of labels. + file_citation: + type: object + properties: + file_id: + description: The ID of the specific File the citation is from. + type: string + required: + - file_id + start_index: + type: integer + minimum: 0 + end_index: + type: integer + minimum: 0 required: - type - - model - - input - - passing_labels - - labels - - name - x-oaiMeta: - name: Label Model Grader - group: graders - example: | - { - "name": "First label grader", - "type": "label_model", - "model": "gpt-4o-2024-08-06", - "input": [ - { - "type": "message", - "role": "system", - "content": { - "type": "input_text", - "text": "Classify the sentiment of the following statement as one of positive, neutral, or negative" - } - }, - { - "type": "message", - "role": "user", - "content": { - "type": "input_text", - "text": "Statement: {{item.response}}" - } - } - ], - "passing_labels": [ - "positive" - ], - "labels": [ - "positive", - "neutral", - "negative" - ] - } - GraderMulti: + - text + - file_citation + - start_index + - end_index + MessageContentTextAnnotationsFilePathObject: + title: File path type: object - title: MultiGrader - description: A MultiGrader object combines the output of multiple graders to produce a single score. + description: A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. properties: type: + description: Always `file_path`. type: string enum: - - multi - default: multi - description: The object type, which is always `multi`. + - file_path x-stainless-const: true - name: - type: string - description: The name of the grader. - graders: - anyOf: - - $ref: '#/components/schemas/GraderStringCheck' - - $ref: '#/components/schemas/GraderTextSimilarity' - - $ref: '#/components/schemas/GraderPython' - - $ref: '#/components/schemas/GraderScoreModel' - - $ref: '#/components/schemas/GraderLabelModel' - calculate_output: + text: + description: The text in the message content that needs to be replaced. type: string - description: A formula to calculate the output based on grader results. + file_path: + type: object + properties: + file_id: + description: The ID of the file that was generated. + type: string + required: + - file_id + start_index: + type: integer + minimum: 0 + end_index: + type: integer + minimum: 0 required: - - name - type - - graders - - calculate_output - x-oaiMeta: - name: Multi Grader - group: graders - example: | - { - "type": "multi", - "name": "example multi grader", - "graders": [ - { - "type": "text_similarity", - "name": "example text similarity grader", - "input": "The graded text", - "reference": "The reference text", - "evaluation_metric": "fuzzy_match" - }, - { - "type": "string_check", - "name": "Example string check grader", - "input": "{{sample.output_text}}", - "reference": "{{item.label}}", - "operation": "eq" - } - ], - "calculate_output": "0.5 * text_similarity_score + 0.5 * string_check_score)" - } - GraderPython: + - text + - file_path + - start_index + - end_index + MessageContentTextObject: + title: Text type: object - title: PythonGrader - description: | - A PythonGrader object that runs a python script on the input. + description: The text content that is part of a message. properties: type: + description: Always `text`. type: string enum: - - python - description: The object type, which is always `python`. + - text x-stainless-const: true - name: - type: string - description: The name of the grader. - source: - type: string - description: The source code of the python script. - image_tag: - type: string - description: The image tag to use for the python script. + text: + type: object + properties: + value: + description: The data that makes up the text. + type: string + annotations: + type: array + items: + $ref: '#/components/schemas/TextAnnotation' + required: + - value + - annotations required: - type - - name - - source - x-oaiMeta: - name: Python Grader - group: graders - example: | - { - "type": "python", - "name": "Example python grader", - "image_tag": "2025-05-08", - "source": """ - def grade(sample: dict, item: dict) -> float: - \""" - Returns 1.0 if `output_text` equals `label`, otherwise 0.0. - \""" - output = sample.get("output_text") - label = item.get("label") - return 1.0 if output == label else 0.0 - """, - } - GraderScoreModel: + - text + MessageDeltaContentImageFileObject: + title: Image file type: object - title: ScoreModelGrader - description: | - A ScoreModelGrader object that uses a model to assign a score to the input. + description: References an image [File](https://developers.openai.com/api/reference/resources/files) in the content of a message. properties: + index: + type: integer + description: The index of the content part in the message. type: + description: Always `image_file`. type: string enum: - - score_model - description: The object type, which is always `score_model`. + - image_file x-stainless-const: true - name: - type: string - description: The name of the grader. - model: - type: string - description: The model to use for the evaluation. - sampling_params: + image_file: type: object - description: The sampling parameters for the model. properties: - seed: - anyOf: - - type: integer - description: | - A seed value to initialize the randomness, during sampling. - - type: 'null' - top_p: - anyOf: - - type: number - default: 1 - example: 1 - description: | - An alternative to temperature for nucleus sampling; 1.0 includes all tokens. - - type: 'null' - temperature: - anyOf: - - type: number - description: | - A higher temperature increases randomness in the outputs. - - type: 'null' - max_completions_tokens: - anyOf: - - type: integer - minimum: 1 - description: | - The maximum number of tokens the grader model may generate in its response. - - type: 'null' - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - input: - type: array - items: - $ref: '#/components/schemas/EvalItem' - description: | - The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings. - range: - type: array - items: - type: number - min_items: 2 - max_items: 2 - description: The range of the score. Defaults to `[0, 1]`. + file_id: + description: The [File](https://developers.openai.com/api/reference/resources/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. + type: string + detail: + type: string + description: Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. + enum: + - auto + - low + - high + default: auto required: + - index - type - - name - - input - - model - x-oaiMeta: - name: Score Model Grader - group: graders - example: | - { - "type": "score_model", - "name": "Example score model grader", - "input": [ - { - "role": "user", - "content": [ - { - "type": "input_text", - "text": ( - "Score how close the reference answer is to the model answer. Score 1.0 if they are the same and 0.0 if they are different." - " Return just a floating point score\n\n" - " Reference answer: {{item.label}}\n\n" - " Model answer: {{sample.output_text}}" - ) - }, - { - "type": "input_image", - "image_url": "https://example.com/reference.png", - "file_id": null, - "detail": "auto" - } - ], - } - ], - "model": "gpt-5-mini", - "sampling_params": { - "temperature": 1, - "top_p": 1, - "seed": 42, - "max_completions_tokens": 32768, - "reasoning_effort": "medium" - }, - } - GraderStringCheck: + MessageDeltaContentImageUrlObject: + title: Image URL type: object - title: StringCheckGrader - description: | - A StringCheckGrader object that performs a string comparison between input and reference using a specified operation. + description: References an image URL in the content of a message. properties: + index: + type: integer + description: The index of the content part in the message. type: + description: Always `image_url`. type: string enum: - - string_check - description: The object type, which is always `string_check`. + - image_url x-stainless-const: true - name: - type: string - description: The name of the grader. - input: - type: string - description: The input text. This may include template strings. - reference: - type: string - description: The reference text. This may include template strings. - operation: + image_url: + type: object + properties: + url: + description: 'The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.' + type: string + format: uri + detail: + type: string + description: Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. + enum: + - auto + - low + - high + default: auto + required: + - index + - type + MessageDeltaContentRefusalObject: + title: Refusal + type: object + description: The refusal content that is part of a message. + properties: + index: + type: integer + description: The index of the refusal part in the message. + type: + description: Always `refusal`. type: string enum: - - eq - - ne - - like - - ilike - description: The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`. + - refusal + x-stainless-const: true + refusal: + type: string required: - - type - - name - - input - - reference - - operation - x-oaiMeta: - name: String Check Grader - group: graders - example: | - { - "type": "string_check", - "name": "Example string check grader", - "input": "{{sample.output_text}}", - "reference": "{{item.label}}", - "operation": "eq" - } - GraderTextSimilarity: + - index + - type + MessageDeltaContentTextAnnotationsFileCitationObject: + title: File citation type: object - title: TextSimilarityGrader - description: | - A TextSimilarityGrader object which grades text based on similarity metrics. + description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. properties: + index: + type: integer + description: The index of the annotation in the text content part. type: + description: Always `file_citation`. type: string enum: - - text_similarity - default: text_similarity - description: The type of grader. + - file_citation x-stainless-const: true - name: - type: string - description: The name of the grader. - input: - type: string - description: The text being graded. - reference: - type: string - description: The text being graded against. - evaluation_metric: + text: + description: The text in the message content that needs to be replaced. type: string - enum: - - cosine - - fuzzy_match - - bleu - - gleu - - meteor - - rouge_1 - - rouge_2 - - rouge_3 - - rouge_4 - - rouge_5 - - rouge_l - description: "The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, \n`gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, \nor `rouge_l`.\n" + file_citation: + type: object + properties: + file_id: + description: The ID of the specific File the citation is from. + type: string + quote: + description: The specific quote in the file. + type: string + start_index: + type: integer + minimum: 0 + end_index: + type: integer + minimum: 0 required: + - index - type - - name - - input - - reference - - evaluation_metric - x-oaiMeta: - name: Text Similarity Grader - group: graders - example: | - { - "type": "text_similarity", - "name": "Example text similarity grader", - "input": "{{sample.output_text}}", - "reference": "{{item.label}}", - "evaluation_metric": "fuzzy_match" - } - Group: + MessageDeltaContentTextAnnotationsFilePathObject: + title: File path type: object - description: Summary information about a group returned in role assignment responses. + description: A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. properties: - object: + index: + type: integer + description: The index of the annotation in the text content part. + type: + description: Always `file_path`. type: string enum: - - group - description: Always `group`. + - file_path x-stainless-const: true - id: - type: string - description: Identifier for the group. - name: + text: + description: The text in the message content that needs to be replaced. type: string - description: Display name of the group. - created_at: + file_path: + type: object + properties: + file_id: + description: The ID of the file that was generated. + type: string + start_index: type: integer - format: unixtime - description: Unix timestamp (in seconds) when the group was created. - scim_managed: - type: boolean - description: Whether the group is managed through SCIM. + minimum: 0 + end_index: + type: integer + minimum: 0 required: - - object - - id - - name - - created_at - - scim_managed - x-oaiMeta: - name: The group object - example: | - { - "object": "group", - "id": "group_01J1F8ABCDXYZ", - "name": "Support Team", - "created_at": 1711471533, - "scim_managed": false - } - GroupDeletedResource: + - index + - type + MessageDeltaContentTextObject: + title: Text type: object - description: Confirmation payload returned after deleting a group. + description: The text content that is part of a message. properties: - object: + index: + type: integer + description: The index of the content part in the message. + type: + description: Always `text`. type: string enum: - - group.deleted - description: Always `group.deleted`. + - text x-stainless-const: true - id: - type: string - description: Identifier of the deleted group. - deleted: - type: boolean - description: Whether the group was deleted. + text: + type: object + properties: + value: + description: The data that makes up the text. + type: string + annotations: + type: array + items: + $ref: '#/components/schemas/TextAnnotationDelta' required: - - object - - id - - deleted - x-oaiMeta: - example: | - { - "object": "group.deleted", - "id": "group_01J1F8ABCDXYZ", - "deleted": true - } - GroupListResource: + - index + - type + MessageDeltaObject: type: object - description: Paginated list of organization groups. + title: Message delta object + description: | + Represents a message delta i.e. any changed fields on a message during streaming. properties: + id: + description: The identifier of the message, which can be referenced in API endpoints. + type: string object: + description: The object type, which is always `thread.message.delta`. type: string enum: - - list - description: Always `list`. + - thread.message.delta x-stainless-const: true - data: - type: array - description: Groups returned in the current page. - items: - $ref: '#/components/schemas/GroupResponse' - has_more: - type: boolean - description: Whether additional groups are available when paginating. - next: - description: Cursor to fetch the next page of results, or `null` if there are no more results. - anyOf: - - type: string - - type: 'null' + delta: + description: The delta containing the fields that have changed on the Message. + type: object + properties: + role: + description: The entity that produced the message. One of `user` or `assistant`. + type: string + enum: + - user + - assistant + content: + description: The content of the message in array of text and/or images. + type: array + items: + $ref: '#/components/schemas/MessageContentDelta' required: + - id - object - - data - - has_more - - next + - delta x-oaiMeta: - name: Group list + name: The message delta object + beta: true example: | { - "object": "list", - "data": [ - { - "id": "group_01J1F8ABCDXYZ", - "name": "Support Team", - "created_at": 1711471533, - "is_scim_managed": false - }, - { - "id": "group_01J1F8PQRMNO", - "name": "Sales", - "created_at": 1711472599, - "is_scim_managed": true - } - ], - "has_more": false, - "next": null + "id": "msg_123", + "object": "thread.message.delta", + "delta": { + "content": [ + { + "index": 0, + "type": "text", + "text": { "value": "Hello", "annotations": [] } + } + ] + } } - GroupMemberUser: + MessageObject: type: object - description: Details about a user returned from an organization group membership lookup. + title: The message object + description: Represents a message within a [thread](https://developers.openai.com/api/docs/assistants/migration). properties: id: + description: The identifier, which can be referenced in API endpoints. type: string - description: Identifier for the user. - name: + object: + description: The object type, which is always `thread.message`. type: string - description: Display name of the user. - email: - description: Email address of the user, or `null` for users without an email. + enum: + - thread.message + x-stainless-const: true + created_at: + description: The Unix timestamp (in seconds) for when the message was created. + type: integer + format: unixtime + thread_id: + description: The [thread](https://developers.openai.com/api/docs/assistants/migration) ID that this message belongs to. + type: string + status: + description: The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. + type: string + enum: + - in_progress + - incomplete + - completed + incomplete_details: anyOf: - - type: string + - description: On an incomplete message, details about why the message is incomplete. + type: object + properties: + reason: + type: string + description: The reason the message is incomplete. + enum: + - content_filter + - max_tokens + - run_cancelled + - run_expired + - run_failed + required: + - reason - type: 'null' - picture: - description: URL of the user's profile picture, if available. + completed_at: anyOf: - - type: string + - description: The Unix timestamp (in seconds) for when the message was completed. + type: integer + format: unixtime - type: 'null' - is_service_account: - description: Whether the user is a service account. + incomplete_at: anyOf: - - type: boolean + - description: The Unix timestamp (in seconds) for when the message was marked as incomplete. + type: integer + format: unixtime - type: 'null' - user_type: + role: + description: The entity that produced the message. One of `user` or `assistant`. type: string enum: - user - - tenant_user - description: The type of user. + - assistant + content: + description: The content of the message in array of text and/or images. + type: array + items: + $ref: '#/components/schemas/MessageContent' + assistant_id: + anyOf: + - description: If applicable, the ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) that authored this message. + type: string + - type: 'null' + run_id: + anyOf: + - description: The ID of the [run](https://developers.openai.com/api/docs/assistants/migration) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. + type: string + - type: 'null' + attachments: + anyOf: + - type: array + items: + type: object + properties: + file_id: + type: string + description: The ID of the file to attach to the message. + tools: + description: The tools to add this file to. + type: array + items: + anyOf: + - $ref: '#/components/schemas/AssistantToolsCode' + - $ref: '#/components/schemas/AssistantToolsFileSearchTypeOnly' + description: A list of files attached to the message, and the tools they were added to. + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' required: - id - - name - - email - - picture - - is_service_account - - user_type + - object + - created_at + - thread_id + - status + - incomplete_details + - completed_at + - incomplete_at + - role + - content + - assistant_id + - run_id + - attachments + - metadata x-oaiMeta: - name: The group member user object + name: The message object + beta: true example: | { - "id": "user_abc123", - "name": "Ada Lovelace", - "email": "ada@example.com", - "picture": null, - "is_service_account": false, - "user_type": "user" + "id": "msg_abc123", + "object": "thread.message", + "created_at": 1698983503, + "thread_id": "thread_abc123", + "role": "assistant", + "content": [ + { + "type": "text", + "text": { + "value": "Hi! How can I help you today?", + "annotations": [] + } + } + ], + "assistant_id": "asst_abc123", + "run_id": "run_abc123", + "attachments": [], + "metadata": {} } - GroupResourceWithSuccess: + MessagePhase: + type: string + description: | + Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`). + For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend + phase on all assistant messages — dropping it can degrade performance. Not used for user messages. + enum: + - commentary + - final_answer + MessageRequestContentTextObject: + title: Text type: object - description: Response returned after updating a group. + description: The text content that is part of a message. properties: - id: + type: + description: Always `text`. type: string - description: Identifier for the group. - name: + enum: + - text + x-stainless-const: true + text: type: string - description: Updated display name for the group. - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) when the group was created. - is_scim_managed: - type: boolean - description: Whether the group is managed through SCIM and controlled by your identity provider. + description: Text content to be sent to the model required: - - id - - name - - created_at - - is_scim_managed - x-oaiMeta: - example: | - { - "id": "group_01J1F8ABCDXYZ", - "name": "Escalations", - "created_at": 1711471533, - "is_scim_managed": false - } - GroupResponse: - type: object - description: Details about an organization group. + - type + - text + MessageStreamEvent: + anyOf: + - type: object + properties: + event: + type: string + enum: + - thread.message.created + x-stainless-const: true + data: + $ref: '#/components/schemas/MessageObject' + required: + - event + - data + description: Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) is created. + x-oaiMeta: + dataDescription: '`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.message.in_progress + x-stainless-const: true + data: + $ref: '#/components/schemas/MessageObject' + required: + - event + - data + description: Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) moves to an `in_progress` state. + x-oaiMeta: + dataDescription: '`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.message.delta + x-stainless-const: true + data: + $ref: '#/components/schemas/MessageDeltaObject' + required: + - event + - data + description: Occurs when parts of a [Message](https://developers.openai.com/api/docs/assistants/migration) are being streamed. + x-oaiMeta: + dataDescription: '`data` is a [message delta](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.message.completed + x-stainless-const: true + data: + $ref: '#/components/schemas/MessageObject' + required: + - event + - data + description: Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) is completed. + x-oaiMeta: + dataDescription: '`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.message.incomplete + x-stainless-const: true + data: + $ref: '#/components/schemas/MessageObject' + required: + - event + - data + description: Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) ends before it is completed. + x-oaiMeta: + dataDescription: '`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)' + discriminator: + propertyName: event + Metadata: + anyOf: + - type: object + description: | + Set of 16 key-value pairs that can be attached to an object. This can be + useful for storing additional information about the object in a structured + format, and querying for objects via API or the dashboard. + + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + additionalProperties: + type: string + x-oaiTypeLabel: map + - type: 'null' + Model: + title: Model + description: Describes an OpenAI model offering that can be used with the API. properties: id: type: string - description: Identifier for the group. - name: - type: string - description: Display name of the group. - created_at: + description: The model identifier, which can be referenced in the API endpoints. + created: type: integer format: unixtime - description: Unix timestamp (in seconds) when the group was created. - is_scim_managed: - type: boolean - description: Whether the group is managed through SCIM and controlled by your identity provider. - group_type: - type: string - enum: - - group - - tenant_group - description: The type of the group. - required: - - id - - name - - created_at - - is_scim_managed - - group_type - x-oaiMeta: - name: Group - example: | - { - "id": "group_01J1F8ABCDXYZ", - "name": "Support Team", - "created_at": 1711471533, - "is_scim_managed": false, - "group_type": "group" - } - GroupRoleAssignment: - type: object - description: Role assignment linking a group to a role. - properties: + description: The Unix timestamp (in seconds) when the model was created. object: type: string + description: The object type, which is always "model". enum: - - group.role - description: Always `group.role`. + - model x-stainless-const: true - group: - $ref: '#/components/schemas/Group' - role: - $ref: '#/components/schemas/Role' - required: - - object - - group - - role - x-oaiMeta: - name: The group role object - example: | - { - "object": "group.role", - "group": { - "object": "group", - "id": "group_01J1F8ABCDXYZ", - "name": "Support Team", - "created_at": 1711471533, - "scim_managed": false - }, - "role": { - "object": "role", - "id": "role_01J1F8ROLE01", - "name": "API Group Manager", - "description": "Allows managing organization groups", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "resource_type": "api.organization", - "predefined_role": false - } - } - GroupUser: - type: object - description: Represents an individual user returned when inspecting group membership. - properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints - name: + owned_by: type: string - description: The name of the user. - email: + description: The organization that owns the model. + shutdown_date: anyOf: - type: string + format: date - type: 'null' - description: The email address of the user. + description: The date when the model will shut down, or null if not announced. required: - id - - name - - email - GroupUserAssignment: - type: object - description: Confirmation payload returned after adding a user to a group. - properties: - object: - type: string - enum: - - group.user - description: Always `group.user`. - x-stainless-const: true - user_id: - type: string - description: Identifier of the user that was added. - group_id: - type: string - description: Identifier of the group the user was added to. - required: - - object - - user_id - - group_id - x-oaiMeta: - name: The group user object - example: | - { - "object": "group.user", - "user_id": "user_abc123", - "group_id": "group_01J1F8ABCDXYZ" - } - GroupUserDeletedResource: - type: object - description: Confirmation payload returned after removing a user from a group. - properties: - object: - type: string - enum: - - group.user.deleted - description: Always `group.user.deleted`. - x-stainless-const: true - deleted: - type: boolean - description: Whether the group membership was removed. - required: - object - - deleted + - created + - owned_by x-oaiMeta: - name: Group user deletion confirmation + name: The model object example: | { - "object": "group.user.deleted", - "deleted": true + "id": "gpt-6-astra", + "object": "model", + "created": 1686935002, + "owned_by": "openai", + "shutdown_date": "2026-10-23" } - HostedToolPermission: - type: object - description: Permission state for a single hosted tool on a project. - properties: - enabled: - type: boolean - description: Whether the hosted tool is enabled for the project. - required: - - enabled - HostedToolPermissionUpdate: - type: object - properties: - enabled: - type: boolean - description: Whether to enable the hosted tool for the project. - required: - - enabled - Image: - type: object - description: Represents the content or the URL of an image generated by the OpenAI API. - properties: - b64_json: - type: string - description: The base64-encoded JSON of the generated image. Returned by default for the GPT image models, and only present if `response_format` is set to `b64_json` for `dall-e-2` and `dall-e-3`. - url: - type: string - format: uri - description: When using `dall-e-2` or `dall-e-3`, the URL of the generated image if `response_format` is set to `url` (default value). Unsupported for the GPT image models. - revised_prompt: - type: string - description: For `dall-e-3` only, the revised prompt that was used to generate the image. - ImageEditCompletedEvent: + ModelIds: + anyOf: + - $ref: '#/components/schemas/ModelIdsShared' + - $ref: '#/components/schemas/ModelIdsResponses' + ModelIdsCompaction: + anyOf: + - $ref: '#/components/schemas/ModelIdsResponses' + - type: string + - type: 'null' + description: Model ID used to generate the response, like `gpt-6-astra`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) to browse and compare available models. + ModelIdsLive: + description: The Live model. Required in the session configuration for every transport; do not pass it as a URL query parameter. + example: gpt-live-1 + anyOf: + - type: string + minLength: 1 + - type: string + enum: + - gpt-live-1 + ModelIdsResponses: + example: gpt-6-astra + anyOf: + - $ref: '#/components/schemas/ModelIdsShared' + - type: string + title: ResponsesOnlyModel + enum: + - o1-pro + - o1-pro-2025-03-19 + - o3-pro + - o3-pro-2025-06-10 + - o3-deep-research + - o3-deep-research-2025-06-26 + - o4-mini-deep-research + - o4-mini-deep-research-2025-06-26 + - computer-use-preview + - computer-use-preview-2025-03-11 + - gpt-5.5-pro + - gpt-5.5-pro-2026-04-23 + - gpt-5-codex + - gpt-5-pro + - gpt-5-pro-2025-10-06 + - gpt-5.1-codex-max + - gpt-daybreak-blue-latest + - gpt-daybreak-red-latest + - gpt-5.6-cyber + ModelIdsShared: + example: gpt-6-astra + anyOf: + - type: string + - $ref: '#/components/schemas/ChatModel' + ModelResponseProperties: type: object - description: | - Emitted when image editing has completed and the final image is available. properties: - type: - type: string - description: | - The type of the event. Always `image_edit.completed`. - enum: - - image_edit.completed - x-stainless-const: true - b64_json: + metadata: + $ref: '#/components/schemas/Metadata' + top_logprobs: + anyOf: + - description: | + An integer between 0 and 20 specifying the maximum number of most likely + tokens to return at each token position, each with an associated log + probability. In some cases, the number of returned tokens may be fewer than + requested. + type: integer + minimum: 0 + maximum: 20 + - type: 'null' + temperature: + anyOf: + - type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + description: | + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + We generally recommend altering this or `top_p` but not both. + - type: 'null' + top_p: + anyOf: + - type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + description: | + An alternative to sampling with temperature, called nucleus sampling, + where the model considers the results of the tokens with top_p probability + mass. So 0.1 means only the tokens comprising the top 10% probability mass + are considered. + + We generally recommend altering this or `temperature` but not both. + - type: 'null' + user: type: string + example: user-1234 + deprecated: true description: | - Base64-encoded final edited image data, suitable for rendering as an image. - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp when the event was created. - size: + This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations. + A stable identifier for your end-users. + Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). + safety_identifier: + anyOf: + - type: string + maxLength: 64 + example: safety-identifier-1234 + description: | + A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. + The IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). + - type: 'null' + prompt_cache_key: anyOf: - type: string + example: prompt-cache-key-1234 + description: | + Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](https://developers.openai.com/api/docs/guides/prompt-caching). + - type: 'null' + prompt_cache_retention: + deprecated: true + anyOf: - type: string enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - - auto - description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. - quality: - type: string + - in_memory + - 24h + description: | + Deprecated. Use `prompt_cache_options.ttl` instead. + + The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://developers.openai.com/api/docs/guides/prompt-caching#prompt-cache-retention). + This field expresses a maximum retention policy, while + `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two + fields are independent and do not interact. + For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. + + For older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy: + - Organizations without ZDR enabled default to `24h`. + - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified. + - type: 'null' + ModifyAssistantRequest: + type: object + additionalProperties: false + properties: + model: description: | - The quality setting for the edited image. - enum: - - low - - medium - - high - - xhigh - - max - - auto - background: - type: string + ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them. + anyOf: + - type: string + - $ref: '#/components/schemas/AssistantSupportedModels' + reasoning_effort: + $ref: '#/components/schemas/ReasoningEffort' + name: + anyOf: + - description: | + The name of the assistant. The maximum length is 256 characters. + type: string + maxLength: 256 + - type: 'null' + description: + anyOf: + - description: | + The description of the assistant. The maximum length is 512 characters. + type: string + maxLength: 512 + - type: 'null' + instructions: + anyOf: + - description: | + The system instructions that the assistant uses. The maximum length is 256,000 characters. + type: string + maxLength: 256000 + - type: 'null' + tools: description: | - The background setting for the edited image. - enum: - - transparent - - opaque - - auto - output_format: + A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`. + default: [] + type: array + maxItems: 128 + items: + $ref: '#/components/schemas/AssistantTool' + tool_resources: + anyOf: + - type: object + description: | + A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + Overrides the list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + Overrides the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. + maxItems: 1 + items: + type: string + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + temperature: + anyOf: + - description: | + What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + type: number + minimum: 0 + maximum: 2 + default: 1 + example: 1 + - type: 'null' + top_p: + anyOf: + - type: number + minimum: 0 + maximum: 1 + default: 1 + example: 1 + description: | + An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + + We generally recommend altering this or temperature but not both. + - type: 'null' + response_format: + anyOf: + - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + - type: 'null' + ModifyCertificateRequest: + type: object + properties: + name: type: string - description: | - The output format for the edited image. - enum: - - png - - webp - - jpeg - usage: - $ref: '#/components/schemas/ImagesUsage' - required: - - type - - b64_json - - created_at - - size - - quality - - background - - output_format - - usage - x-oaiMeta: - name: image_edit.completed - group: images - example: | - { - "type": "image_edit.completed", - "b64_json": "...", - "created_at": 1620000000, - "size": "1024x1024", - "quality": "high", - "background": "transparent", - "output_format": "png", - "usage": { - "total_tokens": 100, - "input_tokens": 50, - "output_tokens": 50, - "input_tokens_details": { - "text_tokens": 10, - "image_tokens": 40 - } - } - } - ImageEditPartialImageEvent: + description: The updated name for the certificate + ModifyMessageRequest: + type: object + additionalProperties: false + properties: + metadata: + $ref: '#/components/schemas/Metadata' + ModifyRunRequest: + type: object + additionalProperties: false + properties: + metadata: + $ref: '#/components/schemas/Metadata' + ModifyThreadRequest: type: object + additionalProperties: false + properties: + tool_resources: + anyOf: + - type: object + description: | + A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: string + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + NoiseReductionType: + type: string + enum: + - near_field + - far_field description: | - Emitted when a partial image is available during image editing streaming. + Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones. + OpenAIFile: + title: OpenAIFile + description: The `File` object represents a document that has been uploaded to OpenAI. properties: - type: - type: string - description: | - The type of the event. Always `image_edit.partial_image`. - enum: - - image_edit.partial_image - x-stainless-const: true - b64_json: + id: type: string - description: | - Base64-encoded partial image data, suitable for rendering as an image. + description: The file identifier, which can be referenced in the API endpoints. + bytes: + type: integer + description: The size of the file, in bytes. created_at: type: integer format: unixtime - description: | - The Unix timestamp when the event was created. - size: - anyOf: - - type: string - - type: string - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - - auto - description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. - quality: + description: The Unix timestamp (in seconds) for when the file was created. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the file will expire. + filename: type: string - description: | - The quality setting for the requested edited image. + description: The name of the file. + object: + type: string + description: The object type, which is always `file`. enum: - - low - - medium - - high - - xhigh - - max - - auto - background: + - file + x-stainless-const: true + purpose: type: string - description: | - The background setting for the requested edited image. + description: The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`. enum: - - transparent - - opaque - - auto - output_format: + - assistants + - assistants_output + - batch + - batch_output + - fine-tune + - fine-tune-results + - vision + - user_data + status: type: string - description: | - The output format for the requested edited image. + deprecated: true + description: Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. enum: - - png - - webp - - jpeg - partial_image_index: - type: integer - description: | - 0-based index for the partial image (streaming). + - uploaded + - processed + - error + status_details: + type: string + deprecated: true + description: Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. required: - - type - - b64_json + - id + - object + - bytes - created_at - - size - - quality - - background - - output_format - - partial_image_index + - filename + - purpose + - status x-oaiMeta: - name: image_edit.partial_image - group: images + name: The file object example: | { - "type": "image_edit.partial_image", - "b64_json": "...", - "created_at": 1620000000, - "size": "1024x1024", - "quality": "high", - "background": "transparent", - "output_format": "png", - "partial_image_index": 0 + "id": "file-abc123", + "object": "file", + "bytes": 120000, + "created_at": 1677610602, + "expires_at": 1680202602, + "filename": "salesOverview.pdf", + "purpose": "assistants", } - ImageEditStreamEvent: - anyOf: - - $ref: '#/components/schemas/ImageEditPartialImageEvent' - - $ref: '#/components/schemas/ImageEditCompletedEvent' - discriminator: - propertyName: type - ImageGenCompletedEvent: + OrganizationCertificate: type: object - description: | - Emitted when image generation has completed and the final image is available. + description: Represents an individual certificate configured at the organization level. properties: - type: + object: type: string - description: | - The type of the event. Always `image_generation.completed`. enum: - - image_generation.completed + - organization.certificate + description: The object type, which is always `organization.certificate`. x-stainless-const: true - b64_json: + id: type: string - description: | - Base64-encoded image data, suitable for rendering as an image. + description: The identifier, which can be referenced in API endpoints + name: + anyOf: + - type: string + - type: 'null' + description: The name of the certificate. created_at: type: integer format: unixtime - description: | - The Unix timestamp when the event was created. - size: - anyOf: - - type: string - - type: string - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - - auto - description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. - quality: - type: string - description: | - The quality setting for the generated image. - enum: - - low - - medium - - high - - xhigh - - max - - auto - background: - type: string - description: | - The background setting for the generated image. - enum: - - transparent - - opaque - - auto - output_format: - type: string - description: | - The output format for the generated image. - enum: - - png - - webp - - jpeg - usage: - $ref: '#/components/schemas/ImagesUsage' + description: The Unix timestamp (in seconds) of when the certificate was uploaded. + certificate_details: + type: object + properties: + valid_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the certificate becomes valid. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the certificate expires. + active: + type: boolean + description: Whether the certificate is currently active at the organization level. required: - - type - - b64_json + - object + - id + - name - created_at - - size - - quality - - background - - output_format - - usage - x-oaiMeta: - name: image_generation.completed - group: images - example: | - { - "type": "image_generation.completed", - "b64_json": "...", - "created_at": 1620000000, - "size": "1024x1024", - "quality": "high", - "background": "transparent", - "output_format": "png", - "usage": { - "total_tokens": 100, - "input_tokens": 50, - "output_tokens": 50, - "input_tokens_details": { - "text_tokens": 10, - "image_tokens": 40 - } - } - } - ImageGenPartialImageEvent: + - certificate_details + - active + OrganizationCertificateActivationResponse: type: object - description: | - Emitted when a partial image is available during image generation streaming. properties: - type: + object: type: string - description: | - The type of the event. Always `image_generation.partial_image`. enum: - - image_generation.partial_image + - organization.certificate.activation + description: The organization certificate activation result type. x-stainless-const: true - b64_json: - type: string - description: | - Base64-encoded partial image data, suitable for rendering as an image. - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp when the event was created. - size: - anyOf: - - type: string - - type: string - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - - auto - description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. - quality: + data: + type: array + items: + $ref: '#/components/schemas/OrganizationCertificate' + required: + - object + - data + OrganizationCertificateDeactivationResponse: + type: object + properties: + object: type: string - description: | - The quality setting for the requested image. enum: - - low - - medium - - high - - xhigh - - max - - auto - background: + - organization.certificate.deactivation + description: The organization certificate deactivation result type. + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/OrganizationCertificate' + required: + - object + - data + OrganizationDataRetention: + type: object + description: Represents the organization's data retention control setting. + properties: + object: type: string - description: | - The background setting for the requested image. enum: - - transparent - - opaque - - auto - output_format: + - organization.data_retention + description: The object type, which is always `organization.data_retention`. + x-stainless-const: true + type: type: string - description: | - The output format for the requested image. enum: - - png - - webp - - jpeg - partial_image_index: - type: integer - description: | - 0-based index for the partial image (streaming). + - zero_data_retention + - modified_abuse_monitoring + - enhanced_zero_data_retention + - enhanced_modified_abuse_monitoring + description: The configured organization data retention type. required: + - object - type - - b64_json - - created_at - - size - - quality - - background - - output_format - - partial_image_index x-oaiMeta: - name: image_generation.partial_image - group: images + name: The organization data retention object example: | { - "type": "image_generation.partial_image", - "b64_json": "...", - "created_at": 1620000000, - "size": "1024x1024", - "quality": "high", - "background": "transparent", - "output_format": "png", - "partial_image_index": 0 + "object": "organization.data_retention", + "type": "modified_abuse_monitoring" } - ImageGenStreamEvent: - anyOf: - - $ref: '#/components/schemas/ImageGenPartialImageEvent' - - $ref: '#/components/schemas/ImageGenCompletedEvent' - discriminator: - propertyName: type - ImageGenTool: + OrganizationProjectCertificate: type: object - title: Image generation tool - description: | - A tool that generates images using the GPT image models. + description: Represents an individual certificate configured at the project level. properties: - type: + object: type: string enum: - - image_generation - description: | - The type of the image generation tool. Always `image_generation`. + - organization.project.certificate + description: The object type, which is always `organization.project.certificate`. x-stainless-const: true - model: - anyOf: - - type: string - - type: string - enum: - - gpt-image-1 - - gpt-image-1-mini - - gpt-image-2 - - gpt-image-2-2026-04-21 - - gpt-image-2.5-sunburst - - gpt-image-2.5-sunburst-2026-09-08 - - gpt-image-2.5-flare - - gpt-image-2.5-flare-2026-09-08 - - gpt-image-1.5 - - chatgpt-image-latest - description: | - The image generation model to use. One of `gpt-image-1`, - `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`, - `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, - `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, - `gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`. Default: - `gpt-image-1`. - default: gpt-image-1 - quality: - type: string - enum: - - low - - medium - - high - - xhigh - - max - - auto - description: | - The quality of the generated image. The GPT image models support `low`, - `medium`, and `high`. `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, - including their `2026-09-08` snapshots, also support `xhigh` and `max`. - Default: `auto`. - default: auto - size: - anyOf: - - type: string - - type: string - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - - auto - description: The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the GPT image models; `auto` is supported for models that allow automatic sizing. For `dall-e-2`, use one of `256x256`, `512x512`, or `1024x1024`. For `dall-e-3`, use one of `1024x1024`, `1792x1024`, or `1024x1792`. - default: auto - output_format: - type: string - enum: - - png - - webp - - jpeg - description: | - The output format of the generated image. One of `png`, `webp`, or - `jpeg`. Default: `png`. - default: png - output_compression: - type: integer - minimum: 0 - maximum: 100 - description: | - Compression level for the output image. Default: 100. - default: 100 - moderation: - type: string - enum: - - auto - - low - description: | - Moderation level for the generated image. Default: `auto`. - default: auto - background: + id: type: string - enum: - - transparent - - opaque - - auto - description: | - Allows to set transparency for the background of the generated image(s). Must - be one of `transparent`, `opaque`, or `auto` (default value). When `auto` is - used, the model will automatically determine the best background for the - image. - - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their - `2026-09-08` snapshots, support `opaque` and `transparent` backgrounds. - Transparent backgrounds are available for supported GPT Image models. For - `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When - using `transparent`, set the output format to `png` or `webp`. - default: auto - input_fidelity: + description: The identifier, which can be referenced in API endpoints + name: anyOf: - - $ref: '#/components/schemas/InputFidelity' + - type: string - type: 'null' - description: Controls fidelity to the original input image(s). This parameter is supported for GPT image models that support input fidelity. `gpt-image-2` and `gpt-image-2-2026-04-21` ignore this parameter. - input_image_mask: + description: The name of the certificate. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the certificate was uploaded. + certificate_details: type: object - description: | - Optional mask for inpainting. Contains `image_url` - (string, optional) and `file_id` (string, optional). properties: - image_url: - type: string - description: | - Base64-encoded mask image. - file_id: - type: string - description: | - File ID for the mask image. - required: [] - additionalProperties: false - partial_images: - type: integer - minimum: 0 - maximum: 3 - description: | - Number of partial images to generate in streaming mode, from 0 (default value) to 3. - default: 0 - action: - description: | - Whether to generate a new image or edit an existing image. Default: `auto`. - $ref: '#/components/schemas/ImageGenActionEnum' + valid_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the certificate becomes valid. + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the certificate expires. + active: + type: boolean + description: Whether the certificate is currently active at the project level. required: - - type - ImageRefParam: + - object + - id + - name + - created_at + - certificate_details + - active + OrganizationProjectCertificateActivationResponse: type: object - description: | - Reference an input image by either URL or uploaded file ID. - Provide exactly one of `image_url` or `file_id`. properties: - image_url: - type: string - format: uri - maxLength: 20971520 - description: A fully qualified URL or base64-encoded data URL. - example: https://example.com/source-image.png - file_id: + object: type: string - description: The File API ID of an uploaded image to use as input. - example: file-abc123 - anyOf: - - required: - - image_url - - required: - - file_id - not: - required: - - image_url - - file_id - additionalProperties: false - ImagesResponse: + enum: + - organization.project.certificate.activation + description: The project certificate activation result type. + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/OrganizationProjectCertificate' + required: + - object + - data + OrganizationProjectCertificateDeactivationResponse: type: object - title: Image generation response - description: The response from the image generation endpoint. properties: - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the image was created. + object: + type: string + enum: + - organization.project.certificate.deactivation + description: The project certificate deactivation result type. + x-stainless-const: true data: type: array - description: The list of generated images. items: - $ref: '#/components/schemas/Image' - background: + $ref: '#/components/schemas/OrganizationProjectCertificate' + required: + - object + - data + OrganizationSpendAlert: + type: object + description: Represents a spend alert configured at the organization level. + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: type: string - description: The background parameter used for the image generation. Either `transparent` or `opaque`. enum: - - transparent - - opaque - output_format: + - organization.spend_alert + description: The object type, which is always `organization.spend_alert`. + x-stainless-const: true + threshold_amount: + type: integer + description: The alert threshold amount, in cents. + currency: type: string - description: The output format of the image generation. Either `png`, `webp`, or `jpeg`. enum: - - png - - webp - - jpeg - size: - anyOf: - - type: string - - type: string - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. - quality: + - USD + description: The currency for the threshold amount. + interval: type: string - description: The quality of the image generated. One of `low`, `medium`, `high`, `xhigh`, or `max`. enum: - - low - - medium - - high - - xhigh - - max - usage: - $ref: '#/components/schemas/ImageGenUsage' + - month + description: The time interval for evaluating spend against the threshold. + notification_channel: + $ref: '#/components/schemas/SpendAlertNotificationChannel' required: - - created + - id + - object + - threshold_amount + - currency + - interval + - notification_channel x-oaiMeta: - name: The image generation response - group: images + name: The organization spend alert object example: | { - "created": 1713833628, - "data": [ - { - "b64_json": "..." - } - ], - "background": "transparent", - "output_format": "png", - "size": "1024x1024", - "quality": "high", - "usage": { - "total_tokens": 100, - "input_tokens": 50, - "output_tokens": 50, - "input_tokens_details": { - "text_tokens": 10, - "image_tokens": 40 + "id": "alert_abc123", + "object": "organization.spend_alert", + "threshold_amount": 100000, + "currency": "USD", + "interval": "month", + "notification_channel": { + "type": "email", + "recipients": ["finance@example.com"], + "subject_prefix": "OpenAI spend alert" } - } } - ImagesUsage: + OrganizationSpendAlertDeletedResource: type: object - description: | - For the GPT image models only, the token usage information for the image generation. + description: Confirmation payload returned after deleting an organization spend alert. + properties: + id: + type: string + description: The deleted spend alert ID. + object: + type: string + enum: + - organization.spend_alert.deleted + description: Always `organization.spend_alert.deleted`. + x-stainless-const: true + deleted: + type: boolean + description: Whether the spend alert was deleted. required: - - total_tokens - - input_tokens - - output_tokens - - input_tokens_details + - id + - object + - deleted + OrganizationSpendAlertListResource: + type: object + description: Paginated list of organization spend alerts. properties: - total_tokens: - type: integer - description: | - The total number of tokens (images and text) used for the image generation. - input_tokens: - type: integer - description: The number of tokens (images and text) in the input prompt. - output_tokens: - type: integer - description: The number of image tokens in the output image. - input_tokens_details: - type: object - description: The input tokens detailed information for the image generation. - required: - - text_tokens - - image_tokens - properties: - text_tokens: - type: integer - description: The number of text tokens in the input prompt. - image_tokens: - type: integer - description: The number of image tokens in the input prompt. - InputAudio: + object: + type: string + enum: + - list + description: Always `list`. + x-stainless-const: true + data: + type: array + description: Spend alerts returned in the current page. + items: + $ref: '#/components/schemas/OrganizationSpendAlert' + first_id: + anyOf: + - type: string + - type: 'null' + description: The ID of the first spend alert in this page. + last_id: + anyOf: + - type: string + - type: 'null' + description: The ID of the last spend alert in this page. + has_more: + type: boolean + description: Whether more spend alerts are available when paginating. + required: + - object + - data + - first_id + - last_id + - has_more + OtherChunkingStrategyResponseParam: type: object - title: Input audio + title: Other Chunking Strategy + description: This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API. + additionalProperties: false + properties: + type: + type: string + description: Always `other`. + enum: + - other + x-stainless-const: true + required: + - type + OutputAudio: + type: object + title: Output audio description: | - An audio input to the model. + An audio output from the model. properties: type: type: string description: | - The type of the input item. Always `input_audio`. + The type of the output audio. Always `output_audio`. enum: - - input_audio + - output_audio x-stainless-const: true - input_audio: - type: object - properties: - data: - type: string - description: | - Base64-encoded audio data. - format: - type: string - description: | - The format of the audio data. Currently supported formats are `mp3` and - `wav`. - enum: - - mp3 - - wav - required: - - data - - format + data: + type: string + description: | + Base64-encoded audio data from the model. + transcript: + type: string + description: | + The transcript of the audio data from the model. required: - type - - input_audio - InputContent: + - data + - transcript + OutputContent: discriminator: propertyName: type anyOf: - - $ref: '#/components/schemas/InputTextContent' - - $ref: '#/components/schemas/InputImageContent' - - $ref: '#/components/schemas/InputFileContent' - InputItem: + - $ref: '#/components/schemas/OutputTextContent' + - $ref: '#/components/schemas/RefusalContent' + - $ref: '#/components/schemas/ReasoningTextContent' + OutputItem: discriminator: propertyName: type anyOf: - - $ref: '#/components/schemas/EasyInputMessage' - - type: object - title: Item - description: | - An item representing part of the context for the response to be - generated by the model. Can contain text, images, and audio inputs, - as well as previous assistant responses and tool call outputs. - $ref: '#/components/schemas/Item' - - $ref: '#/components/schemas/CompactionTriggerItemParam' - - $ref: '#/components/schemas/ItemReferenceParam' - - $ref: '#/components/schemas/ProgramItemParam' - - $ref: '#/components/schemas/ProgramOutputItemParam' - InputMessage: + - $ref: '#/components/schemas/OutputMessage' + - $ref: '#/components/schemas/FileSearchToolCall' + - $ref: '#/components/schemas/FunctionToolCall' + - $ref: '#/components/schemas/FunctionToolCallOutputResource' + - $ref: '#/components/schemas/WebSearchToolCall' + - $ref: '#/components/schemas/ComputerToolCall' + - $ref: '#/components/schemas/ComputerToolCallOutputResource' + - $ref: '#/components/schemas/ReasoningItem' + - $ref: '#/components/schemas/Program' + - $ref: '#/components/schemas/ProgramOutput' + - $ref: '#/components/schemas/ToolSearchCall' + - $ref: '#/components/schemas/ToolSearchOutput' + - $ref: '#/components/schemas/AdditionalTools' + - $ref: '#/components/schemas/CompactionBody' + - $ref: '#/components/schemas/ImageGenToolCall' + - $ref: '#/components/schemas/CodeInterpreterToolCall' + - $ref: '#/components/schemas/LocalShellToolCall' + - $ref: '#/components/schemas/LocalShellToolCallOutput' + - $ref: '#/components/schemas/FunctionShellCall' + - $ref: '#/components/schemas/FunctionShellCallOutput' + - $ref: '#/components/schemas/ApplyPatchToolCall' + - $ref: '#/components/schemas/ApplyPatchToolCallOutput' + - $ref: '#/components/schemas/MCPToolCall' + - $ref: '#/components/schemas/MCPListTools' + - $ref: '#/components/schemas/MCPApprovalRequest' + - $ref: '#/components/schemas/MCPApprovalResponseResource' + - $ref: '#/components/schemas/CustomToolCall' + - $ref: '#/components/schemas/CustomToolCallOutputResource' + OutputMessage: type: object - title: Input message + title: Output message description: | - A message input to the model with a role indicating instruction following - hierarchy. Instructions given with the `developer` or `system` role take - precedence over instructions given with the `user` role. + An output message from the model. properties: + id: + type: string + description: | + The unique ID of the output message. + x-stainless-go-json: omitzero type: type: string description: | - The type of the message input. Always set to `message`. + The type of the output message. Always `message`. enum: - message x-stainless-const: true role: type: string description: | - The role of the message input. One of `user`, `system`, or `developer`. + The role of the output message. Always `assistant`. enum: - - user - - system - - developer + - assistant + x-stainless-const: true + content: + type: array + description: | + The content of the output message. + items: + $ref: '#/components/schemas/OutputMessageContent' + phase: + anyOf: + - $ref: '#/components/schemas/MessagePhase' + - type: 'null' status: type: string description: | - The status of item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. + The status of the message input. One of `in_progress`, `completed`, or + `incomplete`. Populated when input items are returned via API. enum: - in_progress - completed - incomplete - content: - $ref: '#/components/schemas/InputMessageContentList' required: + - id + - type - role - content - InputMessageContentList: - type: array - title: Input item content list - description: "A list of one or many input items to the model, containing different content \ntypes.\n" - items: - $ref: '#/components/schemas/InputContent' - InputMessageResource: - allOf: - - $ref: '#/components/schemas/InputMessage' - - type: object - properties: - id: - type: string - description: | - The unique ID of the message input. - required: - - id - - type - InputParam: - description: | - Text, image, or file inputs to the model, used to generate a response. - - Learn more: - - [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text) - - [Image inputs](https://developers.openai.com/api/docs/guides/images-vision) - - [File inputs](https://developers.openai.com/api/docs/guides/file-inputs) - - [Conversation state](https://developers.openai.com/api/docs/guides/conversation-state) - - [Function calling](https://developers.openai.com/api/docs/guides/function-calling) + - status + OutputMessageContent: + discriminator: + propertyName: type anyOf: - - type: string - title: Text input - description: | - A text input to the model, equivalent to a text input with the - `user` role. - - type: array - title: Input item list + - $ref: '#/components/schemas/OutputTextContent' + - $ref: '#/components/schemas/RefusalContent' + ParallelToolCalls: + description: Whether to enable [parallel function calling](https://developers.openai.com/api/docs/guides/function-calling#parallel-function-calling) during tool use. + type: boolean + default: true + PartialImages: + anyOf: + - type: integer + maximum: 3 + minimum: 0 + default: 0 + example: 1 description: | - A list of one or many input items to the model, containing - different content types. - items: - $ref: '#/components/schemas/InputItem' - Invite: + The number of partial images to generate. This parameter is used for + streaming responses that return partial images. Value must be between 0 and 3. + When set to 0, the response will be a single image sent in one streaming event. + + Note that the final image may be sent before the full number of partial images + are generated if the full image is generated more quickly. + - type: 'null' + PredictionContent: + type: object + title: Static Content + description: | + Static predicted output content, such as the content of a text file that is + being regenerated. + required: + - type + - content + properties: + type: + type: string + enum: + - content + description: | + The type of the predicted content you want to provide. This type is + currently always `content`. + x-stainless-const: true + content: + description: | + The content that should be matched when generating a model response. + If generated tokens would match this content, the entire model response + can be returned much more quickly. + anyOf: + - type: string + title: Text content + description: | + The content used for a Predicted Output. This is often the + text of a file you are regenerating with minor changes. + - type: array + description: An array of content parts with a defined type. Supported options differ based on the [model](https://developers.openai.com/api/docs/models) being used to generate the response. Can contain text inputs. + title: Array of content parts + items: + $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' + minItems: 1 + Project: type: object - description: Represents an individual `invite` to the organization. + description: Represents an individual project. properties: - object: - type: string - enum: - - organization.invite - description: The object type, which is always `organization.invite` - x-stainless-const: true id: type: string description: The identifier, which can be referenced in API endpoints - email: - type: string - description: The email address of the individual to whom the invite was sent - role: + object: type: string enum: - - owner - - reader - description: '`owner` or `reader`' + - organization.project + description: The object type, which is always `organization.project` + x-stainless-const: true + name: + anyOf: + - type: string + - type: 'null' + description: The name of the project. This appears in reporting. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the project was created. + archived_at: + anyOf: + - type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the project was archived or `null`. + - type: 'null' status: + anyOf: + - type: string + - type: 'null' + description: '`active` or `archived`' + external_key_id: + anyOf: + - type: string + - type: 'null' + description: The external key associated with the project. + residency: + $ref: '#/components/schemas/PublicProjectResidency' + description: The residency configuration for the project. + required: + - id + - object + - created_at + x-oaiMeta: + name: The project object + example: | + { + "id": "proj_abc", + "object": "organization.project", + "name": "Project example", + "created_at": 1711471533, + "archived_at": null, + "status": "active", + "external_key_id": null + } + ProjectApiKey: + type: object + description: Represents an individual API key in a project. + properties: + object: type: string enum: - - accepted - - expired - - pending - description: '`accepted`,`expired`, or `pending`' + - organization.project.api_key + description: The object type, which is always `organization.project.api_key` + x-stainless-const: true + redacted_value: + type: string + description: The redacted value of the API key + name: + type: string + description: The name of the API key created_at: type: integer format: unixtime - description: The Unix timestamp (in seconds) of when the invite was sent. + description: The Unix timestamp (in seconds) of when the API key was created expires_at: anyOf: - type: integer format: unixtime - type: 'null' - description: The Unix timestamp (in seconds) of when the invite expires. - accepted_at: + description: The Unix timestamp (in seconds) when the API key expires, or null if it does not expire. + last_used_at: anyOf: - type: integer format: unixtime - type: 'null' - description: The Unix timestamp (in seconds) of when the invite was accepted. - projects: - type: array - description: The projects that were granted membership upon acceptance of the invite. - items: - type: object - properties: - id: - type: string - description: Project's public ID - role: - type: string - enum: - - member - - owner - description: Project membership role - required: - - id - - role + description: The Unix timestamp (in seconds) of when the API key was last used. + id: + type: string + description: The identifier, which can be referenced in API endpoints + owner_project_access: + type: string + enum: + - active + - inactive + description: Whether the API key's owner currently has effective access to the project. + owner: + type: object + properties: + type: + type: string + enum: + - user + - service_account + description: '`user` or `service_account`' + user: + $ref: '#/components/schemas/ProjectApiKeyOwnerUser' + service_account: + $ref: '#/components/schemas/ProjectApiKeyOwnerServiceAccount' required: - object - - id - - email - - role - - status + - redacted_value + - name - created_at - - projects + - last_used_at + - id + - owner_project_access + - owner x-oaiMeta: - name: The invite object + name: The project API key object example: | { - "object": "organization.invite", - "id": "invite-abc", - "email": "user@example.com", - "role": "owner", - "status": "accepted", - "created_at": 1711471533, - "expires_at": 1711471533, - "accepted_at": 1711471533, - "projects": [ - { - "id": "project-xyz", - "role": "member" + "object": "organization.project.api_key", + "redacted_value": "sk-abc...def", + "name": "My API Key", + "created_at": 1711471533, + "expires_at": 1714063533, + "last_used_at": 1711471534, + "id": "key_abc", + "owner_project_access": "active", + "owner": { + "type": "user", + "user": { + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "created_at": 1711471533 + } } - ] } - InviteDeleteResponse: + ProjectApiKeyDeleteResponse: type: object properties: object: type: string enum: - - organization.invite.deleted - description: The object type, which is always `organization.invite.deleted` + - organization.project.api_key.deleted x-stainless-const: true id: type: string @@ -40066,242 +46355,320 @@ components: - object - id - deleted - InviteListResponse: + ProjectApiKeyListResponse: type: object properties: object: type: string enum: - list - description: The object type, which is always `list` x-stainless-const: true data: type: array items: - $ref: '#/components/schemas/Invite' + $ref: '#/components/schemas/ProjectApiKey' first_id: anyOf: - type: string - type: 'null' - description: The first `invite_id` in the retrieved `list` last_id: anyOf: - type: string - type: 'null' - description: The last `invite_id` in the retrieved `list` has_more: type: boolean - description: The `has_more` property is used for pagination to indicate there are additional results. required: - object - data - has_more - InviteProjectGroupBody: + ProjectApiKeyOwnerServiceAccount: type: object - description: Request payload for granting a group access to a project. + description: The service account that owns a project API key. properties: - group_id: + id: type: string - description: Identifier of the group to add to the project. + description: The identifier, which can be referenced in API endpoints + name: + type: string + description: The name of the service account. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the service account was created. role: type: string - description: Identifier of the project role to grant to the group. + description: The service account's project role. required: - - group_id + - id + - name + - created_at + - role + ProjectApiKeyOwnerUser: + type: object + description: The user that owns a project API key. + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints + email: + type: string + description: The email address of the user. + name: + type: string + description: The name of the user. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the user was created. + role: + type: string + description: The user's project role. + required: + - id + - email + - name + - created_at - role + ProjectCreateRequest: + type: object + properties: + name: + type: string + description: The friendly name of the project, this name appears in reports. + geography: + anyOf: + - type: string + - type: 'null' + deprecated: true + description: |- + Create the project with the specified data residency region. Your organization must have access to Data residency functionality in order to use. See [data residency controls](https://developers.openai.com/api/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field. + Deprecated: use `residency` instead. Do not provide both `geography` and `residency`. + residency: + anyOf: + - $ref: '#/components/schemas/PublicProjectResidency' + - type: 'null' + description: Create the project with the specified residency configuration. Your organization must have access to the requested residency configuration in order to use it. See [data residency controls](https://developers.openai.com/api/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field. + external_key_id: + anyOf: + - type: string + - type: 'null' + description: External key ID to associate with the project. + required: + - name + ProjectDataRetention: + type: object + description: Represents a project's data retention control setting. + properties: + object: + type: string + enum: + - project.data_retention + description: The object type, which is always `project.data_retention`. + x-stainless-const: true + type: + type: string + enum: + - organization_default + - none + - zero_data_retention + - modified_abuse_monitoring + - enhanced_zero_data_retention + - enhanced_modified_abuse_monitoring + description: The configured project data retention type. + required: + - object + - type x-oaiMeta: + name: The project data retention object example: | { - "group_id": "group_01J1F8ABCDXYZ", - "role": "role_01J1F8PROJ" + "object": "project.data_retention", + "type": "organization_default" } - InviteRequest: + ProjectGroup: type: object + description: Details about a group's membership in a project. properties: - email: + object: type: string - description: Send an email to this address - role: + enum: + - project.group + description: Always `project.group`. + x-stainless-const: true + project_id: + type: string + description: Identifier of the project. + group_id: + type: string + description: Identifier of the group that has access to the project. + group_name: + type: string + description: Display name of the group. + group_type: type: string enum: - - reader - - owner - description: '`owner` or `reader`' - projects: - type: array - description: An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one. - items: - type: object - properties: - id: - type: string - description: Project's public ID - role: - type: string - enum: - - member - - owner - description: Project membership role - required: - - id - - role + - group + - tenant_group + description: The type of the group. + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the group was granted project access. required: - - email - - role - Item: + - object + - project_id + - group_id + - group_name + - group_type + - created_at + x-oaiMeta: + name: The project group object + example: | + { + "object": "project.group", + "project_id": "proj_abc123", + "group_id": "group_01J1F8ABCDXYZ", + "group_name": "Support Team", + "group_type": "group", + "created_at": 1711471533 + } + ProjectGroupDeletedResource: type: object - description: | - Content item used to generate a response. - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/InputMessage' - - $ref: '#/components/schemas/OutputMessage' - - $ref: '#/components/schemas/FileSearchToolCall' - - $ref: '#/components/schemas/ComputerToolCall' - - $ref: '#/components/schemas/ComputerCallOutputItemParam' - - $ref: '#/components/schemas/WebSearchToolCall' - - $ref: '#/components/schemas/FunctionToolCall' - - $ref: '#/components/schemas/FunctionCallOutputItemParam' - - $ref: '#/components/schemas/ToolSearchCallItemParam' - - $ref: '#/components/schemas/ToolSearchOutputItemParam' - - $ref: '#/components/schemas/AdditionalToolsItemParam' - - $ref: '#/components/schemas/ResponseConfigurationUpdateItemParam' - - $ref: '#/components/schemas/ReasoningItem' - - $ref: '#/components/schemas/CompactionSummaryItemParam' - - $ref: '#/components/schemas/ImageGenToolCall' - - $ref: '#/components/schemas/CodeInterpreterToolCall' - - $ref: '#/components/schemas/LocalShellToolCall' - - $ref: '#/components/schemas/LocalShellToolCallOutput' - - $ref: '#/components/schemas/FunctionShellCallItemParam' - - $ref: '#/components/schemas/FunctionShellCallOutputItemParam' - - $ref: '#/components/schemas/ApplyPatchToolCallItemParam' - - $ref: '#/components/schemas/ApplyPatchToolCallOutputItemParam' - - $ref: '#/components/schemas/MCPListTools' - - $ref: '#/components/schemas/MCPApprovalRequest' - - $ref: '#/components/schemas/MCPApprovalResponse' - - $ref: '#/components/schemas/MCPToolCall' - - $ref: '#/components/schemas/CustomToolCallOutput' - - $ref: '#/components/schemas/CustomToolCall' - ItemResource: - description: | - Content item used to generate a response. - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/InputMessageResource' - - $ref: '#/components/schemas/OutputMessage' - - $ref: '#/components/schemas/FileSearchToolCall' - - $ref: '#/components/schemas/ComputerToolCall' - - $ref: '#/components/schemas/ComputerToolCallOutputResource' - - $ref: '#/components/schemas/WebSearchToolCall' - - $ref: '#/components/schemas/FunctionToolCallResource' - - $ref: '#/components/schemas/FunctionToolCallOutputResource' - - $ref: '#/components/schemas/ToolSearchCall' - - $ref: '#/components/schemas/ToolSearchOutput' - - $ref: '#/components/schemas/AdditionalTools' - - $ref: '#/components/schemas/ResponseConfigurationUpdate' - - $ref: '#/components/schemas/ReasoningItem' - - $ref: '#/components/schemas/Program' - - $ref: '#/components/schemas/ProgramOutput' - - $ref: '#/components/schemas/CompactionBody' - - $ref: '#/components/schemas/ImageGenToolCall' - - $ref: '#/components/schemas/CodeInterpreterToolCall' - - $ref: '#/components/schemas/LocalShellToolCall' - - $ref: '#/components/schemas/LocalShellToolCallOutput' - - $ref: '#/components/schemas/FunctionShellCall' - - $ref: '#/components/schemas/FunctionShellCallOutput' - - $ref: '#/components/schemas/ApplyPatchToolCall' - - $ref: '#/components/schemas/ApplyPatchToolCallOutput' - - $ref: '#/components/schemas/MCPListTools' - - $ref: '#/components/schemas/MCPApprovalRequest' - - $ref: '#/components/schemas/MCPApprovalResponseResource' - - $ref: '#/components/schemas/MCPToolCall' - - $ref: '#/components/schemas/CustomToolCallResource' - - $ref: '#/components/schemas/CustomToolCallOutputResource' - ListAssistantsResponse: + description: Confirmation payload returned after removing a group from a project. + properties: + object: + type: string + enum: + - project.group.deleted + description: Always `project.group.deleted`. + x-stainless-const: true + deleted: + type: boolean + description: Whether the group membership in the project was removed. + required: + - object + - deleted + x-oaiMeta: + name: Project group deletion confirmation + example: | + { + "object": "project.group.deleted", + "deleted": true + } + ProjectGroupListResource: type: object + description: Paginated list of groups that have access to a project. properties: object: type: string - example: list + enum: + - list + description: Always `list`. + x-stainless-const: true data: type: array + description: Project group memberships returned in the current page. items: - $ref: '#/components/schemas/AssistantObject' - first_id: - type: string - example: asst_abc123 - last_id: - type: string - example: asst_abc456 + $ref: '#/components/schemas/ProjectGroup' has_more: type: boolean - example: false + description: Whether additional project group memberships are available. + next: + description: Cursor to fetch the next page of results, or `null` when there are no more results. + anyOf: + - type: string + - type: 'null' + required: + - object + - data + - has_more + - next + x-oaiMeta: + name: Project group list + example: | + { + "object": "list", + "data": [ + { + "object": "project.group", + "project_id": "proj_abc123", + "group_id": "group_01J1F8ABCDXYZ", + "group_name": "Support Team", + "created_at": 1711471533 + } + ], + "has_more": false, + "next": null + } + ProjectHostedToolPermissions: + type: object + description: Represents hosted tool permissions for a project. + properties: + file_search: + $ref: '#/components/schemas/HostedToolPermission' + web_search: + $ref: '#/components/schemas/HostedToolPermission' + image_generation: + $ref: '#/components/schemas/HostedToolPermission' + mcp: + $ref: '#/components/schemas/HostedToolPermission' + code_interpreter: + $ref: '#/components/schemas/HostedToolPermission' required: - - object - - data - - first_id - - last_id - - has_more + - file_search + - web_search + - image_generation + - mcp + - code_interpreter x-oaiMeta: - name: List assistants response object - group: chat + name: The project hosted tool permissions object example: | { - "object": "list", - "data": [ - { - "id": "asst_abc123", - "object": "assistant", - "created_at": 1698982736, - "name": "Coding Tutor", - "description": null, - "model": "gpt-5", - "instructions": "You are a helpful assistant designed to make me better at coding!", - "tools": [], - "tool_resources": {}, - "metadata": {}, - "top_p": 1.0, - "temperature": 1.0, - "response_format": "auto" + "file_search": { + "enabled": true }, - { - "id": "asst_abc456", - "object": "assistant", - "created_at": 1698982718, - "name": "My Assistant", - "description": null, - "model": "gpt-5", - "instructions": "You are a helpful assistant designed to make me better at coding!", - "tools": [], - "tool_resources": {}, - "metadata": {}, - "top_p": 1.0, - "temperature": 1.0, - "response_format": "auto" + "web_search": { + "enabled": true }, - { - "id": "asst_abc789", - "object": "assistant", - "created_at": 1698982643, - "name": null, - "description": null, - "model": "gpt-5", - "instructions": null, - "tools": [], - "tool_resources": {}, - "metadata": {}, - "top_p": 1.0, - "temperature": 1.0, - "response_format": "auto" + "image_generation": { + "enabled": true + }, + "mcp": { + "enabled": true + }, + "code_interpreter": { + "enabled": true } - ], - "first_id": "asst_abc123", - "last_id": "asst_abc789", - "has_more": false } - ListAuditLogsResponse: + ProjectHostedToolPermissionsUpdateRequest: + type: object + properties: + file_search: + anyOf: + - $ref: '#/components/schemas/HostedToolPermissionUpdate' + - type: 'null' + description: The file search permission update. + web_search: + anyOf: + - $ref: '#/components/schemas/HostedToolPermissionUpdate' + - type: 'null' + description: The web search permission update. + image_generation: + anyOf: + - $ref: '#/components/schemas/HostedToolPermissionUpdate' + - type: 'null' + description: The image generation permission update. + mcp: + anyOf: + - $ref: '#/components/schemas/HostedToolPermissionUpdate' + - type: 'null' + description: The MCP permission update. + code_interpreter: + anyOf: + - $ref: '#/components/schemas/HostedToolPermissionUpdate' + - type: 'null' + description: The code interpreter permission update. + ProjectListResponse: type: object properties: object: @@ -40312,4312 +46679,4503 @@ components: data: type: array items: - $ref: '#/components/schemas/AuditLog' + $ref: '#/components/schemas/Project' first_id: anyOf: - type: string - type: 'null' - example: audit_log-defb456h8dks last_id: anyOf: - type: string - type: 'null' - example: audit_log-hnbkd8s93s has_more: type: boolean required: - object - data - has_more - ListBatchesResponse: + ProjectModelPermissions: type: object + description: Represents the model allowlist or denylist policy for a project. properties: - data: + object: + type: string + enum: + - project.model_permissions + description: The object type, which is always `project.model_permissions`. + x-stainless-const: true + mode: + type: string + enum: + - allow_list + - deny_list + description: Whether the project uses an allowlist or a denylist. + model_ids: type: array items: - $ref: '#/components/schemas/Batch' - first_id: - type: string - example: batch_abc123 - last_id: + type: string + description: The model IDs included in the model permissions policy. + required: + - object + - mode + - model_ids + x-oaiMeta: + name: The project model permissions object + example: | + { + "object": "project.model_permissions", + "mode": "allow_list", + "model_ids": [ + "gpt-6-astra", + "o3" + ] + } + ProjectModelPermissionsDeleteResponse: + type: object + description: Confirmation payload returned after deleting project model permissions. + properties: + object: type: string - example: batch_abc456 - has_more: + enum: + - project.model_permissions.deleted + description: The object type, which is always `project.model_permissions.deleted`. + x-stainless-const: true + deleted: type: boolean + description: Whether the project model permissions were deleted. + required: + - object + - deleted + x-oaiMeta: + name: Project model permissions deletion confirmation + example: | + { + "object": "project.model_permissions.deleted", + "deleted": true + } + ProjectModelPermissionsUpdateRequest: + type: object + properties: + mode: + type: string + enum: + - allow_list + - deny_list + description: The model permissions mode to apply. + model_ids: + type: array + items: + type: string + description: The model IDs included in this permissions policy. + required: + - mode + - model_ids + ProjectRateLimit: + type: object + description: Represents a project rate limit config. + properties: object: type: string enum: - - list + - project.rate_limit + description: The object type, which is always `project.rate_limit` x-stainless-const: true + id: + type: string + description: The identifier, which can be referenced in API endpoints. + model: + type: string + description: The model this rate limit applies to. + max_requests_per_1_minute: + type: integer + description: The maximum requests per minute. + max_tokens_per_1_minute: + type: integer + description: The maximum tokens per minute. + max_images_per_1_minute: + type: integer + description: The maximum images per minute. Only present for relevant models. + max_audio_megabytes_per_1_minute: + type: integer + description: The maximum audio megabytes per minute. Only present for relevant models. + max_requests_per_1_day: + type: integer + description: The maximum requests per day. Only present for relevant models. + batch_1_day_max_input_tokens: + type: integer + description: The maximum batch input tokens per day. Only present for relevant models. required: - object - - data - - has_more - ListCertificatesResponse: + - id + - model + - max_requests_per_1_minute + - max_tokens_per_1_minute + x-oaiMeta: + name: The project rate limit object + example: | + { + "object": "project.rate_limit", + "id": "rl_ada", + "model": "ada", + "max_requests_per_1_minute": 600, + "max_tokens_per_1_minute": 150000, + "max_images_per_1_minute": 10 + } + ProjectRateLimitListResponse: type: object properties: + object: + type: string + enum: + - list + x-stainless-const: true data: type: array items: - $ref: '#/components/schemas/OrganizationCertificate' + $ref: '#/components/schemas/ProjectRateLimit' first_id: anyOf: - type: string - type: 'null' - example: cert_abc last_id: anyOf: - type: string - type: 'null' - example: cert_abc has_more: type: boolean - object: - type: string - enum: - - list - x-stainless-const: true required: - object - data - has_more - - first_id - - last_id - ListFilesResponse: + ProjectRateLimitUpdateRequest: + type: object + properties: + max_requests_per_1_minute: + type: integer + description: The maximum requests per minute. + max_tokens_per_1_minute: + type: integer + description: The maximum tokens per minute. + max_images_per_1_minute: + type: integer + description: The maximum images per minute. Only relevant for certain models. + max_audio_megabytes_per_1_minute: + type: integer + description: The maximum audio megabytes per minute. Only relevant for certain models. + max_requests_per_1_day: + type: integer + description: The maximum requests per day. Only relevant for certain models. + batch_1_day_max_input_tokens: + type: integer + description: The maximum batch input tokens per day. Only relevant for certain models. + ProjectServiceAccount: type: object + description: Represents an individual service account in a project. properties: object: type: string - example: list - data: - type: array - items: - $ref: '#/components/schemas/OpenAIFile' - first_id: + enum: + - organization.project.service_account + description: The object type, which is always `organization.project.service_account` + x-stainless-const: true + id: type: string - example: file-abc123 - last_id: + description: The identifier, which can be referenced in API endpoints + name: type: string - example: file-abc456 - has_more: - type: boolean - example: false + description: The name of the service account + role: + type: string + enum: + - owner + - member + - none + description: '`owner`, `member`, or `none`' + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the service account was created required: - object - - data - - first_id - - last_id - - has_more - ListFineTuningCheckpointPermissionResponse: + - id + - name + - role + - created_at + x-oaiMeta: + name: The project service account object + example: | + { + "object": "organization.project.service_account", + "id": "svc_acct_abc", + "name": "Service Account", + "role": "owner", + "created_at": 1711471533 + } + ProjectServiceAccountApiKey: type: object properties: - data: - type: array - items: - $ref: '#/components/schemas/FineTuningCheckpointPermission' object: type: string enum: - - list + - organization.project.service_account.api_key + description: The object type, which is always `organization.project.service_account.api_key` x-stainless-const: true - first_id: + value: + type: string + name: + type: string + created_at: + type: integer + format: unixtime + expires_at: anyOf: - - type: string + - type: integer + format: unixtime - type: 'null' - last_id: + description: The Unix timestamp (in seconds) when the API key expires, or null if it does not expire. + id: + type: string + required: + - object + - value + - name + - created_at + - id + ProjectServiceAccountCreateRequest: + type: object + properties: + name: + type: string + description: The name of the service account being created. + create_service_account_only: anyOf: - - type: string + - type: boolean + description: Create the service account without default roles or an API key. - type: 'null' - has_more: - type: boolean + expires_in_seconds: + anyOf: + - type: integer + minimum: 1 + maximum: 31536000 + - type: 'null' + description: Number of seconds until the initial API key expires. If omitted or null, the key does not expire unless the effective organization or project policy requires an expiration. When a policy sets a maximum lifetime, this value must be provided and must not exceed that limit. A non-null value cannot be used when `create_service_account_only` is true. required: - - object - - data - - has_more - ListFineTuningJobCheckpointsResponse: + - name + ProjectServiceAccountCreateResponse: type: object properties: - data: - type: array - items: - $ref: '#/components/schemas/FineTuningJobCheckpoint' object: type: string enum: - - list + - organization.project.service_account x-stainless-const: true - first_id: - anyOf: - - type: string - - type: 'null' - last_id: + id: + type: string + name: + type: string + role: + type: string + enum: + - member + - none + description: | + Service accounts created with default project membership have role `member`. Accounts created with `create_service_account_only` have role `none`. + created_at: + type: integer + format: unixtime + api_key: anyOf: - - type: string + - $ref: '#/components/schemas/ProjectServiceAccountApiKey' - type: 'null' - has_more: - type: boolean required: - object - - data - - has_more - ListFineTuningJobEventsResponse: + - id + - name + - role + - created_at + - api_key + ProjectServiceAccountDeleteResponse: type: object properties: - data: - type: array - items: - $ref: '#/components/schemas/FineTuningJobEvent' object: type: string enum: - - list + - organization.project.service_account.deleted x-stainless-const: true - has_more: + id: + type: string + deleted: type: boolean required: - object - - data - - has_more - ListMessagesResponse: + - id + - deleted + ProjectServiceAccountListResponse: + type: object properties: object: type: string - example: list + enum: + - list + x-stainless-const: true data: type: array items: - $ref: '#/components/schemas/MessageObject' + $ref: '#/components/schemas/ProjectServiceAccount' first_id: - type: string - example: msg_abc123 + anyOf: + - type: string + - type: 'null' last_id: - type: string - example: msg_abc123 + anyOf: + - type: string + - type: 'null' has_more: type: boolean - example: false required: - object - data - - first_id - - last_id - has_more - ListModelsResponse: + ProjectSpendAlert: + type: object + description: Represents a spend alert configured at the project level. + properties: + id: + type: string + description: The identifier, which can be referenced in API endpoints. + object: + type: string + enum: + - project.spend_alert + description: The object type, which is always `project.spend_alert`. + x-stainless-const: true + threshold_amount: + type: integer + description: The alert threshold amount, in cents. + currency: + type: string + enum: + - USD + description: The currency for the threshold amount. + interval: + type: string + enum: + - month + description: The time interval for evaluating spend against the threshold. + notification_channel: + $ref: '#/components/schemas/SpendAlertNotificationChannel' + required: + - id + - object + - threshold_amount + - currency + - interval + - notification_channel + x-oaiMeta: + name: The project spend alert object + example: | + { + "id": "alert_abc123", + "object": "project.spend_alert", + "threshold_amount": 100000, + "currency": "USD", + "interval": "month", + "notification_channel": { + "type": "email", + "recipients": ["finance@example.com"], + "subject_prefix": "OpenAI spend alert" + } + } + ProjectSpendAlertDeletedResource: type: object + description: Confirmation payload returned after deleting a project spend alert. properties: + id: + type: string + description: The deleted spend alert ID. object: type: string enum: - - list + - project.spend_alert.deleted + description: Always `project.spend_alert.deleted`. x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/Model' + deleted: + type: boolean + description: Whether the spend alert was deleted. required: + - id - object - - data - ListPaginatedFineTuningJobsResponse: + - deleted + ProjectSpendAlertListResource: type: object + description: Paginated list of project spend alerts. properties: - data: - type: array - items: - $ref: '#/components/schemas/FineTuningJob' - has_more: - type: boolean object: type: string enum: - list + description: Always `list`. x-stainless-const: true - required: - - object - - data - - has_more - ListProjectCertificatesResponse: - type: object - properties: data: type: array + description: Spend alerts returned in the current page. items: - $ref: '#/components/schemas/OrganizationProjectCertificate' + $ref: '#/components/schemas/ProjectSpendAlert' first_id: anyOf: - type: string - type: 'null' - example: cert_abc + description: The ID of the first spend alert in this page. last_id: anyOf: - type: string - type: 'null' - example: cert_abc + description: The ID of the last spend alert in this page. has_more: type: boolean - object: - type: string - enum: - - list - x-stainless-const: true + description: Whether more spend alerts are available when paginating. required: - object - data - - has_more - first_id - last_id - ListRunStepsResponse: + - has_more + ProjectUpdateRequest: + type: object + properties: + name: + anyOf: + - type: string + - type: 'null' + description: The updated name of the project, this name appears in reports. + external_key_id: + anyOf: + - type: string + - type: 'null' + description: External key ID to associate with the project. + geography: + anyOf: + - type: string + - type: 'null' + deprecated: true + description: |- + Geography for the project. + Deprecated: use `residency` when creating a project to configure data residency. This field is retained for backward compatibility. + ProjectUser: + type: object + description: Represents an individual user in a project. properties: object: type: string - example: list - data: - type: array - items: - $ref: '#/components/schemas/RunStepObject' - first_id: + enum: + - organization.project.user + description: The object type, which is always `organization.project.user` + x-stainless-const: true + id: type: string - example: step_abc123 - last_id: + description: The identifier, which can be referenced in API endpoints + name: + anyOf: + - type: string + - type: 'null' + description: The name of the user + email: + anyOf: + - type: string + - type: 'null' + description: The email address of the user + role: type: string - example: step_abc456 - has_more: - type: boolean - example: false + description: '`owner` or `member`' + added_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the project was added. required: - object - - data - - first_id - - last_id - - has_more - ListRunsResponse: + - id + - role + - added_at + x-oaiMeta: + name: The project user object + example: | + { + "object": "organization.project.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 + } + ProjectUserCreateRequest: type: object properties: - object: - type: string - example: list - data: - type: array - items: - $ref: '#/components/schemas/RunObject' - first_id: - type: string - example: run_abc123 - last_id: + user_id: + anyOf: + - type: string + - type: 'null' + description: The ID of the user. + email: + anyOf: + - type: string + - type: 'null' + description: Email of the user to add. + role: type: string - example: run_abc456 - has_more: - type: boolean - example: false + description: '`owner` or `member`' required: - - object - - data - - first_id - - last_id - - has_more - ListVectorStoreFilesResponse: + - role + ProjectUserDeleteResponse: + type: object properties: object: type: string - example: list - data: - type: array - items: - $ref: '#/components/schemas/VectorStoreFileObject' - first_id: - type: string - example: file-abc123 - last_id: + enum: + - organization.project.user.deleted + x-stainless-const: true + id: type: string - example: file-abc456 - has_more: + deleted: type: boolean - example: false required: - object - - data - - first_id - - last_id - - has_more - ListVectorStoresResponse: + - id + - deleted + ProjectUserListResponse: + type: object properties: object: type: string - example: list data: type: array items: - $ref: '#/components/schemas/VectorStoreObject' + $ref: '#/components/schemas/ProjectUser' first_id: - type: string - example: vs_abc123 + anyOf: + - type: string + - type: 'null' last_id: - type: string - example: vs_abc456 + anyOf: + - type: string + - type: 'null' has_more: type: boolean - example: false required: - object - data - - first_id - - last_id - has_more - LiveCallAcceptRequest: - type: object - description: Accept an incoming SIP call with Live startup configuration. - properties: - session: - $ref: '#/components/schemas/LiveCallAcceptSession' - description: Model and startup configuration for the Live session that answers the incoming SIP call. - required: - - session - additionalProperties: false - LiveCallAcceptSession: - type: object - description: Startup configuration for accepting an incoming Live SIP call. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when writing frontend and backend instructions. - properties: - model: - $ref: '#/components/schemas/ModelIdsLive' - description: The Live model to use for the accepted call. - minLength: 1 - instructions: - $ref: '#/components/schemas/instructions' - audio: - $ref: '#/components/schemas/LiveMediaSessionAudioParam' - description: Startup audio output configuration. SIP negotiates the media format; audio.format is only accepted for primary WebSockets. Voice cannot change after startup. - delegation: - $ref: '#/components/schemas/delegation' - store: - $ref: '#/components/schemas/store' - input: - $ref: '#/components/schemas/input' - type: - type: string - enum: - - live - default: live - x-stainless-const: true - description: The session type. Always `live`. - required: - - model - - type - additionalProperties: false - LiveCallReferRequest: - type: object - description: Parameters used to transfer a Live SIP call to another destination. - properties: - target_uri: - $ref: '#/components/schemas/target_uri' - minLength: 1 - pattern: \S - description: Nonblank URI for the SIP Refer-To header, such as tel:+14155550123 or sip:agent@example.com. - required: - - target_uri - additionalProperties: false - LiveCallRejectRequest: - type: object - description: Parameters used to reject an incoming Live SIP call. - properties: - status_code: - type: integer - minimum: 300 - maximum: 699 - description: SIP rejection status sent to the caller. This field is required. - example: 486 - required: - - status_code - additionalProperties: false - LiveClientEvent: - description: Client events for Live. Initialize a primary WebSocket with session.start and wait for session.started. WebRTC creation already starts the session. Audio append is primary WebSocket-only. See the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) before writing frontend instructions and delegation policies. - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveSessionStartEvent' - - $ref: '#/components/schemas/LiveSessionUpdateParam' - - $ref: '#/components/schemas/LiveInputAudioAppendEvent' - - $ref: '#/components/schemas/LiveInputAudioMuteParam' - - $ref: '#/components/schemas/LiveInputAudioUnmuteParam' - - $ref: '#/components/schemas/LiveInstructionsAppendParam' - - $ref: '#/components/schemas/LiveThinkingAppendParam' - - $ref: '#/components/schemas/LiveCommentaryAppendParam' - - $ref: '#/components/schemas/LiveResponseItemCreateParam' - - $ref: '#/components/schemas/LiveResponseCreateParam' - - $ref: '#/components/schemas/LiveSessionCloseParam' - LiveConnectParams: - type: object - x-stainless-empty-object: true - description: Primary Live WebSocket connections accept no query parameters. Supply the model and startup configuration in the first session.start event. - properties: {} - additionalProperties: false - LiveCreateRequest: - type: object - description: Create a Live WebRTC session with JSON session configuration and an SDP offer. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) before choosing frontend and backend instructions. The request starts the session; do not send session.start on the data channel. - properties: - session: - $ref: '#/components/schemas/LiveMediaSessionCreateParams' - description: Startup configuration for the Live session. - transport: - $ref: '#/components/schemas/LiveWebRTCTransport' - description: WebRTC transport with the browser's SDP offer. - required: - - session - - transport - additionalProperties: false - LiveCreateResponse: + ProjectUserUpdateRequest: type: object - description: The created Live session identifier and WebRTC answer. Apply transport.sdp as the peer's remote answer and wait for session.started on the data channel before sending commands. properties: - session: - type: object - description: The newly created Live session. Use its ID for session controls and sideband connections. - properties: - id: - type: string - description: Opaque session identifier. Preserve the returned value unchanged, including its prefix. - required: - - id - transport: - $ref: '#/components/schemas/LiveWebRTCTransport' - description: WebRTC transport with the SDP answer. - required: - - session - - transport - LiveForkClientEvent: - description: Client events for a Live fork WebSocket. First send session.start with an overrides object (which may be empty), then wait for session.started before sending other commands. The model and conversation are inherited from the stored session. - discriminator: - propertyName: type + role: + anyOf: + - type: string + - type: 'null' + description: '`owner` or `member`' + Prompt: anyOf: - - $ref: '#/components/schemas/LiveForkSessionStartEvent' - - $ref: '#/components/schemas/LiveSessionUpdateParam' - - $ref: '#/components/schemas/LiveInputAudioAppendEvent' - - $ref: '#/components/schemas/LiveInputAudioMuteParam' - - $ref: '#/components/schemas/LiveInputAudioUnmuteParam' - - $ref: '#/components/schemas/LiveInstructionsAppendParam' - - $ref: '#/components/schemas/LiveThinkingAppendParam' - - $ref: '#/components/schemas/LiveCommentaryAppendParam' - - $ref: '#/components/schemas/LiveResponseItemCreateParam' - - $ref: '#/components/schemas/LiveResponseCreateParam' - - $ref: '#/components/schemas/LiveSessionCloseParam' - LiveForkPathParams: + - type: object + description: | + Reference to a prompt template and its variables. + [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + required: + - id + properties: + id: + type: string + description: The unique identifier of the prompt template to use. + version: + anyOf: + - type: string + description: Optional version of the prompt template. + - type: 'null' + variables: + $ref: '#/components/schemas/ResponsePromptVariables' + - type: 'null' + PublicAssignOrganizationGroupRoleBody: type: object - description: Identifies the stored Live session whose conversation and configuration are used to create a fork. - required: - - session_id + description: Request payload for assigning a role to a group or user. properties: - session_id: + role_id: type: string - description: The ID of the stored Live session to fork. - LiveForkRequest: - type: object - description: Fork a stored Live session onto a new WebRTC connection. Omit session or send an empty object to inherit its configuration. - properties: - session: - $ref: '#/components/schemas/LiveMediaSessionForkParams' - description: Optional configuration overrides for the new Live session. Omit this object or send an empty object to inherit the stored session's settings. - transport: - $ref: '#/components/schemas/LiveWebRTCTransport' - description: WebRTC transport with an SDP offer for the new connection to the forked session. + description: Identifier of the role to assign. required: - - transport - additionalProperties: false - LiveForkServerEvent: - $ref: '#/components/schemas/LiveServerEvent' - LiveMediaSessionAudioParam: - type: object - description: Startup audio output configuration. WebRTC and SIP negotiate the media format; audio.format is only accepted for primary WebSockets. Voice cannot change after startup. - properties: - output: - $ref: '#/components/schemas/LiveInitialSessionAudioOutputParam' - additionalProperties: false - LiveMediaSessionCreateParams: + - role_id + x-oaiMeta: + example: | + { + "role_id": "role_01J1F8ROLE01" + } + PublicCreateOrganizationRoleBody: type: object - description: Startup configuration for a Live media session. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when writing frontend instructions and the backend prompt under delegation.responses.instructions. + description: Request payload for creating a custom role. properties: - model: - $ref: '#/components/schemas/ModelIdsLive' - instructions: - $ref: '#/components/schemas/instructions' - audio: - $ref: '#/components/schemas/LiveMediaSessionAudioParam' - description: Startup audio configuration. WebRTC and SIP negotiate their audio format on the media transport. - delegation: - $ref: '#/components/schemas/delegation' - store: - $ref: '#/components/schemas/store' - input: - $ref: '#/components/schemas/input' - client: - $ref: '#/components/schemas/LiveClientConfigParam' + role_name: + type: string + description: Unique name for the role. + permissions: + type: array + description: Permissions to grant to the role. + items: + type: string + description: + description: Optional description of the role. + anyOf: + - type: string + - type: 'null' required: - - model - additionalProperties: false - LiveMediaSessionForkParams: - type: object - description: Optional overrides for a stored Live session. Omitted settings are inherited. The model, voice, frontend instructions, and prior conversation come from the stored session. WebRTC negotiates its audio format; audio.format is only supported on WebSocket forks. - properties: - store: - $ref: '#/components/schemas/properties-store' - delegation: - $ref: '#/components/schemas/LiveResponsesDelegationUpdateParam' - client: - $ref: '#/components/schemas/LiveClientConfigParam' - additionalProperties: false - LiveServerEvent: - description: Server events for Live. Response lifecycle events are wrapped inside response.event; dispatch the nested event by its full type and tolerate new response event types. Follow the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) when designing the conversation and delegation policy. - discriminator: - propertyName: type - allOf: - - $ref: '#/components/schemas/LiveServerEvent-2' - LiveSidebandClientEvent: - description: Client events accepted by an attached Live sideband WebSocket. The session is already started; send audio over the primary connection. - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveSessionUpdateParam' - - $ref: '#/components/schemas/LiveInputAudioMuteParam' - - $ref: '#/components/schemas/LiveInputAudioUnmuteParam' - - $ref: '#/components/schemas/LiveInstructionsAppendParam' - - $ref: '#/components/schemas/LiveThinkingAppendParam' - - $ref: '#/components/schemas/LiveCommentaryAppendParam' - - $ref: '#/components/schemas/LiveResponseItemCreateParam' - - $ref: '#/components/schemas/LiveResponseCreateParam' - - $ref: '#/components/schemas/LiveSessionCloseParam' - LiveSidebandConnectParams: + - role_name + - permissions + x-oaiMeta: + example: | + { + "role_name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "description": "Allows managing organization groups" + } + PublicRoleListResource: type: object - description: Connection options for a sideband WebSocket attached to an existing Live session. + description: Paginated list of roles available on an organization or project. properties: - graceful_close: + object: + type: string + enum: + - list + description: Always `list`. + x-stainless-const: true + data: + type: array + description: Roles returned in the current page. + items: + $ref: '#/components/schemas/Role' + has_more: type: boolean - description: Opt in to the graceful WebSocket closing handshake when the session ends. The server may also enable this behavior by default. - additionalProperties: false - LiveSidebandPathParams: + description: Whether more roles are available when paginating. + next: + description: Cursor to fetch the next page of results, or `null` when there are no additional roles. + anyOf: + - type: string + - type: 'null' + required: + - object + - data + - has_more + - next + x-oaiMeta: + name: Role list + example: | + { + "object": "list", + "data": [ + { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + ], + "has_more": false, + "next": null + } + PublicUpdateOrganizationRoleBody: type: object - description: Identifies the Live session to observe and control through a sideband WebSocket. - required: - - session_id + description: Request payload for updating an existing role. properties: - session_id: - type: string - description: The ID of the existing Live session to attach to. - LiveSidebandServerEvent: - description: Server events received by an attached Live sideband WebSocket. Audio deltas are delivered over the primary connection. + permissions: + description: Updated set of permissions for the role. + anyOf: + - type: array + items: + type: string + - type: 'null' + description: + description: New description for the role. + anyOf: + - type: string + - type: 'null' + role_name: + description: New name for the role. + anyOf: + - type: string + - type: 'null' + x-oaiMeta: + example: | + { + "role_name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "description": "Allows managing organization groups" + } + RealtimeAudioFormats: + anyOf: + - type: object + title: PCM audio format + description: The PCM audio format. Only a 24kHz sample rate is supported. + properties: + type: + type: string + description: The audio format. Always `audio/pcm`. + enum: + - audio/pcm + rate: + type: integer + description: The sample rate of the audio. Always `24000`. + enum: + - 24000 + - type: object + title: PCMU audio format + description: The G.711 μ-law format. + properties: + type: + type: string + description: The audio format. Always `audio/pcmu`. + enum: + - audio/pcmu + - type: object + title: PCMA audio format + description: The G.711 A-law format. + properties: + type: + type: string + description: The audio format. Always `audio/pcma`. + enum: + - audio/pcma discriminator: propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveSessionStarted' - - $ref: '#/components/schemas/LiveSessionUpdated' - - $ref: '#/components/schemas/LiveInputAudioMuted' - - $ref: '#/components/schemas/LiveInputAudioUnmuted' - - $ref: '#/components/schemas/LiveInstructionsAppended' - - $ref: '#/components/schemas/LiveThinkingAppended' - - $ref: '#/components/schemas/LiveCommentaryAppended' - - $ref: '#/components/schemas/LiveInputTranscriptDelta' - - $ref: '#/components/schemas/LiveOutputTranscriptDelta' - - $ref: '#/components/schemas/LiveDelegationCreated' - - $ref: '#/components/schemas/LiveResponseEvent' - - $ref: '#/components/schemas/LiveSessionUsageUpdated' - - $ref: '#/components/schemas/LiveSessionClosed' - - $ref: '#/components/schemas/LiveErrorEvent' - - $ref: '#/components/schemas/LiveInfoEvent' - LiveWebRTCTransport: + RealtimeBetaClientEventConversationItemCreate: type: object - description: WebRTC transport carrying the offer SDP in a creation request or answer SDP in its response. + description: "Add a new Item to the Conversation's context, including messages, function \ncalls, and function call responses. This event can be used both to populate a \n\"history\" of the conversation and to add new items mid-stream, but has the \ncurrent limitation that it cannot populate assistant audio messages.\n\nIf successful, the server will respond with a `conversation.item.created` \nevent, otherwise an `error` event will be sent.\n" properties: - type: + event_id: type: string - description: The transport used for the Live session. Always `webrtc`. - enum: - - webrtc + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: x-stainless-const: true - sdp: + description: The event type, must be `conversation.item.create`. + const: conversation.item.create + previous_item_id: type: string - minLength: 1 - description: Session Description Protocol message for the WebRTC connection. + description: "The ID of the preceding item after which the new item will be inserted. \nIf not set, the new item will be appended to the end of the conversation.\nIf set to `root`, the new item will be added to the beginning of the conversation.\nIf set to an existing ID, it allows an item to be inserted mid-conversation. If the\nID cannot be found, an error will be returned and the item will not be added.\n" + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - type - - sdp - additionalProperties: false - LocalShellToolCall: + - item + x-oaiMeta: + name: conversation.item.create + group: realtime + example: | + { + "type": "conversation.item.create", + "item": { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "hi" + } + ] + }, + "event_id": "b904fba0-0ec4-40af-8bbb-f908a9b26793", + } + RealtimeBetaClientEventConversationItemDelete: type: object - title: Local shell call - description: | - A tool call to run a command on the local shell. + description: "Send this event when you want to remove any item from the conversation \nhistory. The server will respond with a `conversation.item.deleted` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n" properties: - type: + event_id: type: string - enum: - - local_shell_call - description: | - The type of the local shell call. Always `local_shell_call`. + description: Optional client-generated ID used to identify this event. + type: x-stainless-const: true - id: + description: The event type, must be `conversation.item.delete`. + const: conversation.item.delete + item_id: type: string - description: | - The unique ID of the local shell call. - call_id: + description: The ID of the item to delete. + required: + - type + - item_id + x-oaiMeta: + name: conversation.item.delete + group: realtime + example: | + { + "event_id": "event_901", + "type": "conversation.item.delete", + "item_id": "msg_003" + } + RealtimeBetaClientEventConversationItemRetrieve: + type: object + description: "Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD.\nThe server will respond with a `conversation.item.retrieved` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n" + properties: + event_id: type: string - description: | - The unique ID of the local shell tool call generated by the model. - action: - $ref: '#/components/schemas/LocalShellExecAction' - status: + description: Optional client-generated ID used to identify this event. + type: + x-stainless-const: true + description: The event type, must be `conversation.item.retrieve`. + const: conversation.item.retrieve + item_id: type: string - enum: - - in_progress - - completed - - incomplete - description: | - The status of the local shell call. + description: The ID of the item to retrieve. required: - type - - id - - call_id - - action - - status - LocalShellToolCallOutput: + - item_id + x-oaiMeta: + name: conversation.item.retrieve + group: realtime + example: | + { + "event_id": "event_901", + "type": "conversation.item.retrieve", + "item_id": "msg_003" + } + RealtimeBetaClientEventConversationItemTruncate: type: object - title: Local shell call output - description: | - The output of a local shell tool call. + description: "Send this event to truncate a previous assistant message’s audio. The server \nwill produce audio faster than realtime, so this event is useful when the user \ninterrupts to truncate audio that has already been sent to the client but not \nyet played. This will synchronize the server's understanding of the audio with \nthe client's playback.\n\nTruncating audio will delete the server-side text transcript to ensure there \nis not text in the context that hasn't been heard by the user.\n\nIf successful, the server will respond with a `conversation.item.truncated` \nevent. \n" properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. type: + x-stainless-const: true + description: The event type, must be `conversation.item.truncate`. + const: conversation.item.truncate + item_id: type: string - enum: - - local_shell_call_output - description: | - The type of the local shell tool call output. Always `local_shell_call_output`. + description: "The ID of the assistant message item to truncate. Only assistant message \nitems can be truncated.\n" + content_index: + type: integer + description: The index of the content part to truncate. Set this to 0. + audio_end_ms: + type: integer + description: "Inclusive duration up to which audio is truncated, in milliseconds. If \nthe audio_end_ms is greater than the actual audio duration, the server \nwill respond with an error.\n" + required: + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncate + group: realtime + example: | + { + "event_id": "event_678", + "type": "conversation.item.truncate", + "item_id": "msg_002", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeBetaClientEventInputAudioBufferAppend: + type: object + description: "Send this event to append audio bytes to the input audio buffer. The audio \nbuffer is temporary storage you can write to and later commit. In Server VAD \nmode, the audio buffer is used to detect speech and the server will decide \nwhen to commit. When Server VAD is disabled, you must commit the audio buffer\nmanually.\n\nThe client may choose how much audio to place in each event up to a maximum \nof 15 MiB, for example streaming smaller chunks from the client may allow the \nVAD to be more responsive. Unlike made other client events, the server will \nnot send a confirmation response to this event.\n" + properties: + event_id: + type: string + description: Optional client-generated ID used to identify this event. + type: x-stainless-const: true - id: + description: The event type, must be `input_audio_buffer.append`. + const: input_audio_buffer.append + audio: type: string - description: | - The unique ID of the local shell tool call generated by the model. - output: + description: "Base64-encoded audio bytes. This must be in the format specified by the \n`input_audio_format` field in the session configuration.\n" + required: + - type + - audio + x-oaiMeta: + name: input_audio_buffer.append + group: realtime + example: | + { + "event_id": "event_456", + "type": "input_audio_buffer.append", + "audio": "Base64EncodedAudioData" + } + RealtimeBetaClientEventInputAudioBufferClear: + type: object + description: "Send this event to clear the audio bytes in the buffer. The server will \nrespond with an `input_audio_buffer.cleared` event.\n" + properties: + event_id: type: string - description: | - A JSON string of the output of the local shell tool call. - status: - anyOf: - - type: string - enum: - - in_progress - - completed - - incomplete - description: | - The status of the item. One of `in_progress`, `completed`, or `incomplete`. - - type: 'null' + description: Optional client-generated ID used to identify this event. + type: + x-stainless-const: true + description: The event type, must be `input_audio_buffer.clear`. + const: input_audio_buffer.clear required: - - id - type - - call_id - - output - LogProbProperties: + x-oaiMeta: + name: input_audio_buffer.clear + group: realtime + example: | + { + "event_id": "event_012", + "type": "input_audio_buffer.clear" + } + RealtimeBetaClientEventInputAudioBufferCommit: type: object - description: | - A log probability object. + description: "Send this event to commit the user input audio buffer, which will create a \nnew user message item in the conversation. This event will produce an error \nif the input audio buffer is empty. When in Server VAD mode, the client does \nnot need to send this event, the server will commit the audio buffer \nautomatically.\n\nCommitting the input audio buffer will trigger input audio transcription \n(if enabled in session configuration), but it will not create a response \nfrom the model. The server will respond with an `input_audio_buffer.committed` \nevent.\n" properties: - token: + event_id: type: string - description: | - The token that was used to generate the log probability. - logprob: - type: number - description: | - The log probability of the token. - bytes: - type: array - items: - type: integer - description: | - The bytes that were used to generate the log probability. + description: Optional client-generated ID used to identify this event. + type: + x-stainless-const: true + description: The event type, must be `input_audio_buffer.commit`. + const: input_audio_buffer.commit required: - - token - - logprob - - bytes - MCPApprovalRequest: + - type + x-oaiMeta: + name: input_audio_buffer.commit + group: realtime + example: | + { + "event_id": "event_789", + "type": "input_audio_buffer.commit" + } + RealtimeBetaClientEventOutputAudioBufferClear: type: object - title: MCP approval request description: | - A request for human approval of a tool invocation. + **WebRTC/SIP Only:** Emit to cut off the current audio response. This will trigger the server to + stop generating audio and emit a `output_audio_buffer.cleared` event. This + event should be preceded by a `response.cancel` client event to stop the + generation of the current response. + [Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). properties: - type: + event_id: type: string - enum: - - mcp_approval_request - description: | - The type of the item. Always `mcp_approval_request`. + description: The unique ID of the client event used for error handling. + type: x-stainless-const: true - id: - type: string - description: | - The unique ID of the approval request. - server_label: + description: The event type, must be `output_audio_buffer.clear`. + const: output_audio_buffer.clear + required: + - type + x-oaiMeta: + name: output_audio_buffer.clear + group: realtime + example: | + { + "event_id": "optional_client_event_id", + "type": "output_audio_buffer.clear" + } + RealtimeBetaClientEventResponseCancel: + type: object + description: "Send this event to cancel an in-progress response. The server will respond \nwith a `response.done` event with a status of `response.status=cancelled`. If \nthere is no response to cancel, the server will respond with an error.\n" + properties: + event_id: type: string - description: | - The label of the MCP server making the request. - name: + description: Optional client-generated ID used to identify this event. + type: + x-stainless-const: true + description: The event type, must be `response.cancel`. + const: response.cancel + response_id: type: string - description: | - The name of the tool to run. - arguments: + description: "A specific response ID to cancel - if not provided, will cancel an \nin-progress response in the default conversation.\n" + required: + - type + x-oaiMeta: + name: response.cancel + group: realtime + example: | + { + "event_id": "event_567", + "type": "response.cancel" + } + RealtimeBetaClientEventResponseCreate: + type: object + description: "This event instructs the server to create a Response, which means triggering \nmodel inference. When in Server VAD mode, the server will create Responses \nautomatically.\n\nA Response will include at least one Item, and may have two, in which case \nthe second will be a function call. These Items will be appended to the \nconversation history.\n\nThe server will respond with a `response.created` event, events for Items \nand content created, and finally a `response.done` event to indicate the \nResponse is complete.\n\nThe `response.create` event can optionally include inference configuration like \n`instructions`, and `temperature`. These fields will override the Session's \nconfiguration for this Response only.\n\nResponses can be created out-of-band of the default Conversation, meaning that they can\nhave arbitrary input, and it's possible to disable writing the output to the Conversation.\nOnly one Response can write to the default Conversation at a time, but otherwise multiple\nResponses can be created in parallel.\n\nClients can set `conversation` to `none` to create a Response that does not write to the default\nConversation. Arbitrary input can be provided with the `input` field, which is an array accepting\nraw Items and references to existing Items.\n" + properties: + event_id: type: string - description: | - A JSON string of arguments for the tool. + description: Optional client-generated ID used to identify this event. + type: + x-stainless-const: true + description: The event type, must be `response.create`. + const: response.create + response: + $ref: '#/components/schemas/RealtimeBetaResponseCreateParams' required: - type - - id - - server_label - - name - - arguments - MCPApprovalResponse: + x-oaiMeta: + name: response.create + group: realtime + example: | + // Trigger a response with the default Conversation and no special parameters + { + "type": "response.create", + } + + // Trigger an out-of-band response that does not write to the default Conversation + { + "type": "response.create", + "response": { + "instructions": "Provide a concise answer.", + "tools": [], // clear any session tools + "conversation": "none", + "output_modalities": ["text"], + "input": [ + { + "type": "item_reference", + "id": "item_12345", + }, + { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Summarize the above message in one sentence." + } + ] + } + ], + } + } + RealtimeBetaClientEventSessionUpdate: type: object - title: MCP approval response description: | - A response to an MCP approval request. + Send this event to update the session’s default configuration. + The client may send this event at any time to update any field, + except for `voice`. However, note that once a session has been + initialized with a particular `model`, it can’t be changed to + another model using `session.update`. + + When the server receives a `session.update`, it will respond + with a `session.updated` event showing the full, effective configuration. + Only the fields that are present are updated. To clear a field like + `instructions`, pass an empty string. properties: - type: + event_id: type: string - enum: - - mcp_approval_response - description: | - The type of the item. Always `mcp_approval_response`. + description: Optional client-generated ID used to identify this event. + type: x-stainless-const: true - id: - anyOf: - - type: string - description: | - The unique ID of the approval response - - type: 'null' - approval_request_id: - type: string - description: | - The ID of the approval request being answered. - approve: - type: boolean - description: | - Whether the request was approved. - reason: - anyOf: - - type: string - description: | - Optional reason for the decision. - - type: 'null' + description: The event type, must be `session.update`. + const: session.update + session: + $ref: '#/components/schemas/RealtimeSessionCreateRequest' required: - type - - request_id - - approve - - approval_request_id - MCPApprovalResponseResource: + - session + x-oaiMeta: + name: session.update + group: realtime + example: | + { + "type": "session.update", + "session": { + "tools": [ + { + "type": "function", + "name": "display_color_palette", + "description": "Call this function when a user asks for a color palette.", + "parameters": { + "type": "object", + "properties": { + "theme": { + "type": "string", + "description": "Description of the theme for the color scheme." + }, + "colors": { + "type": "array", + "description": "Array of five hex color codes based on the theme.", + "items": { + "type": "string", + "description": "Hex color code" + } + } + }, + "required": [ + "theme", + "colors" + ] + } + } + ], + "tool_choice": "auto" + } + } + RealtimeBetaClientEventTranscriptionSessionUpdate: type: object - title: MCP approval response description: | - A response to an MCP approval request. + Send this event to update a transcription session. properties: - type: + event_id: type: string - enum: - - mcp_approval_response - description: | - The type of the item. Always `mcp_approval_response`. + description: Optional client-generated ID used to identify this event. + type: x-stainless-const: true - id: - type: string - description: | - The unique ID of the approval response - approval_request_id: - type: string - description: | - The ID of the approval request being answered. - approve: - type: boolean - description: | - Whether the request was approved. - reason: - anyOf: - - type: string - description: | - Optional reason for the decision. - - type: 'null' + description: The event type, must be `transcription_session.update`. + const: transcription_session.update + session: + $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequest' required: - type - - id - - request_id - - approve - - approval_request_id - MCPListTools: + - session + x-oaiMeta: + name: transcription_session.update + group: realtime + example: | + { + "type": "transcription_session.update", + "session": { + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.logprobs", + ] + } + } + RealtimeBetaResponse: type: object - title: MCP list tools - description: | - A list of tools available on an MCP server. + description: The response resource. properties: - type: - type: string - enum: - - mcp_list_tools - description: | - The type of the item. Always `mcp_list_tools`. - x-stainless-const: true id: type: string - description: | - The unique ID of the list. - server_label: + description: The unique ID of the response. + object: + x-stainless-const: true + description: The object type, must be `realtime.response`. + const: realtime.response + status: type: string - description: | - The label of the MCP server. - tools: + enum: + - completed + - cancelled + - failed + - incomplete + - in_progress + description: "The final status of the response (`completed`, `cancelled`, `failed`, or \n`incomplete`, `in_progress`).\n" + status_details: + type: object + description: Additional details about the status. + properties: + type: + type: string + enum: + - completed + - cancelled + - incomplete + - failed + description: "The type of error that caused the response to fail, corresponding \nwith the `status` field (`completed`, `cancelled`, `incomplete`, \n`failed`).\n" + reason: + type: string + enum: + - turn_detected + - client_cancelled + - max_output_tokens + - content_filter + description: "The reason the Response did not complete. For a `cancelled` Response, \none of `turn_detected` (the server VAD detected a new start of speech) \nor `client_cancelled` (the client sent a cancel event). For an \n`incomplete` Response, one of `max_output_tokens` or `content_filter` \n(the server-side safety filter activated and cut off the response).\n" + error: + type: object + description: "A description of the error that caused the response to fail, \npopulated when the `status` is `failed`.\n" + properties: + type: + type: string + description: The type of error. + code: + type: string + description: Error code, if any. + output: type: array + description: The list of output items generated by the response. items: - $ref: '#/components/schemas/MCPListToolsTool' - description: | - The tools available on the server. - error: - anyOf: - - type: string - description: | - Error message if the server could not list tools. - - type: 'null' - required: - - type - - id - - server_label - - tools - MCPListToolsTool: - type: object - title: MCP list tools tool - description: | - A tool available on an MCP server. - properties: - name: - type: string - description: | - The name of the tool. - description: - anyOf: - - type: string - description: | - The description of the tool. - - type: 'null' - input_schema: + $ref: '#/components/schemas/RealtimeConversationItem' + metadata: + $ref: '#/components/schemas/Metadata' + usage: type: object + description: "Usage statistics for the Response, this will correspond to billing. A \nRealtime API session will maintain a conversation context and append new \nItems to the Conversation, thus output from previous turns (text and \naudio tokens) will become the input for later turns.\n" + properties: + total_tokens: + type: integer + description: "The total number of tokens in the Response including input and output \ntext and audio tokens.\n" + input_tokens: + type: integer + description: "The number of input tokens used in the Response, including text and \naudio tokens.\n" + output_tokens: + type: integer + description: "The number of output tokens sent in the Response, including text and \naudio tokens.\n" + input_token_details: + type: object + description: Details about the input tokens used in the Response. + properties: + cached_tokens: + type: integer + description: The number of cached tokens used as input for the Response. + text_tokens: + type: integer + description: The number of text tokens used as input for the Response. + image_tokens: + type: integer + description: The number of image tokens used as input for the Response. + audio_tokens: + type: integer + description: The number of audio tokens used as input for the Response. + cached_tokens_details: + type: object + description: Details about the cached tokens used as input for the Response. + properties: + text_tokens: + type: integer + description: The number of cached text tokens used as input for the Response. + image_tokens: + type: integer + description: The number of cached image tokens used as input for the Response. + audio_tokens: + type: integer + description: The number of cached audio tokens used as input for the Response. + output_token_details: + type: object + description: Details about the output tokens used in the Response. + properties: + text_tokens: + type: integer + description: The number of text tokens used in the Response. + audio_tokens: + type: integer + description: The number of audio tokens used in the Response. + conversation_id: description: | - The JSON schema describing the tool's input. - annotations: - anyOf: - - type: object - description: | - Additional annotations about the tool. - - type: 'null' - required: - - name - - input_schema - MCPTool: - type: object - title: MCP tool - description: | - Give the model access to additional tools via remote Model Context Protocol - (MCP) servers. [Learn more about MCP](https://developers.openai.com/api/docs/guides/tools-connectors-mcp). - properties: - type: - type: string - enum: - - mcp - description: The type of the MCP tool. Always `mcp`. - x-stainless-const: true - server_label: + Which conversation the response is added to, determined by the `conversation` + field in the `response.create` event. If `auto`, the response will be added to + the default conversation and the value of `conversation_id` will be an id like + `conv_1234`. If `none`, the response will not be added to any conversation and + the value of `conversation_id` will be `null`. If responses are being triggered + by server VAD, the response will be added to the default conversation, thus + the `conversation_id` will be an id like `conv_1234`. type: string + voice: + $ref: '#/components/schemas/VoiceIdsShared' description: | - A label for this MCP server, used to identify it in tool calls. - server_url: - type: string - format: uri + The voice the model used to respond. + Current voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + `shimmer`, and `verse`. + modalities: + type: array description: | - The URL for the MCP server. One of `server_url`, `connector_id`, or - `tunnel_id` must be provided. - connector_id: + The set of modalities the model used to respond. If there are multiple modalities, + the model will pick one, for example if `modalities` is `["text", "audio"]`, the model + could be responding in either text or audio. + items: + type: string + enum: + - text + - audio + output_audio_format: type: string enum: - - connector_dropbox - - connector_gmail - - connector_googlecalendar - - connector_googledrive - - connector_microsoftteams - - connector_outlookcalendar - - connector_outlookemail - - connector_sharepoint - description: | - Identifier for service connectors, like those available in ChatGPT. One of - `server_url`, `connector_id`, or `tunnel_id` must be provided. Learn more - about service connectors [here](https://developers.openai.com/api/docs/guides/tools-connectors-mcp#connectors). - - Currently supported `connector_id` values are: - - - Dropbox: `connector_dropbox` - - Gmail: `connector_gmail` - - Google Calendar: `connector_googlecalendar` - - Google Drive: `connector_googledrive` - - Microsoft Teams: `connector_microsoftteams` - - Outlook Calendar: `connector_outlookcalendar` - - Outlook Email: `connector_outlookemail` - - SharePoint: `connector_sharepoint` - tunnel_id: - type: string - pattern: ^tunnel_[a-z0-9]{32}$ + - pcm16 + - g711_ulaw + - g711_alaw description: | - The Secure MCP Tunnel ID to use instead of a direct server URL. One of - `server_url`, `connector_id`, or `tunnel_id` must be provided. - authorization: - type: string + The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + temperature: + type: number description: | - An OAuth access token that can be used with a remote MCP server, either - with a custom MCP server URL or a service connector. Your application - must handle the OAuth authorization flow and provide the token here. - server_description: - type: string + Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + max_output_tokens: description: | - Optional description of the MCP server, used to provide more context. - headers: - anyOf: - - type: object - additionalProperties: - type: string - description: | - Optional HTTP headers to send to the MCP server. Use for authentication - or other purposes. - - type: 'null' - allowed_tools: - anyOf: - - description: | - List of allowed tool names or a filter object. - anyOf: - - type: array - title: MCP allowed tools - description: A string array of allowed tool names - items: - type: string - - $ref: '#/components/schemas/MCPToolFilter' - - type: 'null' - allowed_callers: - anyOf: - - type: array - minItems: 1 - items: - $ref: '#/components/schemas/CallableToolAllowedCaller' - description: The tool invocation context(s). - - type: 'null' - require_approval: + Maximum number of output tokens for a single assistant response, + inclusive of tool calls, that was used in this response. anyOf: - - description: Specify which of the MCP server's tools require approval. - default: always - anyOf: - - type: object - title: MCP tool approval filter - description: | - Specify which of the MCP server's tools require approval. Can be - `always`, `never`, or a filter object associated with tools - that require approval. - properties: - always: - $ref: '#/components/schemas/MCPToolFilter' - never: - $ref: '#/components/schemas/MCPToolFilter' - additionalProperties: false - - type: string - title: MCP tool approval setting - description: | - Specify a single approval policy for all tools. One of `always` or - `never`. When set to `always`, all tools will require approval. When - set to `never`, all tools will not require approval. - enum: - - always - - never - - type: 'null' - defer_loading: - type: boolean - description: | - Whether this MCP tool is deferred and discovered via tool search. - required: - - type - - server_label - MCPToolCall: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + RealtimeBetaResponseCreateParams: type: object - title: MCP tool call - description: | - An invocation of a tool on an MCP server. + description: Create a new Realtime response with these parameters properties: - type: - type: string - enum: - - mcp_call + modalities: + type: array description: | - The type of the item. Always `mcp_call`. - x-stainless-const: true - id: + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + items: + type: string + enum: + - text + - audio + instructions: type: string + description: "The default system instructions (i.e. system message) prepended to model \ncalls. This field allows the client to guide the model on desired \nresponses. The model can be instructed on response content and format, \n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good \nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion \ninto your voice\", \"laugh frequently\"). The instructions are not guaranteed \nto be followed by the model, but they provide guidance to the model on the \ndesired behavior.\n\nNote that the server sets default instructions which will be used if this \nfield is not set and are visible in the `session.created` event at the \nstart of the session.\n" + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' description: | - The unique ID of the tool call. - server_label: + The voice the model uses to respond. Supported built-in voices are + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, + `marin`, and `cedar`. You may also provide a custom voice object with an + `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed during + the session once the model has responded with audio at least once. + output_audio_format: type: string + enum: + - pcm16 + - g711_ulaw + - g711_alaw description: | - The label of the MCP server running the tool. - name: - type: string + The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + tools: + type: array + description: Tools (functions) available to the model. + items: + type: object + properties: + type: + type: string + enum: + - function + description: The type of the tool, i.e. `function`. + x-stainless-const: true + name: + type: string + description: The name of the function. + description: + type: string + description: "The description of the function, including guidance on when and how \nto call it, and guidance about what to tell the user when calling \n(if anything).\n" + parameters: + type: object + description: Parameters of the function in JSON Schema. + tool_choice: description: | - The name of the tool that was run. - arguments: - type: string + How the model chooses tools. Provide one of the string modes or force a specific + function/MCP tool. + default: auto + anyOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + temperature: + type: number description: | - A JSON string of the arguments passed to the tool. - output: + Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + max_output_tokens: + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. anyOf: + - type: integer - type: string - description: | - The output from the tool call. - - type: 'null' - error: - description: The error from the tool call, if any. - anyOf: - - $ref: '#/components/schemas/MCPToolCallError' - - type: 'null' - status: - $ref: '#/components/schemas/MCPToolCallStatus' - description: | - The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`. - approval_request_id: + enum: + - inf + x-stainless-const: true + conversation: + description: "Controls which conversation the response is added to. Currently supports\n`auto` and `none`, with `auto` as the default value. The `auto` value\nmeans that the contents of the response will be added to the default\nconversation. Set this to `none` to create an out-of-band response which \nwill not add items to default conversation.\n" anyOf: - type: string - description: | - Unique identifier for the MCP tool call approval request. - Include this value in a subsequent `mcp_approval_response` input to approve or reject the corresponding tool call. - - type: 'null' - required: - - type - - id - - server_label - - name - - arguments - MCPToolCallError: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/MCPProtocolError' - - $ref: '#/components/schemas/MCPToolExecutionError' - - $ref: '#/components/schemas/HTTPError' - MCPToolFilter: - type: object - title: MCP tool filter - description: | - A filter object to specify which tools are allowed. - properties: - tool_names: + - type: string + default: auto + enum: + - auto + - none + metadata: + $ref: '#/components/schemas/Metadata' + prompt: + $ref: '#/components/schemas/Prompt' + input: type: array - title: MCP allowed tools - items: - type: string - description: List of allowed tool names. - read_only: - type: boolean description: | - Indicates whether or not a tool modifies data or is read-only. If an - MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint), - it will match this filter. - required: [] - additionalProperties: false - MessageContentImageFileObject: - title: Image file + Input items to include in the prompt for the model. Using this field + creates a new context for this Response instead of using the default + conversation. An empty array `[]` will clear the context for this Response. + Note that this can include references to items from the default conversation. + items: + $ref: '#/components/schemas/RealtimeConversationItem' + RealtimeBetaServerEventConversationItemCreated: type: object - description: References an image [File](https://developers.openai.com/api/reference/resources/files) in the content of a message. + description: | + Returned when a conversation item is created. There are several scenarios that produce this event: + - The server is generating a Response, which if successful will produce + either one or two Items, which will be of type `message` + (role `assistant`) or type `function_call`. + - The input audio buffer has been committed, either by the client or the + server (in `server_vad` mode). The server will take the content of the + input audio buffer and add it to a new user message Item. + - The client has sent a `conversation.item.create` event to add a new Item + to the Conversation. properties: - type: - description: Always `image_file`. + event_id: type: string - enum: - - image_file - x-stainless-const: true - image_file: - type: object - properties: - file_id: - description: The [File](https://developers.openai.com/api/reference/resources/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - type: string - detail: - type: string - description: Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - enum: - - auto - - low - - high - default: auto - required: - - file_id - required: - - type - - image_file - MessageContentImageUrlObject: - title: Image URL - type: object - description: References an image URL in the content of a message. - properties: + description: The unique ID of the server event. type: - type: string - enum: - - image_url - description: The type of the content part. x-stainless-const: true - image_url: - type: object - properties: - url: - type: string - description: 'The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.' - format: uri - detail: - type: string - description: Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` - enum: - - auto - - low - - high - default: auto - required: - - url + description: The event type, must be `conversation.item.created`. + const: conversation.item.created + previous_item_id: + anyOf: + - type: string + description: | + The ID of the preceding item in the Conversation context, allows the + client to understand the order of the conversation. Can be `null` if the + item has no predecessor. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: + - event_id - type - - image_url - MessageContentRefusalObject: - title: Refusal + - item + x-oaiMeta: + name: conversation.item.created + group: realtime + example: | + { + "event_id": "event_1920", + "type": "conversation.item.created", + "previous_item_id": "msg_002", + "item": { + "id": "msg_003", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "user", + "content": [] + } + } + RealtimeBetaServerEventConversationItemDeleted: type: object - description: The refusal content generated by the assistant. + description: "Returned when an item in the conversation is deleted by the client with a \n`conversation.item.delete` event. This event is used to synchronize the \nserver's understanding of the conversation history with the client's view.\n" properties: - type: - description: Always `refusal`. - type: string - enum: - - refusal - x-stainless-const: true - refusal: + event_id: type: string - required: - - type - - refusal - MessageContentTextAnnotationsFileCitationObject: - title: File citation - type: object - description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - properties: + description: The unique ID of the server event. type: - description: Always `file_citation`. - type: string - enum: - - file_citation x-stainless-const: true - text: - description: The text in the message content that needs to be replaced. + description: The event type, must be `conversation.item.deleted`. + const: conversation.item.deleted + item_id: type: string - file_citation: - type: object - properties: - file_id: - description: The ID of the specific File the citation is from. - type: string - required: - - file_id - start_index: - type: integer - minimum: 0 - end_index: - type: integer - minimum: 0 + description: The ID of the item that was deleted. required: + - event_id - type - - text - - file_citation - - start_index - - end_index - MessageContentTextAnnotationsFilePathObject: - title: File path + - item_id + x-oaiMeta: + name: conversation.item.deleted + group: realtime + example: | + { + "event_id": "event_2728", + "type": "conversation.item.deleted", + "item_id": "msg_005" + } + RealtimeBetaServerEventConversationItemInputAudioTranscriptionCompleted: type: object - description: A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. + description: | + This event is the output of audio transcription for user audio written to the + user audio buffer. Transcription begins when the input audio buffer is + committed by the client or server (in `server_vad` mode). Transcription runs + asynchronously with Response creation, so this event may come before or after + the Response events. + + Realtime API models accept audio natively, and thus input transcription is a + separate process run on a separate ASR (Automatic Speech Recognition) model. + The transcript may diverge somewhat from the model's interpretation, and + should be treated as a rough guide. properties: - type: - description: Always `file_path`. - type: string - enum: - - file_path - x-stainless-const: true - text: - description: The text in the message content that needs to be replaced. + event_id: type: string - file_path: - type: object - properties: - file_id: - description: The ID of the file that was generated. - type: string - required: - - file_id - start_index: - type: integer - minimum: 0 - end_index: - type: integer - minimum: 0 - required: - - type - - text - - file_path - - start_index - - end_index - MessageContentTextObject: - title: Text - type: object - description: The text content that is part of a message. - properties: + description: The unique ID of the server event. type: - description: Always `text`. type: string enum: - - text + - conversation.item.input_audio_transcription.completed + description: | + The event type, must be + `conversation.item.input_audio_transcription.completed`. x-stainless-const: true - text: - type: object - properties: - value: - description: The data that makes up the text. - type: string - annotations: - type: array - items: - $ref: '#/components/schemas/TextAnnotation' - required: - - value - - annotations - required: - - type - - text - MessageDeltaContentImageFileObject: - title: Image file - type: object - description: References an image [File](https://developers.openai.com/api/reference/resources/files) in the content of a message. - properties: - index: - type: integer - description: The index of the content part in the message. - type: - description: Always `image_file`. + item_id: type: string - enum: - - image_file - x-stainless-const: true - image_file: - type: object - properties: - file_id: - description: The [File](https://developers.openai.com/api/reference/resources/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - type: string - detail: - type: string - description: Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - enum: - - auto - - low - - high - default: auto - required: - - index - - type - MessageDeltaContentImageUrlObject: - title: Image URL - type: object - description: References an image URL in the content of a message. - properties: - index: + description: The ID of the user message item containing the audio. + content_index: type: integer - description: The index of the content part in the message. - type: - description: Always `image_url`. + description: The index of the content part containing the audio. + transcript: type: string - enum: - - image_url - x-stainless-const: true - image_url: + description: The transcribed text. + languages: + type: array + description: | + The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected. + items: + $ref: '#/components/schemas/TranscriptionLanguage' + logprobs: + anyOf: + - type: array + description: The log probabilities of the transcription. + items: + $ref: '#/components/schemas/LogProbProperties' + - type: 'null' + usage: type: object - properties: - url: - description: 'The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp.' - type: string - format: uri - detail: - type: string - description: Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. - enum: - - auto - - low - - high - default: auto + description: Usage statistics for the transcription. + anyOf: + - $ref: '#/components/schemas/TranscriptTextUsageTokens' + title: Token Usage + - $ref: '#/components/schemas/TranscriptTextUsageDuration' + title: Duration Usage required: - - index + - event_id - type - MessageDeltaContentRefusalObject: - title: Refusal + - item_id + - content_index + - transcript + - usage + x-oaiMeta: + name: conversation.item.input_audio_transcription.completed + group: realtime + example: | + { + "event_id": "event_2122", + "type": "conversation.item.input_audio_transcription.completed", + "item_id": "msg_003", + "content_index": 0, + "transcript": "Hello, how are you?", + "usage": { + "type": "tokens", + "total_tokens": 48, + "input_tokens": 38, + "input_token_details": { + "text_tokens": 10, + "audio_tokens": 28, + }, + "output_tokens": 10, + } + } + RealtimeBetaServerEventConversationItemInputAudioTranscriptionDelta: type: object - description: The refusal content that is part of a message. + description: | + Returned when the text value of an input audio transcription content part is updated. properties: - index: - type: integer - description: The index of the refusal part in the message. - type: - description: Always `refusal`. - type: string - enum: - - refusal - x-stainless-const: true - refusal: + event_id: type: string - required: - - index - - type - MessageDeltaContentTextAnnotationsFileCitationObject: - title: File citation - type: object - description: A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - properties: - index: - type: integer - description: The index of the annotation in the text content part. + description: The unique ID of the server event. type: - description: Always `file_citation`. - type: string - enum: - - file_citation x-stainless-const: true - text: - description: The text in the message content that needs to be replaced. + description: The event type, must be `conversation.item.input_audio_transcription.delta`. + const: conversation.item.input_audio_transcription.delta + item_id: type: string - file_citation: - type: object - properties: - file_id: - description: The ID of the specific File the citation is from. - type: string - quote: - description: The specific quote in the file. - type: string - start_index: - type: integer - minimum: 0 - end_index: - type: integer - minimum: 0 - required: - - index - - type - MessageDeltaContentTextAnnotationsFilePathObject: - title: File path - type: object - description: A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - properties: - index: + description: The ID of the item. + content_index: type: integer - description: The index of the annotation in the text content part. - type: - description: Always `file_path`. - type: string - enum: - - file_path - x-stainless-const: true - text: - description: The text in the message content that needs to be replaced. + description: The index of the content part in the item's content array. + delta: type: string - file_path: - type: object - properties: - file_id: - description: The ID of the file that was generated. - type: string - start_index: - type: integer - minimum: 0 - end_index: - type: integer - minimum: 0 + description: The text delta. + logprobs: + anyOf: + - type: array + description: The log probabilities of the transcription. + items: + $ref: '#/components/schemas/LogProbProperties' + - type: 'null' required: - - index + - event_id - type - MessageDeltaContentTextObject: - title: Text + - item_id + x-oaiMeta: + name: conversation.item.input_audio_transcription.delta + group: realtime + example: | + { + "type": "conversation.item.input_audio_transcription.delta", + "event_id": "event_001", + "item_id": "item_001", + "content_index": 0, + "delta": "Hello" + } + RealtimeBetaServerEventConversationItemInputAudioTranscriptionFailed: type: object - description: The text content that is part of a message. + description: "Returned when input audio transcription is configured, and a transcription \nrequest for a user message failed. These events are separate from other \n`error` events so that the client can identify the related Item.\n" properties: - index: - type: integer - description: The index of the content part in the message. + event_id: + type: string + description: The unique ID of the server event. type: - description: Always `text`. type: string enum: - - text + - conversation.item.input_audio_transcription.failed + description: | + The event type, must be + `conversation.item.input_audio_transcription.failed`. x-stainless-const: true - text: + item_id: + type: string + description: The ID of the user message item. + content_index: + type: integer + description: The index of the content part containing the audio. + error: type: object + description: Details of the transcription error. properties: - value: - description: The data that makes up the text. + type: type: string - annotations: - type: array - items: - $ref: '#/components/schemas/TextAnnotationDelta' + description: The type of error. + code: + type: string + description: Error code, if any. + message: + type: string + description: A human-readable error message. + param: + type: string + description: Parameter related to the error, if any. required: - - index + - event_id - type - MessageDeltaObject: + - item_id + - content_index + - error + x-oaiMeta: + name: conversation.item.input_audio_transcription.failed + group: realtime + example: | + { + "event_id": "event_2324", + "type": "conversation.item.input_audio_transcription.failed", + "item_id": "msg_003", + "content_index": 0, + "error": { + "type": "transcription_error", + "code": "audio_unintelligible", + "message": "The audio could not be transcribed.", + "param": null + } + } + RealtimeBetaServerEventConversationItemInputAudioTranscriptionSegment: type: object - title: Message delta object - description: | - Represents a message delta i.e. any changed fields on a message during streaming. + description: Returned when an input audio transcription segment is identified for an item. properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `conversation.item.input_audio_transcription.segment`. + const: conversation.item.input_audio_transcription.segment + item_id: + type: string + description: The ID of the item containing the input audio content. + content_index: + type: integer + description: The index of the input audio content part within the item. + text: + type: string + description: The text for this segment. id: - description: The identifier of the message, which can be referenced in API endpoints. type: string - object: - description: The object type, which is always `thread.message.delta`. + description: The segment identifier. + speaker: type: string - enum: - - thread.message.delta - x-stainless-const: true - delta: - description: The delta containing the fields that have changed on the Message. - type: object - properties: - role: - description: The entity that produced the message. One of `user` or `assistant`. - type: string - enum: - - user - - assistant - content: - description: The content of the message in array of text and/or images. - type: array - items: - $ref: '#/components/schemas/MessageContentDelta' + description: The detected speaker label for this segment. + start: + type: number + format: double + description: Start time of the segment in seconds. + end: + type: number + format: double + description: End time of the segment in seconds. required: + - event_id + - type + - item_id + - content_index + - text - id - - object - - delta + - speaker + - start + - end x-oaiMeta: - name: The message delta object - beta: true + name: conversation.item.input_audio_transcription.segment + group: realtime example: | { - "id": "msg_123", - "object": "thread.message.delta", - "delta": { - "content": [ - { - "index": 0, - "type": "text", - "text": { "value": "Hello", "annotations": [] } - } - ] - } + "event_id": "event_6501", + "type": "conversation.item.input_audio_transcription.segment", + "item_id": "msg_011", + "content_index": 0, + "text": "hello", + "id": "seg_0001", + "speaker": "spk_1", + "start": 0.0, + "end": 0.4 } - MessageObject: + RealtimeBetaServerEventConversationItemRetrieved: type: object - title: The message object - description: Represents a message within a [thread](https://developers.openai.com/api/docs/assistants/migration). + description: | + Returned when a conversation item is retrieved with `conversation.item.retrieve`. properties: - id: - description: The identifier, which can be referenced in API endpoints. - type: string - object: - description: The object type, which is always `thread.message`. + event_id: type: string - enum: - - thread.message + description: The unique ID of the server event. + type: x-stainless-const: true - created_at: - description: The Unix timestamp (in seconds) for when the message was created. - type: integer - format: unixtime - thread_id: - description: The [thread](https://developers.openai.com/api/docs/assistants/migration) ID that this message belongs to. - type: string - status: - description: The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. - type: string - enum: - - in_progress - - incomplete - - completed - incomplete_details: - anyOf: - - description: On an incomplete message, details about why the message is incomplete. - type: object - properties: - reason: - type: string - description: The reason the message is incomplete. - enum: - - content_filter - - max_tokens - - run_cancelled - - run_expired - - run_failed - required: - - reason - - type: 'null' - completed_at: - anyOf: - - description: The Unix timestamp (in seconds) for when the message was completed. - type: integer - format: unixtime - - type: 'null' - incomplete_at: - anyOf: - - description: The Unix timestamp (in seconds) for when the message was marked as incomplete. - type: integer - format: unixtime - - type: 'null' - role: - description: The entity that produced the message. One of `user` or `assistant`. - type: string - enum: - - user - - assistant - content: - description: The content of the message in array of text and/or images. - type: array - items: - $ref: '#/components/schemas/MessageContent' - assistant_id: - anyOf: - - description: If applicable, the ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) that authored this message. - type: string - - type: 'null' - run_id: - anyOf: - - description: The ID of the [run](https://developers.openai.com/api/docs/assistants/migration) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. - type: string - - type: 'null' - attachments: - anyOf: - - type: array - items: - type: object - properties: - file_id: - type: string - description: The ID of the file to attach to the message. - tools: - description: The tools to add this file to. - type: array - items: - anyOf: - - $ref: '#/components/schemas/AssistantToolsCode' - - $ref: '#/components/schemas/AssistantToolsFileSearchTypeOnly' - description: A list of files attached to the message, and the tools they were added to. - - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' + description: The event type, must be `conversation.item.retrieved`. + const: conversation.item.retrieved + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - - id - - object - - created_at - - thread_id - - status - - incomplete_details - - completed_at - - incomplete_at - - role - - content - - assistant_id - - run_id - - attachments - - metadata + - event_id + - type + - item x-oaiMeta: - name: The message object - beta: true + name: conversation.item.retrieved + group: realtime example: | { - "id": "msg_abc123", - "object": "thread.message", - "created_at": 1698983503, - "thread_id": "thread_abc123", - "role": "assistant", - "content": [ - { - "type": "text", - "text": { - "value": "Hi! How can I help you today?", - "annotations": [] - } + "event_id": "event_1920", + "type": "conversation.item.created", + "previous_item_id": "msg_002", + "item": { + "id": "msg_003", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "user", + "content": [ + { + "type": "input_audio", + "transcript": "hello how are you", + "audio": "base64encodedaudio==" + } + ] } - ], - "assistant_id": "asst_abc123", - "run_id": "run_abc123", - "attachments": [], - "metadata": {} } - MessagePhase: - type: string - description: | - Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`). - For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend - phase on all assistant messages — dropping it can degrade performance. Not used for user messages. - enum: - - commentary - - final_answer - MessageRequestContentTextObject: - title: Text + RealtimeBetaServerEventConversationItemTruncated: type: object - description: The text content that is part of a message. + description: "Returned when an earlier assistant audio message item is truncated by the \nclient with a `conversation.item.truncate` event. This event is used to \nsynchronize the server's understanding of the audio with the client's playback.\n\nThis action will truncate the audio and remove the server-side text transcript \nto ensure there is no text in the context that hasn't been heard by the user.\n" properties: - type: - description: Always `text`. + event_id: type: string - enum: - - text + description: The unique ID of the server event. + type: x-stainless-const: true - text: + description: The event type, must be `conversation.item.truncated`. + const: conversation.item.truncated + item_id: type: string - description: Text content to be sent to the model + description: The ID of the assistant message item that was truncated. + content_index: + type: integer + description: The index of the content part that was truncated. + audio_end_ms: + type: integer + description: | + The duration up to which the audio was truncated, in milliseconds. required: + - event_id - type - - text - MessageStreamEvent: - anyOf: - - type: object - properties: - event: - type: string - enum: - - thread.message.created - x-stainless-const: true - data: - $ref: '#/components/schemas/MessageObject' - required: - - event - - data - description: Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) is created. - x-oaiMeta: - dataDescription: '`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.message.in_progress - x-stainless-const: true - data: - $ref: '#/components/schemas/MessageObject' - required: - - event - - data - description: Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) moves to an `in_progress` state. - x-oaiMeta: - dataDescription: '`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.message.delta - x-stainless-const: true - data: - $ref: '#/components/schemas/MessageDeltaObject' - required: - - event - - data - description: Occurs when parts of a [Message](https://developers.openai.com/api/docs/assistants/migration) are being streamed. - x-oaiMeta: - dataDescription: '`data` is a [message delta](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.message.completed - x-stainless-const: true - data: - $ref: '#/components/schemas/MessageObject' - required: - - event - - data - description: Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) is completed. - x-oaiMeta: - dataDescription: '`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.message.incomplete - x-stainless-const: true - data: - $ref: '#/components/schemas/MessageObject' - required: - - event - - data - description: Occurs when a [message](https://developers.openai.com/api/docs/assistants/migration) ends before it is completed. - x-oaiMeta: - dataDescription: '`data` is a [message](https://developers.openai.com/api/docs/assistants/migration)' - discriminator: - propertyName: event - Metadata: - anyOf: - - type: object - description: | - Set of 16 key-value pairs that can be attached to an object. This can be - useful for storing additional information about the object in a structured - format, and querying for objects via API or the dashboard. - - Keys are strings with a maximum length of 64 characters. Values are strings - with a maximum length of 512 characters. - additionalProperties: + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncated + group: realtime + example: | + { + "event_id": "event_2526", + "type": "conversation.item.truncated", + "item_id": "msg_004", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeBetaServerEventError: + type: object + description: | + Returned when an error occurs, which could be a client problem or a server + problem. Most errors are recoverable and the session will stay open, we + recommend to implementors to monitor and log error messages by default. + properties: + event_id: type: string - x-oaiTypeLabel: map - - type: 'null' - Model: - title: Model - description: Describes an OpenAI model offering that can be used with the API. + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `error`. + const: error + error: + type: object + description: Details of the error. + required: + - type + - message + properties: + type: + type: string + description: | + The type of error (e.g., "invalid_request_error", "server_error"). + code: + anyOf: + - type: string + description: Error code, if any. + - type: 'null' + message: + type: string + description: A human-readable error message. + param: + anyOf: + - type: string + description: Parameter related to the error, if any. + - type: 'null' + event_id: + anyOf: + - type: string + description: | + The event_id of the client event that caused the error, if applicable. + - type: 'null' + required: + - event_id + - type + - error + x-oaiMeta: + name: error + group: realtime + example: | + { + "event_id": "event_890", + "type": "error", + "error": { + "type": "invalid_request_error", + "code": "invalid_event", + "message": "The 'type' field is missing.", + "param": null, + "event_id": "event_567" + } + } + RealtimeBetaServerEventInputAudioBufferCleared: + type: object + description: "Returned when the input audio buffer is cleared by the client with a \n`input_audio_buffer.clear` event.\n" properties: - id: - type: string - description: The model identifier, which can be referenced in the API endpoints. - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) when the model was created. - object: + event_id: type: string - description: The object type, which is always "model". - enum: - - model + description: The unique ID of the server event. + type: x-stainless-const: true - owned_by: - type: string - description: The organization that owns the model. - shutdown_date: - anyOf: - - type: string - format: date - - type: 'null' - description: The date when the model will shut down, or null if not announced. + description: The event type, must be `input_audio_buffer.cleared`. + const: input_audio_buffer.cleared required: - - id - - object - - created - - owned_by + - event_id + - type x-oaiMeta: - name: The model object + name: input_audio_buffer.cleared + group: realtime example: | { - "id": "gpt-6-astra", - "object": "model", - "created": 1686935002, - "owned_by": "openai", - "shutdown_date": "2026-10-23" + "event_id": "event_1314", + "type": "input_audio_buffer.cleared" } - ModelIds: - anyOf: - - $ref: '#/components/schemas/ModelIdsShared' - - $ref: '#/components/schemas/ModelIdsResponses' - ModelIdsCompaction: - anyOf: - - $ref: '#/components/schemas/ModelIdsResponses' - - type: string - - type: 'null' - description: Model ID used to generate the response, like `gpt-6-astra`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) to browse and compare available models. - ModelIdsLive: - description: The Live model. Required in the session configuration for every transport; do not pass it as a URL query parameter. - example: gpt-live-1 - anyOf: - - type: string - minLength: 1 - - type: string - enum: - - gpt-live-1 - ModelIdsResponses: - example: gpt-6-astra - anyOf: - - $ref: '#/components/schemas/ModelIdsShared' - - type: string - title: ResponsesOnlyModel - enum: - - o1-pro - - o1-pro-2025-03-19 - - o3-pro - - o3-pro-2025-06-10 - - o3-deep-research - - o3-deep-research-2025-06-26 - - o4-mini-deep-research - - o4-mini-deep-research-2025-06-26 - - computer-use-preview - - computer-use-preview-2025-03-11 - - gpt-5.5-pro - - gpt-5.5-pro-2026-04-23 - - gpt-5-codex - - gpt-5-pro - - gpt-5-pro-2025-10-06 - - gpt-5.1-codex-max - - gpt-daybreak-blue-latest - - gpt-daybreak-red-latest - - gpt-5.6-cyber - ModelIdsShared: - example: gpt-6-astra - anyOf: - - type: string - - $ref: '#/components/schemas/ChatModel' - ModelResponseProperties: + RealtimeBetaServerEventInputAudioBufferCommitted: type: object + description: | + Returned when an input audio buffer is committed, either by the client or + automatically in server VAD mode. The `item_id` property is the ID of the user + message item that will be created, thus a `conversation.item.created` event + will also be sent to the client. properties: - metadata: - $ref: '#/components/schemas/Metadata' - top_logprobs: - anyOf: - - description: | - An integer between 0 and 20 specifying the maximum number of most likely - tokens to return at each token position, each with an associated log - probability. In some cases, the number of returned tokens may be fewer than - requested. - type: integer - minimum: 0 - maximum: 20 - - type: 'null' - temperature: - anyOf: - - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 - description: | - What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - We generally recommend altering this or `top_p` but not both. - - type: 'null' - top_p: - anyOf: - - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 - description: | - An alternative to sampling with temperature, called nucleus sampling, - where the model considers the results of the tokens with top_p probability - mass. So 0.1 means only the tokens comprising the top 10% probability mass - are considered. - - We generally recommend altering this or `temperature` but not both. - - type: 'null' - user: + event_id: type: string - example: user-1234 - deprecated: true - description: | - This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations. - A stable identifier for your end-users. - Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). - safety_identifier: - anyOf: - - type: string - maxLength: 64 - example: safety-identifier-1234 - description: | - A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. - The IDs should be a string that uniquely identifies each user, with a maximum length of 64 characters. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). - - type: 'null' - prompt_cache_key: - anyOf: - - type: string - example: prompt-cache-key-1234 - description: | - Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](https://developers.openai.com/api/docs/guides/prompt-caching). - - type: 'null' - prompt_cache_retention: - deprecated: true - anyOf: - - type: string - enum: - - in_memory - - 24h - description: | - Deprecated. Use `prompt_cache_options.ttl` instead. - - The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://developers.openai.com/api/docs/guides/prompt-caching#prompt-cache-retention). - This field expresses a maximum retention policy, while - `prompt_cache_options.ttl` expresses a minimum cache lifetime. The two - fields are independent and do not interact. - For `gpt-5.5`, `gpt-5.5-pro`, and future models, only `24h` is supported. - - For older models that support both `in_memory` and `24h`, the default depends on your organization's data retention policy: - - Organizations without ZDR enabled default to `24h`. - - Organizations with ZDR enabled default to `in_memory` when `prompt_cache_retention` is not specified. - - type: 'null' - ModifyAssistantRequest: - type: object - additionalProperties: false - properties: - model: - description: | - ID of the model to use. You can use the [List models](https://developers.openai.com/api/reference/resources/models/methods/list) API to see all of your available models, or see our [Model overview](https://developers.openai.com/api/docs/models) for descriptions of them. + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `input_audio_buffer.committed`. + const: input_audio_buffer.committed + previous_item_id: anyOf: - type: string - - $ref: '#/components/schemas/AssistantSupportedModels' - reasoning_effort: - $ref: '#/components/schemas/ReasoningEffort' - name: - anyOf: - - description: | - The name of the assistant. The maximum length is 256 characters. - type: string - maxLength: 256 - - type: 'null' - description: - anyOf: - - description: | - The description of the assistant. The maximum length is 512 characters. - type: string - maxLength: 512 - - type: 'null' - instructions: - anyOf: - - description: | - The system instructions that the assistant uses. The maximum length is 256,000 characters. - type: string - maxLength: 256000 - - type: 'null' - tools: - description: | - A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `file_search`, or `function`. - default: [] - type: array - maxItems: 128 - items: - $ref: '#/components/schemas/AssistantTool' - tool_resources: - anyOf: - - type: object - description: | - A set of resources that are used by the assistant's tools. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - properties: - code_interpreter: - type: object - properties: - file_ids: - type: array - description: | - Overrides the list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. - default: [] - maxItems: 20 - items: - type: string - file_search: - type: object - properties: - vector_store_ids: - type: array - description: | - Overrides the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. - maxItems: 1 - items: - type: string - - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - temperature: - anyOf: - - description: | - What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - type: number - minimum: 0 - maximum: 2 - default: 1 - example: 1 - - type: 'null' - top_p: - anyOf: - - type: number - minimum: 0 - maximum: 1 - default: 1 - example: 1 description: | - An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - - We generally recommend altering this or temperature but not both. - - type: 'null' - response_format: - anyOf: - - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + The ID of the preceding item after which the new item will be inserted. + Can be `null` if the item has no predecessor. - type: 'null' - ModifyCertificateRequest: - type: object - properties: - name: + item_id: type: string - description: The updated name for the certificate - ModifyMessageRequest: - type: object - additionalProperties: false - properties: - metadata: - $ref: '#/components/schemas/Metadata' - ModifyRunRequest: - type: object - additionalProperties: false - properties: - metadata: - $ref: '#/components/schemas/Metadata' - ModifyThreadRequest: + description: The ID of the user message item that will be created. + required: + - event_id + - type + - item_id + x-oaiMeta: + name: input_audio_buffer.committed + group: realtime + example: | + { + "event_id": "event_1121", + "type": "input_audio_buffer.committed", + "previous_item_id": "msg_001", + "item_id": "msg_002" + } + RealtimeBetaServerEventInputAudioBufferSpeechStarted: type: object - additionalProperties: false - properties: - tool_resources: - anyOf: - - type: object - description: | - A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - properties: - code_interpreter: - type: object - properties: - file_ids: - type: array - description: | - A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. - default: [] - maxItems: 20 - items: - type: string - file_search: - type: object - properties: - vector_store_ids: - type: array - description: | - The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread. - maxItems: 1 - items: - type: string - - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - NoiseReductionType: - type: string - enum: - - near_field - - far_field - description: | - Type of noise reduction. `near_field` is for close-talking microphones such as headphones, `far_field` is for far-field microphones such as laptop or conference room microphones. - OpenAIFile: - title: OpenAIFile - description: The `File` object represents a document that has been uploaded to OpenAI. + description: "Sent by the server when in `server_vad` mode to indicate that speech has been \ndetected in the audio buffer. This can happen any time audio is added to the \nbuffer (unless speech is already detected). The client may want to use this \nevent to interrupt audio playback or provide visual feedback to the user. \n\nThe client should expect to receive a `input_audio_buffer.speech_stopped` event \nwhen speech stops. The `item_id` property is the ID of the user message item \nthat will be created when speech stops and will also be included in the \n`input_audio_buffer.speech_stopped` event (unless the client manually commits \nthe audio buffer during VAD activation).\n" properties: - id: + event_id: type: string - description: The file identifier, which can be referenced in the API endpoints. - bytes: - type: integer - description: The size of the file, in bytes. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the file was created. - expires_at: + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `input_audio_buffer.speech_started`. + const: input_audio_buffer.speech_started + audio_start_ms: type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the file will expire. - filename: + description: "Milliseconds from the start of all audio written to the buffer during the \nsession when speech was first detected. This will correspond to the \nbeginning of audio sent to the model, and thus includes the \n`prefix_padding_ms` configured in the Session.\n" + item_id: type: string - description: The name of the file. - object: + description: | + The ID of the user message item that will be created when speech stops. + required: + - event_id + - type + - audio_start_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.speech_started + group: realtime + example: | + { + "event_id": "event_1516", + "type": "input_audio_buffer.speech_started", + "audio_start_ms": 1000, + "item_id": "msg_003" + } + RealtimeBetaServerEventInputAudioBufferSpeechStopped: + type: object + description: "Returned in `server_vad` mode when the server detects the end of speech in \nthe audio buffer. The server will also send an `conversation.item.created` \nevent with the user message item that is created from the audio buffer.\n" + properties: + event_id: type: string - description: The object type, which is always `file`. - enum: - - file + description: The unique ID of the server event. + type: x-stainless-const: true - purpose: + description: The event type, must be `input_audio_buffer.speech_stopped`. + const: input_audio_buffer.speech_stopped + audio_end_ms: + type: integer + description: "Milliseconds since the session started when speech stopped. This will \ncorrespond to the end of audio sent to the model, and thus includes the \n`min_silence_duration_ms` configured in the Session.\n" + item_id: type: string - description: The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`. - enum: - - assistants - - assistants_output - - batch - - batch_output - - fine-tune - - fine-tune-results - - vision - - user_data - status: + description: The ID of the user message item that will be created. + required: + - event_id + - type + - audio_end_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.speech_stopped + group: realtime + example: | + { + "event_id": "event_1718", + "type": "input_audio_buffer.speech_stopped", + "audio_end_ms": 2000, + "item_id": "msg_003" + } + RealtimeBetaServerEventMCPListToolsCompleted: + type: object + description: Returned when listing MCP tools has completed for an item. + properties: + event_id: type: string - deprecated: true - description: Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. - enum: - - uploaded - - processed - - error - status_details: + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `mcp_list_tools.completed`. + const: mcp_list_tools.completed + item_id: type: string - deprecated: true - description: Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. + description: The ID of the MCP list tools item. required: - - id - - object - - bytes - - created_at - - filename - - purpose - - status + - event_id + - type + - item_id + x-oaiMeta: + name: mcp_list_tools.completed + group: realtime + example: | + { + "event_id": "event_6102", + "type": "mcp_list_tools.completed", + "item_id": "mcp_list_tools_001" + } + RealtimeBetaServerEventMCPListToolsFailed: + type: object + description: Returned when listing MCP tools has failed for an item. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `mcp_list_tools.failed`. + const: mcp_list_tools.failed + item_id: + type: string + description: The ID of the MCP list tools item. + required: + - event_id + - type + - item_id x-oaiMeta: - name: The file object + name: mcp_list_tools.failed + group: realtime example: | { - "id": "file-abc123", - "object": "file", - "bytes": 120000, - "created_at": 1677610602, - "expires_at": 1680202602, - "filename": "salesOverview.pdf", - "purpose": "assistants", + "event_id": "event_6103", + "type": "mcp_list_tools.failed", + "item_id": "mcp_list_tools_001" } - OrganizationCertificate: + RealtimeBetaServerEventMCPListToolsInProgress: type: object - description: Represents an individual certificate configured at the organization level. + description: Returned when listing MCP tools is in progress for an item. properties: - object: + event_id: type: string - enum: - - organization.certificate - description: The object type, which is always `organization.certificate`. + description: The unique ID of the server event. + type: x-stainless-const: true - id: + description: The event type, must be `mcp_list_tools.in_progress`. + const: mcp_list_tools.in_progress + item_id: type: string - description: The identifier, which can be referenced in API endpoints - name: - anyOf: - - type: string - - type: 'null' - description: The name of the certificate. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the certificate was uploaded. - certificate_details: - type: object - properties: - valid_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the certificate becomes valid. - expires_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the certificate expires. - active: - type: boolean - description: Whether the certificate is currently active at the organization level. + description: The ID of the MCP list tools item. required: - - object - - id - - name - - created_at - - certificate_details - - active - OrganizationCertificateActivationResponse: + - event_id + - type + - item_id + x-oaiMeta: + name: mcp_list_tools.in_progress + group: realtime + example: | + { + "event_id": "event_6101", + "type": "mcp_list_tools.in_progress", + "item_id": "mcp_list_tools_001" + } + RealtimeBetaServerEventRateLimitsUpdated: type: object + description: "Emitted at the beginning of a Response to indicate the updated rate limits. \nWhen a Response is created some tokens will be \"reserved\" for the output \ntokens, the rate limits shown here reflect that reservation, which is then \nadjusted accordingly once the Response is completed.\n" properties: - object: + event_id: type: string - enum: - - organization.certificate.activation - description: The organization certificate activation result type. + description: The unique ID of the server event. + type: x-stainless-const: true - data: + description: The event type, must be `rate_limits.updated`. + const: rate_limits.updated + rate_limits: type: array + description: List of rate limit information. items: - $ref: '#/components/schemas/OrganizationCertificate' + type: object + properties: + name: + type: string + enum: + - requests + - tokens + description: | + The name of the rate limit (`requests`, `tokens`). + limit: + type: integer + description: The maximum allowed value for the rate limit. + remaining: + type: integer + description: The remaining value before the limit is reached. + reset_seconds: + type: number + description: Seconds until the rate limit resets. required: - - object - - data - OrganizationCertificateDeactivationResponse: + - event_id + - type + - rate_limits + x-oaiMeta: + name: rate_limits.updated + group: realtime + example: | + { + "event_id": "event_5758", + "type": "rate_limits.updated", + "rate_limits": [ + { + "name": "requests", + "limit": 1000, + "remaining": 999, + "reset_seconds": 60 + }, + { + "name": "tokens", + "limit": 50000, + "remaining": 49950, + "reset_seconds": 60 + } + ] + } + RealtimeBetaServerEventResponseAudioDelta: type: object + description: Returned when the model-generated audio is updated. properties: - object: + event_id: type: string - enum: - - organization.certificate.deactivation - description: The organization certificate deactivation result type. + description: The unique ID of the server event. + type: x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/OrganizationCertificate' + description: The event type, must be `response.output_audio.delta`. + const: response.output_audio.delta + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: Base64-encoded audio data delta. required: - - object - - data - OrganizationDataRetention: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - delta + x-oaiMeta: + name: response.output_audio.delta + group: realtime + example: | + { + "event_id": "event_4950", + "type": "response.output_audio.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Base64EncodedAudioDelta" + } + RealtimeBetaServerEventResponseAudioDone: type: object - description: Represents the organization's data retention control setting. + description: | + Returned when the model-generated audio is done. Also emitted when a Response + is interrupted, incomplete, or cancelled. properties: - object: + event_id: type: string - enum: - - organization.data_retention - description: The object type, which is always `organization.data_retention`. - x-stainless-const: true + description: The unique ID of the server event. type: + x-stainless-const: true + description: The event type, must be `response.output_audio.done`. + const: response.output_audio.done + response_id: type: string - enum: - - zero_data_retention - - modified_abuse_monitoring - - enhanced_zero_data_retention - - enhanced_modified_abuse_monitoring - description: The configured organization data retention type. + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. required: - - object + - event_id - type + - response_id + - item_id + - output_index + - content_index x-oaiMeta: - name: The organization data retention object + name: response.output_audio.done + group: realtime example: | { - "object": "organization.data_retention", - "type": "modified_abuse_monitoring" + "event_id": "event_5152", + "type": "response.output_audio.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0 } - OrganizationProjectCertificate: + RealtimeBetaServerEventResponseAudioTranscriptDelta: type: object - description: Represents an individual certificate configured at the project level. + description: | + Returned when the model-generated transcription of audio output is updated. properties: - object: + event_id: type: string - enum: - - organization.project.certificate - description: The object type, which is always `organization.project.certificate`. + description: The unique ID of the server event. + type: x-stainless-const: true - id: + description: The event type, must be `response.output_audio_transcript.delta`. + const: response.output_audio_transcript.delta + response_id: type: string - description: The identifier, which can be referenced in API endpoints - name: - anyOf: - - type: string - - type: 'null' - description: The name of the certificate. - created_at: + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the certificate was uploaded. - certificate_details: - type: object - properties: - valid_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the certificate becomes valid. - expires_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the certificate expires. - active: - type: boolean - description: Whether the certificate is currently active at the project level. + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: The transcript delta. required: - - object - - id - - name - - created_at - - certificate_details - - active - OrganizationProjectCertificateActivationResponse: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - delta + x-oaiMeta: + name: response.output_audio_transcript.delta + group: realtime + example: | + { + "event_id": "event_4546", + "type": "response.output_audio_transcript.delta", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "delta": "Hello, how can I a" + } + RealtimeBetaServerEventResponseAudioTranscriptDone: type: object + description: | + Returned when the model-generated transcription of audio output is done + streaming. Also emitted when a Response is interrupted, incomplete, or + cancelled. properties: - object: + event_id: type: string - enum: - - organization.project.certificate.activation - description: The project certificate activation result type. + description: The unique ID of the server event. + type: x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/OrganizationProjectCertificate' + description: The event type, must be `response.output_audio_transcript.done`. + const: response.output_audio_transcript.done + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + transcript: + type: string + description: The final transcript of the audio. required: - - object - - data - OrganizationProjectCertificateDeactivationResponse: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - transcript + x-oaiMeta: + name: response.output_audio_transcript.done + group: realtime + example: | + { + "event_id": "event_4748", + "type": "response.output_audio_transcript.done", + "response_id": "resp_001", + "item_id": "msg_008", + "output_index": 0, + "content_index": 0, + "transcript": "Hello, how can I assist you today?" + } + RealtimeBetaServerEventResponseContentPartAdded: type: object + description: | + Returned when a new content part is added to an assistant message item during + response generation. properties: - object: + event_id: type: string - enum: - - organization.project.certificate.deactivation - description: The project certificate deactivation result type. + description: The unique ID of the server event. + type: x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/OrganizationProjectCertificate' + description: The event type, must be `response.content_part.added`. + const: response.content_part.added + response_id: + type: string + description: The ID of the response. + item_id: + type: string + description: The ID of the item to which the content part was added. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + part: + type: object + description: The content part that was added. + properties: + type: + type: string + enum: + - text + - audio + description: The content type ("text", "audio"). + text: + type: string + description: The text content (if type is "text"). + audio: + type: string + description: Base64-encoded audio data (if type is "audio"). + transcript: + type: string + description: The transcript of the audio (if type is "audio"). required: - - object - - data - OrganizationSpendAlert: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - part + x-oaiMeta: + name: response.content_part.added + group: realtime + example: | + { + "event_id": "event_3738", + "type": "response.content_part.added", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "" + } + } + RealtimeBetaServerEventResponseContentPartDone: type: object - description: Represents a spend alert configured at the organization level. + description: | + Returned when a content part is done streaming in an assistant message item. + Also emitted when a Response is interrupted, incomplete, or cancelled. properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints. - object: + event_id: type: string - enum: - - organization.spend_alert - description: The object type, which is always `organization.spend_alert`. + description: The unique ID of the server event. + type: x-stainless-const: true - threshold_amount: - type: integer - description: The alert threshold amount, in cents. - currency: + description: The event type, must be `response.content_part.done`. + const: response.content_part.done + response_id: type: string - enum: - - USD - description: The currency for the threshold amount. - interval: + description: The ID of the response. + item_id: type: string - enum: - - month - description: The time interval for evaluating spend against the threshold. - notification_channel: - $ref: '#/components/schemas/SpendAlertNotificationChannel' - required: - - id - - object - - threshold_amount - - currency - - interval - - notification_channel + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + part: + type: object + description: The content part that is done. + properties: + type: + type: string + enum: + - text + - audio + description: The content type ("text", "audio"). + text: + type: string + description: The text content (if type is "text"). + audio: + type: string + description: Base64-encoded audio data (if type is "audio"). + transcript: + type: string + description: The transcript of the audio (if type is "audio"). + required: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - part x-oaiMeta: - name: The organization spend alert object + name: response.content_part.done + group: realtime example: | { - "id": "alert_abc123", - "object": "organization.spend_alert", - "threshold_amount": 100000, - "currency": "USD", - "interval": "month", - "notification_channel": { - "type": "email", - "recipients": ["finance@example.com"], - "subject_prefix": "OpenAI spend alert" + "event_id": "event_3940", + "type": "response.content_part.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "part": { + "type": "text", + "text": "Sure, I can help with that." } } - OrganizationSpendAlertDeletedResource: + RealtimeBetaServerEventResponseCreated: type: object - description: Confirmation payload returned after deleting an organization spend alert. + description: | + Returned when a new Response is created. The first event of response creation, + where the response is in an initial state of `in_progress`. properties: - id: - type: string - description: The deleted spend alert ID. - object: + event_id: type: string - enum: - - organization.spend_alert.deleted - description: Always `organization.spend_alert.deleted`. + description: The unique ID of the server event. + type: x-stainless-const: true - deleted: - type: boolean - description: Whether the spend alert was deleted. + description: The event type, must be `response.created`. + const: response.created + response: + $ref: '#/components/schemas/RealtimeBetaResponse' required: - - id - - object - - deleted - OrganizationSpendAlertListResource: + - event_id + - type + - response + x-oaiMeta: + name: response.created + group: realtime + example: | + { + "type": "response.created", + "event_id": "event_C9G8pqbTEddBSIxbBN6Os", + "response": { + "object": "realtime.response", + "id": "resp_C9G8p7IH2WxLbkgPNouYL", + "status": "in_progress", + "status_details": null, + "output": [], + "conversation_id": "conv_C9G8mmBkLhQJwCon3hoJN", + "output_modalities": [ + "audio" + ], + "max_output_tokens": "inf", + "audio": { + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin" + } + }, + "usage": null, + "metadata": null + }, + "timestamp": "2:30:35 PM" + } + RealtimeBetaServerEventResponseDone: type: object - description: Paginated list of organization spend alerts. + description: "Returned when a Response is done streaming. Always emitted, no matter the \nfinal state. The Response object included in the `response.done` event will \ninclude all output Items in the Response but will omit the raw audio data.\n" properties: - object: + event_id: type: string - enum: - - list - description: Always `list`. - x-stainless-const: true - data: - type: array - description: Spend alerts returned in the current page. - items: - $ref: '#/components/schemas/OrganizationSpendAlert' - first_id: - anyOf: - - type: string - - type: 'null' - description: The ID of the first spend alert in this page. - last_id: - anyOf: - - type: string - - type: 'null' - description: The ID of the last spend alert in this page. - has_more: - type: boolean - description: Whether more spend alerts are available when paginating. - required: - - object - - data - - first_id - - last_id - - has_more - OtherChunkingStrategyResponseParam: - type: object - title: Other Chunking Strategy - description: This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the `chunking_strategy` concept was introduced in the API. - additionalProperties: false - properties: + description: The unique ID of the server event. type: - type: string - description: Always `other`. - enum: - - other x-stainless-const: true + description: The event type, must be `response.done`. + const: response.done + response: + $ref: '#/components/schemas/RealtimeBetaResponse' required: + - event_id - type - OutputAudio: + - response + x-oaiMeta: + name: response.done + group: realtime + example: | + { + "event_id": "event_3132", + "type": "response.done", + "response": { + "id": "resp_001", + "object": "realtime.response", + "status": "completed", + "status_details": null, + "output": [ + { + "id": "msg_006", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Sure, how can I assist you today?" + } + ] + } + ], + "usage": { + "total_tokens":275, + "input_tokens":127, + "output_tokens":148, + "input_token_details": { + "cached_tokens":384, + "text_tokens":119, + "audio_tokens":8, + "cached_tokens_details": { + "text_tokens": 128, + "audio_tokens": 256 + } + }, + "output_token_details": { + "text_tokens":36, + "audio_tokens":112 + } + } + } + } + RealtimeBetaServerEventResponseFunctionCallArgumentsDelta: type: object - title: Output audio description: | - An audio output from the model. + Returned when the model-generated function call arguments are updated. properties: - type: + event_id: type: string - description: | - The type of the output audio. Always `output_audio`. - enum: - - output_audio + description: The unique ID of the server event. + type: x-stainless-const: true - data: - type: string description: | - Base64-encoded audio data from the model. - transcript: + The event type, must be `response.function_call_arguments.delta`. + const: response.function_call_arguments.delta + response_id: type: string - description: | - The transcript of the audio data from the model. + description: The ID of the response. + item_id: + type: string + description: The ID of the function call item. + output_index: + type: integer + description: The index of the output item in the response. + call_id: + type: string + description: The ID of the function call. + delta: + type: string + description: The arguments delta as a JSON string. required: + - event_id - type - - data - - transcript - OutputContent: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/OutputTextContent' - - $ref: '#/components/schemas/RefusalContent' - - $ref: '#/components/schemas/ReasoningTextContent' - OutputItem: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/OutputMessage' - - $ref: '#/components/schemas/FileSearchToolCall' - - $ref: '#/components/schemas/FunctionToolCall' - - $ref: '#/components/schemas/FunctionToolCallOutputResource' - - $ref: '#/components/schemas/WebSearchToolCall' - - $ref: '#/components/schemas/ComputerToolCall' - - $ref: '#/components/schemas/ComputerToolCallOutputResource' - - $ref: '#/components/schemas/ReasoningItem' - - $ref: '#/components/schemas/Program' - - $ref: '#/components/schemas/ProgramOutput' - - $ref: '#/components/schemas/ToolSearchCall' - - $ref: '#/components/schemas/ToolSearchOutput' - - $ref: '#/components/schemas/AdditionalTools' - - $ref: '#/components/schemas/CompactionBody' - - $ref: '#/components/schemas/ImageGenToolCall' - - $ref: '#/components/schemas/CodeInterpreterToolCall' - - $ref: '#/components/schemas/LocalShellToolCall' - - $ref: '#/components/schemas/LocalShellToolCallOutput' - - $ref: '#/components/schemas/FunctionShellCall' - - $ref: '#/components/schemas/FunctionShellCallOutput' - - $ref: '#/components/schemas/ApplyPatchToolCall' - - $ref: '#/components/schemas/ApplyPatchToolCallOutput' - - $ref: '#/components/schemas/MCPToolCall' - - $ref: '#/components/schemas/MCPListTools' - - $ref: '#/components/schemas/MCPApprovalRequest' - - $ref: '#/components/schemas/MCPApprovalResponseResource' - - $ref: '#/components/schemas/CustomToolCall' - - $ref: '#/components/schemas/CustomToolCallOutputResource' - OutputMessage: + - response_id + - item_id + - output_index + - call_id + - delta + x-oaiMeta: + name: response.function_call_arguments.delta + group: realtime + example: | + { + "event_id": "event_5354", + "type": "response.function_call_arguments.delta", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "delta": "{\"location\": \"San\"" + } + RealtimeBetaServerEventResponseFunctionCallArgumentsDone: type: object - title: Output message description: | - An output message from the model. + Returned when the model-generated function call arguments are done streaming. + Also emitted when a Response is interrupted, incomplete, or cancelled. properties: - id: + event_id: type: string - description: | - The unique ID of the output message. - x-stainless-go-json: omitzero + description: The unique ID of the server event. type: - type: string - description: | - The type of the output message. Always `message`. - enum: - - message x-stainless-const: true - role: - type: string - description: | - The role of the output message. Always `assistant`. - enum: - - assistant - x-stainless-const: true - content: - type: array description: | - The content of the output message. - items: - $ref: '#/components/schemas/OutputMessageContent' - phase: - anyOf: - - $ref: '#/components/schemas/MessagePhase' - - type: 'null' - status: + The event type, must be `response.function_call_arguments.done`. + const: response.function_call_arguments.done + response_id: type: string - description: | - The status of the message input. One of `in_progress`, `completed`, or - `incomplete`. Populated when input items are returned via API. - enum: - - in_progress - - completed - - incomplete + description: The ID of the response. + item_id: + type: string + description: The ID of the function call item. + output_index: + type: integer + description: The index of the output item in the response. + call_id: + type: string + description: The ID of the function call. + name: + type: string + description: The name of the function that was called. + arguments: + type: string + description: The final arguments as a JSON string. required: - - id + - event_id - type - - role - - content - - status - OutputMessageContent: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/OutputTextContent' - - $ref: '#/components/schemas/RefusalContent' - ParallelToolCalls: - description: Whether to enable [parallel function calling](https://developers.openai.com/api/docs/guides/function-calling#parallel-function-calling) during tool use. - type: boolean - default: true - PartialImages: - anyOf: - - type: integer - maximum: 3 - minimum: 0 - default: 0 - example: 1 - description: | - The number of partial images to generate. This parameter is used for - streaming responses that return partial images. Value must be between 0 and 3. - When set to 0, the response will be a single image sent in one streaming event. - - Note that the final image may be sent before the full number of partial images - are generated if the full image is generated more quickly. - - type: 'null' - PredictionContent: + - response_id + - item_id + - output_index + - call_id + - name + - arguments + x-oaiMeta: + name: response.function_call_arguments.done + group: realtime + example: | + { + "event_id": "event_5556", + "type": "response.function_call_arguments.done", + "response_id": "resp_002", + "item_id": "fc_001", + "output_index": 0, + "call_id": "call_001", + "name": "get_weather", + "arguments": "{\"location\": \"San Francisco\"}" + } + RealtimeBetaServerEventResponseMCPCallArgumentsDelta: type: object - title: Static Content - description: | - Static predicted output content, such as the content of a text file that is - being regenerated. - required: - - type - - content + description: Returned when MCP tool call arguments are updated during response generation. properties: - type: + event_id: type: string - enum: - - content - description: | - The type of the predicted content you want to provide. This type is - currently always `content`. + description: The unique ID of the server event. + type: x-stainless-const: true - content: - description: | - The content that should be matched when generating a model response. - If generated tokens would match this content, the entire model response - can be returned much more quickly. - anyOf: - - type: string - title: Text content - description: | - The content used for a Predicted Output. This is often the - text of a file you are regenerating with minor changes. - - type: array - description: An array of content parts with a defined type. Supported options differ based on the [model](https://developers.openai.com/api/docs/models) being used to generate the response. Can contain text inputs. - title: Array of content parts - items: - $ref: '#/components/schemas/ChatCompletionRequestMessageContentPartText' - minItems: 1 - Project: - type: object - description: Represents an individual project. - properties: - id: + description: The event type, must be `response.mcp_call_arguments.delta`. + const: response.mcp_call_arguments.delta + response_id: type: string - description: The identifier, which can be referenced in API endpoints - object: + description: The ID of the response. + item_id: type: string - enum: - - organization.project - description: The object type, which is always `organization.project` - x-stainless-const: true - name: - anyOf: - - type: string - - type: 'null' - description: The name of the project. This appears in reporting. - created_at: + description: The ID of the MCP tool call item. + output_index: type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the project was created. - archived_at: - anyOf: - - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the project was archived or `null`. - - type: 'null' - status: - anyOf: - - type: string - - type: 'null' - description: '`active` or `archived`' - external_key_id: + description: The index of the output item in the response. + delta: + type: string + description: The JSON-encoded arguments delta. + obfuscation: anyOf: - type: string + description: If present, indicates the delta text was obfuscated. - type: 'null' - description: The external key associated with the project. - residency: - $ref: '#/components/schemas/PublicProjectResidency' - description: The residency configuration for the project. required: - - id - - object - - created_at + - event_id + - type + - response_id + - item_id + - output_index + - delta x-oaiMeta: - name: The project object + name: response.mcp_call_arguments.delta + group: realtime example: | { - "id": "proj_abc", - "object": "organization.project", - "name": "Project example", - "created_at": 1711471533, - "archived_at": null, - "status": "active", - "external_key_id": null + "event_id": "event_6201", + "type": "response.mcp_call_arguments.delta", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "delta": "{\"partial\":true}" } - ProjectApiKey: + RealtimeBetaServerEventResponseMCPCallArgumentsDone: type: object - description: Represents an individual API key in a project. + description: Returned when MCP tool call arguments are finalized during response generation. properties: - object: + event_id: type: string - enum: - - organization.project.api_key - description: The object type, which is always `organization.project.api_key` + description: The unique ID of the server event. + type: x-stainless-const: true - redacted_value: + description: The event type, must be `response.mcp_call_arguments.done`. + const: response.mcp_call_arguments.done + response_id: type: string - description: The redacted value of the API key - name: + description: The ID of the response. + item_id: type: string - description: The name of the API key - created_at: + description: The ID of the MCP tool call item. + output_index: type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the API key was created - expires_at: - anyOf: - - type: integer - format: unixtime - - type: 'null' - description: The Unix timestamp (in seconds) when the API key expires, or null if it does not expire. - last_used_at: - anyOf: - - type: integer - format: unixtime - - type: 'null' - description: The Unix timestamp (in seconds) of when the API key was last used. - id: - type: string - description: The identifier, which can be referenced in API endpoints - owner_project_access: + description: The index of the output item in the response. + arguments: type: string - enum: - - active - - inactive - description: Whether the API key's owner currently has effective access to the project. - owner: - type: object - properties: - type: - type: string - enum: - - user - - service_account - description: '`user` or `service_account`' - user: - $ref: '#/components/schemas/ProjectApiKeyOwnerUser' - service_account: - $ref: '#/components/schemas/ProjectApiKeyOwnerServiceAccount' + description: The final JSON-encoded arguments string. required: - - object - - redacted_value - - name - - created_at - - last_used_at - - id - - owner_project_access - - owner + - event_id + - type + - response_id + - item_id + - output_index + - arguments x-oaiMeta: - name: The project API key object + name: response.mcp_call_arguments.done + group: realtime example: | { - "object": "organization.project.api_key", - "redacted_value": "sk-abc...def", - "name": "My API Key", - "created_at": 1711471533, - "expires_at": 1714063533, - "last_used_at": 1711471534, - "id": "key_abc", - "owner_project_access": "active", - "owner": { - "type": "user", - "user": { - "id": "user_abc", - "name": "First Last", - "email": "user@example.com", - "role": "owner", - "created_at": 1711471533 - } - } + "event_id": "event_6202", + "type": "response.mcp_call_arguments.done", + "response_id": "resp_001", + "item_id": "mcp_call_001", + "output_index": 0, + "arguments": "{\"q\":\"docs\"}" } - ProjectApiKeyDeleteResponse: + RealtimeBetaServerEventResponseMCPCallCompleted: type: object + description: Returned when an MCP tool call has completed successfully. properties: - object: + event_id: type: string - enum: - - organization.project.api_key.deleted + description: The unique ID of the server event. + type: x-stainless-const: true - id: + description: The event type, must be `response.mcp_call.completed`. + const: response.mcp_call.completed + output_index: + type: integer + description: The index of the output item in the response. + item_id: type: string - deleted: - type: boolean + description: The ID of the MCP tool call item. required: - - object - - id - - deleted - ProjectApiKeyListResponse: + - event_id + - type + - output_index + - item_id + x-oaiMeta: + name: response.mcp_call.completed + group: realtime + example: | + { + "event_id": "event_6302", + "type": "response.mcp_call.completed", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeBetaServerEventResponseMCPCallFailed: type: object + description: Returned when an MCP tool call has failed. properties: - object: + event_id: type: string - enum: - - list + description: The unique ID of the server event. + type: x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/ProjectApiKey' - first_id: - anyOf: - - type: string - - type: 'null' - last_id: - anyOf: - - type: string - - type: 'null' - has_more: - type: boolean + description: The event type, must be `response.mcp_call.failed`. + const: response.mcp_call.failed + output_index: + type: integer + description: The index of the output item in the response. + item_id: + type: string + description: The ID of the MCP tool call item. required: - - object - - data - - has_more - ProjectApiKeyOwnerServiceAccount: + - event_id + - type + - output_index + - item_id + x-oaiMeta: + name: response.mcp_call.failed + group: realtime + example: | + { + "event_id": "event_6303", + "type": "response.mcp_call.failed", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeBetaServerEventResponseMCPCallInProgress: type: object - description: The service account that owns a project API key. + description: Returned when an MCP tool call has started and is in progress. properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints - name: + event_id: type: string - description: The name of the service account. - created_at: + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `response.mcp_call.in_progress`. + const: response.mcp_call.in_progress + output_index: type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the service account was created. - role: + description: The index of the output item in the response. + item_id: type: string - description: The service account's project role. + description: The ID of the MCP tool call item. required: - - id - - name - - created_at - - role - ProjectApiKeyOwnerUser: + - event_id + - type + - output_index + - item_id + x-oaiMeta: + name: response.mcp_call.in_progress + group: realtime + example: | + { + "event_id": "event_6301", + "type": "response.mcp_call.in_progress", + "output_index": 0, + "item_id": "mcp_call_001" + } + RealtimeBetaServerEventResponseOutputItemAdded: type: object - description: The user that owns a project API key. + description: Returned when a new Item is created during Response generation. properties: - id: - type: string - description: The identifier, which can be referenced in API endpoints - email: + event_id: type: string - description: The email address of the user. - name: + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `response.output_item.added`. + const: response.output_item.added + response_id: type: string - description: The name of the user. - created_at: + description: The ID of the Response to which the item belongs. + output_index: type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the user was created. - role: - type: string - description: The user's project role. + description: The index of the output item in the Response. + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - - id - - email - - name - - created_at - - role - ProjectCreateRequest: + - event_id + - type + - response_id + - output_index + - item + x-oaiMeta: + name: response.output_item.added + group: realtime + example: | + { + "event_id": "event_3334", + "type": "response.output_item.added", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "in_progress", + "role": "assistant", + "content": [] + } + } + RealtimeBetaServerEventResponseOutputItemDone: type: object + description: "Returned when an Item is done streaming. Also emitted when a Response is \ninterrupted, incomplete, or cancelled.\n" properties: - name: + event_id: type: string - description: The friendly name of the project, this name appears in reports. - geography: - anyOf: - - type: string - - type: 'null' - deprecated: true - description: |- - Create the project with the specified data residency region. Your organization must have access to Data residency functionality in order to use. See [data residency controls](https://developers.openai.com/api/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field. - Deprecated: use `residency` instead. Do not provide both `geography` and `residency`. - residency: - anyOf: - - $ref: '#/components/schemas/PublicProjectResidency' - - type: 'null' - description: Create the project with the specified residency configuration. Your organization must have access to the requested residency configuration in order to use it. See [data residency controls](https://developers.openai.com/api/docs/guides/your-data#data-residency-controls) to review the functionality and limitations of setting this field. - external_key_id: - anyOf: - - type: string - - type: 'null' - description: External key ID to associate with the project. + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `response.output_item.done`. + const: response.output_item.done + response_id: + type: string + description: The ID of the Response to which the item belongs. + output_index: + type: integer + description: The index of the output item in the Response. + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - - name - ProjectDataRetention: + - event_id + - type + - response_id + - output_index + - item + x-oaiMeta: + name: response.output_item.done + group: realtime + example: | + { + "event_id": "event_3536", + "type": "response.output_item.done", + "response_id": "resp_001", + "output_index": 0, + "item": { + "id": "msg_007", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "text", + "text": "Sure, I can help with that." + } + ] + } + } + RealtimeBetaServerEventResponseTextDelta: type: object - description: Represents a project's data retention control setting. + description: Returned when the text value of an "output_text" content part is updated. properties: - object: + event_id: type: string - enum: - - project.data_retention - description: The object type, which is always `project.data_retention`. - x-stainless-const: true + description: The unique ID of the server event. type: + x-stainless-const: true + description: The event type, must be `response.output_text.delta`. + const: response.output_text.delta + response_id: type: string - enum: - - organization_default - - none - - zero_data_retention - - modified_abuse_monitoring - - enhanced_zero_data_retention - - enhanced_modified_abuse_monitoring - description: The configured project data retention type. + description: The ID of the response. + item_id: + type: string + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + delta: + type: string + description: The text delta. required: - - object + - event_id - type + - response_id + - item_id + - output_index + - content_index + - delta x-oaiMeta: - name: The project data retention object + name: response.output_text.delta + group: realtime example: | { - "object": "project.data_retention", - "type": "organization_default" + "event_id": "event_4142", + "type": "response.output_text.delta", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "delta": "Sure, I can h" } - ProjectGroup: + RealtimeBetaServerEventResponseTextDone: type: object - description: Details about a group's membership in a project. + description: | + Returned when the text value of an "output_text" content part is done streaming. Also + emitted when a Response is interrupted, incomplete, or cancelled. properties: - object: + event_id: type: string - enum: - - project.group - description: Always `project.group`. + description: The unique ID of the server event. + type: x-stainless-const: true - project_id: + description: The event type, must be `response.output_text.done`. + const: response.output_text.done + response_id: type: string - description: Identifier of the project. - group_id: + description: The ID of the response. + item_id: type: string - description: Identifier of the group that has access to the project. - group_name: + description: The ID of the item. + output_index: + type: integer + description: The index of the output item in the response. + content_index: + type: integer + description: The index of the content part in the item's content array. + text: type: string - description: Display name of the group. - group_type: + description: The final text content. + required: + - event_id + - type + - response_id + - item_id + - output_index + - content_index + - text + x-oaiMeta: + name: response.output_text.done + group: realtime + example: | + { + "event_id": "event_4344", + "type": "response.output_text.done", + "response_id": "resp_001", + "item_id": "msg_007", + "output_index": 0, + "content_index": 0, + "text": "Sure, I can help with that." + } + RealtimeBetaServerEventSessionCreated: + type: object + description: | + Returned when a Session is created. Emitted automatically when a new + connection is established as the first server event. This event will contain + the default Session configuration. + properties: + event_id: type: string - enum: - - group - - tenant_group - description: The type of the group. - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) when the group was granted project access. + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `session.created`. + const: session.created + session: + $ref: '#/components/schemas/RealtimeSession' required: - - object - - project_id - - group_id - - group_name - - group_type - - created_at + - event_id + - type + - session x-oaiMeta: - name: The project group object + name: session.created + group: realtime example: | { - "object": "project.group", - "project_id": "proj_abc123", - "group_id": "group_01J1F8ABCDXYZ", - "group_name": "Support Team", - "group_type": "group", - "created_at": 1711471533 + "type": "session.created", + "event_id": "event_C9G5RJeJ2gF77mV7f2B1j", + "session": { + "object": "realtime.session", + "id": "sess_C9G5QPteg4UIbotdKLoYQ", + "model": "gpt-realtime-2025-08-28", + "modalities": [ + "audio" + ], + "instructions": "Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.", + "tools": [], + "tool_choice": "auto", + "max_response_output_tokens": "inf", + "tracing": null, + "prompt": null, + "expires_at": 1756324625, + "input_audio_format": "pcm16", + "input_audio_transcription": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + }, + "output_audio_format": "pcm16", + "voice": "marin", + "include": null + } } - ProjectGroupDeletedResource: + RealtimeBetaServerEventSessionUpdated: type: object - description: Confirmation payload returned after removing a group from a project. + description: | + Returned when a session is updated with a `session.update` event, unless + there is an error. properties: - object: + event_id: type: string - enum: - - project.group.deleted - description: Always `project.group.deleted`. + description: The unique ID of the server event. + type: x-stainless-const: true - deleted: - type: boolean - description: Whether the group membership in the project was removed. + description: The event type, must be `session.updated`. + const: session.updated + session: + $ref: '#/components/schemas/RealtimeSession' required: - - object - - deleted + - event_id + - type + - session x-oaiMeta: - name: Project group deletion confirmation + name: session.updated + group: realtime example: | { - "object": "project.group.deleted", - "deleted": true + "event_id": "event_5678", + "type": "session.updated", + "session": { + "id": "sess_001", + "object": "realtime.session", + "model": "gpt-realtime", + "modalities": ["text"], + "instructions": "New instructions", + "voice": "sage", + "input_audio_format": "pcm16", + "output_audio_format": "pcm16", + "input_audio_transcription": { + "model": "whisper-1" + }, + "turn_detection": null, + "tools": [], + "tool_choice": "none", + "temperature": 0.7, + "max_response_output_tokens": 200, + "speed": 1.1, + "tracing": "auto" + } } - ProjectGroupListResource: + RealtimeBetaServerEventTranscriptionSessionCreated: type: object - description: Paginated list of groups that have access to a project. + description: | + Returned when a transcription session is created. properties: - object: + event_id: type: string - enum: - - list - description: Always `list`. + description: The unique ID of the server event. + type: x-stainless-const: true - data: - type: array - description: Project group memberships returned in the current page. - items: - $ref: '#/components/schemas/ProjectGroup' - has_more: - type: boolean - description: Whether additional project group memberships are available. - next: - description: Cursor to fetch the next page of results, or `null` when there are no more results. - anyOf: - - type: string - - type: 'null' + description: The event type, must be `transcription_session.created`. + const: transcription_session.created + session: + $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponse' required: - - object - - data - - has_more - - next + - event_id + - type + - session x-oaiMeta: - name: Project group list + name: transcription_session.created + group: realtime example: | { - "object": "list", - "data": [ - { - "object": "project.group", - "project_id": "proj_abc123", - "group_id": "group_01J1F8ABCDXYZ", - "group_name": "Support Team", - "created_at": 1711471533 - } - ], - "has_more": false, - "next": null + "event_id": "event_5566", + "type": "transcription_session.created", + "session": { + "id": "sess_001", + "object": "realtime.transcription_session", + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500 + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [] + } } - ProjectHostedToolPermissions: + RealtimeBetaServerEventTranscriptionSessionUpdated: type: object - description: Represents hosted tool permissions for a project. + description: "Returned when a transcription session is updated with a `transcription_session.update` event, unless \nthere is an error.\n" properties: - file_search: - $ref: '#/components/schemas/HostedToolPermission' - web_search: - $ref: '#/components/schemas/HostedToolPermission' - image_generation: - $ref: '#/components/schemas/HostedToolPermission' - mcp: - $ref: '#/components/schemas/HostedToolPermission' - code_interpreter: - $ref: '#/components/schemas/HostedToolPermission' + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `transcription_session.updated`. + const: transcription_session.updated + session: + $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponse' required: - - file_search - - web_search - - image_generation - - mcp - - code_interpreter + - event_id + - type + - session x-oaiMeta: - name: The project hosted tool permissions object + name: transcription_session.updated + group: realtime example: | { - "file_search": { - "enabled": true - }, - "web_search": { - "enabled": true + "event_id": "event_5678", + "type": "transcription_session.updated", + "session": { + "id": "sess_001", + "object": "realtime.transcription_session", + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" }, - "image_generation": { - "enabled": true + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + // "interrupt_response": false -- this will NOT be returned }, - "mcp": { - "enabled": true + "input_audio_noise_reduction": { + "type": "near_field" }, - "code_interpreter": { - "enabled": true - } + "include": [ + "item.input_audio_transcription.avg_logprob", + ], + } } - ProjectHostedToolPermissionsUpdateRequest: + RealtimeCallCreateRequest: + title: Realtime call creation request type: object + description: |- + Parameters required to initiate a realtime call and receive the SDP answer + needed to complete a WebRTC peer connection. Provide an SDP offer generated + by your client and optionally configure the session that will answer the call. + required: + - sdp properties: - file_search: - anyOf: - - $ref: '#/components/schemas/HostedToolPermissionUpdate' - - type: 'null' - description: The file search permission update. - web_search: - anyOf: - - $ref: '#/components/schemas/HostedToolPermissionUpdate' - - type: 'null' - description: The web search permission update. - image_generation: - anyOf: - - $ref: '#/components/schemas/HostedToolPermissionUpdate' - - type: 'null' - description: The image generation permission update. - mcp: - anyOf: - - $ref: '#/components/schemas/HostedToolPermissionUpdate' - - type: 'null' - description: The MCP permission update. - code_interpreter: - anyOf: - - $ref: '#/components/schemas/HostedToolPermissionUpdate' - - type: 'null' - description: The code interpreter permission update. - ProjectListResponse: + sdp: + type: string + description: WebRTC Session Description Protocol (SDP) offer generated by the caller. + session: + title: Session configuration + allOf: + - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' + description: |- + Optional session configuration to apply before the realtime session is + created. Use the same parameters you would send in a [`create client secret`](https://developers.openai.com/api/reference/resources/realtime/subresources/client_secrets/methods/create) + request. + additionalProperties: false + RealtimeCallReferRequest: + title: Realtime call refer request type: object + description: |- + Parameters required to transfer a SIP call to a new destination using the + Realtime API. + required: + - target_uri properties: - object: + target_uri: type: string - enum: - - list - x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/Project' - first_id: - anyOf: - - type: string - - type: 'null' - last_id: - anyOf: - - type: string - - type: 'null' - has_more: - type: boolean - required: - - object - - data - - has_more - ProjectModelPermissions: + description: |- + URI that should appear in the SIP Refer-To header. Supports values like + `tel:+14155550123` or `sip:agent@example.com`. + example: tel:+14155550123 + additionalProperties: false + RealtimeCallRejectRequest: + title: Realtime call reject request type: object - description: Represents the model allowlist or denylist policy for a project. + description: Parameters used to decline an incoming SIP call handled by the Realtime API. properties: - object: + status_code: + type: integer + description: |- + SIP response code to send back to the caller. Defaults to `603` (Decline) + when omitted. + example: 486 + additionalProperties: false + RealtimeClientEvent: + discriminator: + propertyName: type + description: | + A realtime client event. + anyOf: + - $ref: '#/components/schemas/RealtimeClientEventConversationItemCreate' + - $ref: '#/components/schemas/RealtimeClientEventConversationItemDelete' + - $ref: '#/components/schemas/RealtimeClientEventConversationItemRetrieve' + - $ref: '#/components/schemas/RealtimeClientEventConversationItemTruncate' + - $ref: '#/components/schemas/RealtimeClientEventInputAudioBufferAppend' + - $ref: '#/components/schemas/RealtimeClientEventInputAudioBufferClear' + - $ref: '#/components/schemas/RealtimeClientEventOutputAudioBufferClear' + - $ref: '#/components/schemas/RealtimeClientEventInputAudioBufferCommit' + - $ref: '#/components/schemas/RealtimeClientEventResponseCancel' + - $ref: '#/components/schemas/RealtimeClientEventResponseCreate' + - $ref: '#/components/schemas/RealtimeClientEventSessionUpdate' + RealtimeClientEventConversationItemCreate: + type: object + description: "Add a new Item to the Conversation's context, including messages, function \ncalls, and function call responses. This event can be used both to populate a \n\"history\" of the conversation and to add new items mid-stream, but has the \ncurrent limitation that it cannot populate assistant audio messages.\n\nIf successful, the server will respond with a `conversation.item.created` \nevent, otherwise an `error` event will be sent.\n" + properties: + event_id: type: string - enum: - - project.model_permissions - description: The object type, which is always `project.model_permissions`. + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: x-stainless-const: true - mode: + description: The event type, must be `conversation.item.create`. + const: conversation.item.create + previous_item_id: type: string - enum: - - allow_list - - deny_list - description: Whether the project uses an allowlist or a denylist. - model_ids: - type: array - items: - type: string - description: The model IDs included in the model permissions policy. + description: | + The ID of the preceding item after which the new item will be inserted. If not set, the new item will be appended to the end of the conversation. + + If set to `root`, the new item will be added to the beginning of the conversation. + + If set to an existing ID, it allows an item to be inserted mid-conversation. If the ID cannot be found, an error will be returned and the item will not be added. + item: + $ref: '#/components/schemas/RealtimeConversationItem' required: - - object - - mode - - model_ids + - type + - item x-oaiMeta: - name: The project model permissions object + name: conversation.item.create + group: realtime example: | { - "object": "project.model_permissions", - "mode": "allow_list", - "model_ids": [ - "gpt-6-astra", - "o3" + "type": "conversation.item.create", + "item": { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "hi" + } ] + } } - ProjectModelPermissionsDeleteResponse: + RealtimeClientEventConversationItemDelete: type: object - description: Confirmation payload returned after deleting project model permissions. + description: "Send this event when you want to remove any item from the conversation \nhistory. The server will respond with a `conversation.item.deleted` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n" properties: - object: + event_id: type: string - enum: - - project.model_permissions.deleted - description: The object type, which is always `project.model_permissions.deleted`. + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: x-stainless-const: true - deleted: - type: boolean - description: Whether the project model permissions were deleted. + description: The event type, must be `conversation.item.delete`. + const: conversation.item.delete + item_id: + type: string + description: The ID of the item to delete. required: - - object - - deleted + - type + - item_id x-oaiMeta: - name: Project model permissions deletion confirmation + name: conversation.item.delete + group: realtime example: | { - "object": "project.model_permissions.deleted", - "deleted": true + "event_id": "event_901", + "type": "conversation.item.delete", + "item_id": "item_003" } - ProjectModelPermissionsUpdateRequest: + RealtimeClientEventConversationItemRetrieve: type: object + description: "Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD.\nThe server will respond with a `conversation.item.retrieved` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n" properties: - mode: + event_id: type: string - enum: - - allow_list - - deny_list - description: The model permissions mode to apply. - model_ids: - type: array - items: - type: string - description: The model IDs included in this permissions policy. + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: + x-stainless-const: true + description: The event type, must be `conversation.item.retrieve`. + const: conversation.item.retrieve + item_id: + type: string + description: The ID of the item to retrieve. required: - - mode - - model_ids - ProjectRateLimit: + - type + - item_id + x-oaiMeta: + name: conversation.item.retrieve + group: realtime + example: | + { + "event_id": "event_901", + "type": "conversation.item.retrieve", + "item_id": "item_003" + } + RealtimeClientEventConversationItemTruncate: type: object - description: Represents a project rate limit config. + description: "Send this event to truncate a previous assistant message’s audio. The server \nwill produce audio faster than realtime, so this event is useful when the user \ninterrupts to truncate audio that has already been sent to the client but not \nyet played. This will synchronize the server's understanding of the audio with \nthe client's playback.\n\nTruncating audio will delete the server-side text transcript to ensure there \nis not text in the context that hasn't been heard by the user.\n\nIf successful, the server will respond with a `conversation.item.truncated` \nevent. \n" properties: - object: + event_id: type: string - enum: - - project.rate_limit - description: The object type, which is always `project.rate_limit` + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: x-stainless-const: true - id: - type: string - description: The identifier, which can be referenced in API endpoints. - model: + description: The event type, must be `conversation.item.truncate`. + const: conversation.item.truncate + item_id: type: string - description: The model this rate limit applies to. - max_requests_per_1_minute: - type: integer - description: The maximum requests per minute. - max_tokens_per_1_minute: - type: integer - description: The maximum tokens per minute. - max_images_per_1_minute: - type: integer - description: The maximum images per minute. Only present for relevant models. - max_audio_megabytes_per_1_minute: - type: integer - description: The maximum audio megabytes per minute. Only present for relevant models. - max_requests_per_1_day: + description: "The ID of the assistant message item to truncate. Only assistant message \nitems can be truncated.\n" + content_index: type: integer - description: The maximum requests per day. Only present for relevant models. - batch_1_day_max_input_tokens: + description: The index of the content part to truncate. Set this to `0`. + audio_end_ms: type: integer - description: The maximum batch input tokens per day. Only present for relevant models. + description: "Inclusive duration up to which audio is truncated, in milliseconds. If \nthe audio_end_ms is greater than the actual audio duration, the server \nwill respond with an error.\n" + required: + - type + - item_id + - content_index + - audio_end_ms + x-oaiMeta: + name: conversation.item.truncate + group: realtime + example: | + { + "event_id": "event_678", + "type": "conversation.item.truncate", + "item_id": "item_002", + "content_index": 0, + "audio_end_ms": 1500 + } + RealtimeClientEventInputAudioBufferAppend: + type: object + description: "Send this event to append audio bytes to the input audio buffer. The audio \nbuffer is temporary storage you can write to and later commit. A \"commit\" will create a new\nuser message item in the conversation history from the buffer content and clear the buffer.\nInput audio transcription (if enabled) will be generated when the buffer is committed.\n\nIf VAD is enabled the audio buffer is used to detect speech and the server will decide \nwhen to commit. When Server VAD is disabled, you must commit the audio buffer\nmanually. Input audio noise reduction operates on writes to the audio buffer.\n\nThe client may choose how much audio to place in each event up to a maximum \nof 15 MiB, for example streaming smaller chunks from the client may allow the \nVAD to be more responsive. Unlike most other client events, the server will \nnot send a confirmation response to this event.\n" + properties: + event_id: + type: string + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: + x-stainless-const: true + description: The event type, must be `input_audio_buffer.append`. + const: input_audio_buffer.append + audio: + type: string + description: "Base64-encoded audio bytes. This must be in the format specified by the \n`input_audio_format` field in the session configuration.\n" required: - - object - - id - - model - - max_requests_per_1_minute - - max_tokens_per_1_minute + - type + - audio x-oaiMeta: - name: The project rate limit object + name: input_audio_buffer.append + group: realtime example: | { - "object": "project.rate_limit", - "id": "rl_ada", - "model": "ada", - "max_requests_per_1_minute": 600, - "max_tokens_per_1_minute": 150000, - "max_images_per_1_minute": 10 + "event_id": "event_456", + "type": "input_audio_buffer.append", + "audio": "Base64EncodedAudioData" } - ProjectRateLimitListResponse: + RealtimeClientEventInputAudioBufferClear: type: object + description: "Send this event to clear the audio bytes in the buffer. The server will \nrespond with an `input_audio_buffer.cleared` event.\n" properties: - object: + event_id: type: string - enum: - - list + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/ProjectRateLimit' - first_id: - anyOf: - - type: string - - type: 'null' - last_id: - anyOf: - - type: string - - type: 'null' - has_more: - type: boolean + description: The event type, must be `input_audio_buffer.clear`. + const: input_audio_buffer.clear required: - - object - - data - - has_more - ProjectRateLimitUpdateRequest: - type: object - properties: - max_requests_per_1_minute: - type: integer - description: The maximum requests per minute. - max_tokens_per_1_minute: - type: integer - description: The maximum tokens per minute. - max_images_per_1_minute: - type: integer - description: The maximum images per minute. Only relevant for certain models. - max_audio_megabytes_per_1_minute: - type: integer - description: The maximum audio megabytes per minute. Only relevant for certain models. - max_requests_per_1_day: - type: integer - description: The maximum requests per day. Only relevant for certain models. - batch_1_day_max_input_tokens: - type: integer - description: The maximum batch input tokens per day. Only relevant for certain models. - ProjectServiceAccount: + - type + x-oaiMeta: + name: input_audio_buffer.clear + group: realtime + example: | + { + "event_id": "event_012", + "type": "input_audio_buffer.clear" + } + RealtimeClientEventInputAudioBufferCommit: type: object - description: Represents an individual service account in a project. + description: | + Send this event to commit the user input audio buffer, which will create a new user message item in the conversation. This event will produce an error if the input audio buffer is empty. When in Server VAD mode, the client does not need to send this event, the server will commit the audio buffer automatically. + + Committing the input audio buffer will trigger input audio transcription (if enabled in session configuration), but it will not create a response from the model. The server will respond with an `input_audio_buffer.committed` event. properties: - object: + event_id: type: string - enum: - - organization.project.service_account - description: The object type, which is always `organization.project.service_account` + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: x-stainless-const: true - id: - type: string - description: The identifier, which can be referenced in API endpoints - name: - type: string - description: The name of the service account - role: - type: string - enum: - - owner - - member - - none - description: '`owner`, `member`, or `none`' - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the service account was created + description: The event type, must be `input_audio_buffer.commit`. + const: input_audio_buffer.commit required: - - object - - id - - name - - role - - created_at + - type x-oaiMeta: - name: The project service account object + name: input_audio_buffer.commit + group: realtime example: | { - "object": "organization.project.service_account", - "id": "svc_acct_abc", - "name": "Service Account", - "role": "owner", - "created_at": 1711471533 + "event_id": "event_789", + "type": "input_audio_buffer.commit" } - ProjectServiceAccountApiKey: + RealtimeClientEventOutputAudioBufferClear: type: object + description: | + **WebRTC/SIP Only:** Emit to cut off the current audio response. This will trigger the server to + stop generating audio and emit a `output_audio_buffer.cleared` event. This + event should be preceded by a `response.cancel` client event to stop the + generation of the current response. + [Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). properties: - object: + event_id: type: string - enum: - - organization.project.service_account.api_key - description: The object type, which is always `organization.project.service_account.api_key` + description: The unique ID of the client event used for error handling. + type: x-stainless-const: true - value: - type: string - name: - type: string - created_at: - type: integer - format: unixtime - expires_at: - anyOf: - - type: integer - format: unixtime - - type: 'null' - description: The Unix timestamp (in seconds) when the API key expires, or null if it does not expire. - id: - type: string + description: The event type, must be `output_audio_buffer.clear`. + const: output_audio_buffer.clear required: - - object - - value - - name - - created_at - - id - ProjectServiceAccountCreateRequest: + - type + x-oaiMeta: + name: output_audio_buffer.clear + group: realtime + example: | + { + "event_id": "optional_client_event_id", + "type": "output_audio_buffer.clear" + } + RealtimeClientEventResponseCancel: type: object + description: "Send this event to cancel an in-progress response. The server will respond \nwith a `response.done` event with a status of `response.status=cancelled`. If \nthere is no response to cancel, the server will respond with an error. It's safe\nto call `response.cancel` even if no response is in progress, an error will be\nreturned the session will remain unaffected.\n" properties: - name: + event_id: type: string - description: The name of the service account being created. - create_service_account_only: - anyOf: - - type: boolean - description: Create the service account without default roles or an API key. - - type: 'null' - expires_in_seconds: - anyOf: - - type: integer - minimum: 1 - maximum: 31536000 - - type: 'null' - description: Number of seconds until the initial API key expires. If omitted or null, the key does not expire unless the effective organization or project policy requires an expiration. When a policy sets a maximum lifetime, this value must be provided and must not exceed that limit. A non-null value cannot be used when `create_service_account_only` is true. + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: + x-stainless-const: true + description: The event type, must be `response.cancel`. + const: response.cancel + response_id: + type: string + description: "A specific response ID to cancel - if not provided, will cancel an \nin-progress response in the default conversation.\n" required: - - name - ProjectServiceAccountCreateResponse: + - type + x-oaiMeta: + name: response.cancel + group: realtime + example: | + { + "type": "response.cancel", + "response_id": "resp_12345" + } + RealtimeClientEventResponseCreate: type: object + description: "This event instructs the server to create a Response, which means triggering \nmodel inference. When in Server VAD mode, the server will create Responses \nautomatically.\n\nA Response will include at least one Item, and may have two, in which case \nthe second will be a function call. These Items will be appended to the \nconversation history by default.\n\nThe server will respond with a `response.created` event, events for Items \nand content created, and finally a `response.done` event to indicate the \nResponse is complete.\n\nThe `response.create` event includes inference configuration like \n`instructions` and `tools`. If these are set, they will override the Session's \nconfiguration for this Response only.\n\nResponses can be created out-of-band of the default Conversation, meaning that they can\nhave arbitrary input, and it's possible to disable writing the output to the Conversation.\nOnly one Response can write to the default Conversation at a time, but otherwise multiple\nResponses can be created in parallel. The `metadata` field is a good way to disambiguate\nmultiple simultaneous Responses.\n\nClients can set `conversation` to `none` to create a Response that does not write to the default\nConversation. Arbitrary input can be provided with the `input` field, which is an array accepting\nraw Items and references to existing Items.\n" properties: - object: + event_id: type: string - enum: - - organization.project.service_account + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: x-stainless-const: true - id: - type: string - name: - type: string - role: - type: string - enum: - - member - - none - description: | - Service accounts created with default project membership have role `member`. Accounts created with `create_service_account_only` have role `none`. - created_at: - type: integer - format: unixtime - api_key: - anyOf: - - $ref: '#/components/schemas/ProjectServiceAccountApiKey' - - type: 'null' + description: The event type, must be `response.create`. + const: response.create + response: + $ref: '#/components/schemas/RealtimeResponseCreateParams' required: - - object - - id - - name - - role - - created_at - - api_key - ProjectServiceAccountDeleteResponse: + - type + x-oaiMeta: + name: response.create + group: realtime + example: | + // Trigger a response with the default Conversation and no special parameters + { + "type": "response.create", + } + + // Trigger an out-of-band response that does not write to the default Conversation + { + "type": "response.create", + "response": { + "instructions": "Provide a concise answer.", + "tools": [], // clear any session tools + "conversation": "none", + "output_modalities": ["text"], + "metadata": { + "response_purpose": "summarization" + }, + "input": [ + { + "type": "item_reference", + "id": "item_12345" + }, + { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Summarize the above message in one sentence." + } + ] + } + ] + } + } + RealtimeClientEventSessionUpdate: type: object + description: | + Send this event to update the session’s configuration. + The client may send this event at any time to update any field + except for `voice` and `model`. `voice` can be updated only if there have been no other audio outputs yet. + + When the server receives a `session.update`, it will respond + with a `session.updated` event showing the full, effective configuration. + Only the fields that are present in the `session.update` are updated. To clear a field like + `instructions`, pass an empty string. To clear a field like `tools`, pass an empty array. + To clear a field like `turn_detection`, pass `null`. properties: - object: + event_id: type: string - enum: - - organization.project.service_account.deleted + maxLength: 512 + description: Optional client-generated ID used to identify this event. This is an arbitrary string that a client may assign. It will be passed back if there is an error with the event, but the corresponding `session.updated` event will not include it. + type: x-stainless-const: true - id: - type: string - deleted: - type: boolean + description: The event type, must be `session.update`. + const: session.update + session: + type: object + description: | + Update the Realtime session. Choose either a realtime + session or a transcription session. + anyOf: + - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' + - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' required: - - object - - id - - deleted - ProjectServiceAccountListResponse: + - type + - session + x-oaiMeta: + name: session.update + group: realtime + example: | + { + "type": "session.update", + "session": { + "type": "realtime", + "instructions": "You are a creative assistant that helps with design tasks.", + "tools": [ + { + "type": "function", + "name": "display_color_palette", + "description": "Call this function when a user asks for a color palette.", + "parameters": { + "type": "object", + "properties": { + "theme": { + "type": "string", + "description": "Description of the theme for the color scheme." + }, + "colors": { + "type": "array", + "description": "Array of five hex color codes based on the theme.", + "items": { + "type": "string", + "description": "Hex color code" + } + } + }, + "required": [ + "theme", + "colors" + ] + } + } + ], + "tool_choice": "auto" + } + } + RealtimeClientEventTranscriptionSessionUpdate: type: object + description: | + Send this event to update a transcription session. properties: - object: + event_id: type: string - enum: - - list + description: Optional client-generated ID used to identify this event. + type: x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/ProjectServiceAccount' - first_id: - anyOf: - - type: string - - type: 'null' - last_id: - anyOf: - - type: string - - type: 'null' - has_more: - type: boolean + description: The event type, must be `transcription_session.update`. + const: transcription_session.update + session: + $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequest' required: - - object - - data - - has_more - ProjectSpendAlert: + - type + - session + x-oaiMeta: + name: transcription_session.update + group: realtime + example: | + { + "type": "transcription_session.update", + "session": { + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.logprobs", + ] + } + } + RealtimeConversationItem: + description: A single item within a Realtime conversation. + anyOf: + - $ref: '#/components/schemas/RealtimeConversationItemMessageSystem' + - $ref: '#/components/schemas/RealtimeConversationItemMessageUser' + - $ref: '#/components/schemas/RealtimeConversationItemMessageAssistant' + - $ref: '#/components/schemas/RealtimeConversationItemFunctionCall' + - $ref: '#/components/schemas/RealtimeConversationItemFunctionCallOutput' + - $ref: '#/components/schemas/RealtimeMCPApprovalResponse' + - $ref: '#/components/schemas/RealtimeMCPListTools' + - $ref: '#/components/schemas/RealtimeMCPToolCall' + - $ref: '#/components/schemas/RealtimeMCPApprovalRequest' + discriminator: + propertyName: type + RealtimeConversationItemFunctionCall: type: object - description: Represents a spend alert configured at the project level. + title: Realtime function call item + description: A function call item in a Realtime conversation. properties: id: type: string - description: The identifier, which can be referenced in API endpoints. + description: The unique ID of the item. This may be provided by the client or generated by the server. object: type: string enum: - - project.spend_alert - description: The object type, which is always `project.spend_alert`. + - realtime.item + description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. x-stainless-const: true - threshold_amount: - type: integer - description: The alert threshold amount, in cents. - currency: + type: type: string enum: - - USD - description: The currency for the threshold amount. - interval: + - function_call + description: The type of the item. Always `function_call`. + x-stainless-const: true + status: type: string enum: - - month - description: The time interval for evaluating spend against the threshold. - notification_channel: - $ref: '#/components/schemas/SpendAlertNotificationChannel' + - completed + - incomplete + - in_progress + description: The status of the item. Has no effect on the conversation. + call_id: + type: string + description: The ID of the function call. + name: + type: string + description: The name of the function being called. + arguments: + type: string + description: 'The arguments of the function call. This is a JSON-encoded string representing the arguments passed to the function, for example `{"arg1": "value1", "arg2": 42}`.' required: - - id - - object - - threshold_amount - - currency - - interval - - notification_channel - x-oaiMeta: - name: The project spend alert object - example: | - { - "id": "alert_abc123", - "object": "project.spend_alert", - "threshold_amount": 100000, - "currency": "USD", - "interval": "month", - "notification_channel": { - "type": "email", - "recipients": ["finance@example.com"], - "subject_prefix": "OpenAI spend alert" - } - } - ProjectSpendAlertDeletedResource: + - type + - name + - arguments + RealtimeConversationItemFunctionCallOutput: type: object - description: Confirmation payload returned after deleting a project spend alert. + title: Realtime function call output item + description: A function call output item in a Realtime conversation. properties: id: type: string - description: The deleted spend alert ID. + description: The unique ID of the item. This may be provided by the client or generated by the server. object: type: string enum: - - project.spend_alert.deleted - description: Always `project.spend_alert.deleted`. + - realtime.item + description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. x-stainless-const: true - deleted: - type: boolean - description: Whether the spend alert was deleted. + type: + type: string + enum: + - function_call_output + description: The type of the item. Always `function_call_output`. + x-stainless-const: true + status: + type: string + enum: + - completed + - incomplete + - in_progress + description: The status of the item. Has no effect on the conversation. + call_id: + type: string + description: The ID of the function call this output is for. + output: + type: string + description: The output of the function call, this is free text and can contain any information or simply be empty. required: - - id - - object - - deleted - ProjectSpendAlertListResource: + - type + - call_id + - output + RealtimeConversationItemMessageAssistant: type: object - description: Paginated list of project spend alerts. + title: Realtime assistant message item + description: An assistant message item in a Realtime conversation. properties: + id: + type: string + description: The unique ID of the item. This may be provided by the client or generated by the server. object: type: string enum: - - list - description: Always `list`. + - realtime.item + description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. x-stainless-const: true - data: + type: + type: string + enum: + - message + description: The type of the item. Always `message`. + x-stainless-const: true + status: + type: string + enum: + - completed + - incomplete + - in_progress + description: The status of the item. Has no effect on the conversation. + role: + type: string + enum: + - assistant + description: The role of the message sender. Always `assistant`. + x-stainless-const: true + content: type: array - description: Spend alerts returned in the current page. + description: The content of the message. items: - $ref: '#/components/schemas/ProjectSpendAlert' - first_id: - anyOf: - - type: string - - type: 'null' - description: The ID of the first spend alert in this page. - last_id: - anyOf: - - type: string - - type: 'null' - description: The ID of the last spend alert in this page. - has_more: - type: boolean - description: Whether more spend alerts are available when paginating. + type: object + properties: + type: + type: string + enum: + - output_text + - output_audio + description: The content type, `output_text` or `output_audio` depending on the session `output_modalities` configuration. + text: + type: string + description: The text content. + audio: + type: string + description: Base64-encoded audio bytes, these will be parsed as the format specified in the session output audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified. + transcript: + type: string + description: The transcript of the audio content, this will always be present if the output type is `audio`. required: - - object - - data - - first_id - - last_id - - has_more - ProjectUpdateRequest: - type: object - properties: - name: - anyOf: - - type: string - - type: 'null' - description: The updated name of the project, this name appears in reports. - external_key_id: - anyOf: - - type: string - - type: 'null' - description: External key ID to associate with the project. - geography: - anyOf: - - type: string - - type: 'null' - deprecated: true - description: |- - Geography for the project. - Deprecated: use `residency` when creating a project to configure data residency. This field is retained for backward compatibility. - ProjectUser: + - type + - role + - content + RealtimeConversationItemMessageSystem: type: object - description: Represents an individual user in a project. + title: Realtime system message item + description: A system message in a Realtime conversation can be used to provide additional context or instructions to the model. This is similar but distinct from the instruction prompt provided at the start of a conversation, as system messages can be added at any point in the conversation. For major changes to the conversation's behavior, use instructions, but for smaller updates (e.g. "the user is now asking about a different topic"), use system messages. properties: + id: + type: string + description: The unique ID of the item. This may be provided by the client or generated by the server. object: type: string enum: - - organization.project.user - description: The object type, which is always `organization.project.user` + - realtime.item + description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. x-stainless-const: true - id: + type: type: string - description: The identifier, which can be referenced in API endpoints - name: - anyOf: - - type: string - - type: 'null' - description: The name of the user - email: - anyOf: - - type: string - - type: 'null' - description: The email address of the user - role: + enum: + - message + description: The type of the item. Always `message`. + x-stainless-const: true + status: type: string - description: '`owner` or `member`' - added_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the project was added. - required: - - object - - id - - role - - added_at - x-oaiMeta: - name: The project user object - example: | - { - "object": "organization.project.user", - "id": "user_abc", - "name": "First Last", - "email": "user@example.com", - "role": "owner", - "added_at": 1711471533 - } - ProjectUserCreateRequest: - type: object - properties: - user_id: - anyOf: - - type: string - - type: 'null' - description: The ID of the user. - email: - anyOf: - - type: string - - type: 'null' - description: Email of the user to add. + enum: + - completed + - incomplete + - in_progress + description: The status of the item. Has no effect on the conversation. role: type: string - description: '`owner` or `member`' + enum: + - system + description: The role of the message sender. Always `system`. + x-stainless-const: true + content: + type: array + description: The content of the message. + items: + type: object + properties: + type: + type: string + enum: + - input_text + description: The content type. Always `input_text` for system messages. + x-stainless-const: true + text: + type: string + description: The text content. required: + - type - role - ProjectUserDeleteResponse: + - content + RealtimeConversationItemMessageUser: type: object + title: Realtime user message item + description: A user message item in a Realtime conversation. properties: + id: + type: string + description: The unique ID of the item. This may be provided by the client or generated by the server. object: type: string enum: - - organization.project.user.deleted + - realtime.item + description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. x-stainless-const: true - id: + type: type: string - deleted: - type: boolean - required: - - object - - id - - deleted - ProjectUserListResponse: - type: object - properties: - object: + enum: + - message + description: The type of the item. Always `message`. + x-stainless-const: true + status: type: string - data: - type: array - items: - $ref: '#/components/schemas/ProjectUser' - first_id: - anyOf: - - type: string - - type: 'null' - last_id: - anyOf: - - type: string - - type: 'null' - has_more: - type: boolean - required: - - object - - data - - has_more - ProjectUserUpdateRequest: - type: object - properties: + enum: + - completed + - incomplete + - in_progress + description: The status of the item. Has no effect on the conversation. role: - anyOf: - - type: string - - type: 'null' - description: '`owner` or `member`' - Prompt: - anyOf: - - type: object - description: | - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). - required: - - id - properties: - id: - type: string - description: The unique identifier of the prompt template to use. - version: - anyOf: - - type: string - description: Optional version of the prompt template. - - type: 'null' - variables: - $ref: '#/components/schemas/ResponsePromptVariables' - - type: 'null' - PublicAssignOrganizationGroupRoleBody: - type: object - description: Request payload for assigning a role to a group or user. - properties: - role_id: - type: string - description: Identifier of the role to assign. - required: - - role_id - x-oaiMeta: - example: | - { - "role_id": "role_01J1F8ROLE01" - } - PublicCreateOrganizationRoleBody: - type: object - description: Request payload for creating a custom role. - properties: - role_name: type: string - description: Unique name for the role. - permissions: + enum: + - user + description: The role of the message sender. Always `user`. + x-stainless-const: true + content: type: array - description: Permissions to grant to the role. + description: The content of the message. items: - type: string - description: - description: Optional description of the role. - anyOf: - - type: string - - type: 'null' + type: object + properties: + type: + type: string + enum: + - input_text + - input_audio + - input_image + description: The content type (`input_text`, `input_audio`, or `input_image`). + text: + type: string + description: The text content (for `input_text`). + audio: + type: string + description: Base64-encoded audio bytes (for `input_audio`), these will be parsed as the format specified in the session input audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified. + image_url: + type: string + format: uri + description: Base64-encoded image bytes (for `input_image`) as a data URI. For example `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...`. Supported formats are PNG and JPEG. + detail: + type: string + description: The detail level of the image (for `input_image`). `auto` will default to `high`. + default: auto + enum: + - auto + - low + - high + transcript: + type: string + description: Transcript of the audio (for `input_audio`). This is not sent to the model, but will be attached to the message item for reference. required: - - role_name - - permissions - x-oaiMeta: - example: | - { - "role_name": "API Group Manager", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "description": "Allows managing organization groups" - } - PublicRoleListResource: + - type + - role + - content + RealtimeConversationItemWithReference: type: object - description: Paginated list of roles available on an organization or project. + description: The item to add to the conversation. properties: + id: + type: string + description: | + For an item of type (`message` | `function_call` | `function_call_output`) + this field allows the client to assign the unique ID of the item. It is + not required because the server will generate one if not provided. + + For an item of type `item_reference`, this field is required and is a + reference to any item that has previously existed in the conversation. + type: + type: string + enum: + - message + - function_call + - function_call_output + - item_reference + description: | + The type of the item (`message`, `function_call`, `function_call_output`, `item_reference`). object: type: string enum: - - list - description: Always `list`. + - realtime.item + description: | + Identifier for the API object being returned - always `realtime.item`. x-stainless-const: true - data: + status: + type: string + enum: + - completed + - incomplete + - in_progress + description: "The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect \non the conversation, but are accepted for consistency with the \n`conversation.item.created` event.\n" + role: + type: string + enum: + - user + - assistant + - system + description: "The role of the message sender (`user`, `assistant`, `system`), only \napplicable for `message` items.\n" + content: type: array - description: Roles returned in the current page. + description: "The content of the message, applicable for `message` items. \n- Message items of role `system` support only `input_text` content\n- Message items of role `user` support `input_text` and `input_audio` \n content\n- Message items of role `assistant` support `text` content.\n" items: - $ref: '#/components/schemas/Role' - has_more: - type: boolean - description: Whether more roles are available when paginating. - next: - description: Cursor to fetch the next page of results, or `null` when there are no additional roles. - anyOf: - - type: string - - type: 'null' - required: - - object - - data - - has_more - - next - x-oaiMeta: - name: Role list - example: | - { - "object": "list", - "data": [ - { - "object": "role", - "id": "role_01J1F8ROLE01", - "name": "API Group Manager", - "description": "Allows managing organization groups", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "resource_type": "api.organization", - "predefined_role": false - } - ], - "has_more": false, - "next": null - } - PublicUpdateOrganizationRoleBody: + type: object + properties: + type: + type: string + enum: + - input_text + - input_audio + - item_reference + - text + description: | + The content type (`input_text`, `input_audio`, `item_reference`, `text`). + text: + type: string + description: | + The text content, used for `input_text` and `text` content types. + id: + type: string + description: | + ID of a previous conversation item to reference (for `item_reference` + content types in `response.create` events). These can reference both + client and server created items. + audio: + type: string + description: | + Base64-encoded audio bytes, used for `input_audio` content type. + transcript: + type: string + description: | + The transcript of the audio, used for `input_audio` content type. + call_id: + type: string + description: "The ID of the function call (for `function_call` and \n`function_call_output` items). If passed on a `function_call_output` \nitem, the server will check that a `function_call` item with the same \nID exists in the conversation history.\n" + name: + type: string + description: | + The name of the function being called (for `function_call` items). + arguments: + type: string + description: | + The arguments of the function call (for `function_call` items). + output: + type: string + description: | + The output of the function call (for `function_call_output` items). + RealtimeCreateClientSecretRequest: type: object - description: Request payload for updating an existing role. + title: Realtime client secret creation request + description: | + Create a session and client secret for the Realtime API. The request can specify + either a realtime or a transcription session configuration. + [Learn more about the Realtime API](https://developers.openai.com/api/docs/guides/realtime). properties: - permissions: - description: Updated set of permissions for the role. - anyOf: - - type: array - items: + expires_after: + type: object + title: Client secret expiration + description: | + Configuration for the client secret expiration. Expiration refers to the time after which + a client secret will no longer be valid for creating sessions. The session itself may + continue after that time once started. A secret can be used to create multiple sessions + until it expires. + properties: + anchor: type: string - - type: 'null' - description: - description: New description for the role. - anyOf: - - type: string - - type: 'null' - role_name: - description: New name for the role. + enum: + - created_at + description: | + The anchor point for the client secret expiration, meaning that `seconds` will be added to the `created_at` time of the client secret to produce an expiration timestamp. Only `created_at` is currently supported. + default: created_at + x-stainless-const: true + seconds: + type: integer + format: int64 + description: | + The number of seconds from the anchor point to the expiration. Select a value between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if not specified. + minimum: 10 + maximum: 7200 + default: 600 + session: + title: Session configuration + description: | + Session configuration to use for the client secret. Choose either a realtime + session or a transcription session. anyOf: - - type: string - - type: 'null' - x-oaiMeta: - example: | - { - "role_name": "API Group Manager", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "description": "Allows managing organization groups" - } - RealtimeAudioFormats: - anyOf: - - type: object - title: PCM audio format - description: The PCM audio format. Only a 24kHz sample rate is supported. - properties: - type: - type: string - description: The audio format. Always `audio/pcm`. - enum: - - audio/pcm - rate: - type: integer - description: The sample rate of the audio. Always `24000`. - enum: - - 24000 - - type: object - title: PCMU audio format - description: The G.711 μ-law format. - properties: - type: - type: string - description: The audio format. Always `audio/pcmu`. - enum: - - audio/pcmu - - type: object - title: PCMA audio format - description: The G.711 A-law format. - properties: - type: - type: string - description: The audio format. Always `audio/pcma`. - enum: - - audio/pcma - discriminator: - propertyName: type - RealtimeBetaClientEventConversationItemCreate: + - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' + - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' + discriminator: + propertyName: type + RealtimeCreateClientSecretResponse: type: object - description: "Add a new Item to the Conversation's context, including messages, function \ncalls, and function call responses. This event can be used both to populate a \n\"history\" of the conversation and to add new items mid-stream, but has the \ncurrent limitation that it cannot populate assistant audio messages.\n\nIf successful, the server will respond with a `conversation.item.created` \nevent, otherwise an `error` event will be sent.\n" + title: Realtime session and client secret + description: | + Response from creating a session and client secret for the Realtime API. properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. - type: - x-stainless-const: true - description: The event type, must be `conversation.item.create`. - const: conversation.item.create - previous_item_id: + value: type: string - description: "The ID of the preceding item after which the new item will be inserted. \nIf not set, the new item will be appended to the end of the conversation.\nIf set to `root`, the new item will be added to the beginning of the conversation.\nIf set to an existing ID, it allows an item to be inserted mid-conversation. If the\nID cannot be found, an error will be returned and the item will not be added.\n" - item: - $ref: '#/components/schemas/RealtimeConversationItem' + description: The generated client secret value. + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the client secret, in seconds since epoch. + session: + title: Session configuration + description: | + The session configuration for either a realtime or transcription session. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' + - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponseGA' required: - - type - - item + - value + - expires_at + - session x-oaiMeta: - name: conversation.item.create + name: Session response object group: realtime example: | { - "type": "conversation.item.create", - "item": { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "hi" + "value": "ek_68af296e8e408191a1120ab6383263c2", + "expires_at": 1756310470, + "session": { + "type": "realtime", + "object": "realtime.session", + "id": "sess_C9CiUVUzUzYIssh3ELY1d", + "model": "gpt-realtime-2025-08-25", + "output_modalities": [ + "audio" + ], + "instructions": "You are a friendly assistant.", + "tools": [], + "tool_choice": "auto", + "max_output_tokens": "inf", + "tracing": null, + "truncation": "auto", + "prompt": null, + "expires_at": 0, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": null, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + } + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "alloy", + "speed": 1.0 } - ] - }, - "event_id": "b904fba0-0ec4-40af-8bbb-f908a9b26793", + }, + "include": null + } } - RealtimeBetaClientEventConversationItemDelete: + RealtimeFunctionTool: type: object - description: "Send this event when you want to remove any item from the conversation \nhistory. The server will respond with a `conversation.item.deleted` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n" + title: Function tool properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. type: + type: string + enum: + - function + description: The type of the tool, i.e. `function`. x-stainless-const: true - description: The event type, must be `conversation.item.delete`. - const: conversation.item.delete - item_id: + name: type: string - description: The ID of the item to delete. - required: - - type - - item_id - x-oaiMeta: - name: conversation.item.delete - group: realtime - example: | - { - "event_id": "event_901", - "type": "conversation.item.delete", - "item_id": "msg_003" - } - RealtimeBetaClientEventConversationItemRetrieve: + description: The name of the function. + description: + type: string + description: | + The description of the function, including guidance on when and how + to call it, and guidance about what to tell the user when calling + (if anything). + parameters: + type: object + description: Parameters of the function in JSON Schema. + RealtimeMCPApprovalRequest: type: object - description: "Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD.\nThe server will respond with a `conversation.item.retrieved` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n" + title: Realtime MCP approval request + description: | + A Realtime item requesting human approval of a tool invocation. properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. type: + type: string + enum: + - mcp_approval_request + description: The type of the item. Always `mcp_approval_request`. x-stainless-const: true - description: The event type, must be `conversation.item.retrieve`. - const: conversation.item.retrieve - item_id: + id: type: string - description: The ID of the item to retrieve. - required: - - type - - item_id - x-oaiMeta: - name: conversation.item.retrieve - group: realtime - example: | - { - "event_id": "event_901", - "type": "conversation.item.retrieve", - "item_id": "msg_003" - } - RealtimeBetaClientEventConversationItemTruncate: - type: object - description: "Send this event to truncate a previous assistant message’s audio. The server \nwill produce audio faster than realtime, so this event is useful when the user \ninterrupts to truncate audio that has already been sent to the client but not \nyet played. This will synchronize the server's understanding of the audio with \nthe client's playback.\n\nTruncating audio will delete the server-side text transcript to ensure there \nis not text in the context that hasn't been heard by the user.\n\nIf successful, the server will respond with a `conversation.item.truncated` \nevent. \n" - properties: - event_id: + description: The unique ID of the approval request. + server_label: type: string - description: Optional client-generated ID used to identify this event. - type: - x-stainless-const: true - description: The event type, must be `conversation.item.truncate`. - const: conversation.item.truncate - item_id: + description: The label of the MCP server making the request. + name: type: string - description: "The ID of the assistant message item to truncate. Only assistant message \nitems can be truncated.\n" - content_index: - type: integer - description: The index of the content part to truncate. Set this to 0. - audio_end_ms: - type: integer - description: "Inclusive duration up to which audio is truncated, in milliseconds. If \nthe audio_end_ms is greater than the actual audio duration, the server \nwill respond with an error.\n" + description: The name of the tool to run. + arguments: + type: string + description: A JSON string of arguments for the tool. required: - type - - item_id - - content_index - - audio_end_ms - x-oaiMeta: - name: conversation.item.truncate - group: realtime - example: | - { - "event_id": "event_678", - "type": "conversation.item.truncate", - "item_id": "msg_002", - "content_index": 0, - "audio_end_ms": 1500 - } - RealtimeBetaClientEventInputAudioBufferAppend: + - id + - server_label + - name + - arguments + RealtimeMCPApprovalResponse: type: object - description: "Send this event to append audio bytes to the input audio buffer. The audio \nbuffer is temporary storage you can write to and later commit. In Server VAD \nmode, the audio buffer is used to detect speech and the server will decide \nwhen to commit. When Server VAD is disabled, you must commit the audio buffer\nmanually.\n\nThe client may choose how much audio to place in each event up to a maximum \nof 15 MiB, for example streaming smaller chunks from the client may allow the \nVAD to be more responsive. Unlike made other client events, the server will \nnot send a confirmation response to this event.\n" + title: Realtime MCP approval response + description: | + A Realtime item responding to an MCP approval request. properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. type: + type: string + enum: + - mcp_approval_response + description: The type of the item. Always `mcp_approval_response`. x-stainless-const: true - description: The event type, must be `input_audio_buffer.append`. - const: input_audio_buffer.append - audio: + id: type: string - description: "Base64-encoded audio bytes. This must be in the format specified by the \n`input_audio_format` field in the session configuration.\n" - required: - - type - - audio - x-oaiMeta: - name: input_audio_buffer.append - group: realtime - example: | - { - "event_id": "event_456", - "type": "input_audio_buffer.append", - "audio": "Base64EncodedAudioData" - } - RealtimeBetaClientEventInputAudioBufferClear: - type: object - description: "Send this event to clear the audio bytes in the buffer. The server will \nrespond with an `input_audio_buffer.cleared` event.\n" - properties: - event_id: + description: The unique ID of the approval response. + approval_request_id: type: string - description: Optional client-generated ID used to identify this event. - type: - x-stainless-const: true - description: The event type, must be `input_audio_buffer.clear`. - const: input_audio_buffer.clear + description: The ID of the approval request being answered. + approve: + type: boolean + description: Whether the request was approved. + reason: + anyOf: + - type: string + description: Optional reason for the decision. + - type: 'null' required: - type - x-oaiMeta: - name: input_audio_buffer.clear - group: realtime - example: | - { - "event_id": "event_012", - "type": "input_audio_buffer.clear" - } - RealtimeBetaClientEventInputAudioBufferCommit: + - id + - approval_request_id + - approve + RealtimeMCPHTTPError: type: object - description: "Send this event to commit the user input audio buffer, which will create a \nnew user message item in the conversation. This event will produce an error \nif the input audio buffer is empty. When in Server VAD mode, the client does \nnot need to send this event, the server will commit the audio buffer \nautomatically.\n\nCommitting the input audio buffer will trigger input audio transcription \n(if enabled in session configuration), but it will not create a response \nfrom the model. The server will respond with an `input_audio_buffer.committed` \nevent.\n" + title: Realtime MCP HTTP error properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. type: + type: string + enum: + - http_error x-stainless-const: true - description: The event type, must be `input_audio_buffer.commit`. - const: input_audio_buffer.commit + code: + type: integer + message: + type: string required: - type - x-oaiMeta: - name: input_audio_buffer.commit - group: realtime - example: | - { - "event_id": "event_789", - "type": "input_audio_buffer.commit" - } - RealtimeBetaClientEventOutputAudioBufferClear: + - code + - message + RealtimeMCPListTools: type: object + title: Realtime MCP list tools description: | - **WebRTC/SIP Only:** Emit to cut off the current audio response. This will trigger the server to - stop generating audio and emit a `output_audio_buffer.cleared` event. This - event should be preceded by a `response.cancel` client event to stop the - generation of the current response. - [Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + A Realtime item listing tools available on an MCP server. properties: - event_id: - type: string - description: The unique ID of the client event used for error handling. type: - x-stainless-const: true - description: The event type, must be `output_audio_buffer.clear`. - const: output_audio_buffer.clear - required: - - type - x-oaiMeta: - name: output_audio_buffer.clear - group: realtime - example: | - { - "event_id": "optional_client_event_id", - "type": "output_audio_buffer.clear" - } - RealtimeBetaClientEventResponseCancel: - type: object - description: "Send this event to cancel an in-progress response. The server will respond \nwith a `response.done` event with a status of `response.status=cancelled`. If \nthere is no response to cancel, the server will respond with an error.\n" - properties: - event_id: type: string - description: Optional client-generated ID used to identify this event. - type: + enum: + - mcp_list_tools + description: The type of the item. Always `mcp_list_tools`. x-stainless-const: true - description: The event type, must be `response.cancel`. - const: response.cancel - response_id: + id: type: string - description: "A specific response ID to cancel - if not provided, will cancel an \nin-progress response in the default conversation.\n" - required: - - type - x-oaiMeta: - name: response.cancel - group: realtime - example: | - { - "event_id": "event_567", - "type": "response.cancel" - } - RealtimeBetaClientEventResponseCreate: - type: object - description: "This event instructs the server to create a Response, which means triggering \nmodel inference. When in Server VAD mode, the server will create Responses \nautomatically.\n\nA Response will include at least one Item, and may have two, in which case \nthe second will be a function call. These Items will be appended to the \nconversation history.\n\nThe server will respond with a `response.created` event, events for Items \nand content created, and finally a `response.done` event to indicate the \nResponse is complete.\n\nThe `response.create` event can optionally include inference configuration like \n`instructions`, and `temperature`. These fields will override the Session's \nconfiguration for this Response only.\n\nResponses can be created out-of-band of the default Conversation, meaning that they can\nhave arbitrary input, and it's possible to disable writing the output to the Conversation.\nOnly one Response can write to the default Conversation at a time, but otherwise multiple\nResponses can be created in parallel.\n\nClients can set `conversation` to `none` to create a Response that does not write to the default\nConversation. Arbitrary input can be provided with the `input` field, which is an array accepting\nraw Items and references to existing Items.\n" - properties: - event_id: + description: The unique ID of the list. + server_label: type: string - description: Optional client-generated ID used to identify this event. - type: - x-stainless-const: true - description: The event type, must be `response.create`. - const: response.create - response: - $ref: '#/components/schemas/RealtimeBetaResponseCreateParams' + description: The label of the MCP server. + tools: + type: array + items: + $ref: '#/components/schemas/MCPListToolsTool' + description: The tools available on the server. required: - type - x-oaiMeta: - name: response.create - group: realtime - example: | - // Trigger a response with the default Conversation and no special parameters - { - "type": "response.create", - } - - // Trigger an out-of-band response that does not write to the default Conversation - { - "type": "response.create", - "response": { - "instructions": "Provide a concise answer.", - "tools": [], // clear any session tools - "conversation": "none", - "output_modalities": ["text"], - "input": [ - { - "type": "item_reference", - "id": "item_12345", - }, - { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "Summarize the above message in one sentence." - } - ] - } - ], - } - } - RealtimeBetaClientEventSessionUpdate: + - server_label + - tools + RealtimeMCPProtocolError: type: object - description: | - Send this event to update the session’s default configuration. - The client may send this event at any time to update any field, - except for `voice`. However, note that once a session has been - initialized with a particular `model`, it can’t be changed to - another model using `session.update`. - - When the server receives a `session.update`, it will respond - with a `session.updated` event showing the full, effective configuration. - Only the fields that are present are updated. To clear a field like - `instructions`, pass an empty string. + title: Realtime MCP protocol error properties: - event_id: - type: string - description: Optional client-generated ID used to identify this event. type: + type: string + enum: + - protocol_error x-stainless-const: true - description: The event type, must be `session.update`. - const: session.update - session: - $ref: '#/components/schemas/RealtimeSessionCreateRequest' + code: + type: integer + message: + type: string required: - type - - session - x-oaiMeta: - name: session.update - group: realtime - example: | - { - "type": "session.update", - "session": { - "tools": [ - { - "type": "function", - "name": "display_color_palette", - "description": "Call this function when a user asks for a color palette.", - "parameters": { - "type": "object", - "properties": { - "theme": { - "type": "string", - "description": "Description of the theme for the color scheme." - }, - "colors": { - "type": "array", - "description": "Array of five hex color codes based on the theme.", - "items": { - "type": "string", - "description": "Hex color code" - } - } - }, - "required": [ - "theme", - "colors" - ] - } - } - ], - "tool_choice": "auto" - } - } - RealtimeBetaClientEventTranscriptionSessionUpdate: + - code + - message + RealtimeMCPToolCall: type: object + title: Realtime MCP tool call description: | - Send this event to update a transcription session. + A Realtime item representing an invocation of a tool on an MCP server. properties: - event_id: + type: type: string - description: Optional client-generated ID used to identify this event. + enum: + - mcp_call + description: The type of the item. Always `mcp_call`. + x-stainless-const: true + id: + type: string + description: The unique ID of the tool call. + server_label: + type: string + description: The label of the MCP server running the tool. + name: + type: string + description: The name of the tool that was run. + arguments: + type: string + description: A JSON string of the arguments passed to the tool. + approval_request_id: + anyOf: + - type: string + description: The ID of an associated approval request, if any. + - type: 'null' + output: + anyOf: + - type: string + description: The output from the tool call. + - type: 'null' + error: + anyOf: + - description: The error from the tool call, if any. + anyOf: + - $ref: '#/components/schemas/RealtimeMCPProtocolError' + - $ref: '#/components/schemas/RealtimeMCPToolExecutionError' + - $ref: '#/components/schemas/RealtimeMCPHTTPError' + discriminator: + propertyName: type + - type: 'null' + required: + - type + - id + - server_label + - name + - arguments + RealtimeMCPToolExecutionError: + type: object + title: Realtime MCP tool execution error + properties: type: + type: string + enum: + - tool_execution_error x-stainless-const: true - description: The event type, must be `transcription_session.update`. - const: transcription_session.update - session: - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequest' + message: + type: string required: - type - - session - x-oaiMeta: - name: transcription_session.update - group: realtime - example: | - { - "type": "transcription_session.update", - "session": { - "input_audio_format": "pcm16", - "input_audio_transcription": { - "model": "gpt-4o-transcribe", - "prompt": "", - "language": "" - }, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 500, - "create_response": true, - }, - "input_audio_noise_reduction": { - "type": "near_field" - }, - "include": [ - "item.input_audio_transcription.logprobs", - ] - } - } - RealtimeBetaResponse: + - message + RealtimeReasoning: + type: object + title: Realtime reasoning configuration + description: | + Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. + properties: + effort: + $ref: '#/components/schemas/RealtimeReasoningEffort' + RealtimeReasoningEffort: + type: string + description: | + Constrains effort on reasoning for reasoning-capable Realtime models such as + `gpt-realtime-2`. + enum: + - minimal + - low + - medium + - high + - xhigh + default: low + RealtimeResponse: type: object description: The response resource. properties: id: type: string - description: The unique ID of the response. + description: The unique ID of the response, will look like `resp_1234`. object: x-stainless-const: true description: The object type, must be `realtime.response`. @@ -44650,7 +51208,8 @@ components: - client_cancelled - max_output_tokens - content_filter - description: "The reason the Response did not complete. For a `cancelled` Response, \none of `turn_detected` (the server VAD detected a new start of speech) \nor `client_cancelled` (the client sent a cancel event). For an \n`incomplete` Response, one of `max_output_tokens` or `content_filter` \n(the server-side safety filter activated and cut off the response).\n" + description: | + The reason the Response did not complete. For a `cancelled` Response, one of `turn_detected` (the server VAD detected a new start of speech) or `client_cancelled` (the client sent a cancel event). For an `incomplete` Response, one of `max_output_tokens` or `content_filter` (the server-side safety filter activated and cut off the response). error: type: object description: "A description of the error that caused the response to fail, \npopulated when the `status` is `failed`.\n" @@ -44668,6 +51227,25 @@ components: $ref: '#/components/schemas/RealtimeConversationItem' metadata: $ref: '#/components/schemas/Metadata' + audio: + type: object + description: Configuration for audio output. + properties: + output: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + description: The format of the output audio. + voice: + $ref: '#/components/schemas/VoiceIdsShared' + default: alloy + description: | + The voice the model uses to respond. Voice cannot be changed during the + session once the model has responded with audio at least once. Current + voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + `shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for + best quality. usage: type: object description: "Usage statistics for the Response, this will correspond to billing. A \nRealtime API session will maintain a conversation context and append new \nItems to the Conversation, thus output from previous turns (text and \naudio tokens) will become the input for later turns.\n" @@ -44683,7 +51261,7 @@ components: description: "The number of output tokens sent in the Response, including text and \naudio tokens.\n" input_token_details: type: object - description: Details about the input tokens used in the Response. + description: Details about the input tokens used in the Response. Cached tokens are tokens from previous turns in the conversation that are included as context for the current response. Cached tokens here are counted as a subset of input tokens, meaning input tokens will include cached and uncached tokens. properties: cached_tokens: type: integer @@ -44727,38 +51305,19 @@ components: the default conversation and the value of `conversation_id` will be an id like `conv_1234`. If `none`, the response will not be added to any conversation and the value of `conversation_id` will be `null`. If responses are being triggered - by server VAD, the response will be added to the default conversation, thus - the `conversation_id` will be an id like `conv_1234`. + automatically by VAD the response will be added to the default conversation type: string - voice: - $ref: '#/components/schemas/VoiceIdsShared' - description: | - The voice the model used to respond. - Current voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, - `shimmer`, and `verse`. - modalities: + output_modalities: type: array description: | - The set of modalities the model used to respond. If there are multiple modalities, - the model will pick one, for example if `modalities` is `["text", "audio"]`, the model - could be responding in either text or audio. + The set of modalities the model used to respond, currently the only possible values are + `[\"audio\"]`, `[\"text\"]`. Audio output always include a text transcript. Setting the + output to mode `text` will disable audio output from the model. items: type: string enum: - text - audio - output_audio_format: - type: string - enum: - - pcm16 - - g711_ulaw - - g711_alaw - description: | - The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. - temperature: - type: number - description: | - Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. max_output_tokens: description: | Maximum number of output tokens for a single assistant response, @@ -44769,15 +51328,16 @@ components: enum: - inf x-stainless-const: true - RealtimeBetaResponseCreateParams: + RealtimeResponseCreateParams: type: object description: Create a new Realtime response with these parameters properties: - modalities: + output_modalities: type: array description: | - The set of modalities the model can respond with. To disable audio, - set this to ["text"]. + The set of modalities the model used to respond, currently the only possible values are + `[\"audio\"]`, `[\"text\"]`. Audio output always include a text transcript. Setting the + output to mode `text` will disable audio output from the model. items: type: string enum: @@ -44785,44 +51345,36 @@ components: - audio instructions: type: string - description: "The default system instructions (i.e. system message) prepended to model \ncalls. This field allows the client to guide the model on desired \nresponses. The model can be instructed on response content and format, \n(e.g. \"be extremely succinct\", \"act friendly\", \"here are examples of good \nresponses\") and on audio behavior (e.g. \"talk quickly\", \"inject emotion \ninto your voice\", \"laugh frequently\"). The instructions are not guaranteed \nto be followed by the model, but they provide guidance to the model on the \ndesired behavior.\n\nNote that the server sets default instructions which will be used if this \nfield is not set and are visible in the `session.created` event at the \nstart of the session.\n" - voice: - $ref: '#/components/schemas/VoiceIdsOrCustomVoice' - description: | - The voice the model uses to respond. Supported built-in voices are - `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, - `marin`, and `cedar`. You may also provide a custom voice object with an - `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed during - the session once the model has responded with audio at least once. - output_audio_format: - type: string - enum: - - pcm16 - - g711_ulaw - - g711_alaw description: | - The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. + Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session. + audio: + type: object + description: Configuration for audio input and output. + properties: + output: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + description: The format of the output audio. + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + default: alloy + description: | + The voice the model uses to respond. Supported built-in voices are + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, + `marin`, and `cedar`. You may also provide a custom voice object with + an `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed + during the session once the model has responded with audio at least once. + We recommend `marin` and `cedar` for best quality. tools: type: array - description: Tools (functions) available to the model. + description: Tools available to the model. items: - type: object - properties: - type: - type: string - enum: - - function - description: The type of the tool, i.e. `function`. - x-stainless-const: true - name: - type: string - description: The name of the function. - description: - type: string - description: "The description of the function, including guidance on when and how \nto call it, and guidance about what to tell the user when calling \n(if anything).\n" - parameters: - type: object - description: Parameters of the function in JSON Schema. + anyOf: + - $ref: '#/components/schemas/RealtimeFunctionTool' + - $ref: '#/components/schemas/MCPTool' tool_choice: description: | How the model chooses tools. Provide one of the string modes or force a specific @@ -44832,10 +51384,13 @@ components: - $ref: '#/components/schemas/ToolChoiceOptions' - $ref: '#/components/schemas/ToolChoiceFunction' - $ref: '#/components/schemas/ToolChoiceMCP' - temperature: - type: number + parallel_tool_calls: + type: boolean description: | - Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + Whether the model may call multiple tools in parallel. Only supported by + reasoning Realtime models such as `gpt-realtime-2`. + reasoning: + $ref: '#/components/schemas/RealtimeReasoning' max_output_tokens: description: | Maximum number of output tokens for a single assistant response, @@ -44849,7 +51404,12 @@ components: - inf x-stainless-const: true conversation: - description: "Controls which conversation the response is added to. Currently supports\n`auto` and `none`, with `auto` as the default value. The `auto` value\nmeans that the contents of the response will be added to the default\nconversation. Set this to `none` to create an out-of-band response which \nwill not add items to default conversation.\n" + description: | + Controls which conversation the response is added to. Currently supports + `auto` and `none`, with `auto` as the default value. The `auto` value + means that the contents of the response will be added to the default + conversation. Set this to `none` to create an out-of-band response which + will not add items to default conversation. anyOf: - type: string - type: string @@ -44867,10 +51427,152 @@ components: Input items to include in the prompt for the model. Using this field creates a new context for this Response instead of using the default conversation. An empty array `[]` will clear the context for this Response. - Note that this can include references to items from the default conversation. + Note that this can include references to items that previously appeared in the session + using their id. items: $ref: '#/components/schemas/RealtimeConversationItem' - RealtimeBetaServerEventConversationItemCreated: + RealtimeServerEvent: + discriminator: + propertyName: type + description: | + A realtime server event. + anyOf: + - $ref: '#/components/schemas/RealtimeServerEventConversationCreated' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemCreated' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemDeleted' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionCompleted' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionDelta' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionFailed' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemRetrieved' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemTruncated' + - $ref: '#/components/schemas/RealtimeServerEventError' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferCleared' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferCommitted' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferDtmfEventReceived' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferSpeechStarted' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferSpeechStopped' + - $ref: '#/components/schemas/RealtimeServerEventRateLimitsUpdated' + - $ref: '#/components/schemas/RealtimeServerEventResponseAudioDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseAudioDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseAudioTranscriptDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseAudioTranscriptDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseContentPartAdded' + - $ref: '#/components/schemas/RealtimeServerEventResponseContentPartDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseCreated' + - $ref: '#/components/schemas/RealtimeServerEventResponseDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseOutputItemAdded' + - $ref: '#/components/schemas/RealtimeServerEventResponseOutputItemDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseTextDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseTextDone' + - $ref: '#/components/schemas/RealtimeServerEventSessionCreated' + - $ref: '#/components/schemas/RealtimeServerEventSessionUpdated' + - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferStarted' + - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferStopped' + - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferCleared' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemAdded' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemDone' + - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferTimeoutTriggered' + - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionSegment' + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsInProgress' + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsCompleted' + - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsFailed' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDelta' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDone' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallInProgress' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallCompleted' + - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallFailed' + RealtimeServerEventConversationCreated: + type: object + description: | + Returned when a conversation is created. Emitted right after session creation. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `conversation.created`. + const: conversation.created + conversation: + type: object + description: The conversation resource. + properties: + id: + type: string + description: The unique ID of the conversation. + object: + description: The object type, must be `realtime.conversation`. + const: realtime.conversation + required: + - event_id + - type + - conversation + x-oaiMeta: + name: conversation.created + group: realtime + example: | + { + "event_id": "event_9101", + "type": "conversation.created", + "conversation": { + "id": "conv_001", + "object": "realtime.conversation" + } + } + RealtimeServerEventConversationItemAdded: + type: object + description: | + Sent by the server when an Item is added to the default Conversation. This can happen in several cases: + - When the client sends a `conversation.item.create` event. + - When the input audio buffer is committed. In this case the item will be a user message containing the audio from the buffer. + - When the model is generating a Response. In this case the `conversation.item.added` event will be sent when the model starts generating a specific Item, and thus it will not yet have any content (and `status` will be `in_progress`). + + The event will include the full content of the Item (except when model is generating a Response) except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if necessary. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `conversation.item.added`. + const: conversation.item.added + previous_item_id: + anyOf: + - type: string + description: | + The ID of the item that precedes this one, if any. This is used to + maintain ordering when items are inserted. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.added + group: realtime + example: | + { + "type": "conversation.item.added", + "event_id": "event_C9G8pjSJCfRNEhMEnYAVy", + "previous_item_id": null, + "item": { + "id": "item_C9G8pGVKYnaZu8PH5YQ9O", + "type": "message", + "status": "completed", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "hi" + } + ] + } + } + RealtimeServerEventConversationItemCreated: type: object description: | Returned when a conversation item is created. There are several scenarios that produce this event: @@ -44921,7 +51623,7 @@ components: "content": [] } } - RealtimeBetaServerEventConversationItemDeleted: + RealtimeServerEventConversationItemDeleted: type: object description: "Returned when an item in the conversation is deleted by the client with a \n`conversation.item.delete` event. This event is used to synchronize the \nserver's understanding of the conversation history with the client's view.\n" properties: @@ -44948,12 +51650,60 @@ components: "type": "conversation.item.deleted", "item_id": "msg_005" } - RealtimeBetaServerEventConversationItemInputAudioTranscriptionCompleted: + RealtimeServerEventConversationItemDone: + type: object + description: | + Returned when a conversation item is finalized. + + The event will include the full content of the Item except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if needed. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `conversation.item.done`. + const: conversation.item.done + previous_item_id: + anyOf: + - type: string + description: | + The ID of the item that precedes this one, if any. This is used to + maintain ordering when items are inserted. + - type: 'null' + item: + $ref: '#/components/schemas/RealtimeConversationItem' + required: + - event_id + - type + - item + x-oaiMeta: + name: conversation.item.done + group: realtime + example: | + { + "type": "conversation.item.done", + "event_id": "event_CCXLgMZPo3qioWCeQa4WH", + "previous_item_id": "item_CCXLecNJVIVR2HUy3ABLj", + "item": { + "id": "item_CCXLfxmM5sXVJVz4mCa2S", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "output_audio", + "transcript": "Oh, I can hear you loud and clear! Sounds like we're connected just fine. What can I help you with today?" + } + ] + } + } + RealtimeServerEventConversationItemInputAudioTranscriptionCompleted: type: object description: | This event is the output of audio transcription for user audio written to the user audio buffer. Transcription begins when the input audio buffer is - committed by the client or server (in `server_vad` mode). Transcription runs + committed by the client or server (when VAD is enabled). Transcription runs asynchronously with Response creation, so this event may come before or after the Response events. @@ -44975,7 +51725,7 @@ components: x-stainless-const: true item_id: type: string - description: The ID of the user message item containing the audio. + description: The ID of the item containing the audio that is being transcribed. content_index: type: integer description: The index of the content part containing the audio. @@ -44997,12 +51747,12 @@ components: - type: 'null' usage: type: object - description: Usage statistics for the transcription. + description: Usage statistics for the transcription, this is billed according to the ASR model's pricing rather than the realtime model's pricing. anyOf: - $ref: '#/components/schemas/TranscriptTextUsageTokens' - title: Token Usage + title: TranscriptTextUsageTokens - $ref: '#/components/schemas/TranscriptTextUsageDuration' - title: Duration Usage + title: TranscriptTextUsageDuration required: - event_id - type @@ -45015,26 +51765,26 @@ components: group: realtime example: | { - "event_id": "event_2122", - "type": "conversation.item.input_audio_transcription.completed", - "item_id": "msg_003", - "content_index": 0, - "transcript": "Hello, how are you?", - "usage": { - "type": "tokens", - "total_tokens": 48, - "input_tokens": 38, - "input_token_details": { - "text_tokens": 10, - "audio_tokens": 28, - }, - "output_tokens": 10, - } + "type": "conversation.item.input_audio_transcription.completed", + "event_id": "event_CCXGRvtUVrax5SJAnNOWZ", + "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", + "content_index": 0, + "transcript": "Hey, can you hear me?", + "usage": { + "type": "tokens", + "total_tokens": 22, + "input_tokens": 13, + "input_token_details": { + "text_tokens": 0, + "audio_tokens": 13 + }, + "output_tokens": 9 + } } - RealtimeBetaServerEventConversationItemInputAudioTranscriptionDelta: + RealtimeServerEventConversationItemInputAudioTranscriptionDelta: type: object description: | - Returned when the text value of an input audio transcription content part is updated. + Returned when the text value of an input audio transcription content part is updated with incremental transcription results. properties: event_id: type: string @@ -45045,7 +51795,7 @@ components: const: conversation.item.input_audio_transcription.delta item_id: type: string - description: The ID of the item. + description: The ID of the item containing the audio that is being transcribed. content_index: type: integer description: The index of the content part in the item's content array. @@ -45055,7 +51805,7 @@ components: logprobs: anyOf: - type: array - description: The log probabilities of the transcription. + description: 'The log probabilities of the transcription. These can be enabled by configurating the session with `"include": ["item.input_audio_transcription.logprobs"]`. Each entry in the array corresponds a log probability of which token would be selected for this chunk of transcription. This can help to identify if it was possible there were multiple valid options for a given chunk of transcription.' items: $ref: '#/components/schemas/LogProbProperties' - type: 'null' @@ -45069,12 +51819,13 @@ components: example: | { "type": "conversation.item.input_audio_transcription.delta", - "event_id": "event_001", - "item_id": "item_001", + "event_id": "event_CCXGRxsAimPAs8kS2Wc7Z", + "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", "content_index": 0, - "delta": "Hello" + "delta": "Hey", + "obfuscation": "aLxx0jTEciOGe" } - RealtimeBetaServerEventConversationItemInputAudioTranscriptionFailed: + RealtimeServerEventConversationItemInputAudioTranscriptionFailed: type: object description: "Returned when input audio transcription is configured, and a transcription \nrequest for a user message failed. These events are separate from other \n`error` events so that the client can identify the related Item.\n" properties: @@ -45133,7 +51884,7 @@ components: "param": null } } - RealtimeBetaServerEventConversationItemInputAudioTranscriptionSegment: + RealtimeServerEventConversationItemInputAudioTranscriptionSegment: type: object description: Returned when an input audio transcription segment is identified for an item. properties: @@ -45192,10 +51943,10 @@ components: "start": 0.0, "end": 0.4 } - RealtimeBetaServerEventConversationItemRetrieved: + RealtimeServerEventConversationItemRetrieved: type: object description: | - Returned when a conversation item is retrieved with `conversation.item.retrieve`. + Returned when a conversation item is retrieved with `conversation.item.retrieve`. This is provided as a way to fetch the server's representation of an item, for example to get access to the post-processed audio data after noise cancellation and VAD. It includes the full content of the Item, including audio data. properties: event_id: type: string @@ -45215,25 +51966,25 @@ components: group: realtime example: | { - "event_id": "event_1920", - "type": "conversation.item.created", - "previous_item_id": "msg_002", - "item": { - "id": "msg_003", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "user", - "content": [ - { - "type": "input_audio", - "transcript": "hello how are you", - "audio": "base64encodedaudio==" - } - ] - } + "type": "conversation.item.retrieved", + "event_id": "event_CCXGSizgEppa2d4XbKA7K", + "item": { + "id": "item_CCXGRxbY0n6WE4EszhF5w", + "object": "realtime.item", + "type": "message", + "status": "completed", + "role": "assistant", + "content": [ + { + "type": "audio", + "transcript": "Yes, I can hear you loud and clear. How can I help you today?", + "audio": "8//2//v/9//q/+//+P/s...", + "format": "pcm16" + } + ] + } } - RealtimeBetaServerEventConversationItemTruncated: + RealtimeServerEventConversationItemTruncated: type: object description: "Returned when an earlier assistant audio message item is truncated by the \nclient with a `conversation.item.truncate` event. This event is used to \nsynchronize the server's understanding of the audio with the client's playback.\n\nThis action will truncate the audio and remove the server-side text transcript \nto ensure there is no text in the context that hasn't been heard by the user.\n" properties: @@ -45271,7 +52022,7 @@ components: "content_index": 0, "audio_end_ms": 1500 } - RealtimeBetaServerEventError: + RealtimeServerEventError: type: object description: | Returned when an error occurs, which could be a client problem or a server @@ -45334,7 +52085,7 @@ components: "event_id": "event_567" } } - RealtimeBetaServerEventInputAudioBufferCleared: + RealtimeServerEventInputAudioBufferCleared: type: object description: "Returned when the input audio buffer is cleared by the client with a \n`input_audio_buffer.clear` event.\n" properties: @@ -45356,7 +52107,7 @@ components: "event_id": "event_1314", "type": "input_audio_buffer.cleared" } - RealtimeBetaServerEventInputAudioBufferCommitted: + RealtimeServerEventInputAudioBufferCommitted: type: object description: | Returned when an input audio buffer is committed, either by the client or @@ -45395,7 +52146,39 @@ components: "previous_item_id": "msg_001", "item_id": "msg_002" } - RealtimeBetaServerEventInputAudioBufferSpeechStarted: + RealtimeServerEventInputAudioBufferDtmfEventReceived: + type: object + description: | + **SIP Only:** Returned when an DTMF event is received. A DTMF event is a message that + represents a telephone keypad press (0–9, *, #, A–D). The `event` property + is the keypad that the user press. The `received_at` is the UTC Unix Timestamp + that the server received the event. + properties: + type: + x-stainless-const: true + description: The event type, must be `input_audio_buffer.dtmf_event_received`. + const: input_audio_buffer.dtmf_event_received + event: + type: string + description: The telephone keypad that was pressed by the user. + received_at: + type: integer + description: | + UTC Unix Timestamp when DTMF Event was received by server. + required: + - type + - event + - received_at + x-oaiMeta: + name: input_audio_buffer.dtmf_event_received + group: realtime + example: | + { + "type":" input_audio_buffer.dtmf_event_received", + "event": "9", + "received_at": 1763605109, + } + RealtimeServerEventInputAudioBufferSpeechStarted: type: object description: "Sent by the server when in `server_vad` mode to indicate that speech has been \ndetected in the audio buffer. This can happen any time audio is added to the \nbuffer (unless speech is already detected). The client may want to use this \nevent to interrupt audio playback or provide visual feedback to the user. \n\nThe client should expect to receive a `input_audio_buffer.speech_stopped` event \nwhen speech stops. The `item_id` property is the ID of the user message item \nthat will be created when speech stops and will also be included in the \n`input_audio_buffer.speech_stopped` event (unless the client manually commits \nthe audio buffer during VAD activation).\n" properties: @@ -45428,7 +52211,7 @@ components: "audio_start_ms": 1000, "item_id": "msg_003" } - RealtimeBetaServerEventInputAudioBufferSpeechStopped: + RealtimeServerEventInputAudioBufferSpeechStopped: type: object description: "Returned in `server_vad` mode when the server detects the end of speech in \nthe audio buffer. The server will also send an `conversation.item.created` \nevent with the user message item that is created from the audio buffer.\n" properties: @@ -45460,7 +52243,57 @@ components: "audio_end_ms": 2000, "item_id": "msg_003" } - RealtimeBetaServerEventMCPListToolsCompleted: + RealtimeServerEventInputAudioBufferTimeoutTriggered: + type: object + description: | + Returned when the Server VAD timeout is triggered for the input audio buffer. This is configured + with `idle_timeout_ms` in the `turn_detection` settings of the session, and it indicates that + there hasn't been any speech detected for the configured duration. + + The `audio_start_ms` and `audio_end_ms` fields indicate the segment of audio after the last + model response up to the triggering time, as an offset from the beginning of audio written + to the input audio buffer. This means it demarcates the segment of audio that was silent and + the difference between the start and end values will roughly match the configured timeout. + + The empty audio will be committed to the conversation as an `input_audio` item (there will be a + `input_audio_buffer.committed` event) and a model response will be generated. There may be speech + that didn't trigger VAD but is still detected by the model, so the model may respond with + something relevant to the conversation or a prompt to continue speaking. + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `input_audio_buffer.timeout_triggered`. + const: input_audio_buffer.timeout_triggered + audio_start_ms: + type: integer + description: Millisecond offset of audio written to the input audio buffer that was after the playback time of the last model response. + audio_end_ms: + type: integer + description: Millisecond offset of audio written to the input audio buffer at the time the timeout was triggered. + item_id: + type: string + description: The ID of the item associated with this segment. + required: + - event_id + - type + - audio_start_ms + - audio_end_ms + - item_id + x-oaiMeta: + name: input_audio_buffer.timeout_triggered + group: realtime + example: | + { + "type":"input_audio_buffer.timeout_triggered", + "event_id":"event_CEKKrf1KTGvemCPyiJTJ2", + "audio_start_ms":13216, + "audio_end_ms":19232, + "item_id":"item_CEKKrWH0GiwN0ET97NUZc" + } + RealtimeServerEventMCPListToolsCompleted: type: object description: Returned when listing MCP tools has completed for an item. properties: @@ -45487,7 +52320,7 @@ components: "type": "mcp_list_tools.completed", "item_id": "mcp_list_tools_001" } - RealtimeBetaServerEventMCPListToolsFailed: + RealtimeServerEventMCPListToolsFailed: type: object description: Returned when listing MCP tools has failed for an item. properties: @@ -45514,7 +52347,7 @@ components: "type": "mcp_list_tools.failed", "item_id": "mcp_list_tools_001" } - RealtimeBetaServerEventMCPListToolsInProgress: + RealtimeServerEventMCPListToolsInProgress: type: object description: Returned when listing MCP tools is in progress for an item. properties: @@ -45541,7 +52374,101 @@ components: "type": "mcp_list_tools.in_progress", "item_id": "mcp_list_tools_001" } - RealtimeBetaServerEventRateLimitsUpdated: + RealtimeServerEventOutputAudioBufferCleared: + type: object + description: | + **WebRTC/SIP Only:** Emitted when the output audio buffer is cleared. This happens either in VAD + mode when the user has interrupted (`input_audio_buffer.speech_started`), + or when the client has emitted the `output_audio_buffer.clear` event to manually + cut off the current audio response. + [Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `output_audio_buffer.cleared`. + const: output_audio_buffer.cleared + response_id: + type: string + description: The unique ID of the response that produced the audio. + required: + - event_id + - type + - response_id + x-oaiMeta: + name: output_audio_buffer.cleared + group: realtime + example: | + { + "event_id": "event_abc123", + "type": "output_audio_buffer.cleared", + "response_id": "resp_abc123" + } + RealtimeServerEventOutputAudioBufferStarted: + type: object + description: | + **WebRTC/SIP Only:** Emitted when the server begins streaming audio to the client. This event is + emitted after an audio content part has been added (`response.content_part.added`) + to the response. + [Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `output_audio_buffer.started`. + const: output_audio_buffer.started + response_id: + type: string + description: The unique ID of the response that produced the audio. + required: + - event_id + - type + - response_id + x-oaiMeta: + name: output_audio_buffer.started + group: realtime + example: | + { + "event_id": "event_abc123", + "type": "output_audio_buffer.started", + "response_id": "resp_abc123" + } + RealtimeServerEventOutputAudioBufferStopped: + type: object + description: | + **WebRTC/SIP Only:** Emitted when the output audio buffer has been completely drained on the server, + and no more audio is forthcoming. This event is emitted after the full response + data has been sent to the client (`response.done`). + [Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + properties: + event_id: + type: string + description: The unique ID of the server event. + type: + x-stainless-const: true + description: The event type, must be `output_audio_buffer.stopped`. + const: output_audio_buffer.stopped + response_id: + type: string + description: The unique ID of the response that produced the audio. + required: + - event_id + - type + - response_id + x-oaiMeta: + name: output_audio_buffer.stopped + group: realtime + example: | + { + "event_id": "event_abc123", + "type": "output_audio_buffer.stopped", + "response_id": "resp_abc123" + } + RealtimeServerEventRateLimitsUpdated: type: object description: "Emitted at the beginning of a Response to indicate the updated rate limits. \nWhen a Response is created some tokens will be \"reserved\" for the output \ntokens, the rate limits shown here reflect that reservation, which is then \nadjusted accordingly once the Response is completed.\n" properties: @@ -45600,7 +52527,7 @@ components: } ] } - RealtimeBetaServerEventResponseAudioDelta: + RealtimeServerEventResponseAudioDelta: type: object description: Returned when the model-generated audio is updated. properties: @@ -45647,7 +52574,7 @@ components: "content_index": 0, "delta": "Base64EncodedAudioDelta" } - RealtimeBetaServerEventResponseAudioDone: + RealtimeServerEventResponseAudioDone: type: object description: | Returned when the model-generated audio is done. Also emitted when a Response @@ -45691,7 +52618,7 @@ components: "output_index": 0, "content_index": 0 } - RealtimeBetaServerEventResponseAudioTranscriptDelta: + RealtimeServerEventResponseAudioTranscriptDelta: type: object description: | Returned when the model-generated transcription of audio output is updated. @@ -45739,7 +52666,7 @@ components: "content_index": 0, "delta": "Hello, how can I a" } - RealtimeBetaServerEventResponseAudioTranscriptDone: + RealtimeServerEventResponseAudioTranscriptDone: type: object description: | Returned when the model-generated transcription of audio output is done @@ -45789,7 +52716,7 @@ components: "content_index": 0, "transcript": "Hello, how can I assist you today?" } - RealtimeBetaServerEventResponseContentPartAdded: + RealtimeServerEventResponseContentPartAdded: type: object description: | Returned when a new content part is added to an assistant message item during @@ -45857,7 +52784,7 @@ components: "text": "" } } - RealtimeBetaServerEventResponseContentPartDone: + RealtimeServerEventResponseContentPartDone: type: object description: | Returned when a content part is done streaming in an assistant message item. @@ -45925,7 +52852,7 @@ components: "text": "Sure, I can help with that." } } - RealtimeBetaServerEventResponseCreated: + RealtimeServerEventResponseCreated: type: object description: | Returned when a new Response is created. The first event of response creation, @@ -45939,7 +52866,7 @@ components: description: The event type, must be `response.created`. const: response.created response: - $ref: '#/components/schemas/RealtimeBetaResponse' + $ref: '#/components/schemas/RealtimeResponse' required: - event_id - type @@ -45974,11 +52901,10 @@ components: "usage": null, "metadata": null }, - "timestamp": "2:30:35 PM" } - RealtimeBetaServerEventResponseDone: + RealtimeServerEventResponseDone: type: object - description: "Returned when a Response is done streaming. Always emitted, no matter the \nfinal state. The Response object included in the `response.done` event will \ninclude all output Items in the Response but will omit the raw audio data.\n" + description: "Returned when a Response is done streaming. Always emitted, no matter the \nfinal state. The Response object included in the `response.done` event will \ninclude all output Items in the Response but will omit the raw audio data.\n\nClients should check the `status` field of the Response to determine if it was successful\n(`completed`) or if there was another outcome: `cancelled`, `failed`, or `incomplete`.\n\nA response will contain all output items that were generated during the response, excluding\nany audio content.\n" properties: event_id: type: string @@ -45988,7 +52914,7 @@ components: description: The event type, must be `response.done`. const: response.done response: - $ref: '#/components/schemas/RealtimeBetaResponse' + $ref: '#/components/schemas/RealtimeResponse' required: - event_id - type @@ -45998,49 +52924,65 @@ components: group: realtime example: | { - "event_id": "event_3132", - "type": "response.done", - "response": { - "id": "resp_001", - "object": "realtime.response", + "type": "response.done", + "event_id": "event_CCXHxcMy86rrKhBLDdqCh", + "response": { + "object": "realtime.response", + "id": "resp_CCXHw0UJld10EzIUXQCNh", + "status": "completed", + "status_details": null, + "output": [ + { + "id": "item_CCXHwGjjDUfOXbiySlK7i", + "type": "message", "status": "completed", - "status_details": null, - "output": [ - { - "id": "msg_006", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "text", - "text": "Sure, how can I assist you today?" - } - ] - } - ], - "usage": { - "total_tokens":275, - "input_tokens":127, - "output_tokens":148, - "input_token_details": { - "cached_tokens":384, - "text_tokens":119, - "audio_tokens":8, - "cached_tokens_details": { - "text_tokens": 128, - "audio_tokens": 256 - } - }, - "output_token_details": { - "text_tokens":36, - "audio_tokens":112 - } + "role": "assistant", + "content": [ + { + "type": "output_audio", + "transcript": "Loud and clear! I can hear you perfectly. How can I help you today?" + } + ] + } + ], + "conversation_id": "conv_CCXHsurMKcaVxIZvaCI5m", + "output_modalities": [ + "audio" + ], + "max_output_tokens": "inf", + "audio": { + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "alloy" + } + }, + "usage": { + "total_tokens": 253, + "input_tokens": 132, + "output_tokens": 121, + "input_token_details": { + "text_tokens": 119, + "audio_tokens": 13, + "image_tokens": 0, + "cached_tokens": 64, + "cached_tokens_details": { + "text_tokens": 64, + "audio_tokens": 0, + "image_tokens": 0 } - } + }, + "output_token_details": { + "text_tokens": 30, + "audio_tokens": 91 + } + }, + "metadata": null + } } - RealtimeBetaServerEventResponseFunctionCallArgumentsDelta: + RealtimeServerEventResponseFunctionCallArgumentsDelta: type: object description: | Returned when the model-generated function call arguments are updated. @@ -46089,7 +53031,7 @@ components: "call_id": "call_001", "delta": "{\"location\": \"San\"" } - RealtimeBetaServerEventResponseFunctionCallArgumentsDone: + RealtimeServerEventResponseFunctionCallArgumentsDone: type: object description: | Returned when the model-generated function call arguments are done streaming. @@ -46144,7 +53086,7 @@ components: "name": "get_weather", "arguments": "{\"location\": \"San Francisco\"}" } - RealtimeBetaServerEventResponseMCPCallArgumentsDelta: + RealtimeServerEventResponseMCPCallArgumentsDelta: type: object description: Returned when MCP tool call arguments are updated during response generation. properties: @@ -46191,7 +53133,7 @@ components: "output_index": 0, "delta": "{\"partial\":true}" } - RealtimeBetaServerEventResponseMCPCallArgumentsDone: + RealtimeServerEventResponseMCPCallArgumentsDone: type: object description: Returned when MCP tool call arguments are finalized during response generation. properties: @@ -46233,7 +53175,7 @@ components: "output_index": 0, "arguments": "{\"q\":\"docs\"}" } - RealtimeBetaServerEventResponseMCPCallCompleted: + RealtimeServerEventResponseMCPCallCompleted: type: object description: Returned when an MCP tool call has completed successfully. properties: @@ -46265,7 +53207,7 @@ components: "output_index": 0, "item_id": "mcp_call_001" } - RealtimeBetaServerEventResponseMCPCallFailed: + RealtimeServerEventResponseMCPCallFailed: type: object description: Returned when an MCP tool call has failed. properties: @@ -46297,7 +53239,7 @@ components: "output_index": 0, "item_id": "mcp_call_001" } - RealtimeBetaServerEventResponseMCPCallInProgress: + RealtimeServerEventResponseMCPCallInProgress: type: object description: Returned when an MCP tool call has started and is in progress. properties: @@ -46329,7 +53271,7 @@ components: "output_index": 0, "item_id": "mcp_call_001" } - RealtimeBetaServerEventResponseOutputItemAdded: + RealtimeServerEventResponseOutputItemAdded: type: object description: Returned when a new Item is created during Response generation. properties: @@ -46372,7 +53314,7 @@ components: "content": [] } } - RealtimeBetaServerEventResponseOutputItemDone: + RealtimeServerEventResponseOutputItemDone: type: object description: "Returned when an Item is done streaming. Also emitted when a Response is \ninterrupted, incomplete, or cancelled.\n" properties: @@ -46420,7 +53362,7 @@ components: ] } } - RealtimeBetaServerEventResponseTextDelta: + RealtimeServerEventResponseTextDelta: type: object description: Returned when the text value of an "output_text" content part is updated. properties: @@ -46467,7 +53409,7 @@ components: "content_index": 0, "delta": "Sure, I can h" } - RealtimeBetaServerEventResponseTextDone: + RealtimeServerEventResponseTextDone: type: object description: | Returned when the text value of an "output_text" content part is done streaming. Also @@ -46516,7 +53458,7 @@ components: "content_index": 0, "text": "Sure, I can help with that." } - RealtimeBetaServerEventSessionCreated: + RealtimeServerEventSessionCreated: type: object description: | Returned when a Session is created. Emitted automatically when a new @@ -46531,7 +53473,10 @@ components: description: The event type, must be `session.created`. const: session.created session: - $ref: '#/components/schemas/RealtimeSession' + description: The session configuration. + anyOf: + - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' + - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' required: - event_id - type @@ -46544,1043 +53489,1710 @@ components: "type": "session.created", "event_id": "event_C9G5RJeJ2gF77mV7f2B1j", "session": { + "type": "realtime", "object": "realtime.session", "id": "sess_C9G5QPteg4UIbotdKLoYQ", "model": "gpt-realtime-2025-08-28", - "modalities": [ + "output_modalities": [ "audio" ], "instructions": "Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.", "tools": [], "tool_choice": "auto", - "max_response_output_tokens": "inf", + "max_output_tokens": "inf", "tracing": null, "prompt": null, "expires_at": 1756324625, - "input_audio_format": "pcm16", - "input_audio_transcription": null, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 200, - "idle_timeout_ms": null, - "create_response": true, - "interrupt_response": true - }, - "output_audio_format": "pcm16", - "voice": "marin", - "include": null - } - } - RealtimeBetaServerEventSessionUpdated: - type: object - description: | - Returned when a session is updated with a `session.update` event, unless - there is an error. - properties: - event_id: - type: string - description: The unique ID of the server event. - type: - x-stainless-const: true - description: The event type, must be `session.updated`. - const: session.updated - session: - $ref: '#/components/schemas/RealtimeSession' - required: - - event_id - - type - - session - x-oaiMeta: - name: session.updated - group: realtime - example: | - { - "event_id": "event_5678", - "type": "session.updated", - "session": { - "id": "sess_001", - "object": "realtime.session", - "model": "gpt-realtime", - "modalities": ["text"], - "instructions": "New instructions", - "voice": "sage", - "input_audio_format": "pcm16", - "output_audio_format": "pcm16", - "input_audio_transcription": { - "model": "whisper-1" + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 }, - "turn_detection": null, - "tools": [], - "tool_choice": "none", - "temperature": 0.7, - "max_response_output_tokens": 200, - "speed": 1.1, - "tracing": "auto" - } - } - RealtimeBetaServerEventTranscriptionSessionCreated: - type: object - description: | - Returned when a transcription session is created. - properties: - event_id: - type: string - description: The unique ID of the server event. - type: - x-stainless-const: true - description: The event type, must be `transcription_session.created`. - const: transcription_session.created - session: - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponse' - required: - - event_id - - type - - session - x-oaiMeta: - name: transcription_session.created - group: realtime - example: | - { - "event_id": "event_5566", - "type": "transcription_session.created", - "session": { - "id": "sess_001", - "object": "realtime.transcription_session", - "input_audio_format": "pcm16", - "input_audio_transcription": { - "model": "gpt-4o-transcribe", - "prompt": "", - "language": "" - }, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 500 - }, - "input_audio_noise_reduction": { - "type": "near_field" - }, - "include": [] - } - } - RealtimeBetaServerEventTranscriptionSessionUpdated: - type: object - description: "Returned when a transcription session is updated with a `transcription_session.update` event, unless \nthere is an error.\n" - properties: - event_id: - type: string - description: The unique ID of the server event. - type: - x-stainless-const: true - description: The event type, must be `transcription_session.updated`. - const: transcription_session.updated - session: - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponse' - required: - - event_id - - type - - session - x-oaiMeta: - name: transcription_session.updated - group: realtime - example: | - { - "event_id": "event_5678", - "type": "transcription_session.updated", - "session": { - "id": "sess_001", - "object": "realtime.transcription_session", - "input_audio_format": "pcm16", - "input_audio_transcription": { - "model": "gpt-4o-transcribe", - "prompt": "", - "language": "" - }, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 500, - "create_response": true, - // "interrupt_response": false -- this will NOT be returned - }, - "input_audio_noise_reduction": { - "type": "near_field" - }, - "include": [ - "item.input_audio_transcription.avg_logprob", - ], - } - } - RealtimeCallCreateRequest: - title: Realtime call creation request - type: object - description: |- - Parameters required to initiate a realtime call and receive the SDP answer - needed to complete a WebRTC peer connection. Provide an SDP offer generated - by your client and optionally configure the session that will answer the call. - required: - - sdp - properties: - sdp: - type: string - description: WebRTC Session Description Protocol (SDP) offer generated by the caller. - session: - title: Session configuration - allOf: - - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' - description: |- - Optional session configuration to apply before the realtime session is - created. Use the same parameters you would send in a [`create client secret`](https://developers.openai.com/api/reference/resources/realtime/subresources/client_secrets/methods/create) - request. - additionalProperties: false - RealtimeCallReferRequest: - title: Realtime call refer request - type: object - description: |- - Parameters required to transfer a SIP call to a new destination using the - Realtime API. - required: - - target_uri - properties: - target_uri: - type: string - description: |- - URI that should appear in the SIP Refer-To header. Supports values like - `tel:+14155550123` or `sip:agent@example.com`. - example: tel:+14155550123 - additionalProperties: false - RealtimeCallRejectRequest: - title: Realtime call reject request - type: object - description: Parameters used to decline an incoming SIP call handled by the Realtime API. - properties: - status_code: - type: integer - description: |- - SIP response code to send back to the caller. Defaults to `603` (Decline) - when omitted. - example: 486 - additionalProperties: false - RealtimeClientEvent: - discriminator: - propertyName: type - description: | - A realtime client event. - anyOf: - - $ref: '#/components/schemas/RealtimeClientEventConversationItemCreate' - - $ref: '#/components/schemas/RealtimeClientEventConversationItemDelete' - - $ref: '#/components/schemas/RealtimeClientEventConversationItemRetrieve' - - $ref: '#/components/schemas/RealtimeClientEventConversationItemTruncate' - - $ref: '#/components/schemas/RealtimeClientEventInputAudioBufferAppend' - - $ref: '#/components/schemas/RealtimeClientEventInputAudioBufferClear' - - $ref: '#/components/schemas/RealtimeClientEventOutputAudioBufferClear' - - $ref: '#/components/schemas/RealtimeClientEventInputAudioBufferCommit' - - $ref: '#/components/schemas/RealtimeClientEventResponseCancel' - - $ref: '#/components/schemas/RealtimeClientEventResponseCreate' - - $ref: '#/components/schemas/RealtimeClientEventSessionUpdate' - RealtimeClientEventConversationItemCreate: - type: object - description: "Add a new Item to the Conversation's context, including messages, function \ncalls, and function call responses. This event can be used both to populate a \n\"history\" of the conversation and to add new items mid-stream, but has the \ncurrent limitation that it cannot populate assistant audio messages.\n\nIf successful, the server will respond with a `conversation.item.created` \nevent, otherwise an `error` event will be sent.\n" - properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. - type: - x-stainless-const: true - description: The event type, must be `conversation.item.create`. - const: conversation.item.create - previous_item_id: - type: string - description: | - The ID of the preceding item after which the new item will be inserted. If not set, the new item will be appended to the end of the conversation. - - If set to `root`, the new item will be added to the beginning of the conversation. - - If set to an existing ID, it allows an item to be inserted mid-conversation. If the ID cannot be found, an error will be returned and the item will not be added. - item: - $ref: '#/components/schemas/RealtimeConversationItem' - required: - - type - - item - x-oaiMeta: - name: conversation.item.create - group: realtime - example: | - { - "type": "conversation.item.create", - "item": { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "hi" - } - ] - } - } - RealtimeClientEventConversationItemDelete: - type: object - description: "Send this event when you want to remove any item from the conversation \nhistory. The server will respond with a `conversation.item.deleted` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n" - properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. - type: - x-stainless-const: true - description: The event type, must be `conversation.item.delete`. - const: conversation.item.delete - item_id: - type: string - description: The ID of the item to delete. - required: - - type - - item_id - x-oaiMeta: - name: conversation.item.delete - group: realtime - example: | - { - "event_id": "event_901", - "type": "conversation.item.delete", - "item_id": "item_003" + "transcription": null, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + } + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin", + "speed": 1 + } + }, + "include": null + }, } - RealtimeClientEventConversationItemRetrieve: + RealtimeServerEventSessionUpdated: type: object - description: "Send this event when you want to retrieve the server's representation of a specific item in the conversation history. This is useful, for example, to inspect user audio after noise cancellation and VAD.\nThe server will respond with a `conversation.item.retrieved` event, \nunless the item does not exist in the conversation history, in which case the \nserver will respond with an error.\n" + description: | + Returned when a session is updated with a `session.update` event, unless + there is an error. properties: event_id: type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. + description: The unique ID of the server event. type: x-stainless-const: true - description: The event type, must be `conversation.item.retrieve`. - const: conversation.item.retrieve - item_id: - type: string - description: The ID of the item to retrieve. + description: The event type, must be `session.updated`. + const: session.updated + session: + description: The session configuration. + anyOf: + - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' + - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' required: + - event_id - type - - item_id + - session x-oaiMeta: - name: conversation.item.retrieve + name: session.updated group: realtime example: | { - "event_id": "event_901", - "type": "conversation.item.retrieve", - "item_id": "item_003" + "type": "session.updated", + "event_id": "event_C9G8mqI3IucaojlVKE8Cs", + "session": { + "type": "realtime", + "object": "realtime.session", + "id": "sess_C9G8l3zp50uFv4qgxfJ8o", + "model": "gpt-realtime-2025-08-28", + "output_modalities": [ + "audio" + ], + "instructions": "Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.", + "tools": [ + { + "type": "function", + "name": "display_color_palette", + "description": "\nCall this function when a user asks for a color palette.\n", + "parameters": { + "type": "object", + "strict": true, + "properties": { + "theme": { + "type": "string", + "description": "Description of the theme for the color scheme." + }, + "colors": { + "type": "array", + "description": "Array of five hex color codes based on the theme.", + "items": { + "type": "string", + "description": "Hex color code" + } + } + }, + "required": [ + "theme", + "colors" + ] + } + } + ], + "tool_choice": "auto", + "max_output_tokens": "inf", + "tracing": null, + "prompt": null, + "expires_at": 1756324832, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": null, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200, + "idle_timeout_ms": null, + "create_response": true, + "interrupt_response": true + } + }, + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "marin", + "speed": 1 + } + }, + "include": null + }, } - RealtimeClientEventConversationItemTruncate: + RealtimeServerEventTranscriptionSessionUpdated: type: object - description: "Send this event to truncate a previous assistant message’s audio. The server \nwill produce audio faster than realtime, so this event is useful when the user \ninterrupts to truncate audio that has already been sent to the client but not \nyet played. This will synchronize the server's understanding of the audio with \nthe client's playback.\n\nTruncating audio will delete the server-side text transcript to ensure there \nis not text in the context that hasn't been heard by the user.\n\nIf successful, the server will respond with a `conversation.item.truncated` \nevent. \n" + description: "Returned when a transcription session is updated with a `transcription_session.update` event, unless \nthere is an error.\n" properties: event_id: type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. + description: The unique ID of the server event. type: x-stainless-const: true - description: The event type, must be `conversation.item.truncate`. - const: conversation.item.truncate - item_id: - type: string - description: "The ID of the assistant message item to truncate. Only assistant message \nitems can be truncated.\n" - content_index: - type: integer - description: The index of the content part to truncate. Set this to `0`. - audio_end_ms: - type: integer - description: "Inclusive duration up to which audio is truncated, in milliseconds. If \nthe audio_end_ms is greater than the actual audio duration, the server \nwill respond with an error.\n" + description: The event type, must be `transcription_session.updated`. + const: transcription_session.updated + session: + $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponse' required: + - event_id - type - - item_id - - content_index - - audio_end_ms + - session x-oaiMeta: - name: conversation.item.truncate + name: transcription_session.updated group: realtime example: | { - "event_id": "event_678", - "type": "conversation.item.truncate", - "item_id": "item_002", - "content_index": 0, - "audio_end_ms": 1500 + "event_id": "event_5678", + "type": "transcription_session.updated", + "session": { + "id": "sess_001", + "object": "realtime.transcription_session", + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "prompt": "", + "language": "" + }, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 500, + "create_response": true, + // "interrupt_response": false -- this will NOT be returned + }, + "input_audio_noise_reduction": { + "type": "near_field" + }, + "include": [ + "item.input_audio_transcription.avg_logprob", + ], + } } - RealtimeClientEventInputAudioBufferAppend: + RealtimeSession: type: object - description: "Send this event to append audio bytes to the input audio buffer. The audio \nbuffer is temporary storage you can write to and later commit. A \"commit\" will create a new\nuser message item in the conversation history from the buffer content and clear the buffer.\nInput audio transcription (if enabled) will be generated when the buffer is committed.\n\nIf VAD is enabled the audio buffer is used to detect speech and the server will decide \nwhen to commit. When Server VAD is disabled, you must commit the audio buffer\nmanually. Input audio noise reduction operates on writes to the audio buffer.\n\nThe client may choose how much audio to place in each event up to a maximum \nof 15 MiB, for example streaming smaller chunks from the client may allow the \nVAD to be more responsive. Unlike most other client events, the server will \nnot send a confirmation response to this event.\n" + description: Realtime session object for the beta interface. properties: - event_id: + id: type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. - type: - x-stainless-const: true - description: The event type, must be `input_audio_buffer.append`. - const: input_audio_buffer.append - audio: + description: | + Unique identifier for the session that looks like `sess_1234567890abcdef`. + object: + type: string + enum: + - realtime.session + description: The object type. Always `realtime.session`. + modalities: + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + items: + type: string + enum: + - text + - audio + model: + description: | + The Realtime model used for this session. + anyOf: + - type: string + - type: string + enum: + - gpt-realtime + - gpt-realtime-1.5 + - gpt-realtime-2025-08-28 + - gpt-4o-realtime-preview + - gpt-4o-realtime-preview-2024-10-01 + - gpt-4o-realtime-preview-2024-12-17 + - gpt-4o-realtime-preview-2025-06-03 + - gpt-4o-mini-realtime-preview + - gpt-4o-mini-realtime-preview-2024-12-17 + - gpt-realtime-mini + - gpt-realtime-mini-2025-10-06 + - gpt-realtime-mini-2025-12-15 + - gpt-audio-1.5 + - gpt-audio-mini + - gpt-audio-mini-2025-10-06 + - gpt-audio-mini-2025-12-15 + instructions: + type: string + description: | + The default system instructions (i.e. system message) prepended to model + calls. This field allows the client to guide the model on desired + responses. The model can be instructed on response content and format, + (e.g. "be extremely succinct", "act friendly", "here are examples of good + responses") and on audio behavior (e.g. "talk quickly", "inject emotion + into your voice", "laugh frequently"). The instructions are not + guaranteed to be followed by the model, but they provide guidance to the + model on the desired behavior. + + + Note that the server sets default instructions which will be used if this + field is not set and are visible in the `session.created` event at the + start of the session. + voice: + $ref: '#/components/schemas/VoiceIdsShared' + description: | + The voice the model uses to respond. Voice cannot be changed during the + session once the model has responded with audio at least once. Current + voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + `shimmer`, and `verse`. + input_audio_format: + type: string + default: pcm16 + enum: + - pcm16 + - g711_ulaw + - g711_alaw + description: | + The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, + single channel (mono), and little-endian byte order. + output_audio_format: + type: string + default: pcm16 + enum: + - pcm16 + - g711_ulaw + - g711_alaw + description: | + The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + For `pcm16`, output audio is sampled at a rate of 24kHz. + input_audio_transcription: + anyOf: + - allOf: + - $ref: '#/components/schemas/AudioTranscription' + description: | + Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service. + - type: 'null' + turn_detection: + $ref: '#/components/schemas/RealtimeTurnDetection' + input_audio_noise_reduction: + type: object + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + description: | + Configuration for input audio noise reduction. This can be set to `null` to turn off. + Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. + Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. + speed: + type: number + default: 1 + maximum: 1.5 + minimum: 0.25 + description: | + The speed of the model's spoken response. 1.0 is the default speed. 0.25 is + the minimum speed. 1.5 is the maximum speed. This value can only be changed + in between model turns, not while a response is in progress. + tracing: + anyOf: + - title: Tracing Configuration + description: | + Configuration options for tracing. Set to null to disable tracing. Once + tracing is enabled for a session, the configuration cannot be modified. + + `auto` will create a trace for the session with default values for the + workflow name, group id, and metadata. + anyOf: + - type: string + default: auto + description: | + Default tracing mode for the session. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: | + The name of the workflow to attach to this trace. This is used to + name the trace in the traces dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the traces dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the traces dashboard. + - type: 'null' + tools: + type: array + description: Tools (functions) available to the model. + items: + $ref: '#/components/schemas/RealtimeFunctionTool' + tool_choice: + type: string + default: auto + description: | + How the model chooses tools. Options are `auto`, `none`, `required`, or + specify a function. + temperature: + type: number + default: 0.8 + description: | + Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a temperature of 0.8 is highly recommended for best performance. + max_response_output_tokens: + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + anyOf: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + prompt: + anyOf: + - $ref: '#/components/schemas/Prompt' + - type: 'null' + include: + anyOf: + - type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: | + Additional fields to include in server outputs. + - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. + - type: 'null' + RealtimeSessionCreateRequest: + type: object + description: | + A new Realtime session configuration, with an ephemeral key. Default TTL + for keys is one minute. + properties: + client_secret: + type: object + description: Ephemeral key returned by the API. + properties: + value: + type: string + description: | + Ephemeral key usable in client environments to authenticate connections + to the Realtime API. Use this in client-side environments rather than + a standard API token, which should only be used server-side. + expires_at: + type: integer + format: unixtime + description: | + Timestamp for when the token expires. Currently, all tokens expire + after one minute. + required: + - value + - expires_at + modalities: + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + items: + type: string + enum: + - text + - audio + instructions: + type: string + description: | + The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. + Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session. + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + description: | + The voice the model uses to respond. Supported built-in voices are + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, + `marin`, and `cedar`. You may also provide a custom voice object with an + `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed during + the session once the model has responded with audio at least once. + input_audio_format: + type: string + description: | + The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + output_audio_format: + type: string + description: | + The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + input_audio_transcription: + type: object + description: | + Configuration for input audio transcription, defaults to off and can be + set to `null` to turn off once on. Input audio transcription is not native + to the model, since the model consumes audio directly. Transcription runs + asynchronously and should be treated as rough guidance + rather than the representation understood by the model. + properties: + model: + type: string + description: | + The model to use for transcription. + speed: + type: number + default: 1 + maximum: 1.5 + minimum: 0.25 + description: | + The speed of the model's spoken response. 1.0 is the default speed. 0.25 is + the minimum speed. 1.5 is the maximum speed. This value can only be changed + in between model turns, not while a response is in progress. + tracing: + title: Tracing Configuration + description: | + Configuration options for tracing. Set to null to disable tracing. Once + tracing is enabled for a session, the configuration cannot be modified. + + `auto` will create a trace for the session with default values for the + workflow name, group id, and metadata. + anyOf: + - type: string + default: auto + description: | + Default tracing mode for the session. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: | + The name of the workflow to attach to this trace. This is used to + name the trace in the traces dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the traces dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the traces dashboard. + turn_detection: + type: object + description: | + Configuration for turn detection. Can be set to `null` to turn off. Server + VAD means that the model will detect the start and end of speech based on + audio volume and respond at the end of user speech. + properties: + type: + type: string + description: | + Type of turn detection, only `server_vad` is currently supported. + threshold: + type: number + description: | + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A + higher threshold will require louder audio to activate the model, and + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: | + Duration of silence to detect speech stop (in milliseconds). Defaults + to 500ms. With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + tools: + type: array + description: Tools (functions) available to the model. + items: + type: object + properties: + type: + type: string + enum: + - function + description: The type of the tool, i.e. `function`. + x-stainless-const: true + name: + type: string + description: The name of the function. + description: + type: string + description: | + The description of the function, including guidance on when and how + to call it, and guidance about what to tell the user when calling + (if anything). + parameters: + type: object + description: Parameters of the function in JSON Schema. + tool_choice: type: string - description: "Base64-encoded audio bytes. This must be in the format specified by the \n`input_audio_format` field in the session configuration.\n" + description: | + How the model chooses tools. Options are `auto`, `none`, `required`, or + specify a function. + temperature: + type: number + description: | + Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + max_response_output_tokens: + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + anyOf: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + truncation: + $ref: '#/components/schemas/RealtimeTruncation' + prompt: + $ref: '#/components/schemas/Prompt' required: - - type - - audio + - client_secret x-oaiMeta: - name: input_audio_buffer.append + name: The session object group: realtime example: | { - "event_id": "event_456", - "type": "input_audio_buffer.append", - "audio": "Base64EncodedAudioData" + "id": "sess_001", + "object": "realtime.session", + "model": "gpt-realtime-2025-08-25", + "modalities": ["audio", "text"], + "instructions": "You are a friendly assistant.", + "voice": "alloy", + "input_audio_format": "pcm16", + "output_audio_format": "pcm16", + "input_audio_transcription": { + "model": "whisper-1" + }, + "turn_detection": null, + "tools": [], + "tool_choice": "none", + "temperature": 0.7, + "speed": 1.1, + "tracing": "auto", + "max_response_output_tokens": 200, + "truncation": "auto", + "prompt": null, + "client_secret": { + "value": "ek_abc123", + "expires_at": 1234567890 + } } - RealtimeClientEventInputAudioBufferClear: + RealtimeSessionCreateRequestGA: type: object - description: "Send this event to clear the audio bytes in the buffer. The server will \nrespond with an `input_audio_buffer.cleared` event.\n" + title: Realtime session configuration + description: Realtime session object configuration. properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. type: - x-stainless-const: true - description: The event type, must be `input_audio_buffer.clear`. - const: input_audio_buffer.clear - required: - - type - x-oaiMeta: - name: input_audio_buffer.clear - group: realtime - example: | - { - "event_id": "event_012", - "type": "input_audio_buffer.clear" - } - RealtimeClientEventInputAudioBufferCommit: - type: object - description: | - Send this event to commit the user input audio buffer, which will create a new user message item in the conversation. This event will produce an error if the input audio buffer is empty. When in Server VAD mode, the client does not need to send this event, the server will commit the audio buffer automatically. - - Committing the input audio buffer will trigger input audio transcription (if enabled in session configuration), but it will not create a response from the model. The server will respond with an `input_audio_buffer.committed` event. - properties: - event_id: type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. - type: + description: | + The type of session to create. Always `realtime` for the Realtime API. + enum: + - realtime x-stainless-const: true - description: The event type, must be `input_audio_buffer.commit`. - const: input_audio_buffer.commit + output_modalities: + type: array + description: | + The set of modalities the model can respond with. It defaults to `["audio"]`, indicating + that the model will respond with audio plus a transcript. `["text"]` can be used to make + the model respond with text only. It is not possible to request both `text` and `audio` at the same time. + default: + - audio + items: + type: string + enum: + - text + - audio + model: + anyOf: + - type: string + - type: string + enum: + - gpt-realtime + - gpt-realtime-1.5 + - gpt-realtime-2 + - gpt-realtime-2.1 + - gpt-realtime-2.1-mini + - gpt-realtime-2025-08-28 + - gpt-4o-realtime-preview + - gpt-4o-realtime-preview-2024-10-01 + - gpt-4o-realtime-preview-2024-12-17 + - gpt-4o-realtime-preview-2025-06-03 + - gpt-4o-mini-realtime-preview + - gpt-4o-mini-realtime-preview-2024-12-17 + - gpt-realtime-mini + - gpt-realtime-mini-2025-10-06 + - gpt-realtime-mini-2025-12-15 + - gpt-audio-1.5 + - gpt-audio-mini + - gpt-audio-mini-2025-10-06 + - gpt-audio-mini-2025-12-15 + x-stainless-nominal: false + description: | + The Realtime model used for this session. + instructions: + type: string + description: | + The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. + + Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session. + audio: + type: object + description: | + Configuration for input and output audio. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + description: The format of the input audio. + transcription: + description: | + Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service. + $ref: '#/components/schemas/AudioTranscription' + noise_reduction: + type: object + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + description: | + Configuration for input audio noise reduction. This can be set to `null` to turn off. + Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. + Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. + turn_detection: + $ref: '#/components/schemas/RealtimeTurnDetection' + output: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + description: The format of the output audio. + voice: + $ref: '#/components/schemas/VoiceIdsOrCustomVoice' + default: alloy + description: | + The voice the model uses to respond. Supported built-in voices are + `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, + `marin`, and `cedar`. You may also provide a custom voice object with + an `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed + during the session once the model has responded with audio at least once. + We recommend `marin` and `cedar` for best quality. + speed: + type: number + default: 1 + maximum: 1.5 + minimum: 0.25 + description: | + The speed of the model's spoken response as a multiple of the original speed. + 1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress. + + This parameter is a post-processing adjustment to the audio after it is generated, it's + also possible to prompt the model to speak faster or slower. + include: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: | + Additional fields to include in server outputs. + + `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. + tracing: + title: Tracing Configuration + anyOf: + - type: string + title: auto + default: auto + description: | + Enables tracing and sets default values for tracing configuration options. Always `auto`. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: | + The name of the workflow to attach to this trace. This is used to + name the trace in the Traces Dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the Traces Dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the Traces Dashboard. + description: | + Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once + tracing is enabled for a session, the configuration cannot be modified. + + `auto` will create a trace for the session with default values for the + workflow name, group id, and metadata. + nullable: true + tools: + type: array + description: Tools available to the model. + items: + anyOf: + - $ref: '#/components/schemas/RealtimeFunctionTool' + - $ref: '#/components/schemas/MCPTool' + discriminator: + propertyName: type + tool_choice: + description: | + How the model chooses tools. Provide one of the string modes or force a specific + function/MCP tool. + default: auto + anyOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + parallel_tool_calls: + type: boolean + description: | + Whether the model may call multiple tools in parallel. Only supported by + reasoning Realtime models such as `gpt-realtime-2`. + reasoning: + $ref: '#/components/schemas/RealtimeReasoning' + max_output_tokens: + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + anyOf: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + truncation: + $ref: '#/components/schemas/RealtimeTruncation' + prompt: + $ref: '#/components/schemas/Prompt' required: - type - x-oaiMeta: - name: input_audio_buffer.commit - group: realtime - example: | - { - "event_id": "event_789", - "type": "input_audio_buffer.commit" - } - RealtimeClientEventOutputAudioBufferClear: + RealtimeSessionCreateResponse: type: object + title: Realtime session configuration object description: | - **WebRTC/SIP Only:** Emit to cut off the current audio response. This will trigger the server to - stop generating audio and emit a `output_audio_buffer.cleared` event. This - event should be preceded by a `response.cancel` client event to stop the - generation of the current response. - [Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + A Realtime session configuration object. properties: - event_id: + id: type: string - description: The unique ID of the client event used for error handling. - type: - x-stainless-const: true - description: The event type, must be `output_audio_buffer.clear`. - const: output_audio_buffer.clear - required: - - type - x-oaiMeta: - name: output_audio_buffer.clear - group: realtime - example: | - { - "event_id": "optional_client_event_id", - "type": "output_audio_buffer.clear" - } - RealtimeClientEventResponseCancel: - type: object - description: "Send this event to cancel an in-progress response. The server will respond \nwith a `response.done` event with a status of `response.status=cancelled`. If \nthere is no response to cancel, the server will respond with an error. It's safe\nto call `response.cancel` even if no response is in progress, an error will be\nreturned the session will remain unaffected.\n" - properties: - event_id: + description: | + Unique identifier for the session that looks like `sess_1234567890abcdef`. + object: type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. - type: - x-stainless-const: true - description: The event type, must be `response.cancel`. - const: response.cancel - response_id: + description: The object type. Always `realtime.session`. + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + include: + type: array + items: + type: string + enum: + - item.input_audio_transcription.logprobs + description: | + Additional fields to include in server outputs. + - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. + model: type: string - description: "A specific response ID to cancel - if not provided, will cancel an \nin-progress response in the default conversation.\n" - required: - - type - x-oaiMeta: - name: response.cancel - group: realtime - example: | - { - "type": "response.cancel", - "response_id": "resp_12345" - } - RealtimeClientEventResponseCreate: - type: object - description: "This event instructs the server to create a Response, which means triggering \nmodel inference. When in Server VAD mode, the server will create Responses \nautomatically.\n\nA Response will include at least one Item, and may have two, in which case \nthe second will be a function call. These Items will be appended to the \nconversation history by default.\n\nThe server will respond with a `response.created` event, events for Items \nand content created, and finally a `response.done` event to indicate the \nResponse is complete.\n\nThe `response.create` event includes inference configuration like \n`instructions` and `tools`. If these are set, they will override the Session's \nconfiguration for this Response only.\n\nResponses can be created out-of-band of the default Conversation, meaning that they can\nhave arbitrary input, and it's possible to disable writing the output to the Conversation.\nOnly one Response can write to the default Conversation at a time, but otherwise multiple\nResponses can be created in parallel. The `metadata` field is a good way to disambiguate\nmultiple simultaneous Responses.\n\nClients can set `conversation` to `none` to create a Response that does not write to the default\nConversation. Arbitrary input can be provided with the `input` field, which is an array accepting\nraw Items and references to existing Items.\n" - properties: - event_id: + description: The Realtime model used for this session. + output_modalities: + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + items: + type: string + enum: + - text + - audio + instructions: type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. - type: - x-stainless-const: true - description: The event type, must be `response.create`. - const: response.create - response: - $ref: '#/components/schemas/RealtimeResponseCreateParams' - required: - - type - x-oaiMeta: - name: response.create - group: realtime - example: | - // Trigger a response with the default Conversation and no special parameters - { - "type": "response.create", - } + description: | + The default system instructions (i.e. system message) prepended to model + calls. This field allows the client to guide the model on desired + responses. The model can be instructed on response content and format, + (e.g. "be extremely succinct", "act friendly", "here are examples of good + responses") and on audio behavior (e.g. "talk quickly", "inject emotion + into your voice", "laugh frequently"). The instructions are not guaranteed + to be followed by the model, but they provide guidance to the model on the + desired behavior. - // Trigger an out-of-band response that does not write to the default Conversation - { - "type": "response.create", - "response": { - "instructions": "Provide a concise answer.", - "tools": [], // clear any session tools - "conversation": "none", - "output_modalities": ["text"], - "metadata": { - "response_purpose": "summarization" - }, - "input": [ - { - "type": "item_reference", - "id": "item_12345" - }, - { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "Summarize the above message in one sentence." - } - ] - } - ] - } - } - RealtimeClientEventSessionUpdate: - type: object - description: | - Send this event to update the session’s configuration. - The client may send this event at any time to update any field - except for `voice` and `model`. `voice` can be updated only if there have been no other audio outputs yet. + Note that the server sets default instructions which will be used if this + field is not set and are visible in the `session.created` event at the + start of the session. + audio: + type: object + description: | + Configuration for input and output audio for the session. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + transcription: + $ref: '#/components/schemas/AudioTranscription' + noise_reduction: + type: object + description: | + Configuration for input audio noise reduction. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + turn_detection: + type: object + description: | + Configuration for turn detection. + properties: + type: + type: string + description: | + Type of turn detection, only `server_vad` is currently supported. + threshold: + type: number + prefix_padding_ms: + type: integer + silence_duration_ms: + type: integer + output: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + voice: + $ref: '#/components/schemas/VoiceIdsShared' + speed: + type: number + tracing: + title: Tracing Configuration + description: | + Configuration options for tracing. Set to null to disable tracing. Once + tracing is enabled for a session, the configuration cannot be modified. - When the server receives a `session.update`, it will respond - with a `session.updated` event showing the full, effective configuration. - Only the fields that are present in the `session.update` are updated. To clear a field like - `instructions`, pass an empty string. To clear a field like `tools`, pass an empty array. - To clear a field like `turn_detection`, pass `null`. - properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. This is an arbitrary string that a client may assign. It will be passed back if there is an error with the event, but the corresponding `session.updated` event will not include it. - type: - x-stainless-const: true - description: The event type, must be `session.update`. - const: session.update - session: + `auto` will create a trace for the session with default values for the + workflow name, group id, and metadata. + anyOf: + - type: string + default: auto + description: | + Default tracing mode for the session. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: | + The name of the workflow to attach to this trace. This is used to + name the trace in the traces dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the traces dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the traces dashboard. + turn_detection: type: object description: | - Update the Realtime session. Choose either a realtime - session or a transcription session. - anyOf: - - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' - - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' - required: - - type - - session - x-oaiMeta: - name: session.update - group: realtime - example: | - { - "type": "session.update", - "session": { - "type": "realtime", - "instructions": "You are a creative assistant that helps with design tasks.", - "tools": [ - { - "type": "function", - "name": "display_color_palette", - "description": "Call this function when a user asks for a color palette.", - "parameters": { - "type": "object", - "properties": { - "theme": { - "type": "string", - "description": "Description of the theme for the color scheme." - }, - "colors": { - "type": "array", - "description": "Array of five hex color codes based on the theme.", - "items": { - "type": "string", - "description": "Hex color code" - } - } - }, - "required": [ - "theme", - "colors" - ] - } - } - ], - "tool_choice": "auto" - } - } - RealtimeClientEventTranscriptionSessionUpdate: - type: object - description: | - Send this event to update a transcription session. - properties: - event_id: + Configuration for turn detection. Can be set to `null` to turn off. Server + VAD means that the model will detect the start and end of speech based on + audio volume and respond at the end of user speech. + properties: + type: + type: string + description: | + Type of turn detection, only `server_vad` is currently supported. + threshold: + type: number + description: | + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A + higher threshold will require louder audio to activate the model, and + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: | + Duration of silence to detect speech stop (in milliseconds). Defaults + to 500ms. With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + tools: + type: array + description: Tools (functions) available to the model. + items: + $ref: '#/components/schemas/RealtimeFunctionTool' + tool_choice: type: string - description: Optional client-generated ID used to identify this event. - type: - x-stainless-const: true - description: The event type, must be `transcription_session.update`. - const: transcription_session.update - session: - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequest' - required: - - type - - session + description: | + How the model chooses tools. Options are `auto`, `none`, `required`, or + specify a function. + max_output_tokens: + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + anyOf: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true x-oaiMeta: - name: transcription_session.update + name: The session object group: realtime example: | { - "type": "transcription_session.update", - "session": { - "input_audio_format": "pcm16", - "input_audio_transcription": { - "model": "gpt-4o-transcribe", - "prompt": "", - "language": "" - }, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 500, - "create_response": true, - }, - "input_audio_noise_reduction": { - "type": "near_field" + "id": "sess_001", + "object": "realtime.session", + "expires_at": 1742188264, + "model": "gpt-realtime", + "output_modalities": ["audio"], + "instructions": "You are a friendly assistant.", + "tools": [], + "tool_choice": "none", + "max_output_tokens": "inf", + "tracing": "auto", + "truncation": "auto", + "prompt": null, + "audio": { + "input": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "transcription": { "model": "whisper-1" }, + "noise_reduction": null, + "turn_detection": null }, - "include": [ - "item.input_audio_transcription.logprobs", - ] + "output": { + "format": { + "type": "audio/pcm", + "rate": 24000 + }, + "voice": "alloy", + "speed": 1.0 + } } } - RealtimeConversationItem: - description: A single item within a Realtime conversation. - anyOf: - - $ref: '#/components/schemas/RealtimeConversationItemMessageSystem' - - $ref: '#/components/schemas/RealtimeConversationItemMessageUser' - - $ref: '#/components/schemas/RealtimeConversationItemMessageAssistant' - - $ref: '#/components/schemas/RealtimeConversationItemFunctionCall' - - $ref: '#/components/schemas/RealtimeConversationItemFunctionCallOutput' - - $ref: '#/components/schemas/RealtimeMCPApprovalResponse' - - $ref: '#/components/schemas/RealtimeMCPListTools' - - $ref: '#/components/schemas/RealtimeMCPToolCall' - - $ref: '#/components/schemas/RealtimeMCPApprovalRequest' - discriminator: - propertyName: type - RealtimeConversationItemFunctionCall: - type: object - title: Realtime function call item - description: A function call item in a Realtime conversation. - properties: - id: - type: string - description: The unique ID of the item. This may be provided by the client or generated by the server. - object: - type: string - enum: - - realtime.item - description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. - x-stainless-const: true - type: - type: string - enum: - - function_call - description: The type of the item. Always `function_call`. - x-stainless-const: true - status: - type: string - enum: - - completed - - incomplete - - in_progress - description: The status of the item. Has no effect on the conversation. - call_id: - type: string - description: The ID of the function call. - name: - type: string - description: The name of the function being called. - arguments: - type: string - description: 'The arguments of the function call. This is a JSON-encoded string representing the arguments passed to the function, for example `{"arg1": "value1", "arg2": 42}`.' - required: - - type - - name - - arguments - RealtimeConversationItemFunctionCallOutput: + RealtimeSessionCreateResponseGA: type: object - title: Realtime function call output item - description: A function call output item in a Realtime conversation. + title: Realtime session configuration object + description: | + A Realtime session configuration object. properties: - id: - type: string - description: The unique ID of the item. This may be provided by the client or generated by the server. - object: - type: string - enum: - - realtime.item - description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. - x-stainless-const: true type: type: string + description: | + The type of session to create. Always `realtime` for the Realtime API. enum: - - function_call_output - description: The type of the item. Always `function_call_output`. + - realtime x-stainless-const: true - status: - type: string - enum: - - completed - - incomplete - - in_progress - description: The status of the item. Has no effect on the conversation. - call_id: - type: string - description: The ID of the function call this output is for. - output: - type: string - description: The output of the function call, this is free text and can contain any information or simply be empty. - required: - - type - - call_id - - output - RealtimeConversationItemMessageAssistant: - type: object - title: Realtime assistant message item - description: An assistant message item in a Realtime conversation. - properties: id: type: string - description: The unique ID of the item. This may be provided by the client or generated by the server. + description: | + Unique identifier for the session that looks like `sess_1234567890abcdef`. object: type: string + description: The object type. Always `realtime.session`. enum: - - realtime.item - description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. - x-stainless-const: true - type: - type: string - enum: - - message - description: The type of the item. Always `message`. + - realtime.session x-stainless-const: true - status: - type: string - enum: - - completed - - incomplete - - in_progress - description: The status of the item. Has no effect on the conversation. - role: + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + output_modalities: + type: array + description: | + The set of modalities the model can respond with. It defaults to `["audio"]`, indicating + that the model will respond with audio plus a transcript. `["text"]` can be used to make + the model respond with text only. It is not possible to request both `text` and `audio` at the same time. + default: + - audio + items: + type: string + enum: + - text + - audio + model: + anyOf: + - type: string + - type: string + enum: + - gpt-realtime + - gpt-realtime-1.5 + - gpt-realtime-2 + - gpt-realtime-2.1 + - gpt-realtime-2.1-mini + - gpt-realtime-2025-08-28 + - gpt-4o-realtime-preview + - gpt-4o-realtime-preview-2024-10-01 + - gpt-4o-realtime-preview-2024-12-17 + - gpt-4o-realtime-preview-2025-06-03 + - gpt-4o-mini-realtime-preview + - gpt-4o-mini-realtime-preview-2024-12-17 + - gpt-realtime-mini + - gpt-realtime-mini-2025-10-06 + - gpt-realtime-mini-2025-12-15 + - gpt-audio-1.5 + - gpt-audio-mini + - gpt-audio-mini-2025-10-06 + - gpt-audio-mini-2025-12-15 + description: | + The Realtime model used for this session. + instructions: type: string - enum: - - assistant - description: The role of the message sender. Always `assistant`. - x-stainless-const: true - content: + description: | + The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. + + Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session. + audio: + type: object + description: | + Configuration for input and output audio. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + description: The format of the input audio. + transcription: + $ref: '#/components/schemas/AudioTranscription' + noise_reduction: + type: object + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + description: | + Configuration for input audio noise reduction. This can be set to `null` to turn off. + Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. + Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. + turn_detection: + $ref: '#/components/schemas/RealtimeTurnDetection' + output: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + description: The format of the output audio. + voice: + $ref: '#/components/schemas/VoiceIdsShared' + default: alloy + description: | + The voice the model uses to respond. Voice cannot be changed during the + session once the model has responded with audio at least once. Current + voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, + `shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for + best quality. + speed: + type: number + default: 1 + maximum: 1.5 + minimum: 0.25 + description: | + The speed of the model's spoken response as a multiple of the original speed. + 1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress. + + This parameter is a post-processing adjustment to the audio after it is generated, it's + also possible to prompt the model to speak faster or slower. + include: type: array - description: The content of the message. items: - type: object - properties: - type: - type: string - enum: - - output_text - - output_audio - description: The content type, `output_text` or `output_audio` depending on the session `output_modalities` configuration. - text: - type: string - description: The text content. - audio: - type: string - description: Base64-encoded audio bytes, these will be parsed as the format specified in the session output audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified. - transcript: - type: string - description: The transcript of the audio content, this will always be present if the output type is `audio`. + type: string + enum: + - item.input_audio_transcription.logprobs + description: | + Additional fields to include in server outputs. + + `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. + tracing: + anyOf: + - title: Tracing Configuration + anyOf: + - type: string + title: auto + default: auto + description: | + Enables tracing and sets default values for tracing configuration options. Always `auto`. + enum: + - auto + x-stainless-const: true + - type: object + title: Tracing Configuration + description: | + Granular configuration for tracing. + properties: + workflow_name: + type: string + description: | + The name of the workflow to attach to this trace. This is used to + name the trace in the Traces Dashboard. + group_id: + type: string + description: | + The group id to attach to this trace to enable filtering and + grouping in the Traces Dashboard. + metadata: + type: object + description: | + The arbitrary metadata to attach to this trace to enable + filtering in the Traces Dashboard. + description: | + Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once + tracing is enabled for a session, the configuration cannot be modified. + + `auto` will create a trace for the session with default values for the + workflow name, group id, and metadata. + - type: 'null' + tools: + type: array + description: Tools available to the model. + items: + anyOf: + - $ref: '#/components/schemas/RealtimeFunctionTool' + - $ref: '#/components/schemas/MCPTool' + tool_choice: + description: | + How the model chooses tools. Provide one of the string modes or force a specific + function/MCP tool. + default: auto + anyOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + reasoning: + $ref: '#/components/schemas/RealtimeReasoning' + max_output_tokens: + description: | + Maximum number of output tokens for a single assistant response, + inclusive of tool calls. Provide an integer between 1 and 4096 to + limit output tokens, or `inf` for the maximum available tokens for a + given model. Defaults to `inf`. + anyOf: + - type: integer + - type: string + enum: + - inf + x-stainless-const: true + truncation: + $ref: '#/components/schemas/RealtimeTruncation' + prompt: + $ref: '#/components/schemas/Prompt' required: - type - - role - - content - RealtimeConversationItemMessageSystem: + - id + - object + x-oaiMeta: + name: The session object + group: realtime + RealtimeTranscriptionSessionCreateRequest: type: object - title: Realtime system message item - description: A system message in a Realtime conversation can be used to provide additional context or instructions to the model. This is similar but distinct from the instruction prompt provided at the start of a conversation, as system messages can be added at any point in the conversation. For major changes to the conversation's behavior, use instructions, but for smaller updates (e.g. "the user is now asking about a different topic"), use system messages. + title: Realtime transcription session configuration + description: Realtime transcription session object configuration. properties: - id: - type: string - description: The unique ID of the item. This may be provided by the client or generated by the server. - object: - type: string - enum: - - realtime.item - description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. - x-stainless-const: true - type: - type: string - enum: - - message - description: The type of the item. Always `message`. - x-stainless-const: true - status: - type: string - enum: - - completed - - incomplete - - in_progress - description: The status of the item. Has no effect on the conversation. - role: + turn_detection: + type: object + description: | + Configuration for turn detection. Can be set to `null` to turn off. Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech. + properties: + type: + type: string + description: | + Type of turn detection. Only `server_vad` is currently supported for transcription sessions. + enum: + - server_vad + threshold: + type: number + description: | + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A + higher threshold will require louder audio to activate the model, and + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: | + Duration of silence to detect speech stop (in milliseconds). Defaults + to 500ms. With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + input_audio_noise_reduction: + type: object + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + description: | + Configuration for input audio noise reduction. This can be set to `null` to turn off. + Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. + Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. + input_audio_format: type: string + default: pcm16 enum: - - system - description: The role of the message sender. Always `system`. - x-stainless-const: true - content: + - pcm16 + - g711_ulaw + - g711_alaw + description: | + The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, + single channel (mono), and little-endian byte order. + input_audio_transcription: + description: | + Configuration for input audio transcription. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service. + $ref: '#/components/schemas/AudioTranscription' + include: type: array - description: The content of the message. items: - type: object - properties: - type: - type: string - enum: - - input_text - description: The content type. Always `input_text` for system messages. - x-stainless-const: true - text: - type: string - description: The text content. - required: - - type - - role - - content - RealtimeConversationItemMessageUser: + type: string + enum: + - item.input_audio_transcription.logprobs + description: | + The set of items to include in the transcription. Current available items are: + `item.input_audio_transcription.logprobs` + RealtimeTranscriptionSessionCreateRequestGA: type: object - title: Realtime user message item - description: A user message item in a Realtime conversation. + title: Realtime transcription session configuration + description: Realtime transcription session object configuration. properties: - id: - type: string - description: The unique ID of the item. This may be provided by the client or generated by the server. - object: - type: string - enum: - - realtime.item - description: Identifier for the API object being returned - always `realtime.item`. Optional when creating a new item. - x-stainless-const: true type: type: string + description: | + The type of session to create. Always `transcription` for transcription sessions. enum: - - message - description: The type of the item. Always `message`. - x-stainless-const: true - status: - type: string - enum: - - completed - - incomplete - - in_progress - description: The status of the item. Has no effect on the conversation. - role: - type: string - enum: - - user - description: The role of the message sender. Always `user`. + - transcription x-stainless-const: true - content: + audio: + type: object + description: | + Configuration for input and output audio. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + transcription: + description: | + Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service. + $ref: '#/components/schemas/AudioTranscription' + noise_reduction: + type: object + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + description: | + Configuration for input audio noise reduction. This can be set to `null` to turn off. + Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. + Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. + turn_detection: + $ref: '#/components/schemas/RealtimeTurnDetection' + include: type: array - description: The content of the message. items: - type: object - properties: - type: - type: string - enum: - - input_text - - input_audio - - input_image - description: The content type (`input_text`, `input_audio`, or `input_image`). - text: - type: string - description: The text content (for `input_text`). - audio: - type: string - description: Base64-encoded audio bytes (for `input_audio`), these will be parsed as the format specified in the session input audio type configuration. This defaults to PCM 16-bit 24kHz mono if not specified. - image_url: - type: string - format: uri - description: Base64-encoded image bytes (for `input_image`) as a data URI. For example `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...`. Supported formats are PNG and JPEG. - detail: - type: string - description: The detail level of the image (for `input_image`). `auto` will default to `high`. - default: auto - enum: - - auto - - low - - high - transcript: - type: string - description: Transcript of the audio (for `input_audio`). This is not sent to the model, but will be attached to the message item for reference. + type: string + enum: + - item.input_audio_transcription.logprobs + description: | + Additional fields to include in server outputs. + + `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. required: - type - - role - - content - RealtimeConversationItemWithReference: + RealtimeTranscriptionSessionCreateResponse: type: object - description: The item to add to the conversation. + description: | + A new Realtime transcription session configuration. + + When a session is created on the server via REST API, the session object + also contains an ephemeral key. Default TTL for keys is 10 minutes. This + property is not present when a session is updated via the WebSocket API. properties: - id: + client_secret: + type: object + description: | + Ephemeral key returned by the API. Only present when the session is + created on the server via REST API. + properties: + value: + type: string + description: | + Ephemeral key usable in client environments to authenticate connections + to the Realtime API. Use this in client-side environments rather than + a standard API token, which should only be used server-side. + expires_at: + type: integer + format: unixtime + description: | + Timestamp for when the token expires. Currently, all tokens expire + after one minute. + required: + - value + - expires_at + modalities: + description: | + The set of modalities the model can respond with. To disable audio, + set this to ["text"]. + items: + type: string + enum: + - text + - audio + input_audio_format: type: string description: | - For an item of type (`message` | `function_call` | `function_call_output`) - this field allows the client to assign the unique ID of the item. It is - not required because the server will generate one if not provided. - - For an item of type `item_reference`, this field is required and is a - reference to any item that has previously existed in the conversation. + The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + input_audio_transcription: + $ref: '#/components/schemas/AudioTranscription' + turn_detection: + type: object + description: | + Configuration for turn detection. Can be set to `null` to turn off. Server + VAD means that the model will detect the start and end of speech based on + audio volume and respond at the end of user speech. + properties: + type: + type: string + description: | + Type of turn detection, only `server_vad` is currently supported. + threshold: + type: number + description: | + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A + higher threshold will require louder audio to activate the model, and + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: | + Duration of silence to detect speech stop (in milliseconds). Defaults + to 500ms. With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + required: + - client_secret + x-oaiMeta: + name: The transcription session object + group: realtime + example: | + { + "id": "sess_BBwZc7cFV3XizEyKGDCGL", + "object": "realtime.transcription_session", + "expires_at": 1742188264, + "modalities": ["audio", "text"], + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200 + }, + "input_audio_format": "pcm16", + "input_audio_transcription": { + "model": "gpt-4o-transcribe", + "language": null, + "prompt": "" + }, + "client_secret": null + } + RealtimeTranscriptionSessionCreateResponseGA: + type: object + title: Realtime transcription session configuration object + description: | + A Realtime transcription session configuration object. + properties: type: type: string - enum: - - message - - function_call - - function_call_output - - item_reference description: | - The type of the item (`message`, `function_call`, `function_call_output`, `item_reference`). - object: - type: string + The type of session. Always `transcription` for transcription sessions. enum: - - realtime.item - description: | - Identifier for the API object being returned - always `realtime.item`. + - transcription x-stainless-const: true - status: + id: type: string - enum: - - completed - - incomplete - - in_progress - description: "The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect \non the conversation, but are accepted for consistency with the \n`conversation.item.created` event.\n" - role: + description: | + Unique identifier for the session that looks like `sess_1234567890abcdef`. + object: type: string - enum: - - user - - assistant - - system - description: "The role of the message sender (`user`, `assistant`, `system`), only \napplicable for `message` items.\n" - content: + description: The object type. Always `realtime.transcription_session`. + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + include: type: array - description: "The content of the message, applicable for `message` items. \n- Message items of role `system` support only `input_text` content\n- Message items of role `user` support `input_text` and `input_audio` \n content\n- Message items of role `assistant` support `text` content.\n" items: - type: object - properties: - type: - type: string - enum: - - input_text - - input_audio - - item_reference - - text - description: | - The content type (`input_text`, `input_audio`, `item_reference`, `text`). - text: - type: string - description: | - The text content, used for `input_text` and `text` content types. - id: - type: string - description: | - ID of a previous conversation item to reference (for `item_reference` - content types in `response.create` events). These can reference both - client and server created items. - audio: - type: string - description: | - Base64-encoded audio bytes, used for `input_audio` content type. - transcript: - type: string - description: | - The transcript of the audio, used for `input_audio` content type. - call_id: + type: string + enum: + - item.input_audio_transcription.logprobs + description: | + Additional fields to include in server outputs. + - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. + audio: + type: object + description: | + Configuration for input audio for the session. + properties: + input: + type: object + properties: + format: + $ref: '#/components/schemas/RealtimeAudioFormats' + transcription: + $ref: '#/components/schemas/AudioTranscription' + noise_reduction: + type: object + description: | + Configuration for input audio noise reduction. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + turn_detection: + description: | + Configuration for turn detection. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported. + anyOf: + - type: object + description: | + Configuration for turn detection. Can be set to `null` to turn off. Server + VAD means that the model will detect the start and end of speech based on + audio volume and respond at the end of user speech. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported. + properties: + type: + type: string + description: | + Type of turn detection, only `server_vad` is currently supported. + threshold: + type: number + description: | + Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A + higher threshold will require louder audio to activate the model, and + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: | + Duration of silence to detect speech stop (in milliseconds). Defaults + to 500ms. With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + - type: 'null' + required: + - type + - id + - object + x-oaiMeta: + name: The transcription session object + group: realtime + example: | + { + "id": "sess_BBwZc7cFV3XizEyKGDCGL", + "type": "transcription", + "object": "realtime.transcription_session", + "expires_at": 1742188264, + "include": ["item.input_audio_transcription.logprobs"], + "audio": { + "input": { + "format": "pcm16", + "transcription": { + "model": "gpt-4o-transcribe", + "language": null, + "prompt": "" + }, + "noise_reduction": null, + "turn_detection": { + "type": "server_vad", + "threshold": 0.5, + "prefix_padding_ms": 300, + "silence_duration_ms": 200 + } + } + } + } + RealtimeTranslationClientEvent: + discriminator: + propertyName: type + description: | + A Realtime translation client event. + anyOf: + - $ref: '#/components/schemas/RealtimeTranslationClientEventSessionUpdate' + - $ref: '#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend' + - $ref: '#/components/schemas/RealtimeTranslationClientEventSessionClose' + RealtimeTranslationClientEventInputAudioBufferAppend: + type: object + description: | + Send this event to append audio bytes to the translation session input audio buffer. + + WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono + little-endian raw audio bytes. Unsupported websocket audio formats return a + validation error because lower-quality audio materially degrades translation + quality. + + Translation consumes 200 ms engine frames. For best realtime behavior, append + audio in 200 ms chunks. If a chunk is shorter, the server buffers it until it + has enough audio for one frame. If a chunk is longer, the server splits it into + 200 ms frames and enqueues them back-to-back. + + Keep appending silence while the session is active. If a client stops sending + audio and later resumes, model time treats the resumed audio as contiguous with + the previous audio rather than as a real-world pause. + properties: + event_id: type: string - description: "The ID of the function call (for `function_call` and \n`function_call_output` items). If passed on a `function_call_output` \nitem, the server will check that a `function_call` item with the same \nID exists in the conversation history.\n" - name: + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: + x-stainless-const: true + description: The event type, must be `session.input_audio_buffer.append`. + const: session.input_audio_buffer.append + audio: type: string - description: | - The name of the function being called (for `function_call` items). - arguments: + description: Base64-encoded 24 kHz PCM16 mono audio bytes. + required: + - type + - audio + x-oaiMeta: + name: session.input_audio_buffer.append + group: realtime + example: | + { + "event_id": "event_456", + "type": "session.input_audio_buffer.append", + "audio": "Base64EncodedAudioData" + } + RealtimeTranslationClientEventSessionClose: + type: object + description: | + Gracefully close the realtime translation session. The server flushes pending + input audio and emits any remaining translated output before closing the + session. + properties: + event_id: type: string - description: | - The arguments of the function call (for `function_call` items). - output: + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: + x-stainless-const: true + description: The event type, must be `session.close`. + const: session.close + required: + - type + x-oaiMeta: + name: session.close + group: realtime + example: | + { + "event_id": "event_789", + "type": "session.close" + } + RealtimeTranslationClientEventSessionUpdate: + type: object + description: | + Send this event to update the translation session configuration. Translation + sessions support updates to `audio.output.language`, `audio.input.transcription`, + and `audio.input.noise_reduction`. + properties: + event_id: type: string + maxLength: 512 + description: Optional client-generated ID used to identify this event. + type: + x-stainless-const: true + description: The event type, must be `session.update`. + const: session.update + session: + $ref: '#/components/schemas/RealtimeTranslationSessionUpdateRequest' description: | - The output of the function call (for `function_call_output` items). - RealtimeCreateClientSecretRequest: + Translation session fields to update. The session `type` and `model` are set + at creation and cannot be changed with `session.update`. + required: + - type + - session + x-oaiMeta: + name: session.update + group: realtime + example: | + { + "type": "session.update", + "session": { + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper" + }, + "noise_reduction": null + }, + "output": { + "language": "es" + } + } + } + } + RealtimeTranslationClientSecretCreateRequest: type: object - title: Realtime client secret creation request + title: Realtime translation client secret creation request description: | - Create a session and client secret for the Realtime API. The request can specify - either a realtime or a transcription session configuration. - [Learn more about the Realtime API](https://developers.openai.com/api/docs/guides/realtime). + Create a translation session and client secret for the Realtime API. properties: expires_after: type: object @@ -47608,20 +55220,14 @@ components: maximum: 7200 default: 600 session: - title: Session configuration - description: | - Session configuration to use for the client secret. Choose either a realtime - session or a transcription session. - anyOf: - - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' - - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' - discriminator: - propertyName: type - RealtimeCreateClientSecretResponse: + $ref: '#/components/schemas/RealtimeTranslationSessionCreateRequest' + required: + - session + RealtimeTranslationClientSecretCreateResponse: type: object - title: Realtime session and client secret + title: Realtime translation session and client secret description: | - Response from creating a session and client secret for the Realtime API. + Response from creating a translation session and client secret for the Realtime API. properties: value: type: string @@ -47631,22157 +55237,25367 @@ components: format: unixtime description: Expiration timestamp for the client secret, in seconds since epoch. session: - title: Session configuration - description: | - The session configuration for either a realtime or transcription session. - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/RealtimeSessionCreateResponseGA' - - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponseGA' + $ref: '#/components/schemas/RealtimeTranslationSession' required: - value - expires_at - session x-oaiMeta: - name: Session response object + name: Translation session response object group: realtime example: | { "value": "ek_68af296e8e408191a1120ab6383263c2", "expires_at": 1756310470, "session": { - "type": "realtime", - "object": "realtime.session", "id": "sess_C9CiUVUzUzYIssh3ELY1d", - "model": "gpt-realtime-2025-08-25", - "output_modalities": [ - "audio" - ], - "instructions": "You are a friendly assistant.", - "tools": [], - "tool_choice": "auto", - "max_output_tokens": "inf", - "tracing": null, - "truncation": "auto", - "prompt": null, - "expires_at": 0, + "type": "translation", + "expires_at": 1756310470, + "model": "gpt-realtime-translate", "audio": { "input": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, "transcription": null, - "noise_reduction": null, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 200, - "idle_timeout_ms": null, - "create_response": true, - "interrupt_response": true - } + "noise_reduction": null }, "output": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "voice": "alloy", - "speed": 1.0 + "language": "es" } - }, - "include": null + } } } - RealtimeFunctionTool: - type: object - title: Function tool - properties: - type: - type: string - enum: - - function - description: The type of the tool, i.e. `function`. - x-stainless-const: true - name: - type: string - description: The name of the function. - description: - type: string - description: | - The description of the function, including guidance on when and how - to call it, and guidance about what to tell the user when calling - (if anything). - parameters: - type: object - description: Parameters of the function in JSON Schema. - RealtimeMCPApprovalRequest: + RealtimeTranslationServerEvent: + discriminator: + propertyName: type + description: | + A Realtime translation server event. + anyOf: + - $ref: '#/components/schemas/RealtimeServerEventError' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionCreated' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionUpdated' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionClosed' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta' + - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta' + RealtimeTranslationServerEventSessionClosed: type: object - title: Realtime MCP approval request description: | - A Realtime item requesting human approval of a tool invocation. + Returned when a realtime translation session is closed. properties: - type: + event_id: type: string - enum: - - mcp_approval_request - description: The type of the item. Always `mcp_approval_request`. + description: The unique ID of the server event. + type: x-stainless-const: true - id: - type: string - description: The unique ID of the approval request. - server_label: - type: string - description: The label of the MCP server making the request. - name: - type: string - description: The name of the tool to run. - arguments: - type: string - description: A JSON string of arguments for the tool. + description: The event type, must be `session.closed`. + const: session.closed required: + - event_id - type - - id - - server_label - - name - - arguments - RealtimeMCPApprovalResponse: + x-oaiMeta: + name: session.closed + group: realtime + example: | + { + "event_id": "event_987", + "type": "session.closed" + } + RealtimeTranslationServerEventSessionCreated: type: object - title: Realtime MCP approval response description: | - A Realtime item responding to an MCP approval request. + Returned when a translation session is created. Emitted automatically when a + new connection is established as the first server event. This event contains + the default translation session configuration. properties: - type: + event_id: type: string - enum: - - mcp_approval_response - description: The type of the item. Always `mcp_approval_response`. + description: The unique ID of the server event. + type: x-stainless-const: true - id: - type: string - description: The unique ID of the approval response. - approval_request_id: - type: string - description: The ID of the approval request being answered. - approve: - type: boolean - description: Whether the request was approved. - reason: - anyOf: - - type: string - description: Optional reason for the decision. - - type: 'null' + description: The event type, must be `session.created`. + const: session.created + session: + $ref: '#/components/schemas/RealtimeTranslationSession' + description: The translation session configuration. required: + - event_id - type - - id - - approval_request_id - - approve - RealtimeMCPHTTPError: + - session + x-oaiMeta: + name: session.created + group: realtime + example: | + { + "type": "session.created", + "event_id": "event_123", + "session": { + "id": "sess_123", + "type": "translation", + "model": "gpt-realtime-translate", + "expires_at": 1714857600, + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper", + "language": "en" + }, + "noise_reduction": { + "type": "near_field" + } + }, + "output": { + "language": "fr" + } + } + } + } + RealtimeTranslationServerEventSessionInputTranscriptDelta: type: object - title: Realtime MCP HTTP error + description: | + Returned when optional source-language transcript text is available. This event + is emitted only when `audio.input.transcription` is configured. + + Transcript deltas are append-only text fragments. Clients should not insert + unconditional spaces between deltas. properties: - type: + event_id: type: string - enum: - - http_error + description: The unique ID of the server event. + type: x-stainless-const: true - code: - type: integer - message: + description: The event type, must be `session.input_transcript.delta`. + const: session.input_transcript.delta + delta: type: string + description: Append-only source-language transcript text. + elapsed_ms: + anyOf: + - type: integer + description: | + Timing metadata for stream alignment, derived from the translation frame + when available. It advances in 200 ms increments, but multiple transcript + deltas may share the same `elapsed_ms`. Treat it as alignment metadata, + not a unique transcript-delta identifier. + - type: 'null' required: + - event_id - type - - code - - message - RealtimeMCPListTools: + - delta + x-oaiMeta: + name: session.input_transcript.delta + group: realtime + example: | + { + "event_id": "event_125", + "type": "session.input_transcript.delta", + "delta": " hear", + "elapsed_ms": 1200 + } + RealtimeTranslationServerEventSessionOutputAudioDelta: type: object - title: Realtime MCP list tools description: | - A Realtime item listing tools available on an MCP server. + Returned when translated output audio is available. The `delta` contains a + PCM16 audio chunk whose length can vary. Clients should decode and queue the + complete delta instead of assuming a fixed byte or sample count. properties: - type: + event_id: type: string - enum: - - mcp_list_tools - description: The type of the item. Always `mcp_list_tools`. + description: The unique ID of the server event. + type: x-stainless-const: true - id: - type: string - description: The unique ID of the list. - server_label: + description: The event type, must be `session.output_audio.delta`. + const: session.output_audio.delta + delta: type: string - description: The label of the MCP server. - tools: - type: array - items: - $ref: '#/components/schemas/MCPListToolsTool' - description: The tools available on the server. - required: - - type - - server_label - - tools - RealtimeMCPProtocolError: - type: object - title: Realtime MCP protocol error - properties: - type: + description: Base64-encoded translated audio data. + sample_rate: + type: integer + description: Sample rate of the audio delta. + default: 24000 + channels: + type: integer + description: Number of audio channels. + default: 1 + format: type: string enum: - - protocol_error + - pcm16 + description: Audio encoding for `delta`. x-stainless-const: true - code: - type: integer - message: - type: string + elapsed_ms: + anyOf: + - type: integer + description: | + Timing metadata for stream alignment, derived from the translation frame + when available. Treat `elapsed_ms` as alignment metadata, not a unique + event identifier. + - type: 'null' required: + - event_id - type - - code - - message - RealtimeMCPToolCall: + - delta + x-oaiMeta: + name: session.output_audio.delta + group: realtime + example: | + { + "event_id": "event_123", + "type": "session.output_audio.delta", + "delta": "Base64EncodedAudioDelta", + "sample_rate": 24000, + "channels": 1, + "format": "pcm16", + "elapsed_ms": 1200 + } + RealtimeTranslationServerEventSessionOutputTranscriptDelta: type: object - title: Realtime MCP tool call description: | - A Realtime item representing an invocation of a tool on an MCP server. + Returned when translated transcript text is available. + + Transcript deltas are append-only text fragments. Clients should not insert + unconditional spaces between deltas. properties: - type: + event_id: type: string - enum: - - mcp_call - description: The type of the item. Always `mcp_call`. + description: The unique ID of the server event. + type: x-stainless-const: true - id: - type: string - description: The unique ID of the tool call. - server_label: - type: string - description: The label of the MCP server running the tool. - name: - type: string - description: The name of the tool that was run. - arguments: + description: The event type, must be `session.output_transcript.delta`. + const: session.output_transcript.delta + delta: type: string - description: A JSON string of the arguments passed to the tool. - approval_request_id: - anyOf: - - type: string - description: The ID of an associated approval request, if any. - - type: 'null' - output: - anyOf: - - type: string - description: The output from the tool call. - - type: 'null' - error: + description: Append-only transcript text for the translated output audio. + elapsed_ms: anyOf: - - description: The error from the tool call, if any. - anyOf: - - $ref: '#/components/schemas/RealtimeMCPProtocolError' - - $ref: '#/components/schemas/RealtimeMCPToolExecutionError' - - $ref: '#/components/schemas/RealtimeMCPHTTPError' - discriminator: - propertyName: type + - type: integer + description: | + Timing metadata for stream alignment, derived from the translation frame + when available. It advances in 200 ms increments, but multiple transcript + deltas may share the same `elapsed_ms`. Treat it as alignment metadata, + not a unique transcript-delta identifier. - type: 'null' required: + - event_id - type - - id - - server_label - - name - - arguments - RealtimeMCPToolExecutionError: + - delta + x-oaiMeta: + name: session.output_transcript.delta + group: realtime + example: | + { + "event_id": "event_124", + "type": "session.output_transcript.delta", + "delta": " escuch", + "elapsed_ms": 1200 + } + RealtimeTranslationServerEventSessionUpdated: type: object - title: Realtime MCP tool execution error + description: | + Returned when a translation session is updated with a `session.update` event, + unless there is an error. properties: - type: + event_id: type: string - enum: - - tool_execution_error + description: The unique ID of the server event. + type: x-stainless-const: true - message: - type: string + description: The event type, must be `session.updated`. + const: session.updated + session: + $ref: '#/components/schemas/RealtimeTranslationSession' + description: The translation session configuration. required: + - event_id - type - - message - RealtimeReasoning: + - session + x-oaiMeta: + name: session.updated + group: realtime + example: | + { + "type": "session.updated", + "event_id": "event_124", + "session": { + "id": "sess_123", + "type": "translation", + "model": "gpt-realtime-translate", + "expires_at": 1714857600, + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper", + "language": "en" + }, + "noise_reduction": { + "type": "near_field" + } + }, + "output": { + "language": "es" + } + } + } + } + RealtimeTranslationSession: type: object - title: Realtime reasoning configuration - description: | - Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. - properties: - effort: - $ref: '#/components/schemas/RealtimeReasoningEffort' - RealtimeReasoningEffort: - type: string + title: Realtime translation session description: | - Constrains effort on reasoning for reasoning-capable Realtime models such as - `gpt-realtime-2`. - enum: - - minimal - - low - - medium - - high - - xhigh - default: low - RealtimeResponse: - type: object - description: The response resource. + A Realtime translation session. Translation sessions continuously translate input + audio into the configured output language. properties: id: type: string - description: The unique ID of the response, will look like `resp_1234`. - object: - x-stainless-const: true - description: The object type, must be `realtime.response`. - const: realtime.response - status: + description: | + Unique identifier for the session that looks like `sess_1234567890abcdef`. + type: type: string enum: - - completed - - cancelled - - failed - - incomplete - - in_progress - description: "The final status of the response (`completed`, `cancelled`, `failed`, or \n`incomplete`, `in_progress`).\n" - status_details: + - translation + description: | + The session type. Always `translation` for Realtime translation sessions. + x-stainless-const: true + expires_at: + type: integer + format: unixtime + description: Expiration timestamp for the session, in seconds since epoch. + model: + type: string + description: | + The Realtime translation model used for this session. This field is set at + session creation and cannot be changed with `session.update`. + audio: type: object - description: Additional details about the status. + description: | + Configuration for translation input and output audio. properties: - type: - type: string - enum: - - completed - - cancelled - - incomplete - - failed - description: "The type of error that caused the response to fail, corresponding \nwith the `status` field (`completed`, `cancelled`, `incomplete`, \n`failed`).\n" - reason: - type: string - enum: - - turn_detected - - client_cancelled - - max_output_tokens - - content_filter - description: | - The reason the Response did not complete. For a `cancelled` Response, one of `turn_detected` (the server VAD detected a new start of speech) or `client_cancelled` (the client sent a cancel event). For an `incomplete` Response, one of `max_output_tokens` or `content_filter` (the server-side safety filter activated and cut off the response). - error: + input: type: object - description: "A description of the error that caused the response to fail, \npopulated when the `status` is `failed`.\n" properties: - type: - type: string - description: The type of error. - code: + transcription: + anyOf: + - type: object + description: | + Optional source-language transcription. When configured, the server emits + `session.input_transcript.delta` events. Translation itself still runs from + the input audio stream. + properties: + model: + type: string + description: The transcription model used for source transcript deltas. + required: + - model + - type: 'null' + noise_reduction: + anyOf: + - type: object + description: | + Optional input noise reduction. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + required: + - type + - type: 'null' + output: + type: object + properties: + language: type: string - description: Error code, if any. - output: - type: array - description: The list of output items generated by the response. - items: - $ref: '#/components/schemas/RealtimeConversationItem' - metadata: - $ref: '#/components/schemas/Metadata' + description: | + Target language for translated output audio and transcript deltas. + required: + - id + - type + - expires_at + - model + - audio + x-oaiMeta: + name: The translation session object + group: realtime + example: | + { + "id": "sess_C9G5QPteg4UIbotdKLoYQ", + "type": "translation", + "expires_at": 1756324625, + "model": "gpt-realtime-translate", + "audio": { + "input": { + "transcription": { + "model": "gpt-realtime-whisper" + }, + "noise_reduction": null + }, + "output": { + "language": "es" + } + } + } + RealtimeTranslationSessionCreateRequest: + type: object + title: Realtime translation session configuration + description: | + Realtime translation session configuration. Translation sessions stream source + audio in and translated audio plus transcript deltas out continuously. + properties: + model: + type: string + description: | + The Realtime translation model used for this session. audio: type: object - description: Configuration for audio output. + description: | + Configuration for translation input and output audio. properties: + input: + type: object + properties: + transcription: + anyOf: + - type: object + description: | + Optional source-language transcription. When configured, the server emits + `session.input_transcript.delta` events. Translation itself still runs from + the input audio stream. + properties: + model: + type: string + description: The transcription model to use for source transcript deltas. + required: + - model + - type: 'null' + noise_reduction: + anyOf: + - type: object + description: | + Optional input noise reduction. Set to `null` to disable it. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + required: + - type + - type: 'null' output: type: object properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - description: The format of the output audio. - voice: - $ref: '#/components/schemas/VoiceIdsShared' - default: alloy + language: + type: string description: | - The voice the model uses to respond. Voice cannot be changed during the - session once the model has responded with audio at least once. Current - voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, - `shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for - best quality. - usage: + Target language for translated output audio and transcript deltas. + required: + - model + RealtimeTranslationSessionUpdateRequest: + type: object + title: Realtime translation session update + description: | + Realtime translation session fields that can be updated with `session.update`. + properties: + audio: type: object - description: "Usage statistics for the Response, this will correspond to billing. A \nRealtime API session will maintain a conversation context and append new \nItems to the Conversation, thus output from previous turns (text and \naudio tokens) will become the input for later turns.\n" + description: | + Configuration for translation input and output audio. properties: - total_tokens: - type: integer - description: "The total number of tokens in the Response including input and output \ntext and audio tokens.\n" - input_tokens: - type: integer - description: "The number of input tokens used in the Response, including text and \naudio tokens.\n" - output_tokens: - type: integer - description: "The number of output tokens sent in the Response, including text and \naudio tokens.\n" - input_token_details: + input: type: object - description: Details about the input tokens used in the Response. Cached tokens are tokens from previous turns in the conversation that are included as context for the current response. Cached tokens here are counted as a subset of input tokens, meaning input tokens will include cached and uncached tokens. properties: - cached_tokens: - type: integer - description: The number of cached tokens used as input for the Response. - text_tokens: - type: integer - description: The number of text tokens used as input for the Response. - image_tokens: - type: integer - description: The number of image tokens used as input for the Response. - audio_tokens: - type: integer - description: The number of audio tokens used as input for the Response. - cached_tokens_details: - type: object - description: Details about the cached tokens used as input for the Response. - properties: - text_tokens: - type: integer - description: The number of cached text tokens used as input for the Response. - image_tokens: - type: integer - description: The number of cached image tokens used as input for the Response. - audio_tokens: - type: integer - description: The number of cached audio tokens used as input for the Response. - output_token_details: + transcription: + anyOf: + - type: object + description: | + Optional source-language transcription. When configured, the server emits + `session.input_transcript.delta` events. Translation itself still runs from + the input audio stream. + properties: + model: + type: string + description: The transcription model to use for source transcript deltas. + required: + - model + - type: 'null' + noise_reduction: + anyOf: + - type: object + description: | + Optional input noise reduction. Set to `null` to disable it. + properties: + type: + $ref: '#/components/schemas/NoiseReductionType' + required: + - type + - type: 'null' + output: type: object - description: Details about the output tokens used in the Response. properties: - text_tokens: - type: integer - description: The number of text tokens used in the Response. - audio_tokens: - type: integer - description: The number of audio tokens used in the Response. - conversation_id: - description: | - Which conversation the response is added to, determined by the `conversation` - field in the `response.create` event. If `auto`, the response will be added to - the default conversation and the value of `conversation_id` will be an id like - `conv_1234`. If `none`, the response will not be added to any conversation and - the value of `conversation_id` will be `null`. If responses are being triggered - automatically by VAD the response will be added to the default conversation - type: string - output_modalities: - type: array + language: + type: string + description: | + Target language for translated output audio and transcript deltas. + RealtimeTruncation: + title: Realtime Truncation Controls + description: | + When the number of tokens in a conversation exceeds the model's input token limit, the conversation be truncated, meaning messages (starting from the oldest) will not be included in the model's context. A 32k context model with 4,096 max output tokens can only include 28,224 tokens in the context before truncation occurs. + + Clients can configure truncation behavior to truncate with a lower max token limit, which is an effective way to control token usage and cost. + + Truncation will reduce the number of cached tokens on the next turn (busting the cache), since messages are dropped from the beginning of the context. However, clients can also configure truncation to retain messages up to a fraction of the maximum context size, which will reduce the need for future truncations and thus improve the cache rate. + + Truncation can be disabled entirely, which means the server will never truncate but would instead return an error if the conversation exceeds the model's input token limit. + anyOf: + - type: string + description: The truncation strategy to use for the session. `auto` is the default truncation strategy. `disabled` will disable truncation and emit errors when the conversation exceeds the input token limit. + enum: + - auto + - disabled + title: RealtimeTruncationStrategy + - type: object + title: Retention ratio truncation + description: Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage. + properties: + type: + type: string + enum: + - retention_ratio + description: Use retention ratio truncation. + x-stainless-const: true + retention_ratio: + type: number + description: | + Fraction of post-instruction conversation tokens to retain (`0.0` - `1.0`) when the conversation exceeds the input token limit. Setting this to `0.8` means that messages will be dropped until 80% of the maximum allowed tokens are used. This helps reduce the frequency of truncations and improve cache rates. + minimum: 0 + maximum: 1 + token_limits: + type: object + description: Optional custom token limits for this truncation strategy. If not provided, the model's default token limits will be used. + properties: + post_instructions: + type: integer + description: Maximum tokens allowed in the conversation after instructions (which including tool definitions). For example, setting this to 5,000 would mean that truncation would occur when the conversation exceeds 5,000 tokens after instructions. This cannot be higher than the model's context window size minus the maximum output tokens. + minimum: 0 + required: + - type + - retention_ratio + RealtimeTurnDetection: + anyOf: + - title: Realtime Turn Detection + description: | + Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response. + + Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech. + + Semantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency. + + For `gpt-realtime-whisper` transcription sessions, turn detection must be + set to `null`; VAD is not supported. + discriminator: + propertyName: type + anyOf: + - type: object + title: Server VAD + description: Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence. + required: + - type + properties: + type: + type: string + default: server_vad + const: server_vad + description: | + Type of turn detection, `server_vad` to turn on simple Server VAD. + threshold: + type: number + description: | + Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A + higher threshold will require louder audio to activate the model, and + thus might perform better in noisy environments. + prefix_padding_ms: + type: integer + description: | + Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in + milliseconds). Defaults to 300ms. + silence_duration_ms: + type: integer + description: | + Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults + to 500ms. With shorter values the model will respond more quickly, + but may jump in on short pauses from the user. + create_response: + type: boolean + default: true + description: | + Whether or not to automatically generate a response when a VAD stop event occurs. If `interrupt_response` is set to `false` this may fail to create a response if the model is already responding. + + If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted. + interrupt_response: + type: boolean + default: true + description: | + Whether or not to automatically interrupt (cancel) any ongoing response with output to the default + conversation (i.e. `conversation` of `auto`) when a VAD start event occurs. If `true` then the response will be cancelled, otherwise it will continue until complete. + + If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted. + idle_timeout_ms: + anyOf: + - type: integer + minimum: 5000 + maximum: 30000 + description: | + Optional timeout after which a model response will be triggered automatically. This is + useful for situations in which a long pause from the user is unexpected, such as a phone + call. The model will effectively prompt the user to continue the conversation based + on the current context. + + The timeout value will be applied after the last model response's audio has finished playing, + i.e. it's set to the `response.done` time plus audio playback duration. + + An `input_audio_buffer.timeout_triggered` event (plus events + associated with the Response) will be emitted when the timeout is reached. + Idle timeout is currently only supported for `server_vad` mode. + - type: 'null' + - type: object + title: Semantic VAD + description: Server-side semantic turn detection which uses a model to determine when the user has finished speaking. + required: + - type + properties: + type: + type: string + const: semantic_vad + description: | + Type of turn detection, `semantic_vad` to turn on Semantic VAD. + eagerness: + type: string + default: auto + enum: + - low + - medium + - high + - auto + description: | + Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`, and `high` have max timeouts of 8s, 4s, and 2s respectively. + create_response: + type: boolean + default: true + description: | + Whether or not to automatically generate a response when a VAD stop event occurs. + interrupt_response: + type: boolean + default: true + description: | + Whether or not to automatically interrupt any ongoing response with output to the default + conversation (i.e. `conversation` of `auto`) when a VAD start event occurs. + - type: 'null' + Reasoning: + type: object + description: | + Configuration options for + [reasoning models](https://developers.openai.com/api/docs/guides/reasoning). + title: Reasoning + properties: + mode: + $ref: '#/components/schemas/ReasoningModeEnum' description: | - The set of modalities the model used to respond, currently the only possible values are - `[\"audio\"]`, `[\"text\"]`. Audio output always include a text transcript. Setting the - output to mode `text` will disable audio output from the model. - items: - type: string + Controls the reasoning execution mode for the request. + + When returned on a response, this is the effective execution mode. + effort: + $ref: '#/components/schemas/ReasoningEffort' + summary: + anyOf: + - type: string + description: | + A summary of the reasoning performed by the model. This can be + useful for debugging and understanding the model's reasoning process. + One of `auto`, `concise`, or `detailed`. + + `concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`. enum: - - text - - audio - max_output_tokens: - description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls, that was used in this response. + - auto + - concise + - detailed + - type: 'null' + context: anyOf: - - type: integer - type: string + description: | + Controls which reasoning items are rendered back to the model on later turns. + If omitted or set to `auto`, the model determines the context mode. The + `gpt-5.6` model family defaults to `all_turns`; earlier models default to + `current_turn`. + + When returned on a response, this is the effective reasoning context mode + used for the response. enum: - - inf - x-stainless-const: true - RealtimeResponseCreateParams: + - auto + - current_turn + - all_turns + - type: 'null' + generate_summary: + anyOf: + - type: string + deprecated: true + description: | + **Deprecated:** use `summary` instead. + + A summary of the reasoning performed by the model. This can be + useful for debugging and understanding the model's reasoning process. + One of `auto`, `concise`, or `detailed`. + enum: + - auto + - concise + - detailed + - type: 'null' + ReasoningEffort: + anyOf: + - type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + - max + default: medium + description: | + Constrains effort on reasoning for reasoning models. Currently supported + values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. + Reducing reasoning effort can result in faster responses and fewer tokens + used on reasoning in a response. Not all reasoning models support every + value. See the + [reasoning guide](https://developers.openai.com/api/docs/guides/reasoning) + for model-specific support. + - type: 'null' + ReasoningItem: type: object - description: Create a new Realtime response with these parameters + description: | + A description of the chain of thought used by a reasoning model while generating + a response. Be sure to include these items in your `input` to the Responses API + for subsequent turns of a conversation if you are manually + [managing context](https://developers.openai.com/api/docs/guides/conversation-state). + title: Reasoning properties: - output_modalities: + type: + type: string + description: | + The type of the object. Always `reasoning`. + enum: + - reasoning + x-stainless-const: true + id: + type: string + description: | + The unique identifier of the reasoning content. + encrypted_content: + anyOf: + - type: string + description: | + The encrypted content of the reasoning item. This is populated by default + for reasoning items returned by `POST /v1/responses` and WebSocket + `response.create` requests. + + When streaming, use the completed reasoning item and its + `encrypted_content` from the `response.output_item.done` event in + subsequent requests. The `encrypted_content` in + `response.output_item.added` may be incomplete. This is especially + important when `store` is `false` or when using Zero Data Retention. + - type: 'null' + summary: type: array description: | - The set of modalities the model used to respond, currently the only possible values are - `[\"audio\"]`, `[\"text\"]`. Audio output always include a text transcript. Setting the - output to mode `text` will disable audio output from the model. + Reasoning summary content. items: - type: string - enum: - - text - - audio - instructions: + $ref: '#/components/schemas/Summary' + content: + type: array + description: | + Reasoning text content. + items: + $ref: '#/components/schemas/ReasoningTextContent' + status: type: string description: | - The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. - Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session. - audio: - type: object - description: Configuration for audio input and output. - properties: - output: - type: object + The status of the item. One of `in_progress`, `completed`, or + `incomplete`. Populated when items are returned via API. + enum: + - in_progress + - completed + - incomplete + required: + - id + - summary + - type + Response: + title: The response object + allOf: + - $ref: '#/components/schemas/ModelResponseProperties' + - $ref: '#/components/schemas/ResponseProperties' + - type: object + properties: + service_tier: + $ref: '#/components/schemas/ServiceTierResponses' + truncation: + anyOf: + - type: string + description: | + The truncation strategy to use for the model response. + - `auto`: If the input to this Response exceeds + the model's context window size, the model will truncate the + response to fit the context window by dropping items from the beginning of the conversation. + - `disabled` (default): If the input size will exceed the context window + size for a model, the request will fail with a 400 error. + enum: + - auto + - disabled + default: disabled + - type: 'null' + id: + type: string + description: | + Unique identifier for this Response. + object: + type: string + description: | + The object type of this resource - always set to `response`. + enum: + - response + x-stainless-const: true + status: + type: string + description: | + The status of the response generation. One of `completed`, `failed`, + `in_progress`, `cancelled`, `queued`, or `incomplete`. + enum: + - completed + - failed + - in_progress + - cancelled + - queued + - incomplete + created_at: + type: number + format: unixtime + description: | + Unix timestamp (in seconds) of when this Response was created. + completed_at: + anyOf: + - type: number + format: unixtime + description: | + Unix timestamp (in seconds) of when this Response was completed. + Only present when the status is `completed`. + - type: 'null' + error: + $ref: '#/components/schemas/ResponseError' + incomplete_details: + anyOf: + - type: object + description: | + Details about why the response is incomplete. properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - description: The format of the output audio. - voice: - $ref: '#/components/schemas/VoiceIdsOrCustomVoice' - default: alloy + reason: + type: string description: | - The voice the model uses to respond. Supported built-in voices are - `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, - `marin`, and `cedar`. You may also provide a custom voice object with - an `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed - during the session once the model has responded with audio at least once. - We recommend `marin` and `cedar` for best quality. - tools: - type: array - description: Tools available to the model. - items: + The reason why the response is incomplete. `steered` means + the response stopped at a safe output boundary after a + WebSocket `response.steer` event. The server can then create + a successor response automatically with the queued input. + enum: + - max_output_tokens + - max_messages + - content_filter + - steered + - type: 'null' + output: + type: array + description: | + An array of content items generated by the model. + + - The length and order of items in the `output` array is dependent + on the model's response. + - Rather than accessing the first item in the `output` array and + assuming it's an `assistant` message with the content generated by + the model, you might consider using the `output_text` property where + supported in SDKs. + items: + $ref: '#/components/schemas/OutputItem' + reasoning: anyOf: - - $ref: '#/components/schemas/RealtimeFunctionTool' - - $ref: '#/components/schemas/MCPTool' - tool_choice: + - $ref: '#/components/schemas/Reasoning' + - type: 'null' + instructions: + anyOf: + - description: | + A system (or developer) message inserted into the model's context. + + When using along with `previous_response_id`, the instructions from a previous + response will not be carried over to the next response. This makes it simple + to swap out system (or developer) messages in new responses. + anyOf: + - type: string + description: | + A text input to the model, equivalent to a text input with the + `developer` role. + - type: array + title: Input item list + description: | + A list of one or many input items to the model, containing + different content types. + items: + $ref: '#/components/schemas/InputItem' + - type: 'null' + output_text: + anyOf: + - type: string + description: | + SDK-only convenience property that contains the aggregated text output + from all `output_text` items in the `output` array, if any are present. + Supported in the Python and JavaScript SDKs. + x-oaiSupportedSDKs: + - python + - javascript + - type: 'null' + x-stainless-skip: true + usage: + $ref: '#/components/schemas/ResponseUsage' + prompt_cache_options: + $ref: '#/components/schemas/PromptCacheOptions' + prompt_cache_diagnostics: + $ref: '#/components/schemas/PromptCacheDiagnostics' + moderation: + anyOf: + - $ref: '#/components/schemas/Moderation' + description: | + Moderation results for the response input and output, if moderated completions were requested. + - type: 'null' + parallel_tool_calls: + type: boolean + description: | + Whether to allow the model to run tool calls in parallel. + default: true + conversation: + anyOf: + - $ref: '#/components/schemas/ResponseConversation' + - type: 'null' + max_output_tokens: + anyOf: + - description: | + An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](https://developers.openai.com/api/docs/guides/reasoning). + type: integer + - type: 'null' + required: + - id + - object + - created_at + - error + - incomplete_details + - instructions + - model + - tools + - output + - parallel_tool_calls + - metadata + - tool_choice + - temperature + - top_p + ResponseAudioDeltaEvent: + type: object + description: Emitted when there is a partial audio response. + properties: + type: + type: string description: | - How the model chooses tools. Provide one of the string modes or force a specific - function/MCP tool. - default: auto - anyOf: - - $ref: '#/components/schemas/ToolChoiceOptions' - - $ref: '#/components/schemas/ToolChoiceFunction' - - $ref: '#/components/schemas/ToolChoiceMCP' - parallel_tool_calls: - type: boolean + The type of the event. Always `response.audio.delta`. + enum: + - response.audio.delta + x-stainless-const: true + sequence_number: + type: integer description: | - Whether the model may call multiple tools in parallel. Only supported by - reasoning Realtime models such as `gpt-realtime-2`. - reasoning: - $ref: '#/components/schemas/RealtimeReasoning' - max_output_tokens: + A sequence number for this chunk of the stream response. + delta: + type: string description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. - anyOf: - - type: integer - - type: string - enum: - - inf - x-stainless-const: true - conversation: + A chunk of Base64 encoded response audio bytes. + required: + - type + - delta + - sequence_number + x-oaiMeta: + name: response.audio.delta + group: responses + example: | + { + "type": "response.audio.delta", + "response_id": "resp_123", + "delta": "base64encoded...", + "sequence_number": 1 + } + ResponseAudioDoneEvent: + type: object + description: Emitted when the audio response is complete. + properties: + type: + type: string description: | - Controls which conversation the response is added to. Currently supports - `auto` and `none`, with `auto` as the default value. The `auto` value - means that the contents of the response will be added to the default - conversation. Set this to `none` to create an out-of-band response which - will not add items to default conversation. - anyOf: - - type: string - - type: string - default: auto - enum: - - auto - - none - metadata: - $ref: '#/components/schemas/Metadata' - prompt: - $ref: '#/components/schemas/Prompt' - input: - type: array + The type of the event. Always `response.audio.done`. + enum: + - response.audio.done + x-stainless-const: true + sequence_number: + type: integer description: | - Input items to include in the prompt for the model. Using this field - creates a new context for this Response instead of using the default - conversation. An empty array `[]` will clear the context for this Response. - Note that this can include references to items that previously appeared in the session - using their id. - items: - $ref: '#/components/schemas/RealtimeConversationItem' - RealtimeServerEvent: - discriminator: - propertyName: type - description: | - A realtime server event. - anyOf: - - $ref: '#/components/schemas/RealtimeServerEventConversationCreated' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemCreated' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemDeleted' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionCompleted' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionDelta' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionFailed' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemRetrieved' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemTruncated' - - $ref: '#/components/schemas/RealtimeServerEventError' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferCleared' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferCommitted' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferDtmfEventReceived' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferSpeechStarted' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferSpeechStopped' - - $ref: '#/components/schemas/RealtimeServerEventRateLimitsUpdated' - - $ref: '#/components/schemas/RealtimeServerEventResponseAudioDelta' - - $ref: '#/components/schemas/RealtimeServerEventResponseAudioDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseAudioTranscriptDelta' - - $ref: '#/components/schemas/RealtimeServerEventResponseAudioTranscriptDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseContentPartAdded' - - $ref: '#/components/schemas/RealtimeServerEventResponseContentPartDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseCreated' - - $ref: '#/components/schemas/RealtimeServerEventResponseDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDelta' - - $ref: '#/components/schemas/RealtimeServerEventResponseFunctionCallArgumentsDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseOutputItemAdded' - - $ref: '#/components/schemas/RealtimeServerEventResponseOutputItemDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseTextDelta' - - $ref: '#/components/schemas/RealtimeServerEventResponseTextDone' - - $ref: '#/components/schemas/RealtimeServerEventSessionCreated' - - $ref: '#/components/schemas/RealtimeServerEventSessionUpdated' - - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferStarted' - - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferStopped' - - $ref: '#/components/schemas/RealtimeServerEventOutputAudioBufferCleared' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemAdded' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemDone' - - $ref: '#/components/schemas/RealtimeServerEventInputAudioBufferTimeoutTriggered' - - $ref: '#/components/schemas/RealtimeServerEventConversationItemInputAudioTranscriptionSegment' - - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsInProgress' - - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsCompleted' - - $ref: '#/components/schemas/RealtimeServerEventMCPListToolsFailed' - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDelta' - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallArgumentsDone' - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallInProgress' - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallCompleted' - - $ref: '#/components/schemas/RealtimeServerEventResponseMCPCallFailed' - RealtimeServerEventConversationCreated: + The sequence number of the delta. + required: + - type + - sequence_number + - response_id + x-oaiMeta: + name: response.audio.done + group: responses + example: | + { + "type": "response.audio.done", + "response_id": "resp-123", + "sequence_number": 1 + } + ResponseAudioTranscriptDeltaEvent: type: object - description: | - Returned when a conversation is created. Emitted right after session creation. + description: Emitted when there is a partial transcript of audio. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: | + The type of the event. Always `response.audio.transcript.delta`. + enum: + - response.audio.transcript.delta x-stainless-const: true - description: The event type, must be `conversation.created`. - const: conversation.created - conversation: - type: object - description: The conversation resource. - properties: - id: - type: string - description: The unique ID of the conversation. - object: - description: The object type, must be `realtime.conversation`. - const: realtime.conversation + delta: + type: string + description: | + The partial transcript of the audio response. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - conversation + - response_id + - delta + - sequence_number x-oaiMeta: - name: conversation.created - group: realtime + name: response.audio.transcript.delta + group: responses example: | { - "event_id": "event_9101", - "type": "conversation.created", - "conversation": { - "id": "conv_001", - "object": "realtime.conversation" - } + "type": "response.audio.transcript.delta", + "response_id": "resp_123", + "delta": " ... partial transcript ... ", + "sequence_number": 1 } - RealtimeServerEventConversationItemAdded: + ResponseAudioTranscriptDoneEvent: type: object - description: | - Sent by the server when an Item is added to the default Conversation. This can happen in several cases: - - When the client sends a `conversation.item.create` event. - - When the input audio buffer is committed. In this case the item will be a user message containing the audio from the buffer. - - When the model is generating a Response. In this case the `conversation.item.added` event will be sent when the model starts generating a specific Item, and thus it will not yet have any content (and `status` will be `in_progress`). - - The event will include the full content of the Item (except when model is generating a Response) except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if necessary. + description: Emitted when the full audio transcript is completed. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: | + The type of the event. Always `response.audio.transcript.done`. + enum: + - response.audio.transcript.done x-stainless-const: true - description: The event type, must be `conversation.item.added`. - const: conversation.item.added - previous_item_id: - anyOf: - - type: string - description: | - The ID of the item that precedes this one, if any. This is used to - maintain ordering when items are inserted. - - type: 'null' - item: - $ref: '#/components/schemas/RealtimeConversationItem' + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - item + - response_id + - sequence_number x-oaiMeta: - name: conversation.item.added - group: realtime + name: response.audio.transcript.done + group: responses example: | { - "type": "conversation.item.added", - "event_id": "event_C9G8pjSJCfRNEhMEnYAVy", - "previous_item_id": null, - "item": { - "id": "item_C9G8pGVKYnaZu8PH5YQ9O", - "type": "message", - "status": "completed", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "hi" - } - ] - } + "type": "response.audio.transcript.done", + "response_id": "resp_123", + "sequence_number": 1 } - RealtimeServerEventConversationItemCreated: + ResponseCodeInterpreterCallCodeDeltaEvent: type: object - description: | - Returned when a conversation item is created. There are several scenarios that produce this event: - - The server is generating a Response, which if successful will produce - either one or two Items, which will be of type `message` - (role `assistant`) or type `function_call`. - - The input audio buffer has been committed, either by the client or the - server (in `server_vad` mode). The server will take the content of the - input audio buffer and add it to a new user message Item. - - The client has sent a `conversation.item.create` event to add a new Item - to the Conversation. + description: Emitted when a partial code snippet is streamed by the code interpreter. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: The type of the event. Always `response.code_interpreter_call_code.delta`. + enum: + - response.code_interpreter_call_code.delta x-stainless-const: true - description: The event type, must be `conversation.item.created`. - const: conversation.item.created - previous_item_id: - anyOf: - - type: string - description: | - The ID of the preceding item in the Conversation context, allows the - client to understand the order of the conversation. Can be `null` if the - item has no predecessor. - - type: 'null' - item: - $ref: '#/components/schemas/RealtimeConversationItem' + output_index: + type: integer + description: The index of the output item in the response for which the code is being streamed. + item_id: + type: string + description: The unique identifier of the code interpreter tool call item. + delta: + type: string + description: The partial code snippet being streamed by the code interpreter. + sequence_number: + type: integer + description: The sequence number of this event, used to order streaming events. required: - - event_id - type - - item + - output_index + - item_id + - delta + - sequence_number x-oaiMeta: - name: conversation.item.created - group: realtime + name: response.code_interpreter_call_code.delta + group: responses example: | { - "event_id": "event_1920", - "type": "conversation.item.created", - "previous_item_id": "msg_002", - "item": { - "id": "msg_003", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "user", - "content": [] - } + "type": "response.code_interpreter_call_code.delta", + "output_index": 0, + "item_id": "ci_12345", + "delta": "print('Hello, world')", + "sequence_number": 1 } - RealtimeServerEventConversationItemDeleted: + ResponseCodeInterpreterCallCodeDoneEvent: type: object - description: "Returned when an item in the conversation is deleted by the client with a \n`conversation.item.delete` event. This event is used to synchronize the \nserver's understanding of the conversation history with the client's view.\n" + description: Emitted when the code snippet is finalized by the code interpreter. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: The type of the event. Always `response.code_interpreter_call_code.done`. + enum: + - response.code_interpreter_call_code.done x-stainless-const: true - description: The event type, must be `conversation.item.deleted`. - const: conversation.item.deleted + output_index: + type: integer + description: The index of the output item in the response for which the code is finalized. item_id: type: string - description: The ID of the item that was deleted. + description: The unique identifier of the code interpreter tool call item. + code: + type: string + description: The final code snippet output by the code interpreter. + sequence_number: + type: integer + description: The sequence number of this event, used to order streaming events. required: - - event_id - type + - output_index - item_id + - code + - sequence_number x-oaiMeta: - name: conversation.item.deleted - group: realtime + name: response.code_interpreter_call_code.done + group: responses example: | { - "event_id": "event_2728", - "type": "conversation.item.deleted", - "item_id": "msg_005" + "type": "response.code_interpreter_call_code.done", + "output_index": 3, + "item_id": "ci_12345", + "code": "print('done')", + "sequence_number": 1 } - RealtimeServerEventConversationItemDone: + ResponseCodeInterpreterCallCompletedEvent: type: object - description: | - Returned when a conversation item is finalized. - - The event will include the full content of the Item except for audio data, which can be retrieved separately with a `conversation.item.retrieve` event if needed. + description: Emitted when the code interpreter call is completed. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: The type of the event. Always `response.code_interpreter_call.completed`. + enum: + - response.code_interpreter_call.completed x-stainless-const: true - description: The event type, must be `conversation.item.done`. - const: conversation.item.done - previous_item_id: - anyOf: - - type: string - description: | - The ID of the item that precedes this one, if any. This is used to - maintain ordering when items are inserted. - - type: 'null' - item: - $ref: '#/components/schemas/RealtimeConversationItem' + output_index: + type: integer + description: The index of the output item in the response for which the code interpreter call is completed. + item_id: + type: string + description: The unique identifier of the code interpreter tool call item. + sequence_number: + type: integer + description: The sequence number of this event, used to order streaming events. required: - - event_id - type - - item + - output_index + - item_id + - sequence_number x-oaiMeta: - name: conversation.item.done - group: realtime + name: response.code_interpreter_call.completed + group: responses example: | { - "type": "conversation.item.done", - "event_id": "event_CCXLgMZPo3qioWCeQa4WH", - "previous_item_id": "item_CCXLecNJVIVR2HUy3ABLj", - "item": { - "id": "item_CCXLfxmM5sXVJVz4mCa2S", - "type": "message", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "output_audio", - "transcript": "Oh, I can hear you loud and clear! Sounds like we're connected just fine. What can I help you with today?" - } - ] - } + "type": "response.code_interpreter_call.completed", + "output_index": 5, + "item_id": "ci_12345", + "sequence_number": 1 } - RealtimeServerEventConversationItemInputAudioTranscriptionCompleted: + ResponseCodeInterpreterCallInProgressEvent: type: object - description: | - This event is the output of audio transcription for user audio written to the - user audio buffer. Transcription begins when the input audio buffer is - committed by the client or server (when VAD is enabled). Transcription runs - asynchronously with Response creation, so this event may come before or after - the Response events. - - Realtime API models accept audio natively, and thus input transcription is a - separate process run on a separate ASR (Automatic Speech Recognition) model. - The transcript may diverge somewhat from the model's interpretation, and - should be treated as a rough guide. + description: Emitted when a code interpreter call is in progress. properties: - event_id: + type: type: string - description: The unique ID of the server event. + description: The type of the event. Always `response.code_interpreter_call.in_progress`. + enum: + - response.code_interpreter_call.in_progress + x-stainless-const: true + output_index: + type: integer + description: The index of the output item in the response for which the code interpreter call is in progress. + item_id: + type: string + description: The unique identifier of the code interpreter tool call item. + sequence_number: + type: integer + description: The sequence number of this event, used to order streaming events. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call.in_progress + group: responses + example: | + { + "type": "response.code_interpreter_call.in_progress", + "output_index": 0, + "item_id": "ci_12345", + "sequence_number": 1 + } + ResponseCodeInterpreterCallInterpretingEvent: + type: object + description: Emitted when the code interpreter is actively interpreting the code snippet. + properties: type: type: string + description: The type of the event. Always `response.code_interpreter_call.interpreting`. enum: - - conversation.item.input_audio_transcription.completed - description: | - The event type, must be - `conversation.item.input_audio_transcription.completed`. + - response.code_interpreter_call.interpreting x-stainless-const: true + output_index: + type: integer + description: The index of the output item in the response for which the code interpreter is interpreting code. item_id: type: string - description: The ID of the item containing the audio that is being transcribed. - content_index: + description: The unique identifier of the code interpreter tool call item. + sequence_number: type: integer - description: The index of the content part containing the audio. - transcript: + description: The sequence number of this event, used to order streaming events. + required: + - type + - output_index + - item_id + - sequence_number + x-oaiMeta: + name: response.code_interpreter_call.interpreting + group: responses + example: | + { + "type": "response.code_interpreter_call.interpreting", + "output_index": 4, + "item_id": "ci_12345", + "sequence_number": 1 + } + ResponseCompletedEvent: + type: object + description: Emitted when the model response is complete. + properties: + type: type: string - description: The transcribed text. - languages: - type: array description: | - The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected. - items: - $ref: '#/components/schemas/TranscriptionLanguage' - logprobs: - anyOf: - - type: array - description: The log probabilities of the transcription. - items: - $ref: '#/components/schemas/LogProbProperties' - - type: 'null' - usage: - type: object - description: Usage statistics for the transcription, this is billed according to the ASR model's pricing rather than the realtime model's pricing. - anyOf: - - $ref: '#/components/schemas/TranscriptTextUsageTokens' - title: TranscriptTextUsageTokens - - $ref: '#/components/schemas/TranscriptTextUsageDuration' - title: TranscriptTextUsageDuration + The type of the event. Always `response.completed`. + enum: + - response.completed + x-stainless-const: true + response: + $ref: '#/components/schemas/Response' + description: | + Properties of the completed response. + sequence_number: + type: integer + description: The sequence number for this event. required: - - event_id - type - - item_id - - content_index - - transcript - - usage + - response + - sequence_number x-oaiMeta: - name: conversation.item.input_audio_transcription.completed - group: realtime + name: response.completed + group: responses example: | { - "type": "conversation.item.input_audio_transcription.completed", - "event_id": "event_CCXGRvtUVrax5SJAnNOWZ", - "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", - "content_index": 0, - "transcript": "Hey, can you hear me?", - "usage": { - "type": "tokens", - "total_tokens": 22, - "input_tokens": 13, - "input_token_details": { - "text_tokens": 0, - "audio_tokens": 13 + "type": "response.completed", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "completed", + "completed_at": 1740855870, + "error": null, + "incomplete_details": null, + "input": [], + "instructions": null, + "max_output_tokens": null, + "model": "gpt-6-astra", + "output": [ + { + "id": "msg_123", + "type": "message", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", + "annotations": [] + } + ] + } + ], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } }, - "output_tokens": 9 - } + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": { + "input_tokens": 0, + "output_tokens": 0, + "output_tokens_details": { + "reasoning_tokens": 0 + }, + "total_tokens": 0 + }, + "user": null, + "metadata": {} + }, + "sequence_number": 1 } - RealtimeServerEventConversationItemInputAudioTranscriptionDelta: + ResponseConfigurationUpdate: type: object description: | - Returned when the text value of an input audio transcription content part is updated with incremental transcription results. + A configuration update that applies to subsequent responses until it is + replaced by another configuration update. properties: - event_id: + id: type: string - description: The unique ID of the server event. + description: The unique ID of the configuration update item. + example: cnfu_123 type: - x-stainless-const: true - description: The event type, must be `conversation.item.input_audio_transcription.delta`. - const: conversation.item.input_audio_transcription.delta - item_id: - type: string - description: The ID of the item containing the audio that is being transcribed. - content_index: - type: integer - description: The index of the content part in the item's content array. - delta: type: string - description: The text delta. - logprobs: - anyOf: - - type: array - description: 'The log probabilities of the transcription. These can be enabled by configurating the session with `"include": ["item.input_audio_transcription.logprobs"]`. Each entry in the array corresponds a log probability of which token would be selected for this chunk of transcription. This can help to identify if it was possible there were multiple valid options for a given chunk of transcription.' - items: - $ref: '#/components/schemas/LogProbProperties' - - type: 'null' + enum: + - configuration_update + description: The item type. Always `configuration_update`. + default: configuration_update + x-stainless-const: true + reasoning: + type: object + description: The reasoning configuration applied by this update. + properties: + effort: + $ref: '#/components/schemas/ReasoningEffort' + description: | + The reasoning effort used for subsequent responses until another + configuration update replaces it. required: - - event_id + - id - type - - item_id - x-oaiMeta: - name: conversation.item.input_audio_transcription.delta - group: realtime - example: | - { - "type": "conversation.item.input_audio_transcription.delta", - "event_id": "event_CCXGRxsAimPAs8kS2Wc7Z", - "item_id": "item_CCXGQ4e1ht4cOraEYcuR2", - "content_index": 0, - "delta": "Hey", - "obfuscation": "aLxx0jTEciOGe" - } - RealtimeServerEventConversationItemInputAudioTranscriptionFailed: + ResponseConfigurationUpdateItemParam: type: object - description: "Returned when input audio transcription is configured, and a transcription \nrequest for a user message failed. These events are separate from other \n`error` events so that the client can identify the related Item.\n" + description: | + An update to the conversation's response configuration. The configuration + remains in effect for subsequent responses until it is replaced by another + configuration update. properties: - event_id: - type: string - description: The unique ID of the server event. + id: + anyOf: + - type: string + description: The unique ID of the configuration update item. + example: cnfu_123 + - type: 'null' type: type: string enum: - - conversation.item.input_audio_transcription.failed - description: | - The event type, must be - `conversation.item.input_audio_transcription.failed`. + - configuration_update + description: The item type. Always `configuration_update`. + default: configuration_update x-stainless-const: true - item_id: - type: string - description: The ID of the user message item. - content_index: - type: integer - description: The index of the content part containing the audio. - error: + reasoning: type: object - description: Details of the transcription error. + description: Updates to reasoning configuration. Only effort is supported. properties: - type: - type: string - description: The type of error. - code: - type: string - description: Error code, if any. - message: - type: string - description: A human-readable error message. - param: - type: string - description: Parameter related to the error, if any. + effort: + $ref: '#/components/schemas/ReasoningEffort' + description: | + The reasoning effort to use for subsequent responses until another + configuration update replaces it. required: - - event_id - type - - item_id - - content_index - - error - x-oaiMeta: - name: conversation.item.input_audio_transcription.failed - group: realtime - example: | - { - "event_id": "event_2324", - "type": "conversation.item.input_audio_transcription.failed", - "item_id": "msg_003", - "content_index": 0, - "error": { - "type": "transcription_error", - "code": "audio_unintelligible", - "message": "The audio could not be transcribed.", - "param": null - } - } - RealtimeServerEventConversationItemInputAudioTranscriptionSegment: + ResponseContentPartAddedEvent: type: object - description: Returned when an input audio transcription segment is identified for an item. + description: Emitted when a new content part is added. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: | + The type of the event. Always `response.content_part.added`. + enum: + - response.content_part.added x-stainless-const: true - description: The event type, must be `conversation.item.input_audio_transcription.segment`. - const: conversation.item.input_audio_transcription.segment item_id: type: string - description: The ID of the item containing the input audio content. + description: | + The ID of the output item that the content part was added to. + output_index: + type: integer + description: | + The index of the output item that the content part was added to. content_index: type: integer - description: The index of the input audio content part within the item. - text: - type: string - description: The text for this segment. - id: - type: string - description: The segment identifier. - speaker: - type: string - description: The detected speaker label for this segment. - start: - type: number - format: double - description: Start time of the segment in seconds. - end: - type: number - format: double - description: End time of the segment in seconds. + description: | + The index of the content part that was added. + part: + $ref: '#/components/schemas/OutputContent' + description: | + The content part that was added. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - item_id + - output_index - content_index - - text - - id - - speaker - - start - - end + - part + - sequence_number x-oaiMeta: - name: conversation.item.input_audio_transcription.segment - group: realtime + name: response.content_part.added + group: responses example: | { - "event_id": "event_6501", - "type": "conversation.item.input_audio_transcription.segment", - "item_id": "msg_011", - "content_index": 0, - "text": "hello", - "id": "seg_0001", - "speaker": "spk_1", - "start": 0.0, - "end": 0.4 + "type": "response.content_part.added", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "part": { + "type": "output_text", + "text": "", + "annotations": [] + }, + "sequence_number": 1 } - RealtimeServerEventConversationItemRetrieved: + ResponseContentPartDoneEvent: type: object - description: | - Returned when a conversation item is retrieved with `conversation.item.retrieve`. This is provided as a way to fetch the server's representation of an item, for example to get access to the post-processed audio data after noise cancellation and VAD. It includes the full content of the Item, including audio data. + description: Emitted when a content part is done. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `conversation.item.retrieved`. - const: conversation.item.retrieved - item: - $ref: '#/components/schemas/RealtimeConversationItem' - required: - - event_id - - type - - item - x-oaiMeta: - name: conversation.item.retrieved - group: realtime - example: | - { - "type": "conversation.item.retrieved", - "event_id": "event_CCXGSizgEppa2d4XbKA7K", - "item": { - "id": "item_CCXGRxbY0n6WE4EszhF5w", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "audio", - "transcript": "Yes, I can hear you loud and clear. How can I help you today?", - "audio": "8//2//v/9//q/+//+P/s...", - "format": "pcm16" - } - ] - } - } - RealtimeServerEventConversationItemTruncated: - type: object - description: "Returned when an earlier assistant audio message item is truncated by the \nclient with a `conversation.item.truncate` event. This event is used to \nsynchronize the server's understanding of the audio with the client's playback.\n\nThis action will truncate the audio and remove the server-side text transcript \nto ensure there is no text in the context that hasn't been heard by the user.\n" - properties: - event_id: type: string - description: The unique ID of the server event. - type: + description: | + The type of the event. Always `response.content_part.done`. + enum: + - response.content_part.done x-stainless-const: true - description: The event type, must be `conversation.item.truncated`. - const: conversation.item.truncated item_id: type: string - description: The ID of the assistant message item that was truncated. + description: | + The ID of the output item that the content part was added to. + output_index: + type: integer + description: | + The index of the output item that the content part was added to. content_index: type: integer - description: The index of the content part that was truncated. - audio_end_ms: + description: | + The index of the content part that is done. + sequence_number: type: integer + description: The sequence number of this event. + part: + $ref: '#/components/schemas/OutputContent' description: | - The duration up to which the audio was truncated, in milliseconds. + The content part that is done. required: - - event_id - type - item_id + - output_index - content_index - - audio_end_ms + - part + - sequence_number x-oaiMeta: - name: conversation.item.truncated - group: realtime + name: response.content_part.done + group: responses example: | { - "event_id": "event_2526", - "type": "conversation.item.truncated", - "item_id": "msg_004", - "content_index": 0, - "audio_end_ms": 1500 + "type": "response.content_part.done", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "sequence_number": 1, + "part": { + "type": "output_text", + "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", + "annotations": [] + } } - RealtimeServerEventError: + ResponseCreatedEvent: type: object description: | - Returned when an error occurs, which could be a client problem or a server - problem. Most errors are recoverable and the session will stay open, we - recommend to implementors to monitor and log error messages by default. + An event that is emitted when a response is created. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: | + The type of the event. Always `response.created`. + enum: + - response.created x-stainless-const: true - description: The event type, must be `error`. - const: error - error: - type: object - description: Details of the error. - required: - - type - - message - properties: - type: - type: string - description: | - The type of error (e.g., "invalid_request_error", "server_error"). - code: - anyOf: - - type: string - description: Error code, if any. - - type: 'null' - message: - type: string - description: A human-readable error message. - param: - anyOf: - - type: string - description: Parameter related to the error, if any. - - type: 'null' - event_id: - anyOf: - - type: string - description: | - The event_id of the client event that caused the error, if applicable. - - type: 'null' + response: + $ref: '#/components/schemas/Response' + description: | + The response that was created. + sequence_number: + type: integer + description: The sequence number for this event. required: - - event_id - type - - error + - response + - sequence_number x-oaiMeta: - name: error - group: realtime + name: response.created + group: responses example: | { - "event_id": "event_890", - "type": "error", - "error": { - "type": "invalid_request_error", - "code": "invalid_event", - "message": "The 'type' field is missing.", - "param": null, - "event_id": "event_567" - } + "type": "response.created", + "response": { + "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", + "object": "response", + "created_at": 1741487325, + "status": "in_progress", + "completed_at": null, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-6-astra", + "output": [], + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + }, + "sequence_number": 1 } - RealtimeServerEventInputAudioBufferCleared: + ResponseCustomToolCallInputDeltaEvent: + title: ResponseCustomToolCallInputDelta type: object - description: "Returned when the input audio buffer is cleared by the client with a \n`input_audio_buffer.clear` event.\n" + description: | + Event representing a delta (partial update) to the input of a custom tool call. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + enum: + - response.custom_tool_call_input.delta + description: The event type identifier. x-stainless-const: true - description: The event type, must be `input_audio_buffer.cleared`. - const: input_audio_buffer.cleared + sequence_number: + type: integer + description: The sequence number of this event. + output_index: + type: integer + description: The index of the output this delta applies to. + item_id: + type: string + description: Unique identifier for the API item associated with this event. + delta: + type: string + description: The incremental input data (delta) for the custom tool call. required: - - event_id - type + - output_index + - item_id + - delta + - sequence_number x-oaiMeta: - name: input_audio_buffer.cleared - group: realtime + name: response.custom_tool_call_input.delta + group: responses example: | { - "event_id": "event_1314", - "type": "input_audio_buffer.cleared" + "type": "response.custom_tool_call_input.delta", + "output_index": 0, + "item_id": "ctc_1234567890abcdef", + "delta": "partial input text" } - RealtimeServerEventInputAudioBufferCommitted: + ResponseCustomToolCallInputDoneEvent: + title: ResponseCustomToolCallInputDone type: object description: | - Returned when an input audio buffer is committed, either by the client or - automatically in server VAD mode. The `item_id` property is the ID of the user - message item that will be created, thus a `conversation.item.created` event - will also be sent to the client. + Event indicating that input for a custom tool call is complete. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + enum: + - response.custom_tool_call_input.done + description: The event type identifier. x-stainless-const: true - description: The event type, must be `input_audio_buffer.committed`. - const: input_audio_buffer.committed - previous_item_id: - anyOf: - - type: string - description: | - The ID of the preceding item after which the new item will be inserted. - Can be `null` if the item has no predecessor. - - type: 'null' + sequence_number: + type: integer + description: The sequence number of this event. + output_index: + type: integer + description: The index of the output this event applies to. item_id: type: string - description: The ID of the user message item that will be created. + description: Unique identifier for the API item associated with this event. + input: + type: string + description: The complete input data for the custom tool call. required: - - event_id - type + - output_index - item_id + - input + - sequence_number x-oaiMeta: - name: input_audio_buffer.committed - group: realtime + name: response.custom_tool_call_input.done + group: responses example: | { - "event_id": "event_1121", - "type": "input_audio_buffer.committed", - "previous_item_id": "msg_001", - "item_id": "msg_002" + "type": "response.custom_tool_call_input.done", + "output_index": 0, + "item_id": "ctc_1234567890abcdef", + "input": "final complete input text" } - RealtimeServerEventInputAudioBufferDtmfEventReceived: - type: object + ResponseError: + anyOf: + - type: object + description: | + An error object returned when the model fails to generate a Response. + properties: + code: + $ref: '#/components/schemas/ResponseErrorCode' + message: + type: string + description: | + A human-readable description of the error. + misalignment: + $ref: '#/components/schemas/MisalignmentErrorDetailsResource' + required: + - code + - message + - type: 'null' + ResponseErrorCode: + type: string description: | - **SIP Only:** Returned when an DTMF event is received. A DTMF event is a message that - represents a telephone keypad press (0–9, *, #, A–D). The `event` property - is the keypad that the user press. The `received_at` is the UTC Unix Timestamp - that the server received the event. + The error code for the response. + enum: + - server_error + - rate_limit_exceeded + - invalid_prompt + - data_residency_mismatch + - bio_policy + - misalignment_policy_violation + - vector_store_timeout + - invalid_image + - invalid_image_format + - invalid_base64_image + - invalid_image_url + - image_too_large + - image_too_small + - image_parse_error + - image_content_policy_violation + - invalid_image_mode + - image_file_too_large + - unsupported_image_media_type + - empty_image_file + - failed_to_download_image + - image_file_not_found + ResponseErrorEvent: + type: object + description: Emitted when an error occurs. properties: type: + type: string + description: | + The type of the event. Always `error`. + enum: + - error x-stainless-const: true - description: The event type, must be `input_audio_buffer.dtmf_event_received`. - const: input_audio_buffer.dtmf_event_received - event: + code: + anyOf: + - type: string + description: | + The error code. + - type: 'null' + message: type: string - description: The telephone keypad that was pressed by the user. - received_at: - type: integer description: | - UTC Unix Timestamp when DTMF Event was received by server. + The error message. + param: + anyOf: + - type: string + description: | + The error parameter. + - type: 'null' + sequence_number: + type: integer + description: The sequence number of this event. required: - type - - event - - received_at + - code + - message + - param + - sequence_number x-oaiMeta: - name: input_audio_buffer.dtmf_event_received - group: realtime + name: error + group: responses example: | { - "type":" input_audio_buffer.dtmf_event_received", - "event": "9", - "received_at": 1763605109, + "type": "error", + "code": "ERR_SOMETHING", + "message": "Something went wrong", + "param": null, + "sequence_number": 1 } - RealtimeServerEventInputAudioBufferSpeechStarted: + ResponseFailedEvent: type: object - description: "Sent by the server when in `server_vad` mode to indicate that speech has been \ndetected in the audio buffer. This can happen any time audio is added to the \nbuffer (unless speech is already detected). The client may want to use this \nevent to interrupt audio playback or provide visual feedback to the user. \n\nThe client should expect to receive a `input_audio_buffer.speech_stopped` event \nwhen speech stops. The `item_id` property is the ID of the user message item \nthat will be created when speech stops and will also be included in the \n`input_audio_buffer.speech_stopped` event (unless the client manually commits \nthe audio buffer during VAD activation).\n" + description: | + An event that is emitted when a response fails. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: | + The type of the event. Always `response.failed`. + enum: + - response.failed x-stainless-const: true - description: The event type, must be `input_audio_buffer.speech_started`. - const: input_audio_buffer.speech_started - audio_start_ms: + sequence_number: type: integer - description: "Milliseconds from the start of all audio written to the buffer during the \nsession when speech was first detected. This will correspond to the \nbeginning of audio sent to the model, and thus includes the \n`prefix_padding_ms` configured in the Session.\n" - item_id: - type: string + description: The sequence number of this event. + response: + $ref: '#/components/schemas/Response' description: | - The ID of the user message item that will be created when speech stops. + The response that failed. required: - - event_id - type - - audio_start_ms - - item_id + - response + - sequence_number x-oaiMeta: - name: input_audio_buffer.speech_started - group: realtime + name: response.failed + group: responses example: | { - "event_id": "event_1516", - "type": "input_audio_buffer.speech_started", - "audio_start_ms": 1000, - "item_id": "msg_003" + "type": "response.failed", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "failed", + "completed_at": null, + "error": { + "code": "server_error", + "message": "The model failed to generate a response." + }, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-6-astra", + "output": [], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + } } - RealtimeServerEventInputAudioBufferSpeechStopped: + ResponseFileSearchCallCompletedEvent: type: object - description: "Returned in `server_vad` mode when the server detects the end of speech in \nthe audio buffer. The server will also send an `conversation.item.created` \nevent with the user message item that is created from the audio buffer.\n" + description: Emitted when a file search call is completed (results found). properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: | + The type of the event. Always `response.file_search_call.completed`. + enum: + - response.file_search_call.completed x-stainless-const: true - description: The event type, must be `input_audio_buffer.speech_stopped`. - const: input_audio_buffer.speech_stopped - audio_end_ms: + output_index: type: integer - description: "Milliseconds since the session started when speech stopped. This will \ncorrespond to the end of audio sent to the model, and thus includes the \n`min_silence_duration_ms` configured in the Session.\n" + description: | + The index of the output item that the file search call is initiated. item_id: type: string - description: The ID of the user message item that will be created. + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - audio_end_ms + - output_index - item_id + - sequence_number x-oaiMeta: - name: input_audio_buffer.speech_stopped - group: realtime + name: response.file_search_call.completed + group: responses example: | { - "event_id": "event_1718", - "type": "input_audio_buffer.speech_stopped", - "audio_end_ms": 2000, - "item_id": "msg_003" + "type": "response.file_search_call.completed", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 } - RealtimeServerEventInputAudioBufferTimeoutTriggered: + ResponseFileSearchCallInProgressEvent: type: object - description: | - Returned when the Server VAD timeout is triggered for the input audio buffer. This is configured - with `idle_timeout_ms` in the `turn_detection` settings of the session, and it indicates that - there hasn't been any speech detected for the configured duration. - - The `audio_start_ms` and `audio_end_ms` fields indicate the segment of audio after the last - model response up to the triggering time, as an offset from the beginning of audio written - to the input audio buffer. This means it demarcates the segment of audio that was silent and - the difference between the start and end values will roughly match the configured timeout. - - The empty audio will be committed to the conversation as an `input_audio` item (there will be a - `input_audio_buffer.committed` event) and a model response will be generated. There may be speech - that didn't trigger VAD but is still detected by the model, so the model may respond with - something relevant to the conversation or a prompt to continue speaking. + description: Emitted when a file search call is initiated. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: | + The type of the event. Always `response.file_search_call.in_progress`. + enum: + - response.file_search_call.in_progress x-stainless-const: true - description: The event type, must be `input_audio_buffer.timeout_triggered`. - const: input_audio_buffer.timeout_triggered - audio_start_ms: - type: integer - description: Millisecond offset of audio written to the input audio buffer that was after the playback time of the last model response. - audio_end_ms: + output_index: type: integer - description: Millisecond offset of audio written to the input audio buffer at the time the timeout was triggered. + description: | + The index of the output item that the file search call is initiated. item_id: type: string - description: The ID of the item associated with this segment. + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - audio_start_ms - - audio_end_ms + - output_index - item_id + - sequence_number x-oaiMeta: - name: input_audio_buffer.timeout_triggered - group: realtime + name: response.file_search_call.in_progress + group: responses example: | { - "type":"input_audio_buffer.timeout_triggered", - "event_id":"event_CEKKrf1KTGvemCPyiJTJ2", - "audio_start_ms":13216, - "audio_end_ms":19232, - "item_id":"item_CEKKrWH0GiwN0ET97NUZc" + "type": "response.file_search_call.in_progress", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 } - RealtimeServerEventMCPListToolsCompleted: + ResponseFileSearchCallSearchingEvent: type: object - description: Returned when listing MCP tools has completed for an item. + description: Emitted when a file search is currently searching. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `mcp_list_tools.completed`. - const: mcp_list_tools.completed - item_id: - type: string - description: The ID of the MCP list tools item. - required: - - event_id - - type - - item_id - x-oaiMeta: - name: mcp_list_tools.completed - group: realtime - example: | - { - "event_id": "event_6102", - "type": "mcp_list_tools.completed", - "item_id": "mcp_list_tools_001" - } - RealtimeServerEventMCPListToolsFailed: - type: object - description: Returned when listing MCP tools has failed for an item. - properties: - event_id: type: string - description: The unique ID of the server event. - type: + description: | + The type of the event. Always `response.file_search_call.searching`. + enum: + - response.file_search_call.searching x-stainless-const: true - description: The event type, must be `mcp_list_tools.failed`. - const: mcp_list_tools.failed + output_index: + type: integer + description: | + The index of the output item that the file search call is searching. item_id: type: string - description: The ID of the MCP list tools item. + description: | + The ID of the output item that the file search call is initiated. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type + - output_index - item_id + - sequence_number x-oaiMeta: - name: mcp_list_tools.failed - group: realtime + name: response.file_search_call.searching + group: responses example: | { - "event_id": "event_6103", - "type": "mcp_list_tools.failed", - "item_id": "mcp_list_tools_001" + "type": "response.file_search_call.searching", + "output_index": 0, + "item_id": "fs_123", + "sequence_number": 1 } - RealtimeServerEventMCPListToolsInProgress: + ResponseFormatJsonObject: type: object - description: Returned when listing MCP tools is in progress for an item. + title: JSON object + description: | + JSON object response format. An older method of generating JSON responses. + Using `json_schema` is recommended for models that support it. Note that the + model will not generate JSON without a system or user message instructing it + to do so. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `mcp_list_tools.in_progress`. - const: mcp_list_tools.in_progress - item_id: type: string - description: The ID of the MCP list tools item. + description: The type of response format being defined. Always `json_object`. + enum: + - json_object + x-stainless-const: true required: - - event_id - type - - item_id - x-oaiMeta: - name: mcp_list_tools.in_progress - group: realtime - example: | - { - "event_id": "event_6101", - "type": "mcp_list_tools.in_progress", - "item_id": "mcp_list_tools_001" - } - RealtimeServerEventOutputAudioBufferCleared: + ResponseFormatJsonSchema: type: object + title: JSON schema description: | - **WebRTC/SIP Only:** Emitted when the output audio buffer is cleared. This happens either in VAD - mode when the user has interrupted (`input_audio_buffer.speech_started`), - or when the client has emitted the `output_audio_buffer.clear` event to manually - cut off the current audio response. - [Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + JSON Schema response format. Used to generate structured JSON responses. + Learn more about [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `output_audio_buffer.cleared`. - const: output_audio_buffer.cleared - response_id: type: string - description: The unique ID of the response that produced the audio. + description: The type of response format being defined. Always `json_schema`. + enum: + - json_schema + x-stainless-const: true + json_schema: + type: object + title: JSON schema + description: | + Structured Outputs configuration options, including a JSON Schema. + properties: + description: + type: string + description: | + A description of what the response format is for, used by the model to + determine how to respond in the format. + name: + type: string + description: | + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: | + Whether to enable strict schema adherence when generating the output. + If set to true, the model will always follow the exact schema defined + in the `schema` field. Only a subset of JSON Schema is supported when + `strict` is `true`. To learn more, read the [Structured Outputs + guide](https://developers.openai.com/api/docs/guides/structured-outputs). + - type: 'null' + required: + - name required: - - event_id - type - - response_id - x-oaiMeta: - name: output_audio_buffer.cleared - group: realtime - example: | - { - "event_id": "event_abc123", - "type": "output_audio_buffer.cleared", - "response_id": "resp_abc123" - } - RealtimeServerEventOutputAudioBufferStarted: + - json_schema + ResponseFormatJsonSchemaSchema: type: object + title: JSON schema description: | - **WebRTC/SIP Only:** Emitted when the server begins streaming audio to the client. This event is - emitted after an audio content part has been added (`response.content_part.added`) - to the response. - [Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). - properties: - event_id: - type: string - description: The unique ID of the server event. - type: - x-stainless-const: true - description: The event type, must be `output_audio_buffer.started`. - const: output_audio_buffer.started - response_id: - type: string - description: The unique ID of the response that produced the audio. - required: - - event_id - - type - - response_id - x-oaiMeta: - name: output_audio_buffer.started - group: realtime - example: | - { - "event_id": "event_abc123", - "type": "output_audio_buffer.started", - "response_id": "resp_abc123" - } - RealtimeServerEventOutputAudioBufferStopped: + The schema for the response format, described as a JSON Schema object. + Learn how to build JSON schemas [here](https://json-schema.org/). + additionalProperties: true + ResponseFormatText: type: object + title: Text description: | - **WebRTC/SIP Only:** Emitted when the output audio buffer has been completely drained on the server, - and no more audio is forthcoming. This event is emitted after the full response - data has been sent to the client (`response.done`). - [Learn more](https://developers.openai.com/api/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). + Default response format. Used to generate text responses. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `output_audio_buffer.stopped`. - const: output_audio_buffer.stopped - response_id: type: string - description: The unique ID of the response that produced the audio. + description: The type of response format being defined. Always `text`. + enum: + - text + x-stainless-const: true required: - - event_id - type - - response_id - x-oaiMeta: - name: output_audio_buffer.stopped - group: realtime - example: | - { - "event_id": "event_abc123", - "type": "output_audio_buffer.stopped", - "response_id": "resp_abc123" - } - RealtimeServerEventRateLimitsUpdated: + ResponseFormatTextGrammar: type: object - description: "Emitted at the beginning of a Response to indicate the updated rate limits. \nWhen a Response is created some tokens will be \"reserved\" for the output \ntokens, the rate limits shown here reflect that reservation, which is then \nadjusted accordingly once the Response is completed.\n" + title: Text grammar + description: | + A custom grammar for the model to follow when generating text. + Learn more in the [custom grammars guide](https://developers.openai.com/api/docs/guides/function-calling#context-free-grammars). properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: The type of response format being defined. Always `grammar`. + enum: + - grammar x-stainless-const: true - description: The event type, must be `rate_limits.updated`. - const: rate_limits.updated - rate_limits: - type: array - description: List of rate limit information. - items: - type: object - properties: - name: - type: string - enum: - - requests - - tokens - description: | - The name of the rate limit (`requests`, `tokens`). - limit: - type: integer - description: The maximum allowed value for the rate limit. - remaining: - type: integer - description: The remaining value before the limit is reached. - reset_seconds: - type: number - description: Seconds until the rate limit resets. + grammar: + type: string + description: The custom grammar for the model to follow. required: - - event_id - type - - rate_limits - x-oaiMeta: - name: rate_limits.updated - group: realtime - example: | - { - "event_id": "event_5758", - "type": "rate_limits.updated", - "rate_limits": [ - { - "name": "requests", - "limit": 1000, - "remaining": 999, - "reset_seconds": 60 - }, - { - "name": "tokens", - "limit": 50000, - "remaining": 49950, - "reset_seconds": 60 - } - ] - } - RealtimeServerEventResponseAudioDelta: + - grammar + ResponseFormatTextPython: type: object - description: Returned when the model-generated audio is updated. + title: Python grammar + description: | + Configure the model to generate valid Python code. See the + [custom grammars guide](https://developers.openai.com/api/docs/guides/function-calling#context-free-grammars) for more details. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: The type of response format being defined. Always `python`. + enum: + - python x-stainless-const: true - description: The event type, must be `response.output_audio.delta`. - const: response.output_audio.delta - response_id: + required: + - type + ResponseFunctionCallArgumentsDeltaEvent: + type: object + description: Emitted when there is a partial function-call arguments delta. + properties: + type: type: string - description: The ID of the response. + description: | + The type of the event. Always `response.function_call_arguments.delta`. + enum: + - response.function_call_arguments.delta + x-stainless-const: true item_id: type: string - description: The ID of the item. + description: | + The ID of the output item that the function-call arguments delta is added to. output_index: type: integer - description: The index of the output item in the response. - content_index: + description: | + The index of the output item that the function-call arguments delta is added to. + sequence_number: type: integer - description: The index of the content part in the item's content array. + description: The sequence number of this event. delta: type: string - description: Base64-encoded audio data delta. + description: | + The function-call arguments delta that is added. required: - - event_id - type - - response_id - item_id - output_index - - content_index - delta + - sequence_number x-oaiMeta: - name: response.output_audio.delta - group: realtime + name: response.function_call_arguments.delta + group: responses example: | { - "event_id": "event_4950", - "type": "response.output_audio.delta", - "response_id": "resp_001", - "item_id": "msg_008", - "output_index": 0, - "content_index": 0, - "delta": "Base64EncodedAudioDelta" + "type": "response.function_call_arguments.delta", + "item_id": "item-abc", + "output_index": 0, + "delta": "{ \"arg\":" + "sequence_number": 1 } - RealtimeServerEventResponseAudioDone: + ResponseFunctionCallArgumentsDoneEvent: type: object - description: | - Returned when the model-generated audio is done. Also emitted when a Response - is interrupted, incomplete, or cancelled. + description: Emitted when function-call arguments are finalized. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `response.output_audio.done`. - const: response.output_audio.done - response_id: type: string - description: The ID of the response. + enum: + - response.function_call_arguments.done + x-stainless-const: true item_id: type: string description: The ID of the item. output_index: type: integer - description: The index of the output item in the response. - content_index: + description: The index of the output item. + sequence_number: type: integer - description: The index of the content part in the item's content array. + description: The sequence number of this event. + arguments: + type: string + description: The function-call arguments. required: - - event_id - type - - response_id - item_id - output_index - - content_index + - arguments + - sequence_number x-oaiMeta: - name: response.output_audio.done - group: realtime + name: response.function_call_arguments.done + group: responses example: | { - "event_id": "event_5152", - "type": "response.output_audio.done", - "response_id": "resp_001", - "item_id": "msg_008", - "output_index": 0, - "content_index": 0 + "type": "response.function_call_arguments.done", + "item_id": "item-abc", + "output_index": 1, + "arguments": "{ \"arg\": 123 }", + "sequence_number": 1 } - RealtimeServerEventResponseAudioTranscriptDelta: + ResponseImageGenCallCompletedEvent: type: object + title: ResponseImageGenCallCompletedEvent description: | - Returned when the model-generated transcription of audio output is updated. + Emitted when an image generation tool call has completed and the final image is available. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `response.output_audio_transcript.delta`. - const: response.output_audio_transcript.delta - response_id: type: string - description: The ID of the response. - item_id: - type: string - description: The ID of the item. + enum: + - response.image_generation_call.completed + description: The type of the event. Always 'response.image_generation_call.completed'. + x-stainless-const: true output_index: type: integer - description: The index of the output item in the response. - content_index: + description: The index of the output item in the response's output array. + sequence_number: type: integer - description: The index of the content part in the item's content array. - delta: + description: The sequence number of this event. + item_id: type: string - description: The transcript delta. + description: The unique identifier of the image generation item being processed. required: - - event_id - type - - response_id - - item_id - output_index - - content_index - - delta + - item_id + - sequence_number x-oaiMeta: - name: response.output_audio_transcript.delta - group: realtime + name: response.image_generation_call.completed + group: responses example: | { - "event_id": "event_4546", - "type": "response.output_audio_transcript.delta", - "response_id": "resp_001", - "item_id": "msg_008", - "output_index": 0, - "content_index": 0, - "delta": "Hello, how can I a" + "type": "response.image_generation_call.completed", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 1 } - RealtimeServerEventResponseAudioTranscriptDone: + ResponseImageGenCallGeneratingEvent: type: object + title: ResponseImageGenCallGeneratingEvent description: | - Returned when the model-generated transcription of audio output is done - streaming. Also emitted when a Response is interrupted, incomplete, or - cancelled. + Emitted when an image generation tool call is actively generating an image (intermediate state). properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `response.output_audio_transcript.done`. - const: response.output_audio_transcript.done - response_id: - type: string - description: The ID of the response. - item_id: type: string - description: The ID of the item. + enum: + - response.image_generation_call.generating + description: The type of the event. Always 'response.image_generation_call.generating'. + x-stainless-const: true output_index: type: integer - description: The index of the output item in the response. - content_index: - type: integer - description: The index of the content part in the item's content array. - transcript: + description: The index of the output item in the response's output array. + item_id: type: string - description: The final transcript of the audio. + description: The unique identifier of the image generation item being processed. + sequence_number: + type: integer + description: The sequence number of the image generation item being processed. required: - - event_id - type - - response_id - - item_id - output_index - - content_index - - transcript + - item_id + - sequence_number x-oaiMeta: - name: response.output_audio_transcript.done - group: realtime + name: response.image_generation_call.generating + group: responses example: | { - "event_id": "event_4748", - "type": "response.output_audio_transcript.done", - "response_id": "resp_001", - "item_id": "msg_008", - "output_index": 0, - "content_index": 0, - "transcript": "Hello, how can I assist you today?" + "type": "response.image_generation_call.generating", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0 } - RealtimeServerEventResponseContentPartAdded: + ResponseImageGenCallInProgressEvent: type: object + title: ResponseImageGenCallInProgressEvent description: | - Returned when a new content part is added to an assistant message item during - response generation. + Emitted when an image generation tool call is in progress. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `response.content_part.added`. - const: response.content_part.added - response_id: - type: string - description: The ID of the response. - item_id: type: string - description: The ID of the item to which the content part was added. + enum: + - response.image_generation_call.in_progress + description: The type of the event. Always 'response.image_generation_call.in_progress'. + x-stainless-const: true output_index: type: integer - description: The index of the output item in the response. - content_index: + description: The index of the output item in the response's output array. + item_id: + type: string + description: The unique identifier of the image generation item being processed. + sequence_number: type: integer - description: The index of the content part in the item's content array. - part: - type: object - description: The content part that was added. - properties: - type: - type: string - enum: - - text - - audio - description: The content type ("text", "audio"). - text: - type: string - description: The text content (if type is "text"). - audio: - type: string - description: Base64-encoded audio data (if type is "audio"). - transcript: - type: string - description: The transcript of the audio (if type is "audio"). + description: The sequence number of the image generation item being processed. required: - - event_id - type - - response_id - - item_id - output_index - - content_index - - part + - item_id + - sequence_number x-oaiMeta: - name: response.content_part.added - group: realtime + name: response.image_generation_call.in_progress + group: responses example: | { - "event_id": "event_3738", - "type": "response.content_part.added", - "response_id": "resp_001", - "item_id": "msg_007", - "output_index": 0, - "content_index": 0, - "part": { - "type": "text", - "text": "" - } + "type": "response.image_generation_call.in_progress", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0 } - RealtimeServerEventResponseContentPartDone: + ResponseImageGenCallPartialImageEvent: type: object + title: ResponseImageGenCallPartialImageEvent description: | - Returned when a content part is done streaming in an assistant message item. - Also emitted when a Response is interrupted, incomplete, or cancelled. + Emitted when a partial image is available during image generation streaming. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `response.content_part.done`. - const: response.content_part.done - response_id: type: string - description: The ID of the response. + enum: + - response.image_generation_call.partial_image + description: The type of the event. Always 'response.image_generation_call.partial_image'. + x-stainless-const: true + output_index: + type: integer + description: The index of the output item in the response's output array. item_id: type: string - description: The ID of the item. - output_index: + description: The unique identifier of the image generation item being processed. + sequence_number: type: integer - description: The index of the output item in the response. - content_index: + description: The sequence number of the image generation item being processed. + partial_image_index: type: integer - description: The index of the content part in the item's content array. - part: - type: object - description: The content part that is done. - properties: - type: - type: string - enum: - - text - - audio - description: The content type ("text", "audio"). - text: - type: string - description: The text content (if type is "text"). - audio: - type: string - description: Base64-encoded audio data (if type is "audio"). - transcript: - type: string - description: The transcript of the audio (if type is "audio"). + description: 0-based index for the partial image (backend is 1-based, but this is 0-based for the user). + partial_image_b64: + type: string + description: Base64-encoded partial image data, suitable for rendering as an image. + size: + type: string + description: The image size that was used. + quality: + type: string + description: The image quality that was used. + background: + type: string + description: The background setting that was used. + output_format: + type: string + description: The output format that was used. required: - - event_id - type - - response_id - - item_id - output_index - - content_index - - part + - item_id + - sequence_number + - partial_image_index + - partial_image_b64 x-oaiMeta: - name: response.content_part.done - group: realtime + name: response.image_generation_call.partial_image + group: responses example: | { - "event_id": "event_3940", - "type": "response.content_part.done", - "response_id": "resp_001", - "item_id": "msg_007", - "output_index": 0, - "content_index": 0, - "part": { - "type": "text", - "text": "Sure, I can help with that." - } + "type": "response.image_generation_call.partial_image", + "output_index": 0, + "item_id": "item-123", + "sequence_number": 0, + "partial_image_index": 0, + "partial_image_b64": "..." } - RealtimeServerEventResponseCreated: + ResponseInProgressEvent: type: object - description: | - Returned when a new Response is created. The first event of response creation, - where the response is in an initial state of `in_progress`. + description: Emitted when the response is in progress. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: | + The type of the event. Always `response.in_progress`. + enum: + - response.in_progress x-stainless-const: true - description: The event type, must be `response.created`. - const: response.created response: - $ref: '#/components/schemas/RealtimeResponse' + $ref: '#/components/schemas/Response' + description: | + The response that is in progress. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - response + - sequence_number x-oaiMeta: - name: response.created - group: realtime + name: response.in_progress + group: responses example: | { - "type": "response.created", - "event_id": "event_C9G8pqbTEddBSIxbBN6Os", + "type": "response.in_progress", "response": { - "object": "realtime.response", - "id": "resp_C9G8p7IH2WxLbkgPNouYL", + "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", + "object": "response", + "created_at": 1741487325, "status": "in_progress", - "status_details": null, + "completed_at": null, + "error": null, + "incomplete_details": null, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-6-astra", "output": [], - "conversation_id": "conv_C9G8mmBkLhQJwCon3hoJN", - "output_modalities": [ - "audio" - ], - "max_output_tokens": "inf", - "audio": { - "output": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "voice": "marin" + "parallel_tool_calls": true, + "previous_response_id": null, + "reasoning": { + "effort": null, + "summary": null + }, + "store": true, + "temperature": 1, + "text": { + "format": { + "type": "text" + } + }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", + "usage": null, + "user": null, + "metadata": {} + }, + "sequence_number": 1 + } + ResponseIncompleteEvent: + type: object + description: | + An event that is emitted when a response finishes as incomplete. + + Over WebSocket, steering can finish a response with + `response.incomplete_details.reason` set to `steered`, followed automatically + by a successor `response.created` that commits the queued steering input. + properties: + type: + type: string + description: | + The type of the event. Always `response.incomplete`. + enum: + - response.incomplete + x-stainless-const: true + response: + $ref: '#/components/schemas/Response' + description: | + The response that was incomplete. + sequence_number: + type: integer + description: The sequence number of this event. + required: + - type + - response + - sequence_number + x-oaiMeta: + name: response.incomplete + group: responses + example: | + { + "type": "response.incomplete", + "response": { + "id": "resp_123", + "object": "response", + "created_at": 1740855869, + "status": "incomplete", + "completed_at": null, + "error": null, + "incomplete_details": { + "reason": "max_tokens" + }, + "instructions": null, + "max_output_tokens": null, + "model": "gpt-6-astra", + "output": [], + "previous_response_id": null, + "reasoning_effort": null, + "store": false, + "temperature": 1, + "text": { + "format": { + "type": "text" } }, + "tool_choice": "auto", + "tools": [], + "top_p": 1, + "truncation": "disabled", "usage": null, - "metadata": null + "user": null, + "metadata": {} }, + "sequence_number": 1 } - RealtimeServerEventResponseDone: + ResponseItemList: type: object - description: "Returned when a Response is done streaming. Always emitted, no matter the \nfinal state. The Response object included in the `response.done` event will \ninclude all output Items in the Response but will omit the raw audio data.\n\nClients should check the `status` field of the Response to determine if it was successful\n(`completed`) or if there was another outcome: `cancelled`, `failed`, or `incomplete`.\n\nA response will contain all output items that were generated during the response, excluding\nany audio content.\n" + description: A list of Response items. properties: - event_id: - type: string - description: The unique ID of the server event. - type: + object: x-stainless-const: true - description: The event type, must be `response.done`. - const: response.done - response: - $ref: '#/components/schemas/RealtimeResponse' + description: The type of object returned, must be `list`. + const: list + data: + type: array + description: A list of items used to generate this response. + items: + $ref: '#/components/schemas/ItemResource' + has_more: + type: boolean + description: Whether there are more items available. + first_id: + type: string + description: The ID of the first item in the list. + last_id: + type: string + description: The ID of the last item in the list. required: - - event_id - - type - - response + - object + - data + - has_more + - first_id + - last_id x-oaiMeta: - name: response.done - group: realtime + name: The input item list + group: responses example: | { - "type": "response.done", - "event_id": "event_CCXHxcMy86rrKhBLDdqCh", - "response": { - "object": "realtime.response", - "id": "resp_CCXHw0UJld10EzIUXQCNh", - "status": "completed", - "status_details": null, - "output": [ - { - "id": "item_CCXHwGjjDUfOXbiySlK7i", - "type": "message", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "output_audio", - "transcript": "Loud and clear! I can hear you perfectly. How can I help you today?" - } - ] - } - ], - "conversation_id": "conv_CCXHsurMKcaVxIZvaCI5m", - "output_modalities": [ - "audio" - ], - "max_output_tokens": "inf", - "audio": { - "output": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "voice": "alloy" - } - }, - "usage": { - "total_tokens": 253, - "input_tokens": 132, - "output_tokens": 121, - "input_token_details": { - "text_tokens": 119, - "audio_tokens": 13, - "image_tokens": 0, - "cached_tokens": 64, - "cached_tokens_details": { - "text_tokens": 64, - "audio_tokens": 0, - "image_tokens": 0 + "object": "list", + "data": [ + { + "id": "msg_abc123", + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Tell me a three sentence bedtime story about a unicorn." } - }, - "output_token_details": { - "text_tokens": 30, - "audio_tokens": 91 - } - }, - "metadata": null - } + ] + } + ], + "first_id": "msg_abc123", + "last_id": "msg_abc123", + "has_more": false } - RealtimeServerEventResponseFunctionCallArgumentsDelta: + ResponseLogProb: type: object - description: | - Returned when the model-generated function call arguments are updated. + description: "A logprob is the logarithmic probability that the model assigns to producing \na particular token at a given position in the sequence. Less-negative (higher) \nlogprob values indicate greater model confidence in that token choice.\n" properties: - event_id: + token: + description: A possible text token. type: string - description: The unique ID of the server event. - type: - x-stainless-const: true + logprob: description: | - The event type, must be `response.function_call_arguments.delta`. - const: response.function_call_arguments.delta - response_id: - type: string - description: The ID of the response. - item_id: + The log probability of this token. + type: number + top_logprobs: + description: | + The log probabilities of up to 20 of the most likely tokens. + type: array + items: + type: object + properties: + token: + description: A possible text token. + type: string + logprob: + description: The log probability of this token. + type: number + required: + - token + - logprob + ResponseMCPCallArgumentsDeltaEvent: + type: object + title: ResponseMCPCallArgumentsDeltaEvent + description: | + Emitted when there is a delta (partial update) to the arguments of an MCP tool call. + properties: + type: type: string - description: The ID of the function call item. + enum: + - response.mcp_call_arguments.delta + description: The type of the event. Always 'response.mcp_call_arguments.delta'. + x-stainless-const: true output_index: type: integer - description: The index of the output item in the response. - call_id: + description: The index of the output item in the response's output array. + item_id: type: string - description: The ID of the function call. + description: The unique identifier of the MCP tool call item being processed. delta: type: string - description: The arguments delta as a JSON string. + description: | + A JSON string containing the partial update to the arguments for the MCP tool call. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - response_id - - item_id - output_index - - call_id + - item_id - delta + - sequence_number x-oaiMeta: - name: response.function_call_arguments.delta - group: realtime + name: response.mcp_call_arguments.delta + group: responses example: | { - "event_id": "event_5354", - "type": "response.function_call_arguments.delta", - "response_id": "resp_002", - "item_id": "fc_001", - "output_index": 0, - "call_id": "call_001", - "delta": "{\"location\": \"San\"" + "type": "response.mcp_call_arguments.delta", + "output_index": 0, + "item_id": "item-abc", + "delta": "{", + "sequence_number": 1 } - RealtimeServerEventResponseFunctionCallArgumentsDone: + ResponseMCPCallArgumentsDoneEvent: type: object + title: ResponseMCPCallArgumentsDoneEvent description: | - Returned when the model-generated function call arguments are done streaming. - Also emitted when a Response is interrupted, incomplete, or cancelled. + Emitted when the arguments for an MCP tool call are finalized. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: | - The event type, must be `response.function_call_arguments.done`. - const: response.function_call_arguments.done - response_id: - type: string - description: The ID of the response. - item_id: type: string - description: The ID of the function call item. + enum: + - response.mcp_call_arguments.done + description: The type of the event. Always 'response.mcp_call_arguments.done'. + x-stainless-const: true output_index: type: integer - description: The index of the output item in the response. - call_id: - type: string - description: The ID of the function call. - name: + description: The index of the output item in the response's output array. + item_id: type: string - description: The name of the function that was called. + description: The unique identifier of the MCP tool call item being processed. arguments: type: string - description: The final arguments as a JSON string. + description: | + A JSON string containing the finalized arguments for the MCP tool call. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - response_id - - item_id - output_index - - call_id - - name + - item_id - arguments + - sequence_number x-oaiMeta: - name: response.function_call_arguments.done - group: realtime + name: response.mcp_call_arguments.done + group: responses example: | { - "event_id": "event_5556", - "type": "response.function_call_arguments.done", - "response_id": "resp_002", - "item_id": "fc_001", - "output_index": 0, - "call_id": "call_001", - "name": "get_weather", - "arguments": "{\"location\": \"San Francisco\"}" + "type": "response.mcp_call_arguments.done", + "output_index": 0, + "item_id": "item-abc", + "arguments": "{\"arg1\": \"value1\", \"arg2\": \"value2\"}", + "sequence_number": 1 } - RealtimeServerEventResponseMCPCallArgumentsDelta: + ResponseMCPCallCompletedEvent: type: object - description: Returned when MCP tool call arguments are updated during response generation. + title: ResponseMCPCallCompletedEvent + description: | + Emitted when an MCP tool call has completed successfully. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `response.mcp_call_arguments.delta`. - const: response.mcp_call_arguments.delta - response_id: type: string - description: The ID of the response. + enum: + - response.mcp_call.completed + description: The type of the event. Always 'response.mcp_call.completed'. + x-stainless-const: true item_id: type: string - description: The ID of the MCP tool call item. + description: The ID of the MCP tool call item that completed. output_index: type: integer - description: The index of the output item in the response. - delta: - type: string - description: The JSON-encoded arguments delta. - obfuscation: - anyOf: - - type: string - description: If present, indicates the delta text was obfuscated. - - type: 'null' + description: The index of the output item that completed. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - response_id - item_id - output_index - - delta + - sequence_number x-oaiMeta: - name: response.mcp_call_arguments.delta - group: realtime + name: response.mcp_call.completed + group: responses example: | { - "event_id": "event_6201", - "type": "response.mcp_call_arguments.delta", - "response_id": "resp_001", - "item_id": "mcp_call_001", - "output_index": 0, - "delta": "{\"partial\":true}" + "type": "response.mcp_call.completed", + "sequence_number": 1, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", + "output_index": 0 } - RealtimeServerEventResponseMCPCallArgumentsDone: + ResponseMCPCallFailedEvent: type: object - description: Returned when MCP tool call arguments are finalized during response generation. + title: ResponseMCPCallFailedEvent + description: | + Emitted when an MCP tool call has failed. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `response.mcp_call_arguments.done`. - const: response.mcp_call_arguments.done - response_id: type: string - description: The ID of the response. + enum: + - response.mcp_call.failed + description: The type of the event. Always 'response.mcp_call.failed'. + x-stainless-const: true item_id: type: string - description: The ID of the MCP tool call item. + description: The ID of the MCP tool call item that failed. output_index: type: integer - description: The index of the output item in the response. - arguments: - type: string - description: The final JSON-encoded arguments string. + description: The index of the output item that failed. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - response_id - item_id - output_index - - arguments + - sequence_number x-oaiMeta: - name: response.mcp_call_arguments.done - group: realtime + name: response.mcp_call.failed + group: responses example: | { - "event_id": "event_6202", - "type": "response.mcp_call_arguments.done", - "response_id": "resp_001", - "item_id": "mcp_call_001", - "output_index": 0, - "arguments": "{\"q\":\"docs\"}" + "type": "response.mcp_call.failed", + "sequence_number": 1, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", + "output_index": 0 } - RealtimeServerEventResponseMCPCallCompleted: + ResponseMCPCallInProgressEvent: type: object - description: Returned when an MCP tool call has completed successfully. + title: ResponseMCPCallInProgressEvent + description: | + Emitted when an MCP tool call is in progress. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + enum: + - response.mcp_call.in_progress + description: The type of the event. Always 'response.mcp_call.in_progress'. x-stainless-const: true - description: The event type, must be `response.mcp_call.completed`. - const: response.mcp_call.completed + sequence_number: + type: integer + description: The sequence number of this event. output_index: type: integer - description: The index of the output item in the response. + description: The index of the output item in the response's output array. item_id: type: string - description: The ID of the MCP tool call item. + description: The unique identifier of the MCP tool call item being processed. required: - - event_id - type - output_index - item_id + - sequence_number x-oaiMeta: - name: response.mcp_call.completed - group: realtime + name: response.mcp_call.in_progress + group: responses example: | { - "event_id": "event_6302", - "type": "response.mcp_call.completed", - "output_index": 0, - "item_id": "mcp_call_001" + "type": "response.mcp_call.in_progress", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90" } - RealtimeServerEventResponseMCPCallFailed: + ResponseMCPListToolsCompletedEvent: type: object - description: Returned when an MCP tool call has failed. + title: ResponseMCPListToolsCompletedEvent + description: | + Emitted when the list of available MCP tools has been successfully retrieved. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + enum: + - response.mcp_list_tools.completed + description: The type of the event. Always 'response.mcp_list_tools.completed'. x-stainless-const: true - description: The event type, must be `response.mcp_call.failed`. - const: response.mcp_call.failed - output_index: - type: integer - description: The index of the output item in the response. item_id: type: string - description: The ID of the MCP tool call item. + description: The ID of the MCP tool call item that produced this output. + output_index: + type: integer + description: The index of the output item that was processed. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - output_index - item_id + - output_index + - sequence_number x-oaiMeta: - name: response.mcp_call.failed - group: realtime + name: response.mcp_list_tools.completed + group: responses example: | { - "event_id": "event_6303", - "type": "response.mcp_call.failed", - "output_index": 0, - "item_id": "mcp_call_001" + "type": "response.mcp_list_tools.completed", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" } - RealtimeServerEventResponseMCPCallInProgress: + ResponseMCPListToolsFailedEvent: type: object - description: Returned when an MCP tool call has started and is in progress. + title: ResponseMCPListToolsFailedEvent + description: | + Emitted when the attempt to list available MCP tools has failed. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + enum: + - response.mcp_list_tools.failed + description: The type of the event. Always 'response.mcp_list_tools.failed'. x-stainless-const: true - description: The event type, must be `response.mcp_call.in_progress`. - const: response.mcp_call.in_progress - output_index: - type: integer - description: The index of the output item in the response. item_id: type: string - description: The ID of the MCP tool call item. + description: The ID of the MCP tool call item that failed. + output_index: + type: integer + description: The index of the output item that failed. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - output_index - item_id + - output_index + - sequence_number x-oaiMeta: - name: response.mcp_call.in_progress - group: realtime + name: response.mcp_list_tools.failed + group: responses example: | { - "event_id": "event_6301", - "type": "response.mcp_call.in_progress", - "output_index": 0, - "item_id": "mcp_call_001" + "type": "response.mcp_list_tools.failed", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" } - RealtimeServerEventResponseOutputItemAdded: + ResponseMCPListToolsInProgressEvent: type: object - description: Returned when a new Item is created during Response generation. + title: ResponseMCPListToolsInProgressEvent + description: | + Emitted when the system is in the process of retrieving the list of available MCP tools. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + enum: + - response.mcp_list_tools.in_progress + description: The type of the event. Always 'response.mcp_list_tools.in_progress'. x-stainless-const: true - description: The event type, must be `response.output_item.added`. - const: response.output_item.added - response_id: + item_id: type: string - description: The ID of the Response to which the item belongs. + description: The ID of the MCP tool call item that is being processed. output_index: type: integer - description: The index of the output item in the Response. - item: - $ref: '#/components/schemas/RealtimeConversationItem' + description: The index of the output item that is being processed. + sequence_number: + type: integer + description: The sequence number of this event. required: - - event_id - type - - response_id + - item_id - output_index - - item + - sequence_number x-oaiMeta: - name: response.output_item.added - group: realtime + name: response.mcp_list_tools.in_progress + group: responses example: | { - "event_id": "event_3334", - "type": "response.output_item.added", - "response_id": "resp_001", - "output_index": 0, - "item": { - "id": "msg_007", - "object": "realtime.item", - "type": "message", - "status": "in_progress", - "role": "assistant", - "content": [] - } + "type": "response.mcp_list_tools.in_progress", + "sequence_number": 1, + "output_index": 0, + "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" } - RealtimeServerEventResponseOutputItemDone: + ResponseModalities: + anyOf: + - type: array + description: | + Output types that you would like the model to generate. + Most models are capable of generating text, which is the default: + + `["text"]` + + The `gpt-4o-audio-preview` model can also be used to + [generate audio](https://developers.openai.com/api/docs/guides/audio). To request that this model generate + both text and audio responses, you can use: + + `["text", "audio"]` + items: + type: string + enum: + - text + - audio + - type: 'null' + ResponseOutputItemAddedEvent: type: object - description: "Returned when an Item is done streaming. Also emitted when a Response is \ninterrupted, incomplete, or cancelled.\n" + description: Emitted when a new output item is added. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `response.output_item.done`. - const: response.output_item.done - response_id: type: string - description: The ID of the Response to which the item belongs. + description: | + The type of the event. Always `response.output_item.added`. + enum: + - response.output_item.added + x-stainless-const: true output_index: type: integer - description: The index of the output item in the Response. + description: | + The index of the output item that was added. + sequence_number: + type: integer + description: | + The sequence number of this event. item: - $ref: '#/components/schemas/RealtimeConversationItem' + $ref: '#/components/schemas/OutputItem' + description: | + The output item that was added. For reasoning items, `encrypted_content` + may be incomplete while the item is in progress. Use the reasoning item + from the corresponding `response.output_item.done` event when passing it + as input to a subsequent request. required: - - event_id - type - - response_id - output_index - item + - sequence_number x-oaiMeta: - name: response.output_item.done - group: realtime + name: response.output_item.added + group: responses example: | { - "event_id": "event_3536", - "type": "response.output_item.done", - "response_id": "resp_001", - "output_index": 0, - "item": { - "id": "msg_007", - "object": "realtime.item", - "type": "message", - "status": "completed", - "role": "assistant", - "content": [ - { - "type": "text", - "text": "Sure, I can help with that." - } - ] - } + "type": "response.output_item.added", + "output_index": 0, + "item": { + "id": "msg_123", + "status": "in_progress", + "type": "message", + "role": "assistant", + "content": [] + }, + "sequence_number": 1 } - RealtimeServerEventResponseTextDelta: + ResponseOutputItemDoneEvent: type: object - description: Returned when the text value of an "output_text" content part is updated. + description: Emitted when an output item is marked done. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `response.output_text.delta`. - const: response.output_text.delta - response_id: - type: string - description: The ID of the response. - item_id: type: string - description: The ID of the item. + description: | + The type of the event. Always `response.output_item.done`. + enum: + - response.output_item.done + x-stainless-const: true output_index: type: integer - description: The index of the output item in the response. - content_index: + description: | + The index of the output item that was marked done. + sequence_number: type: integer - description: The index of the content part in the item's content array. - delta: - type: string - description: The text delta. + description: | + The sequence number of this event. + item: + $ref: '#/components/schemas/OutputItem' + description: | + The output item that was marked done. required: - - event_id - type - - response_id - - item_id - output_index - - content_index - - delta + - item + - sequence_number x-oaiMeta: - name: response.output_text.delta - group: realtime + name: response.output_item.done + group: responses example: | { - "event_id": "event_4142", - "type": "response.output_text.delta", - "response_id": "resp_001", - "item_id": "msg_007", - "output_index": 0, - "content_index": 0, - "delta": "Sure, I can h" + "type": "response.output_item.done", + "output_index": 0, + "item": { + "id": "msg_123", + "status": "completed", + "type": "message", + "role": "assistant", + "content": [ + { + "type": "output_text", + "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", + "annotations": [] + } + ] + }, + "sequence_number": 1 } - RealtimeServerEventResponseTextDone: + ResponseOutputTextAnnotationAddedEvent: type: object + title: ResponseOutputTextAnnotationAddedEvent description: | - Returned when the text value of an "output_text" content part is done streaming. Also - emitted when a Response is interrupted, incomplete, or cancelled. + Emitted when an annotation is added to output text content. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `response.output_text.done`. - const: response.output_text.done - response_id: type: string - description: The ID of the response. + enum: + - response.output_text.annotation.added + description: The type of the event. Always 'response.output_text.annotation.added'. + x-stainless-const: true item_id: type: string - description: The ID of the item. + description: The unique identifier of the item to which the annotation is being added. output_index: type: integer - description: The index of the output item in the response. + description: The index of the output item in the response's output array. content_index: type: integer - description: The index of the content part in the item's content array. - text: - type: string - description: The final text content. + description: The index of the content part within the output item. + annotation_index: + type: integer + description: The index of the annotation within the content part. + sequence_number: + type: integer + description: The sequence number of this event. + annotation: + anyOf: + - $ref: '#/components/schemas/Annotation' + - type: 'null' + description: The annotation object being added. (See annotation schema for details.) required: - - event_id - type - - response_id - item_id - output_index - content_index - - text + - annotation_index + - annotation + - sequence_number x-oaiMeta: - name: response.output_text.done - group: realtime + name: response.output_text.annotation.added + group: responses example: | { - "event_id": "event_4344", - "type": "response.output_text.done", - "response_id": "resp_001", - "item_id": "msg_007", - "output_index": 0, - "content_index": 0, - "text": "Sure, I can help with that." + "type": "response.output_text.annotation.added", + "item_id": "item-abc", + "output_index": 0, + "content_index": 0, + "annotation_index": 0, + "annotation": { + "type": "file_citation", + "file_id": "file-abc", + "index": 0, + "filename": "example.txt" + }, + "sequence_number": 1 } - RealtimeServerEventSessionCreated: + ResponsePromptVariables: + anyOf: + - type: object + title: Prompt Variables + description: | + Optional map of values to substitute in for variables in your + prompt. The substitution values can either be strings, or other + Response input types like images or files. + x-oaiExpandable: true + x-oaiTypeLabel: map + additionalProperties: + x-oaiExpandable: true + x-oaiTypeLabel: map + anyOf: + - type: string + - $ref: '#/components/schemas/InputTextContent' + - $ref: '#/components/schemas/InputImageContent' + - $ref: '#/components/schemas/InputFileContent' + - type: 'null' + ResponseProperties: type: object - description: | - Returned when a Session is created. Emitted automatically when a new - connection is established as the first server event. This event will contain - the default Session configuration. properties: - event_id: - type: string - description: The unique ID of the server event. - type: - x-stainless-const: true - description: The event type, must be `session.created`. - const: session.created - session: - description: The session configuration. + previous_response_id: anyOf: - - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' - - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' - required: - - event_id - - type - - session - x-oaiMeta: - name: session.created - group: realtime - example: | - { - "type": "session.created", - "event_id": "event_C9G5RJeJ2gF77mV7f2B1j", - "session": { - "type": "realtime", - "object": "realtime.session", - "id": "sess_C9G5QPteg4UIbotdKLoYQ", - "model": "gpt-realtime-2025-08-28", - "output_modalities": [ - "audio" - ], - "instructions": "Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.", - "tools": [], - "tool_choice": "auto", - "max_output_tokens": "inf", - "tracing": null, - "prompt": null, - "expires_at": 1756324625, - "audio": { - "input": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "transcription": null, - "noise_reduction": null, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 200, - "idle_timeout_ms": null, - "create_response": true, - "interrupt_response": true - } - }, - "output": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "voice": "marin", - "speed": 1 - } - }, - "include": null - }, - } - RealtimeServerEventSessionUpdated: + - type: string + description: | + The unique ID of the previous response to the model. Use this to + create multi-turn conversations. Learn more about + [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`. + - type: 'null' + model: + description: | + Model ID used to generate the response, like `gpt-6-astra`. OpenAI + offers a wide range of models with different capabilities, performance + characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) + to browse and compare available models. + $ref: '#/components/schemas/ModelIdsResponses' + background: + anyOf: + - type: boolean + description: | + Whether to run the model response in the background. + [Learn more](https://developers.openai.com/api/docs/guides/background). + default: false + - type: 'null' + max_tool_calls: + anyOf: + - description: | + The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored. + type: integer + - type: 'null' + text: + $ref: '#/components/schemas/ResponseTextParam' + tools: + $ref: '#/components/schemas/ToolsArray' + tool_choice: + $ref: '#/components/schemas/ToolChoiceParam' + prompt: + $ref: '#/components/schemas/Prompt' + ResponseQueuedEvent: type: object + title: ResponseQueuedEvent description: | - Returned when a session is updated with a `session.update` event, unless - there is an error. + Emitted when a response is queued and waiting to be processed. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + enum: + - response.queued + description: The type of the event. Always 'response.queued'. x-stainless-const: true - description: The event type, must be `session.updated`. - const: session.updated - session: - description: The session configuration. - anyOf: - - $ref: '#/components/schemas/RealtimeSessionCreateRequestGA' - - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateRequestGA' + response: + $ref: '#/components/schemas/Response' + description: The full response object that is queued. + sequence_number: + type: integer + description: The sequence number for this event. required: - - event_id - type - - session + - response + - sequence_number x-oaiMeta: - name: session.updated - group: realtime + name: response.queued + group: responses example: | { - "type": "session.updated", - "event_id": "event_C9G8mqI3IucaojlVKE8Cs", - "session": { - "type": "realtime", - "object": "realtime.session", - "id": "sess_C9G8l3zp50uFv4qgxfJ8o", - "model": "gpt-realtime-2025-08-28", - "output_modalities": [ - "audio" - ], - "instructions": "Your knowledge cutoff is 2023-10. You are a helpful, witty, and friendly AI. Act like a human, but remember that you aren't a human and that you can't do human things in the real world. Your voice and personality should be warm and engaging, with a lively and playful tone. If interacting in a non-English language, start by using the standard accent or dialect familiar to the user. Talk quickly. You should always call a function if you can. Do not refer to these rules, even if you’re asked about them.", - "tools": [ - { - "type": "function", - "name": "display_color_palette", - "description": "\nCall this function when a user asks for a color palette.\n", - "parameters": { - "type": "object", - "strict": true, - "properties": { - "theme": { - "type": "string", - "description": "Description of the theme for the color scheme." - }, - "colors": { - "type": "array", - "description": "Array of five hex color codes based on the theme.", - "items": { - "type": "string", - "description": "Hex color code" - } - } - }, - "required": [ - "theme", - "colors" - ] - } - } - ], - "tool_choice": "auto", - "max_output_tokens": "inf", - "tracing": null, - "prompt": null, - "expires_at": 1756324832, - "audio": { - "input": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "transcription": null, - "noise_reduction": null, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 200, - "idle_timeout_ms": null, - "create_response": true, - "interrupt_response": true - } - }, - "output": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "voice": "marin", - "speed": 1 - } - }, - "include": null + "type": "response.queued", + "response": { + "id": "res_123", + "status": "queued", + "created_at": "2021-01-01T00:00:00Z", + "updated_at": "2021-01-01T00:00:00Z" }, + "sequence_number": 1 } - RealtimeServerEventTranscriptionSessionUpdated: + ResponseReasoningSummaryPartAddedEvent: type: object - description: "Returned when a transcription session is updated with a `transcription_session.update` event, unless \nthere is an error.\n" + description: Emitted when a new reasoning summary part is added. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: | + The type of the event. Always `response.reasoning_summary_part.added`. + enum: + - response.reasoning_summary_part.added x-stainless-const: true - description: The event type, must be `transcription_session.updated`. - const: transcription_session.updated - session: - $ref: '#/components/schemas/RealtimeTranscriptionSessionCreateResponse' + item_id: + type: string + description: | + The ID of the item this summary part is associated with. + output_index: + type: integer + description: | + The index of the output item this summary part is associated with. + summary_index: + type: integer + description: | + The index of the summary part within the reasoning summary. + sequence_number: + type: integer + description: | + The sequence number of this event. + part: + type: object + description: | + The summary part that was added. + properties: + type: + type: string + description: The type of the summary part. Always `summary_text`. + enum: + - summary_text + x-stainless-const: true + text: + type: string + description: The text of the summary part. + required: + - type + - text required: - - event_id - type - - session + - item_id + - output_index + - summary_index + - part + - sequence_number x-oaiMeta: - name: transcription_session.updated - group: realtime + name: response.reasoning_summary_part.added + group: responses example: | { - "event_id": "event_5678", - "type": "transcription_session.updated", - "session": { - "id": "sess_001", - "object": "realtime.transcription_session", - "input_audio_format": "pcm16", - "input_audio_transcription": { - "model": "gpt-4o-transcribe", - "prompt": "", - "language": "" - }, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 500, - "create_response": true, - // "interrupt_response": false -- this will NOT be returned - }, - "input_audio_noise_reduction": { - "type": "near_field" - }, - "include": [ - "item.input_audio_transcription.avg_logprob", - ], - } + "type": "response.reasoning_summary_part.added", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "part": { + "type": "summary_text", + "text": "" + }, + "sequence_number": 1 } - RealtimeSession: + ResponseReasoningSummaryPartDoneEvent: type: object - description: Realtime session object for the beta interface. + description: Emitted when a reasoning summary part is completed. properties: - id: + type: type: string description: | - Unique identifier for the session that looks like `sess_1234567890abcdef`. - object: - type: string + The type of the event. Always `response.reasoning_summary_part.done`. enum: - - realtime.session - description: The object type. Always `realtime.session`. - modalities: - description: | - The set of modalities the model can respond with. To disable audio, - set this to ["text"]. - items: - type: string - enum: - - text - - audio - model: - description: | - The Realtime model used for this session. - anyOf: - - type: string - - type: string - enum: - - gpt-realtime - - gpt-realtime-1.5 - - gpt-realtime-2025-08-28 - - gpt-4o-realtime-preview - - gpt-4o-realtime-preview-2024-10-01 - - gpt-4o-realtime-preview-2024-12-17 - - gpt-4o-realtime-preview-2025-06-03 - - gpt-4o-mini-realtime-preview - - gpt-4o-mini-realtime-preview-2024-12-17 - - gpt-realtime-mini - - gpt-realtime-mini-2025-10-06 - - gpt-realtime-mini-2025-12-15 - - gpt-audio-1.5 - - gpt-audio-mini - - gpt-audio-mini-2025-10-06 - - gpt-audio-mini-2025-12-15 - instructions: + - response.reasoning_summary_part.done + x-stainless-const: true + item_id: type: string description: | - The default system instructions (i.e. system message) prepended to model - calls. This field allows the client to guide the model on desired - responses. The model can be instructed on response content and format, - (e.g. "be extremely succinct", "act friendly", "here are examples of good - responses") and on audio behavior (e.g. "talk quickly", "inject emotion - into your voice", "laugh frequently"). The instructions are not - guaranteed to be followed by the model, but they provide guidance to the - model on the desired behavior. - - - Note that the server sets default instructions which will be used if this - field is not set and are visible in the `session.created` event at the - start of the session. - voice: - $ref: '#/components/schemas/VoiceIdsShared' + The ID of the item this summary part is associated with. + output_index: + type: integer description: | - The voice the model uses to respond. Voice cannot be changed during the - session once the model has responded with audio at least once. Current - voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, - `shimmer`, and `verse`. - input_audio_format: - type: string - default: pcm16 - enum: - - pcm16 - - g711_ulaw - - g711_alaw + The index of the output item this summary part is associated with. + summary_index: + type: integer description: | - The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. - For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, - single channel (mono), and little-endian byte order. - output_audio_format: + The index of the summary part within the reasoning summary. + status: type: string - default: pcm16 + description: | + The completion status of the summary part. Omitted when the part completed + normally and set to `incomplete` when generation was interrupted. enum: - - pcm16 - - g711_ulaw - - g711_alaw + - incomplete + sequence_number: + type: integer description: | - The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. - For `pcm16`, output audio is sampled at a rate of 24kHz. - input_audio_transcription: - anyOf: - - allOf: - - $ref: '#/components/schemas/AudioTranscription' - description: | - Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service. - - type: 'null' - turn_detection: - $ref: '#/components/schemas/RealtimeTurnDetection' - input_audio_noise_reduction: + The sequence number of this event. + part: type: object + description: | + The completed summary part. properties: type: - $ref: '#/components/schemas/NoiseReductionType' - description: | - Configuration for input audio noise reduction. This can be set to `null` to turn off. - Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. - Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. - speed: - type: number - default: 1 - maximum: 1.5 - minimum: 0.25 - description: | - The speed of the model's spoken response. 1.0 is the default speed. 0.25 is - the minimum speed. 1.5 is the maximum speed. This value can only be changed - in between model turns, not while a response is in progress. - tracing: - anyOf: - - title: Tracing Configuration - description: | - Configuration options for tracing. Set to null to disable tracing. Once - tracing is enabled for a session, the configuration cannot be modified. - - `auto` will create a trace for the session with default values for the - workflow name, group id, and metadata. - anyOf: - - type: string - default: auto - description: | - Default tracing mode for the session. + type: string + description: The type of the summary part. Always `summary_text`. enum: - - auto + - summary_text x-stainless-const: true - - type: object - title: Tracing Configuration - description: | - Granular configuration for tracing. - properties: - workflow_name: - type: string - description: | - The name of the workflow to attach to this trace. This is used to - name the trace in the traces dashboard. - group_id: - type: string - description: | - The group id to attach to this trace to enable filtering and - grouping in the traces dashboard. - metadata: - type: object - description: | - The arbitrary metadata to attach to this trace to enable - filtering in the traces dashboard. - - type: 'null' - tools: - type: array - description: Tools (functions) available to the model. - items: - $ref: '#/components/schemas/RealtimeFunctionTool' - tool_choice: - type: string - default: auto - description: | - How the model chooses tools. Options are `auto`, `none`, `required`, or - specify a function. - temperature: - type: number - default: 0.8 - description: | - Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a temperature of 0.8 is highly recommended for best performance. - max_response_output_tokens: - description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. - anyOf: - - type: integer - - type: string - enum: - - inf - x-stainless-const: true - expires_at: - type: integer - format: unixtime - description: Expiration timestamp for the session, in seconds since epoch. - prompt: - anyOf: - - $ref: '#/components/schemas/Prompt' - - type: 'null' - include: - anyOf: - - type: array - items: + text: type: string - enum: - - item.input_audio_transcription.logprobs - description: | - Additional fields to include in server outputs. - - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. - - type: 'null' - RealtimeSessionCreateRequest: + description: The text of the summary part. + required: + - type + - text + required: + - type + - item_id + - output_index + - summary_index + - part + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_part.done + group: responses + example: | + { + "type": "response.reasoning_summary_part.done", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "part": { + "type": "summary_text", + "text": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!" + }, + "sequence_number": 1 + } + ResponseReasoningSummaryTextDeltaEvent: type: object - description: | - A new Realtime session configuration, with an ephemeral key. Default TTL - for keys is one minute. + description: Emitted when a delta is added to a reasoning summary text. properties: - client_secret: - type: object - description: Ephemeral key returned by the API. - properties: - value: - type: string - description: | - Ephemeral key usable in client environments to authenticate connections - to the Realtime API. Use this in client-side environments rather than - a standard API token, which should only be used server-side. - expires_at: - type: integer - format: unixtime - description: | - Timestamp for when the token expires. Currently, all tokens expire - after one minute. - required: - - value - - expires_at - modalities: - description: | - The set of modalities the model can respond with. To disable audio, - set this to ["text"]. - items: - type: string - enum: - - text - - audio - instructions: + type: type: string description: | - The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. - Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session. - voice: - $ref: '#/components/schemas/VoiceIdsOrCustomVoice' - description: | - The voice the model uses to respond. Supported built-in voices are - `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, - `marin`, and `cedar`. You may also provide a custom voice object with an - `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed during - the session once the model has responded with audio at least once. - input_audio_format: + The type of the event. Always `response.reasoning_summary_text.delta`. + enum: + - response.reasoning_summary_text.delta + x-stainless-const: true + item_id: type: string description: | - The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. - output_audio_format: - type: string + The ID of the item this summary text delta is associated with. + output_index: + type: integer description: | - The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. - input_audio_transcription: - type: object + The index of the output item this summary text delta is associated with. + summary_index: + type: integer description: | - Configuration for input audio transcription, defaults to off and can be - set to `null` to turn off once on. Input audio transcription is not native - to the model, since the model consumes audio directly. Transcription runs - asynchronously and should be treated as rough guidance - rather than the representation understood by the model. - properties: - model: - type: string - description: | - The model to use for transcription. - speed: - type: number - default: 1 - maximum: 1.5 - minimum: 0.25 + The index of the summary part within the reasoning summary. + delta: + type: string description: | - The speed of the model's spoken response. 1.0 is the default speed. 0.25 is - the minimum speed. 1.5 is the maximum speed. This value can only be changed - in between model turns, not while a response is in progress. - tracing: - title: Tracing Configuration + The text delta that was added to the summary. + sequence_number: + type: integer description: | - Configuration options for tracing. Set to null to disable tracing. Once - tracing is enabled for a session, the configuration cannot be modified. - - `auto` will create a trace for the session with default values for the - workflow name, group id, and metadata. - anyOf: - - type: string - default: auto - description: | - Default tracing mode for the session. - enum: - - auto - x-stainless-const: true - - type: object - title: Tracing Configuration - description: | - Granular configuration for tracing. - properties: - workflow_name: - type: string - description: | - The name of the workflow to attach to this trace. This is used to - name the trace in the traces dashboard. - group_id: - type: string - description: | - The group id to attach to this trace to enable filtering and - grouping in the traces dashboard. - metadata: - type: object - description: | - The arbitrary metadata to attach to this trace to enable - filtering in the traces dashboard. - turn_detection: - type: object + The sequence number of this event. + required: + - type + - item_id + - output_index + - summary_index + - delta + - sequence_number + x-oaiMeta: + name: response.reasoning_summary_text.delta + group: responses + example: | + { + "type": "response.reasoning_summary_text.delta", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "delta": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!", + "sequence_number": 1 + } + ResponseReasoningSummaryTextDoneEvent: + type: object + description: Emitted when a reasoning summary text is completed. + properties: + type: + type: string description: | - Configuration for turn detection. Can be set to `null` to turn off. Server - VAD means that the model will detect the start and end of speech based on - audio volume and respond at the end of user speech. - properties: - type: - type: string - description: | - Type of turn detection, only `server_vad` is currently supported. - threshold: - type: number - description: | - Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A - higher threshold will require louder audio to activate the model, and - thus might perform better in noisy environments. - prefix_padding_ms: - type: integer - description: | - Amount of audio to include before the VAD detected speech (in - milliseconds). Defaults to 300ms. - silence_duration_ms: - type: integer - description: | - Duration of silence to detect speech stop (in milliseconds). Defaults - to 500ms. With shorter values the model will respond more quickly, - but may jump in on short pauses from the user. - tools: - type: array - description: Tools (functions) available to the model. - items: - type: object - properties: - type: - type: string - enum: - - function - description: The type of the tool, i.e. `function`. - x-stainless-const: true - name: - type: string - description: The name of the function. - description: - type: string - description: | - The description of the function, including guidance on when and how - to call it, and guidance about what to tell the user when calling - (if anything). - parameters: - type: object - description: Parameters of the function in JSON Schema. - tool_choice: + The type of the event. Always `response.reasoning_summary_text.done`. + enum: + - response.reasoning_summary_text.done + x-stainless-const: true + item_id: type: string description: | - How the model chooses tools. Options are `auto`, `none`, `required`, or - specify a function. - temperature: - type: number + The ID of the item this summary text is associated with. + output_index: + type: integer description: | - Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. - max_response_output_tokens: + The index of the output item this summary text is associated with. + summary_index: + type: integer description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. - anyOf: - - type: integer - - type: string - enum: - - inf - x-stainless-const: true - truncation: - $ref: '#/components/schemas/RealtimeTruncation' - prompt: - $ref: '#/components/schemas/Prompt' + The index of the summary part within the reasoning summary. + text: + type: string + description: | + The full text of the completed reasoning summary. + sequence_number: + type: integer + description: | + The sequence number of this event. required: - - client_secret + - type + - item_id + - output_index + - summary_index + - text + - sequence_number x-oaiMeta: - name: The session object - group: realtime + name: response.reasoning_summary_text.done + group: responses example: | { - "id": "sess_001", - "object": "realtime.session", - "model": "gpt-realtime-2025-08-25", - "modalities": ["audio", "text"], - "instructions": "You are a friendly assistant.", - "voice": "alloy", - "input_audio_format": "pcm16", - "output_audio_format": "pcm16", - "input_audio_transcription": { - "model": "whisper-1" - }, - "turn_detection": null, - "tools": [], - "tool_choice": "none", - "temperature": 0.7, - "speed": 1.1, - "tracing": "auto", - "max_response_output_tokens": 200, - "truncation": "auto", - "prompt": null, - "client_secret": { - "value": "ek_abc123", - "expires_at": 1234567890 - } + "type": "response.reasoning_summary_text.done", + "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", + "output_index": 0, + "summary_index": 0, + "text": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!", + "sequence_number": 1 } - RealtimeSessionCreateRequestGA: + ResponseReasoningTextDeltaEvent: type: object - title: Realtime session configuration - description: Realtime session object configuration. + description: Emitted when a delta is added to a reasoning text. properties: type: type: string description: | - The type of session to create. Always `realtime` for the Realtime API. + The type of the event. Always `response.reasoning_text.delta`. enum: - - realtime + - response.reasoning_text.delta x-stainless-const: true - output_modalities: - type: array - description: | - The set of modalities the model can respond with. It defaults to `["audio"]`, indicating - that the model will respond with audio plus a transcript. `["text"]` can be used to make - the model respond with text only. It is not possible to request both `text` and `audio` at the same time. - default: - - audio - items: - type: string - enum: - - text - - audio - model: - anyOf: - - type: string - - type: string - enum: - - gpt-realtime - - gpt-realtime-1.5 - - gpt-realtime-2 - - gpt-realtime-2.1 - - gpt-realtime-2.1-mini - - gpt-realtime-2025-08-28 - - gpt-4o-realtime-preview - - gpt-4o-realtime-preview-2024-10-01 - - gpt-4o-realtime-preview-2024-12-17 - - gpt-4o-realtime-preview-2025-06-03 - - gpt-4o-mini-realtime-preview - - gpt-4o-mini-realtime-preview-2024-12-17 - - gpt-realtime-mini - - gpt-realtime-mini-2025-10-06 - - gpt-realtime-mini-2025-12-15 - - gpt-audio-1.5 - - gpt-audio-mini - - gpt-audio-mini-2025-10-06 - - gpt-audio-mini-2025-12-15 - x-stainless-nominal: false - description: | - The Realtime model used for this session. - instructions: + item_id: type: string description: | - The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. - - Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session. - audio: - type: object - description: | - Configuration for input and output audio. - properties: - input: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - description: The format of the input audio. - transcription: - description: | - Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service. - $ref: '#/components/schemas/AudioTranscription' - noise_reduction: - type: object - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - description: | - Configuration for input audio noise reduction. This can be set to `null` to turn off. - Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. - Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. - turn_detection: - $ref: '#/components/schemas/RealtimeTurnDetection' - output: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - description: The format of the output audio. - voice: - $ref: '#/components/schemas/VoiceIdsOrCustomVoice' - default: alloy - description: | - The voice the model uses to respond. Supported built-in voices are - `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, `shimmer`, `verse`, - `marin`, and `cedar`. You may also provide a custom voice object with - an `id`, for example `{ "id": "voice_1234" }`. Voice cannot be changed - during the session once the model has responded with audio at least once. - We recommend `marin` and `cedar` for best quality. - speed: - type: number - default: 1 - maximum: 1.5 - minimum: 0.25 - description: | - The speed of the model's spoken response as a multiple of the original speed. - 1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress. - - This parameter is a post-processing adjustment to the audio after it is generated, it's - also possible to prompt the model to speak faster or slower. - include: - type: array - items: - type: string - enum: - - item.input_audio_transcription.logprobs - description: | - Additional fields to include in server outputs. - - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. - tracing: - title: Tracing Configuration - anyOf: - - type: string - title: auto - default: auto - description: | - Enables tracing and sets default values for tracing configuration options. Always `auto`. - enum: - - auto - x-stainless-const: true - - type: object - title: Tracing Configuration - description: | - Granular configuration for tracing. - properties: - workflow_name: - type: string - description: | - The name of the workflow to attach to this trace. This is used to - name the trace in the Traces Dashboard. - group_id: - type: string - description: | - The group id to attach to this trace to enable filtering and - grouping in the Traces Dashboard. - metadata: - type: object - description: | - The arbitrary metadata to attach to this trace to enable - filtering in the Traces Dashboard. + The ID of the item this reasoning text delta is associated with. + output_index: + type: integer description: | - Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once - tracing is enabled for a session, the configuration cannot be modified. - - `auto` will create a trace for the session with default values for the - workflow name, group id, and metadata. - nullable: true - tools: - type: array - description: Tools available to the model. - items: - anyOf: - - $ref: '#/components/schemas/RealtimeFunctionTool' - - $ref: '#/components/schemas/MCPTool' - discriminator: - propertyName: type - tool_choice: + The index of the output item this reasoning text delta is associated with. + content_index: + type: integer description: | - How the model chooses tools. Provide one of the string modes or force a specific - function/MCP tool. - default: auto - anyOf: - - $ref: '#/components/schemas/ToolChoiceOptions' - - $ref: '#/components/schemas/ToolChoiceFunction' - - $ref: '#/components/schemas/ToolChoiceMCP' - parallel_tool_calls: - type: boolean + The index of the reasoning content part this delta is associated with. + delta: + type: string description: | - Whether the model may call multiple tools in parallel. Only supported by - reasoning Realtime models such as `gpt-realtime-2`. - reasoning: - $ref: '#/components/schemas/RealtimeReasoning' - max_output_tokens: + The text delta that was added to the reasoning content. + sequence_number: + type: integer description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. - anyOf: - - type: integer - - type: string - enum: - - inf - x-stainless-const: true - truncation: - $ref: '#/components/schemas/RealtimeTruncation' - prompt: - $ref: '#/components/schemas/Prompt' + The sequence number of this event. required: - type - RealtimeSessionCreateResponse: + - item_id + - output_index + - content_index + - delta + - sequence_number + x-oaiMeta: + name: response.reasoning_text.delta + group: responses + example: | + { + "type": "response.reasoning_text.delta", + "item_id": "rs_123", + "output_index": 0, + "content_index": 0, + "delta": "The", + "sequence_number": 1 + } + ResponseReasoningTextDoneEvent: type: object - title: Realtime session configuration object - description: | - A Realtime session configuration object. + description: Emitted when a reasoning text is completed. properties: - id: + type: type: string description: | - Unique identifier for the session that looks like `sess_1234567890abcdef`. - object: + The type of the event. Always `response.reasoning_text.done`. + enum: + - response.reasoning_text.done + x-stainless-const: true + item_id: type: string - description: The object type. Always `realtime.session`. - expires_at: + description: | + The ID of the item this reasoning text is associated with. + output_index: type: integer - format: unixtime - description: Expiration timestamp for the session, in seconds since epoch. - include: - type: array - items: - type: string - enum: - - item.input_audio_transcription.logprobs description: | - Additional fields to include in server outputs. - - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. - model: - type: string - description: The Realtime model used for this session. - output_modalities: + The index of the output item this reasoning text is associated with. + content_index: + type: integer description: | - The set of modalities the model can respond with. To disable audio, - set this to ["text"]. - items: - type: string - enum: - - text - - audio - instructions: + The index of the reasoning content part. + text: type: string description: | - The default system instructions (i.e. system message) prepended to model - calls. This field allows the client to guide the model on desired - responses. The model can be instructed on response content and format, - (e.g. "be extremely succinct", "act friendly", "here are examples of good - responses") and on audio behavior (e.g. "talk quickly", "inject emotion - into your voice", "laugh frequently"). The instructions are not guaranteed - to be followed by the model, but they provide guidance to the model on the - desired behavior. - - Note that the server sets default instructions which will be used if this - field is not set and are visible in the `session.created` event at the - start of the session. - audio: - type: object + The full text of the completed reasoning content. + sequence_number: + type: integer description: | - Configuration for input and output audio for the session. - properties: - input: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - transcription: - $ref: '#/components/schemas/AudioTranscription' - noise_reduction: - type: object - description: | - Configuration for input audio noise reduction. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - turn_detection: - type: object - description: | - Configuration for turn detection. - properties: - type: - type: string - description: | - Type of turn detection, only `server_vad` is currently supported. - threshold: - type: number - prefix_padding_ms: - type: integer - silence_duration_ms: - type: integer - output: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - voice: - $ref: '#/components/schemas/VoiceIdsShared' - speed: - type: number - tracing: - title: Tracing Configuration + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - text + - sequence_number + x-oaiMeta: + name: response.reasoning_text.done + group: responses + example: | + { + "type": "response.reasoning_text.done", + "item_id": "rs_123", + "output_index": 0, + "content_index": 0, + "text": "The user is asking...", + "sequence_number": 4 + } + ResponseRefusalDeltaEvent: + type: object + description: Emitted when there is a partial refusal text. + properties: + type: + type: string description: | - Configuration options for tracing. Set to null to disable tracing. Once - tracing is enabled for a session, the configuration cannot be modified. - - `auto` will create a trace for the session with default values for the - workflow name, group id, and metadata. - anyOf: - - type: string - default: auto - description: | - Default tracing mode for the session. - enum: - - auto - x-stainless-const: true - - type: object - title: Tracing Configuration - description: | - Granular configuration for tracing. - properties: - workflow_name: - type: string - description: | - The name of the workflow to attach to this trace. This is used to - name the trace in the traces dashboard. - group_id: - type: string - description: | - The group id to attach to this trace to enable filtering and - grouping in the traces dashboard. - metadata: - type: object - description: | - The arbitrary metadata to attach to this trace to enable - filtering in the traces dashboard. - turn_detection: - type: object + The type of the event. Always `response.refusal.delta`. + enum: + - response.refusal.delta + x-stainless-const: true + item_id: + type: string description: | - Configuration for turn detection. Can be set to `null` to turn off. Server - VAD means that the model will detect the start and end of speech based on - audio volume and respond at the end of user speech. - properties: - type: - type: string - description: | - Type of turn detection, only `server_vad` is currently supported. - threshold: - type: number - description: | - Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A - higher threshold will require louder audio to activate the model, and - thus might perform better in noisy environments. - prefix_padding_ms: - type: integer - description: | - Amount of audio to include before the VAD detected speech (in - milliseconds). Defaults to 300ms. - silence_duration_ms: - type: integer - description: | - Duration of silence to detect speech stop (in milliseconds). Defaults - to 500ms. With shorter values the model will respond more quickly, - but may jump in on short pauses from the user. - tools: - type: array - description: Tools (functions) available to the model. - items: - $ref: '#/components/schemas/RealtimeFunctionTool' - tool_choice: + The ID of the output item that the refusal text is added to. + output_index: + type: integer + description: | + The index of the output item that the refusal text is added to. + content_index: + type: integer + description: | + The index of the content part that the refusal text is added to. + delta: type: string description: | - How the model chooses tools. Options are `auto`, `none`, `required`, or - specify a function. - max_output_tokens: + The refusal text that is added. + sequence_number: + type: integer description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. - anyOf: - - type: integer - - type: string - enum: - - inf - x-stainless-const: true + The sequence number of this event. + required: + - type + - item_id + - output_index + - content_index + - delta + - sequence_number x-oaiMeta: - name: The session object - group: realtime + name: response.refusal.delta + group: responses example: | { - "id": "sess_001", - "object": "realtime.session", - "expires_at": 1742188264, - "model": "gpt-realtime", - "output_modalities": ["audio"], - "instructions": "You are a friendly assistant.", - "tools": [], - "tool_choice": "none", - "max_output_tokens": "inf", - "tracing": "auto", - "truncation": "auto", - "prompt": null, - "audio": { - "input": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "transcription": { "model": "whisper-1" }, - "noise_reduction": null, - "turn_detection": null - }, - "output": { - "format": { - "type": "audio/pcm", - "rate": 24000 - }, - "voice": "alloy", - "speed": 1.0 - } - } + "type": "response.refusal.delta", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "delta": "refusal text so far", + "sequence_number": 1 } - RealtimeSessionCreateResponseGA: + ResponseRefusalDoneEvent: type: object - title: Realtime session configuration object - description: | - A Realtime session configuration object. + description: Emitted when refusal text is finalized. properties: type: type: string description: | - The type of session to create. Always `realtime` for the Realtime API. + The type of the event. Always `response.refusal.done`. enum: - - realtime + - response.refusal.done x-stainless-const: true - id: + item_id: type: string description: | - Unique identifier for the session that looks like `sess_1234567890abcdef`. - object: - type: string - description: The object type. Always `realtime.session`. - enum: - - realtime.session - x-stainless-const: true - expires_at: + The ID of the output item that the refusal text is finalized. + output_index: type: integer - format: unixtime - description: Expiration timestamp for the session, in seconds since epoch. - output_modalities: - type: array description: | - The set of modalities the model can respond with. It defaults to `["audio"]`, indicating - that the model will respond with audio plus a transcript. `["text"]` can be used to make - the model respond with text only. It is not possible to request both `text` and `audio` at the same time. - default: - - audio - items: - type: string - enum: - - text - - audio - model: - anyOf: - - type: string - - type: string - enum: - - gpt-realtime - - gpt-realtime-1.5 - - gpt-realtime-2 - - gpt-realtime-2.1 - - gpt-realtime-2.1-mini - - gpt-realtime-2025-08-28 - - gpt-4o-realtime-preview - - gpt-4o-realtime-preview-2024-10-01 - - gpt-4o-realtime-preview-2024-12-17 - - gpt-4o-realtime-preview-2025-06-03 - - gpt-4o-mini-realtime-preview - - gpt-4o-mini-realtime-preview-2024-12-17 - - gpt-realtime-mini - - gpt-realtime-mini-2025-10-06 - - gpt-realtime-mini-2025-12-15 - - gpt-audio-1.5 - - gpt-audio-mini - - gpt-audio-mini-2025-10-06 - - gpt-audio-mini-2025-12-15 + The index of the output item that the refusal text is finalized. + content_index: + type: integer description: | - The Realtime model used for this session. - instructions: + The index of the content part that the refusal text is finalized. + refusal: type: string description: | - The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. - - Note that the server sets default instructions which will be used if this field is not set and are visible in the `session.created` event at the start of the session. - audio: - type: object - description: | - Configuration for input and output audio. - properties: - input: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - description: The format of the input audio. - transcription: - $ref: '#/components/schemas/AudioTranscription' - noise_reduction: - type: object - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - description: | - Configuration for input audio noise reduction. This can be set to `null` to turn off. - Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. - Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. - turn_detection: - $ref: '#/components/schemas/RealtimeTurnDetection' - output: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - description: The format of the output audio. - voice: - $ref: '#/components/schemas/VoiceIdsShared' - default: alloy - description: | - The voice the model uses to respond. Voice cannot be changed during the - session once the model has responded with audio at least once. Current - voice options are `alloy`, `ash`, `ballad`, `coral`, `echo`, `sage`, - `shimmer`, `verse`, `marin`, and `cedar`. We recommend `marin` and `cedar` for - best quality. - speed: - type: number - default: 1 - maximum: 1.5 - minimum: 0.25 - description: | - The speed of the model's spoken response as a multiple of the original speed. - 1.0 is the default speed. 0.25 is the minimum speed. 1.5 is the maximum speed. This value can only be changed in between model turns, not while a response is in progress. - - This parameter is a post-processing adjustment to the audio after it is generated, it's - also possible to prompt the model to speak faster or slower. - include: - type: array - items: - type: string - enum: - - item.input_audio_transcription.logprobs - description: | - Additional fields to include in server outputs. - - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. - tracing: - anyOf: - - title: Tracing Configuration - anyOf: - - type: string - title: auto - default: auto - description: | - Enables tracing and sets default values for tracing configuration options. Always `auto`. - enum: - - auto - x-stainless-const: true - - type: object - title: Tracing Configuration - description: | - Granular configuration for tracing. - properties: - workflow_name: - type: string - description: | - The name of the workflow to attach to this trace. This is used to - name the trace in the Traces Dashboard. - group_id: - type: string - description: | - The group id to attach to this trace to enable filtering and - grouping in the Traces Dashboard. - metadata: - type: object - description: | - The arbitrary metadata to attach to this trace to enable - filtering in the Traces Dashboard. - description: | - Realtime API can write session traces to the [Traces Dashboard](https://platform.openai.com/logs?api=traces). Set to null to disable tracing. Once - tracing is enabled for a session, the configuration cannot be modified. - - `auto` will create a trace for the session with default values for the - workflow name, group id, and metadata. - - type: 'null' - tools: - type: array - description: Tools available to the model. - items: - anyOf: - - $ref: '#/components/schemas/RealtimeFunctionTool' - - $ref: '#/components/schemas/MCPTool' - tool_choice: - description: | - How the model chooses tools. Provide one of the string modes or force a specific - function/MCP tool. - default: auto - anyOf: - - $ref: '#/components/schemas/ToolChoiceOptions' - - $ref: '#/components/schemas/ToolChoiceFunction' - - $ref: '#/components/schemas/ToolChoiceMCP' - reasoning: - $ref: '#/components/schemas/RealtimeReasoning' - max_output_tokens: + The refusal text that is finalized. + sequence_number: + type: integer description: | - Maximum number of output tokens for a single assistant response, - inclusive of tool calls. Provide an integer between 1 and 4096 to - limit output tokens, or `inf` for the maximum available tokens for a - given model. Defaults to `inf`. - anyOf: - - type: integer - - type: string - enum: - - inf - x-stainless-const: true - truncation: - $ref: '#/components/schemas/RealtimeTruncation' - prompt: - $ref: '#/components/schemas/Prompt' + The sequence number of this event. required: - type - - id - - object + - item_id + - output_index + - content_index + - refusal + - sequence_number x-oaiMeta: - name: The session object - group: realtime - RealtimeTranscriptionSessionCreateRequest: + name: response.refusal.done + group: responses + example: | + { + "type": "response.refusal.done", + "item_id": "item-abc", + "output_index": 1, + "content_index": 2, + "refusal": "final refusal text", + "sequence_number": 1 + } + ResponseSteerAcceptedEvent: type: object - title: Realtime transcription session configuration - description: Realtime transcription session object configuration. + title: ResponseSteerAcceptedEvent + description: | + Emitted when steering input has been validated and queued. Acceptance means + the server owns the input, not that it has been applied. The successor's + `response.created` event is the commit point. If accepted input cannot be + committed, `response.steer.failed` returns it with the same steering ID. + + When the response stops for client-owned tool output or approval, the input + remains queued and `response.steer.pending` is emitted after + `response.completed`. Fill the pending event's `required_input` stubs with + saved results and send one matching explicit `response.create` per parent. + Do not resend accepted input while it is still queued. properties: - turn_detection: + type: + type: string + enum: + - response.steer.accepted + description: The event discriminator. Always `response.steer.accepted`. + x-stainless-const: true + sequence_number: + type: integer + description: The sequence number for this event. + steer: type: object - description: | - Configuration for turn detection. Can be set to `null` to turn off. Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech. + description: The accepted steering submission. properties: - type: + id: type: string - description: | - Type of turn detection. Only `server_vad` is currently supported for transcription sessions. - enum: - - server_vad - threshold: - type: number - description: | - Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A - higher threshold will require louder audio to activate the model, and - thus might perform better in noisy environments. - prefix_padding_ms: - type: integer - description: | - Amount of audio to include before the VAD detected speech (in - milliseconds). Defaults to 300ms. - silence_duration_ms: - type: integer - description: | - Duration of silence to detect speech stop (in milliseconds). Defaults - to 500ms. With shorter values the model will respond more quickly, - but may jump in on short pauses from the user. - input_audio_noise_reduction: - type: object - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - description: | - Configuration for input audio noise reduction. This can be set to `null` to turn off. - Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. - Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. - input_audio_format: + description: The ID assigned to the steering submission. + previous_response_id: + type: string + description: The ID of the response being steered. + required: + - id + - previous_response_id + stream_id: type: string - default: pcm16 - enum: - - pcm16 - - g711_ulaw - - g711_alaw - description: | - The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. - For `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, - single channel (mono), and little-endian byte order. - input_audio_transcription: - description: | - Configuration for input audio transcription. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service. - $ref: '#/components/schemas/AudioTranscription' - include: - type: array - items: - type: string - enum: - - item.input_audio_transcription.logprobs description: | - The set of items to include in the transcription. Current available items are: - `item.input_audio_transcription.logprobs` - RealtimeTranscriptionSessionCreateRequestGA: + The WebSocket lane that emitted this event. This field is present when + the target response's `response.create` event supplied a `stream_id`. + required: + - type + - sequence_number + - steer + x-oaiMeta: + name: response.steer.accepted + group: responses + example: | + { + "type": "response.steer.accepted", + "sequence_number": 2, + "steer": { + "id": "steer_456", + "previous_response_id": "resp_123" + } + } + ResponseSteerErrorCode: + title: ResponseSteerErrorCode + description: | + A machine-readable steering error code. Clients should handle unknown + values because additional codes may be introduced. Known values include: + - `response_not_found`: The target response is not available on this connection. + - `invalid_input`: The event or input failed validation. + - `steering_not_supported`: The model or response execution mode does not support steering. + - `too_many_pending_steers`: Too much steering input is pending for the response. + - `response_already_completed`: The response completed and is no longer accepting steering input. + - `response_not_active`: The response is no longer accepting steering input. + - `successor_creation_failed`: The successor response could not be created. + anyOf: + - type: string + enum: + - response_not_found + - invalid_input + - steering_not_supported + - too_many_pending_steers + - response_already_completed + - response_not_active + - successor_creation_failed + - type: string + ResponseSteerEvent: type: object - title: Realtime transcription session configuration - description: Realtime transcription session object configuration. + title: ResponseSteerEvent + additionalProperties: false + description: | + Queues user input to steer a response on this WebSocket connection. Input + can contain text, images, and files. Steering is supported only for + single-agent responses on models and execution modes that support steering. + Responses bound to a conversation or using automatic compaction do not + support steering. + + A `response.steer.accepted` event acknowledges that the server owns the + queued input, not that it has been applied. The successor's `response.created` + event is the commit point. Input that cannot be committed is returned in + `response.steer.failed`. + + Steering may cause the active response to finish at a safe output boundary + with `response.incomplete` and `incomplete_details.reason` set to `steered`, + followed automatically by a successor `response.created`. Normal completion + can also be followed by an automatic successor. Automatic successors inherit + the previous response's settings and continue from it with the queued input. + + If the response stops for client-owned tool output or approval, accepted + steering input remains queued and `response.steer.pending` is emitted after + `response.completed`. Fill the `required_input` stubs from that event with + saved tool results or approval decisions, and send one explicit + `response.create` per parent with the same `previous_response_id` and + WebSocket lane. Do not rerun tools or resend accepted steering input. The + queued input is prepended in submission order to that request's input, and + the explicit request retains its own settings. + + This event accepts only `type`, `previous_response_id`, and `input`. Do not + send `stream_id`; the target response determines the WebSocket lane. properties: type: type: string - description: | - The type of session to create. Always `transcription` for transcription sessions. enum: - - transcription + - response.steer + description: The event discriminator. Always `response.steer`. x-stainless-const: true - audio: - type: object - description: | - Configuration for input and output audio. - properties: - input: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - transcription: - description: | - Configuration for input audio transcription, defaults to off and can be set to `null` to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through [the /audio/transcriptions endpoint](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service. - $ref: '#/components/schemas/AudioTranscription' - noise_reduction: - type: object - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - description: | - Configuration for input audio noise reduction. This can be set to `null` to turn off. - Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. - Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. - turn_detection: - $ref: '#/components/schemas/RealtimeTurnDetection' - include: - type: array - items: - type: string - enum: - - item.input_audio_transcription.logprobs - description: | - Additional fields to include in server outputs. - - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. + previous_response_id: + type: string + description: The ID of the response to steer on this WebSocket connection. + input: + $ref: '#/components/schemas/ResponseSteerInput' required: - type - RealtimeTranscriptionSessionCreateResponse: + - previous_response_id + - input + x-oaiMeta: + name: response.steer + group: responses + example: | + { + "type": "response.steer", + "previous_response_id": "resp_123", + "input": [ + { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Prioritize the database rollout." + } + ] + } + ] + } + ResponseSteerFailedEvent: type: object + title: ResponseSteerFailedEvent description: | - A new Realtime transcription session configuration. + Emitted when steering input is rejected or cannot be committed to a + successor response. Returns the original, uncommitted input so the client + can carry it into `response.create` when appropriate. Invalid input must + be corrected before retrying. - When a session is created on the server via REST API, the session object - also contains an ephemeral key. Default TTL for keys is 10 minutes. This - property is not present when a session is updated via the WebSocket API. + Failures after acceptance include the same steering ID. Failures before an + ID is allocated omit `steer.id`. A lost connection or missing acknowledgement + leaves the outcome unknown; it is not proof that the input was rejected. properties: - client_secret: + type: + type: string + enum: + - response.steer.failed + description: The event discriminator. Always `response.steer.failed`. + x-stainless-const: true + sequence_number: + type: integer + description: The sequence number for this event. + steer: type: object - description: | - Ephemeral key returned by the API. Only present when the session is - created on the server via REST API. + description: The steering submission that could not be committed. properties: - value: + id: type: string description: | - Ephemeral key usable in client environments to authenticate connections - to the Realtime API. Use this in client-side environments rather than - a standard API token, which should only be used server-side. - expires_at: - type: integer - format: unixtime - description: | - Timestamp for when the token expires. Currently, all tokens expire - after one minute. + The ID assigned to the steering submission, if one was allocated. + previous_response_id: + type: string + description: The ID of the response that was targeted for steering. + input: + $ref: '#/components/schemas/ResponseSteerInput' required: - - value - - expires_at - modalities: - description: | - The set of modalities the model can respond with. To disable audio, - set this to ["text"]. - items: - type: string - enum: - - text - - audio - input_audio_format: - type: string - description: | - The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. - input_audio_transcription: - $ref: '#/components/schemas/AudioTranscription' - turn_detection: + - previous_response_id + - input + error: type: object - description: | - Configuration for turn detection. Can be set to `null` to turn off. Server - VAD means that the model will detect the start and end of speech based on - audio volume and respond at the end of user speech. + description: Information about why the input could not be committed. properties: type: type: string - description: | - Type of turn detection, only `server_vad` is currently supported. - threshold: - type: number - description: | - Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A - higher threshold will require louder audio to activate the model, and - thus might perform better in noisy environments. - prefix_padding_ms: - type: integer - description: | - Amount of audio to include before the VAD detected speech (in - milliseconds). Defaults to 300ms. - silence_duration_ms: - type: integer - description: | - Duration of silence to detect speech stop (in milliseconds). Defaults - to 500ms. With shorter values the model will respond more quickly, - but may jump in on short pauses from the user. + enum: + - invalid_request_error + description: The error type. Always `invalid_request_error`. + x-stainless-const: true + code: + $ref: '#/components/schemas/ResponseSteerErrorCode' + message: + type: string + description: A human-readable description of the error. + required: + - type + - code + - message + stream_id: + type: string + description: | + The WebSocket lane that emitted this event, when the target response is + available and its `response.create` event supplied a `stream_id`. required: - - client_secret + - type + - sequence_number + - steer + - error x-oaiMeta: - name: The transcription session object - group: realtime + name: response.steer.failed + group: responses example: | { - "id": "sess_BBwZc7cFV3XizEyKGDCGL", - "object": "realtime.transcription_session", - "expires_at": 1742188264, - "modalities": ["audio", "text"], - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 200 - }, - "input_audio_format": "pcm16", - "input_audio_transcription": { - "model": "gpt-4o-transcribe", - "language": null, - "prompt": "" + "type": "response.steer.failed", + "sequence_number": 5, + "steer": { + "id": "steer_456", + "previous_response_id": "resp_123", + "input": [ + { + "type": "message", + "role": "user", + "content": [ + { + "type": "input_text", + "text": "Prioritize the database rollout." + } + ] + } + ] }, - "client_secret": null + "error": { + "type": "invalid_request_error", + "code": "successor_creation_failed", + "message": "We couldn't start the next response. Send this steering input again with response.create." + } } - RealtimeTranscriptionSessionCreateResponseGA: + ResponseSteerInput: + title: ResponseSteerInput + description: | + Input to queue for a continuation of the response. Uses the same string or + input-item shape as `response.create.input`, with a non-empty array when + supplying input items. + + Steering accepts only messages with the `user` role. Each message may + contain only `type`, `role`, and `content`, with `content` as a string or an + array of `input_text`, `input_image`, and `input_file` parts. The optional + `type` must be `message`. Other roles, tool outputs, and item types are not + supported for steering. + anyOf: + - type: string + title: Text input + description: A text input, equivalent to a message with the `user` role. + - $ref: '#/components/schemas/ResponseSteerInputItemList' + ResponseSteerInputItem: + title: Response steer input item + anyOf: + - $ref: '#/components/schemas/UserMessageItemParam' + - $ref: '#/components/schemas/FunctionCallOutputItemParam' + discriminator: + propertyName: type + ResponseSteerInputItemList: + type: array + title: Response steer input item list + description: A non-empty list of message inputs to queue for the response. + minItems: 1 + items: + $ref: '#/components/schemas/ResponseSteerInputItem' + ResponseSteerPendingEvent: type: object - title: Realtime transcription session configuration object + title: ResponseSteerPendingEvent description: | - A Realtime transcription session configuration object. + Emitted when accepted steering input remains queued after the target + response completes. The server still owns the input. Do not resend it. + The successor's `response.created` event is the commit point. + + When `reason` is `waiting_for_required_input`, this event follows + `response.completed` while the response waits for the tool results or + approval decisions identified by `required_input`. Copy those stubs, fill + their result fields using the ordinary `response.create` input schemas, + and submit one continuation per parent with the same `previous_response_id` + and WebSocket lane. Use saved results without rerunning tools. The queued + steering input is prepended in submission order to the continuation's + input. That explicit request retains its own settings. + + This notification is emitted at most once per steering submission. Multiple + submissions for the same parent can report the same required inputs; they + do not each require a separate continuation. properties: type: type: string - description: | - The type of session. Always `transcription` for transcription sessions. enum: - - transcription + - response.steer.pending + description: The event discriminator. Always `response.steer.pending`. x-stainless-const: true - id: - type: string - description: | - Unique identifier for the session that looks like `sess_1234567890abcdef`. - object: - type: string - description: The object type. Always `realtime.transcription_session`. - expires_at: + sequence_number: type: integer - format: unixtime - description: Expiration timestamp for the session, in seconds since epoch. - include: + description: The sequence number for this event. + steer: + type: object + description: The steering submission that remains queued. + properties: + id: + type: string + description: The ID assigned to the steering submission. + previous_response_id: + type: string + description: The ID of the response being steered. + required: + - id + - previous_response_id + reason: + $ref: '#/components/schemas/ResponseSteerPendingReason' + required_input: type: array - items: - type: string - enum: - - item.input_audio_transcription.logprobs + minItems: 1 description: | - Additional fields to include in server outputs. - - `item.input_audio_transcription.logprobs`: Include logprobs for input audio transcription. - audio: - type: object + Input stubs identifying outstanding client-owned tool results or + approval decisions. Each stub contains identifying fields only; the + client supplies the result before including it in `response.create`. + items: + $ref: '#/components/schemas/ResponseSteerRequiredInput' + stream_id: + type: string description: | - Configuration for input audio for the session. - properties: - input: - type: object - properties: - format: - $ref: '#/components/schemas/RealtimeAudioFormats' - transcription: - $ref: '#/components/schemas/AudioTranscription' - noise_reduction: - type: object - description: | - Configuration for input audio noise reduction. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - turn_detection: - description: | - Configuration for turn detection. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported. - anyOf: - - type: object - description: | - Configuration for turn detection. Can be set to `null` to turn off. Server - VAD means that the model will detect the start and end of speech based on - audio volume and respond at the end of user speech. For `gpt-realtime-whisper`, this must be `null`; VAD is not supported. - properties: - type: - type: string - description: | - Type of turn detection, only `server_vad` is currently supported. - threshold: - type: number - description: | - Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A - higher threshold will require louder audio to activate the model, and - thus might perform better in noisy environments. - prefix_padding_ms: - type: integer - description: | - Amount of audio to include before the VAD detected speech (in - milliseconds). Defaults to 300ms. - silence_duration_ms: - type: integer - description: | - Duration of silence to detect speech stop (in milliseconds). Defaults - to 500ms. With shorter values the model will respond more quickly, - but may jump in on short pauses from the user. - - type: 'null' + The WebSocket lane that emitted this event. This field is present when + the target response's `response.create` event supplied a `stream_id`. required: - type - - id - - object + - sequence_number + - steer + - reason + - required_input x-oaiMeta: - name: The transcription session object - group: realtime + name: response.steer.pending + group: responses example: | { - "id": "sess_BBwZc7cFV3XizEyKGDCGL", - "type": "transcription", - "object": "realtime.transcription_session", - "expires_at": 1742188264, - "include": ["item.input_audio_transcription.logprobs"], - "audio": { - "input": { - "format": "pcm16", - "transcription": { - "model": "gpt-4o-transcribe", - "language": null, - "prompt": "" - }, - "noise_reduction": null, - "turn_detection": { - "type": "server_vad", - "threshold": 0.5, - "prefix_padding_ms": 300, - "silence_duration_ms": 200 - } + "type": "response.steer.pending", + "sequence_number": 10, + "steer": { + "id": "steer_456", + "previous_response_id": "resp_123" + }, + "reason": "waiting_for_required_input", + "required_input": [ + { + "type": "function_call_output", + "call_id": "call_789", + "name": "lookup" } - } + ] } - RealtimeTranslationClientEvent: + ResponseSteerPendingReason: + title: ResponseSteerPendingReason + description: | + An extensible enum describing why accepted steering input is still queued. + Clients should handle unknown values because additional reasons may be + introduced. Known values include: + - `waiting_for_required_input`: The response is waiting for the tool results or approval decisions identified by `required_input`. + anyOf: + - type: string + enum: + - waiting_for_required_input + - type: string + ResponseSteerRequiredInput: + title: ResponseSteerRequiredInput + description: | + An input stub identifying an outstanding client-owned tool result or + approval decision. Copy the stub and fill the result fields using the + corresponding `response.create` input schema. Use saved results without + rerunning the tool. The server does not supply results, approval decisions, + or safety acknowledgements in these stubs. + discriminator: + propertyName: type + anyOf: + - type: object + title: Required function tool call output + additionalProperties: false + description: | + Supply `output` using the function tool call output input schema. + properties: + type: + type: string + enum: + - function_call_output + x-stainless-const: true + call_id: + type: string + name: + type: string + required: + - type + - call_id + - name + - type: object + title: Required custom tool call output + additionalProperties: false + description: | + Supply `output` using the custom tool call output input schema. The + original custom tool call supplies the tool's name. + properties: + type: + type: string + enum: + - custom_tool_call_output + x-stainless-const: true + call_id: + type: string + required: + - type + - call_id + - type: object + title: Required computer tool call output + additionalProperties: false + description: | + Supply `output` using the computer tool call output input schema, + including any required `acknowledged_safety_checks`. + properties: + type: + type: string + enum: + - computer_call_output + x-stainless-const: true + call_id: + type: string + required: + - type + - call_id + - type: object + title: Required shell tool call output + additionalProperties: false + description: | + Supply `output` using the shell tool call output input schema. Each + output entry includes `stdout`, `stderr`, and `outcome`. + properties: + type: + type: string + enum: + - shell_call_output + x-stainless-const: true + call_id: + type: string + required: + - type + - call_id + - type: object + title: Required apply patch tool call output + additionalProperties: false + description: | + Supply `status` and optional `output` using the apply patch tool call + output input schema. + properties: + type: + type: string + enum: + - apply_patch_call_output + x-stainless-const: true + call_id: + type: string + required: + - type + - call_id + - type: object + title: Required tool search output + additionalProperties: false + description: | + Supply `tools` using the tool search output input schema, retaining + `execution: "client"`. + properties: + type: + type: string + enum: + - tool_search_output + x-stainless-const: true + call_id: + type: string + execution: + type: string + enum: + - client + x-stainless-const: true + required: + - type + - call_id + - execution + - type: object + title: Required MCP approval response + additionalProperties: false + description: | + Supply `approve` using the MCP approval response input schema. An + optional `reason` can be supplied when denying the request. The original + approval request identifies the tool and server. + properties: + type: + type: string + enum: + - mcp_approval_response + x-stainless-const: true + approval_request_id: + type: string + required: + - type + - approval_request_id + ResponseStreamEvent: + description: Event emitted while a response is streamed. + anyOf: + - $ref: '#/components/schemas/ResponseAudioDeltaEvent' + - $ref: '#/components/schemas/ResponseAudioDoneEvent' + - $ref: '#/components/schemas/ResponseAudioTranscriptDeltaEvent' + - $ref: '#/components/schemas/ResponseAudioTranscriptDoneEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCompletedEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallInProgressEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent' + - $ref: '#/components/schemas/ResponseCompletedEvent' + - $ref: '#/components/schemas/ResponseContentPartAddedEvent' + - $ref: '#/components/schemas/ResponseContentPartDoneEvent' + - $ref: '#/components/schemas/ResponseCreatedEvent' + - $ref: '#/components/schemas/ResponseErrorEvent' + - $ref: '#/components/schemas/ResponseFileSearchCallCompletedEvent' + - $ref: '#/components/schemas/ResponseFileSearchCallInProgressEvent' + - $ref: '#/components/schemas/ResponseFileSearchCallSearchingEvent' + - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent' + - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDoneEvent' + - $ref: '#/components/schemas/ResponseShellCallCommandAddedStreamingEvent' + - $ref: '#/components/schemas/ResponseShellCallCommandDeltaStreamingEvent' + - $ref: '#/components/schemas/ResponseShellCallCommandDoneStreamingEvent' + - $ref: '#/components/schemas/ResponseShellCallOutputContentDeltaStreamingEvent' + x-stainless-skip: + - go + - $ref: '#/components/schemas/ResponseShellCallOutputContentDoneStreamingEvent' + - $ref: '#/components/schemas/ResponseInProgressEvent' + - $ref: '#/components/schemas/ResponseFailedEvent' + - $ref: '#/components/schemas/ResponseIncompleteEvent' + - $ref: '#/components/schemas/ResponseOutputItemAddedEvent' + - $ref: '#/components/schemas/ResponseOutputItemDoneEvent' + - $ref: '#/components/schemas/ResponseReasoningSummaryPartAddedEvent' + - $ref: '#/components/schemas/ResponseReasoningSummaryPartDoneEvent' + - $ref: '#/components/schemas/ResponseReasoningSummaryTextDeltaEvent' + - $ref: '#/components/schemas/ResponseReasoningSummaryTextDoneEvent' + - $ref: '#/components/schemas/ResponseReasoningTextDeltaEvent' + - $ref: '#/components/schemas/ResponseReasoningTextDoneEvent' + - $ref: '#/components/schemas/ResponseRefusalDeltaEvent' + - $ref: '#/components/schemas/ResponseRefusalDoneEvent' + - $ref: '#/components/schemas/ResponseTextDeltaEvent' + - $ref: '#/components/schemas/ResponseTextDoneEvent' + - $ref: '#/components/schemas/ResponseWebSearchCallCompletedEvent' + - $ref: '#/components/schemas/ResponseWebSearchCallInProgressEvent' + - $ref: '#/components/schemas/ResponseWebSearchCallSearchingEvent' + - $ref: '#/components/schemas/ResponseImageGenCallCompletedEvent' + - $ref: '#/components/schemas/ResponseImageGenCallGeneratingEvent' + - $ref: '#/components/schemas/ResponseImageGenCallInProgressEvent' + - $ref: '#/components/schemas/ResponseImageGenCallPartialImageEvent' + - $ref: '#/components/schemas/ResponseMCPCallArgumentsDeltaEvent' + - $ref: '#/components/schemas/ResponseMCPCallArgumentsDoneEvent' + - $ref: '#/components/schemas/ResponseMCPCallCompletedEvent' + - $ref: '#/components/schemas/ResponseMCPCallFailedEvent' + - $ref: '#/components/schemas/ResponseMCPCallInProgressEvent' + - $ref: '#/components/schemas/ResponseMCPListToolsCompletedEvent' + - $ref: '#/components/schemas/ResponseMCPListToolsFailedEvent' + - $ref: '#/components/schemas/ResponseMCPListToolsInProgressEvent' + - $ref: '#/components/schemas/ResponseOutputTextAnnotationAddedEvent' + - $ref: '#/components/schemas/ResponseQueuedEvent' + - $ref: '#/components/schemas/ResponseCustomToolCallInputDeltaEvent' + - $ref: '#/components/schemas/ResponseCustomToolCallInputDoneEvent' discriminator: propertyName: type - description: | - A Realtime translation client event. + ResponseStreamOptions: anyOf: - - $ref: '#/components/schemas/RealtimeTranslationClientEventSessionUpdate' - - $ref: '#/components/schemas/RealtimeTranslationClientEventInputAudioBufferAppend' - - $ref: '#/components/schemas/RealtimeTranslationClientEventSessionClose' - RealtimeTranslationClientEventInputAudioBufferAppend: + - description: | + Options for streaming responses. Only set this when you set `stream: true`. + type: object + properties: + include_obfuscation: + type: boolean + description: | + When true, stream obfuscation will be enabled. Stream obfuscation adds + random characters to an `obfuscation` field on streaming delta events to + normalize payload sizes as a mitigation to certain side-channel attacks. + These obfuscation fields are included by default, but add a small amount + of overhead to the data stream. You can set `include_obfuscation` to + false to optimize for bandwidth if you trust the network links between + your application and the OpenAI API. + - type: 'null' + ResponseTextDeltaEvent: type: object - description: | - Send this event to append audio bytes to the translation session input audio buffer. - - WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono - little-endian raw audio bytes. Unsupported websocket audio formats return a - validation error because lower-quality audio materially degrades translation - quality. - - Translation consumes 200 ms engine frames. For best realtime behavior, append - audio in 200 ms chunks. If a chunk is shorter, the server buffers it until it - has enough audio for one frame. If a chunk is longer, the server splits it into - 200 ms frames and enqueues them back-to-back. - - Keep appending silence while the session is active. If a client stops sending - audio and later resumes, model time treats the resumed audio as contiguous with - the previous audio rather than as a real-world pause. + description: Emitted when there is an additional text delta. properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. type: + type: string + description: | + The type of the event. Always `response.output_text.delta`. + enum: + - response.output_text.delta x-stainless-const: true - description: The event type, must be `session.input_audio_buffer.append`. - const: session.input_audio_buffer.append - audio: + item_id: type: string - description: Base64-encoded 24 kHz PCM16 mono audio bytes. - required: - - type - - audio - x-oaiMeta: - name: session.input_audio_buffer.append - group: realtime - example: | - { - "event_id": "event_456", - "type": "session.input_audio_buffer.append", - "audio": "Base64EncodedAudioData" - } - RealtimeTranslationClientEventSessionClose: - type: object - description: | - Gracefully close the realtime translation session. The server flushes pending - input audio and emits any remaining translated output before closing the - session. - properties: - event_id: + description: | + The ID of the output item that the text delta was added to. + output_index: + type: integer + description: | + The index of the output item that the text delta was added to. + content_index: + type: integer + description: | + The index of the content part that the text delta was added to. + delta: type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. - type: - x-stainless-const: true - description: The event type, must be `session.close`. - const: session.close + description: | + The text delta that was added. + sequence_number: + type: integer + description: The sequence number for this event. + logprobs: + type: array + description: | + The log probabilities of the tokens in the delta. + items: + $ref: '#/components/schemas/ResponseLogProb' required: - type + - item_id + - output_index + - content_index + - delta + - sequence_number + - logprobs x-oaiMeta: - name: session.close - group: realtime + name: response.output_text.delta + group: responses example: | { - "event_id": "event_789", - "type": "session.close" + "type": "response.output_text.delta", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "delta": "In", + "sequence_number": 1 } - RealtimeTranslationClientEventSessionUpdate: + ResponseTextDoneEvent: type: object - description: | - Send this event to update the translation session configuration. Translation - sessions support updates to `audio.output.language`, `audio.input.transcription`, - and `audio.input.noise_reduction`. + description: Emitted when text content is finalized. properties: - event_id: - type: string - maxLength: 512 - description: Optional client-generated ID used to identify this event. type: + type: string + description: | + The type of the event. Always `response.output_text.done`. + enum: + - response.output_text.done x-stainless-const: true - description: The event type, must be `session.update`. - const: session.update - session: - $ref: '#/components/schemas/RealtimeTranslationSessionUpdateRequest' + item_id: + type: string description: | - Translation session fields to update. The session `type` and `model` are set - at creation and cannot be changed with `session.update`. - required: - - type - - session - x-oaiMeta: - name: session.update - group: realtime - example: | - { - "type": "session.update", - "session": { - "audio": { - "input": { - "transcription": { - "model": "gpt-realtime-whisper" - }, - "noise_reduction": null - }, - "output": { - "language": "es" - } - } - } - } - RealtimeTranslationClientSecretCreateRequest: - type: object - title: Realtime translation client secret creation request - description: | - Create a translation session and client secret for the Realtime API. - properties: - expires_after: - type: object - title: Client secret expiration + The ID of the output item that the text content is finalized. + output_index: + type: integer description: | - Configuration for the client secret expiration. Expiration refers to the time after which - a client secret will no longer be valid for creating sessions. The session itself may - continue after that time once started. A secret can be used to create multiple sessions - until it expires. - properties: - anchor: - type: string - enum: - - created_at - description: | - The anchor point for the client secret expiration, meaning that `seconds` will be added to the `created_at` time of the client secret to produce an expiration timestamp. Only `created_at` is currently supported. - default: created_at - x-stainless-const: true - seconds: - type: integer - format: int64 - description: | - The number of seconds from the anchor point to the expiration. Select a value between `10` and `7200` (2 hours). This default to 600 seconds (10 minutes) if not specified. - minimum: 10 - maximum: 7200 - default: 600 - session: - $ref: '#/components/schemas/RealtimeTranslationSessionCreateRequest' - required: - - session - RealtimeTranslationClientSecretCreateResponse: - type: object - title: Realtime translation session and client secret - description: | - Response from creating a translation session and client secret for the Realtime API. - properties: - value: - type: string - description: The generated client secret value. - expires_at: + The index of the output item that the text content is finalized. + content_index: type: integer - format: unixtime - description: Expiration timestamp for the client secret, in seconds since epoch. - session: - $ref: '#/components/schemas/RealtimeTranslationSession' - required: - - value - - expires_at - - session - x-oaiMeta: - name: Translation session response object - group: realtime - example: | - { - "value": "ek_68af296e8e408191a1120ab6383263c2", - "expires_at": 1756310470, - "session": { - "id": "sess_C9CiUVUzUzYIssh3ELY1d", - "type": "translation", - "expires_at": 1756310470, - "model": "gpt-realtime-translate", - "audio": { - "input": { - "transcription": null, - "noise_reduction": null - }, - "output": { - "language": "es" - } - } - } - } - RealtimeTranslationServerEvent: - discriminator: - propertyName: type - description: | - A Realtime translation server event. - anyOf: - - $ref: '#/components/schemas/RealtimeServerEventError' - - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionCreated' - - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionUpdated' - - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionClosed' - - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionInputTranscriptDelta' - - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionOutputTranscriptDelta' - - $ref: '#/components/schemas/RealtimeTranslationServerEventSessionOutputAudioDelta' - RealtimeTranslationServerEventSessionClosed: - type: object - description: | - Returned when a realtime translation session is closed. - properties: - event_id: + description: | + The index of the content part that the text content is finalized. + text: type: string - description: The unique ID of the server event. - type: - x-stainless-const: true - description: The event type, must be `session.closed`. - const: session.closed + description: | + The text content that is finalized. + sequence_number: + type: integer + description: The sequence number for this event. + logprobs: + type: array + description: | + The log probabilities of the tokens in the delta. + items: + $ref: '#/components/schemas/ResponseLogProb' required: - - event_id - type + - item_id + - output_index + - content_index + - text + - sequence_number + - logprobs x-oaiMeta: - name: session.closed - group: realtime + name: response.output_text.done + group: responses example: | { - "event_id": "event_987", - "type": "session.closed" + "type": "response.output_text.done", + "item_id": "msg_123", + "output_index": 0, + "content_index": 0, + "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", + "sequence_number": 1 } - RealtimeTranslationServerEventSessionCreated: + ResponseTextParam: type: object description: | - Returned when a translation session is created. Emitted automatically when a - new connection is established as the first server event. This event contains - the default translation session configuration. + Configuration options for a text response from the model. Can be plain + text or structured JSON data. Learn more: + - [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text) + - [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs) properties: - event_id: - type: string - description: The unique ID of the server event. - type: - x-stainless-const: true - description: The event type, must be `session.created`. - const: session.created - session: - $ref: '#/components/schemas/RealtimeTranslationSession' - description: The translation session configuration. - required: - - event_id - - type - - session - x-oaiMeta: - name: session.created - group: realtime - example: | - { - "type": "session.created", - "event_id": "event_123", - "session": { - "id": "sess_123", - "type": "translation", - "model": "gpt-realtime-translate", - "expires_at": 1714857600, - "audio": { - "input": { - "transcription": { - "model": "gpt-realtime-whisper", - "language": "en" - }, - "noise_reduction": { - "type": "near_field" - } - }, - "output": { - "language": "fr" - } - } - } - } - RealtimeTranslationServerEventSessionInputTranscriptDelta: + format: + $ref: '#/components/schemas/TextResponseFormatConfiguration' + verbosity: + $ref: '#/components/schemas/Verbosity' + ResponseUsage: type: object description: | - Returned when optional source-language transcript text is available. This event - is emitted only when `audio.input.transcription` is configured. - - Transcript deltas are append-only text fragments. Clients should not insert - unconditional spaces between deltas. + Represents token usage details including input tokens, output tokens, + a breakdown of output tokens, and the total tokens used. properties: - event_id: - type: string - description: The unique ID of the server event. - type: - x-stainless-const: true - description: The event type, must be `session.input_transcript.delta`. - const: session.input_transcript.delta - delta: - type: string - description: Append-only source-language transcript text. - elapsed_ms: - anyOf: - - type: integer - description: | - Timing metadata for stream alignment, derived from the translation frame - when available. It advances in 200 ms increments, but multiple transcript - deltas may share the same `elapsed_ms`. Treat it as alignment metadata, - not a unique transcript-delta identifier. - - type: 'null' + input_tokens: + type: integer + description: The number of input tokens. + input_tokens_details: + type: object + description: A detailed breakdown of the input tokens. + properties: + cached_tokens: + type: integer + description: | + The number of tokens that were retrieved from the cache. + [More on prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching). + cache_write_tokens: + type: integer + description: The number of input tokens that were written to the cache. + required: + - cached_tokens + - cache_write_tokens + output_tokens: + type: integer + description: The number of output tokens. + output_tokens_details: + type: object + description: A detailed breakdown of the output tokens. + properties: + reasoning_tokens: + type: integer + description: The number of reasoning tokens. + required: + - reasoning_tokens + total_tokens: + type: integer + description: The total number of tokens used. required: - - event_id - - type - - delta - x-oaiMeta: - name: session.input_transcript.delta - group: realtime - example: | - { - "event_id": "event_125", - "type": "session.input_transcript.delta", - "delta": " hear", - "elapsed_ms": 1200 - } - RealtimeTranslationServerEventSessionOutputAudioDelta: + - input_tokens + - input_tokens_details + - output_tokens + - output_tokens_details + - total_tokens + ResponseWebSearchCallCompletedEvent: type: object - description: | - Returned when translated output audio is available. The `delta` contains a - PCM16 audio chunk whose length can vary. Clients should decode and queue the - complete delta instead of assuming a fixed byte or sample count. + description: Emitted when a web search call is completed. properties: - event_id: - type: string - description: The unique ID of the server event. type: - x-stainless-const: true - description: The event type, must be `session.output_audio.delta`. - const: session.output_audio.delta - delta: - type: string - description: Base64-encoded translated audio data. - sample_rate: - type: integer - description: Sample rate of the audio delta. - default: 24000 - channels: - type: integer - description: Number of audio channels. - default: 1 - format: type: string + description: | + The type of the event. Always `response.web_search_call.completed`. enum: - - pcm16 - description: Audio encoding for `delta`. + - response.web_search_call.completed x-stainless-const: true - elapsed_ms: - anyOf: - - type: integer - description: | - Timing metadata for stream alignment, derived from the translation frame - when available. Treat `elapsed_ms` as alignment metadata, not a unique - event identifier. - - type: 'null' + output_index: + type: integer + description: | + The index of the output item that the web search call is associated with. + item_id: + type: string + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. required: - - event_id - type - - delta + - output_index + - item_id + - sequence_number x-oaiMeta: - name: session.output_audio.delta - group: realtime + name: response.web_search_call.completed + group: responses example: | { - "event_id": "event_123", - "type": "session.output_audio.delta", - "delta": "Base64EncodedAudioDelta", - "sample_rate": 24000, - "channels": 1, - "format": "pcm16", - "elapsed_ms": 1200 + "type": "response.web_search_call.completed", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 } - RealtimeTranslationServerEventSessionOutputTranscriptDelta: + ResponseWebSearchCallInProgressEvent: type: object - description: | - Returned when translated transcript text is available. - - Transcript deltas are append-only text fragments. Clients should not insert - unconditional spaces between deltas. + description: Emitted when a web search call is initiated. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: | + The type of the event. Always `response.web_search_call.in_progress`. + enum: + - response.web_search_call.in_progress x-stainless-const: true - description: The event type, must be `session.output_transcript.delta`. - const: session.output_transcript.delta - delta: + output_index: + type: integer + description: | + The index of the output item that the web search call is associated with. + item_id: type: string - description: Append-only transcript text for the translated output audio. - elapsed_ms: - anyOf: - - type: integer - description: | - Timing metadata for stream alignment, derived from the translation frame - when available. It advances in 200 ms increments, but multiple transcript - deltas may share the same `elapsed_ms`. Treat it as alignment metadata, - not a unique transcript-delta identifier. - - type: 'null' + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. required: - - event_id - type - - delta + - output_index + - item_id + - sequence_number x-oaiMeta: - name: session.output_transcript.delta - group: realtime + name: response.web_search_call.in_progress + group: responses example: | { - "event_id": "event_124", - "type": "session.output_transcript.delta", - "delta": " escuch", - "elapsed_ms": 1200 + "type": "response.web_search_call.in_progress", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 } - RealtimeTranslationServerEventSessionUpdated: + ResponseWebSearchCallSearchingEvent: type: object - description: | - Returned when a translation session is updated with a `session.update` event, - unless there is an error. + description: Emitted when a web search call is executing. properties: - event_id: - type: string - description: The unique ID of the server event. type: + type: string + description: | + The type of the event. Always `response.web_search_call.searching`. + enum: + - response.web_search_call.searching x-stainless-const: true - description: The event type, must be `session.updated`. - const: session.updated - session: - $ref: '#/components/schemas/RealtimeTranslationSession' - description: The translation session configuration. + output_index: + type: integer + description: | + The index of the output item that the web search call is associated with. + item_id: + type: string + description: | + Unique ID for the output item associated with the web search call. + sequence_number: + type: integer + description: The sequence number of the web search call being processed. required: - - event_id - type - - session + - output_index + - item_id + - sequence_number x-oaiMeta: - name: session.updated - group: realtime + name: response.web_search_call.searching + group: responses example: | { - "type": "session.updated", - "event_id": "event_124", - "session": { - "id": "sess_123", - "type": "translation", - "model": "gpt-realtime-translate", - "expires_at": 1714857600, - "audio": { - "input": { - "transcription": { - "model": "gpt-realtime-whisper", - "language": "en" - }, - "noise_reduction": { - "type": "near_field" - } - }, - "output": { - "language": "es" - } - } - } + "type": "response.web_search_call.searching", + "output_index": 0, + "item_id": "ws_123", + "sequence_number": 0 } - RealtimeTranslationSession: + ResponseWsError: type: object - title: Realtime translation session - description: | - A Realtime translation session. Translation sessions continuously translate input - audio into the configured output language. + title: ResponseWsError + description: Emitted when an error occurs while processing a Responses WebSocket request. properties: - id: - type: string - description: | - Unique identifier for the session that looks like `sess_1234567890abcdef`. type: type: string + description: The type of the event. Always `error`. enum: - - translation - description: | - The session type. Always `translation` for Realtime translation sessions. + - error x-stainless-const: true - expires_at: + status: type: integer - format: unixtime - description: Expiration timestamp for the session, in seconds since epoch. - model: + description: The HTTP status code associated with a WebSocket protocol error. + sequence_number: + type: integer + description: The sequence number of an error emitted by the response stream. + error: + $ref: '#/components/schemas/ErrorPayload' + description: Details about the error. + stream_id: type: string description: | - The Realtime translation model used for this session. This field is set at - session creation and cannot be changed with `session.update`. - audio: - type: object - description: | - Configuration for translation input and output audio. + The WebSocket lane that emitted this event. This field is present when the + originating `response.create` event supplied a `stream_id`. + required: + - type + - error + x-oaiMeta: + name: error + group: responses + example: | + { + "type": "error", + "status": 400, + "stream_id": "agent_1", + "error": { + "type": "invalid_request_error", + "code": "websocket_stream_limit_reached", + "message": "This WebSocket connection has reached its stream limit.", + "param": "stream_id" + } + } + ResponsesClientEvent: + discriminator: + propertyName: type + description: | + Client events accepted by the Responses WebSocket server. + anyOf: + - $ref: '#/components/schemas/ResponsesClientEventResponseCreate' + - $ref: '#/components/schemas/ResponseSteerEvent' + ResponsesClientEventResponseCreate: + allOf: + - type: object + properties: + type: + type: string + enum: + - response.create + description: | + The type of the client event. Always `response.create`. + x-stainless-const: true + stream_id: + type: string + minLength: 1 + maxLength: 256 + pattern: ^[A-Za-z0-9_.-]+$ + description: | + The WebSocket lane for this response. Requests with the same + `stream_id` are processed FIFO, and events for the response echo the + same `stream_id`. + + `stream_id` controls routing; `previous_response_id` controls + conversation lineage, so a new lane can fork from a response created + on another lane. + required: + - type + - $ref: '#/components/schemas/CreateResponse' + description: | + Client event for creating a response over a persistent WebSocket connection. + This payload uses the same top-level fields as `POST /v1/responses`, plus + WebSocket-only envelope metadata. + + Notes: + - `stream` is implicit over WebSocket and should not be sent. + - `background` is not supported over WebSocket. + - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`. + x-oaiMeta: + example: | + { + "type": "response.create", + "stream_id": "agent_1", + "model": "gpt-6-astra", + "input": "Say hello." + } + ResponsesServerEvent: + discriminator: + propertyName: type + description: | + Server events emitted by the Responses WebSocket server. + anyOf: + - title: ResponseAudioWsDelta + description: Emitted when there is a partial audio response. + allOf: + - $ref: '#/components/schemas/ResponseAudioDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseAudioWsDone + description: Emitted when the audio response is complete. + allOf: + - $ref: '#/components/schemas/ResponseAudioDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseAudioTranscriptWsDelta + description: Emitted when there is a partial transcript of audio. + allOf: + - $ref: '#/components/schemas/ResponseAudioTranscriptDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseAudioTranscriptWsDone + description: Emitted when the full audio transcript is completed. + allOf: + - $ref: '#/components/schemas/ResponseAudioTranscriptDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCodeInterpreterCallCodeWsDelta + description: Emitted when a partial code snippet is streamed by the code interpreter. + allOf: + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCodeInterpreterCallCodeWsDone + description: Emitted when the code snippet is finalized by the code interpreter. + allOf: + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCodeInterpreterCallWsCompleted + description: Emitted when the code interpreter call is completed. + allOf: + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCodeInterpreterCallInWsProgress + description: Emitted when a code interpreter call is in progress. + allOf: + - $ref: '#/components/schemas/ResponseCodeInterpreterCallInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCodeInterpreterCallWsInterpreting + description: Emitted when the code interpreter is actively interpreting the code snippet. + allOf: + - $ref: '#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWsCompleted + description: Emitted when the model response is complete. + allOf: + - $ref: '#/components/schemas/ResponseCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseContentPartWsAdded + description: Emitted when a new content part is added. + allOf: + - $ref: '#/components/schemas/ResponseContentPartAddedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseContentPartWsDone + description: Emitted when a content part is done. + allOf: + - $ref: '#/components/schemas/ResponseContentPartDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWsCreated + description: | + An event that is emitted when a response is created. + allOf: + - $ref: '#/components/schemas/ResponseCreatedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseFileSearchCallWsCompleted + description: Emitted when a file search call is completed (results found). + allOf: + - $ref: '#/components/schemas/ResponseFileSearchCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseFileSearchCallInWsProgress + description: Emitted when a file search call is initiated. + allOf: + - $ref: '#/components/schemas/ResponseFileSearchCallInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseFileSearchCallWsSearching + description: Emitted when a file search is currently searching. + allOf: + - $ref: '#/components/schemas/ResponseFileSearchCallSearchingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseFunctionCallArgumentsWsDelta + description: Emitted when there is a partial function-call arguments delta. + allOf: + - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseFunctionCallArgumentsWsDone + description: Emitted when function-call arguments are finalized. + allOf: + - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDoneEvent' + - type: object properties: - input: - type: object - properties: - transcription: - anyOf: - - type: object - description: | - Optional source-language transcription. When configured, the server emits - `session.input_transcript.delta` events. Translation itself still runs from - the input audio stream. - properties: - model: - type: string - description: The transcription model used for source transcript deltas. - required: - - model - - type: 'null' - noise_reduction: - anyOf: - - type: object - description: | - Optional input noise reduction. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - required: - - type - - type: 'null' - output: - type: object - properties: - language: - type: string - description: | - Target language for translated output audio and transcript deltas. - required: - - id - - type - - expires_at - - model - - audio - x-oaiMeta: - name: The translation session object - group: realtime - example: | - { - "id": "sess_C9G5QPteg4UIbotdKLoYQ", - "type": "translation", - "expires_at": 1756324625, - "model": "gpt-realtime-translate", - "audio": { - "input": { - "transcription": { - "model": "gpt-realtime-whisper" - }, - "noise_reduction": null - }, - "output": { - "language": "es" - } - } - } - RealtimeTranslationSessionCreateRequest: - type: object - title: Realtime translation session configuration - description: | - Realtime translation session configuration. Translation sessions stream source - audio in and translated audio plus transcript deltas out continuously. - properties: - model: - type: string - description: | - The Realtime translation model used for this session. - audio: - type: object - description: | - Configuration for translation input and output audio. + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseShellCallCommandWsAdded + description: A streaming event that indicated a shell command was added to a tool call. + allOf: + - $ref: '#/components/schemas/ResponseShellCallCommandAddedStreamingEvent' + - type: object properties: - input: - type: object - properties: - transcription: - anyOf: - - type: object - description: | - Optional source-language transcription. When configured, the server emits - `session.input_transcript.delta` events. Translation itself still runs from - the input audio stream. - properties: - model: - type: string - description: The transcription model to use for source transcript deltas. - required: - - model - - type: 'null' - noise_reduction: - anyOf: - - type: object - description: | - Optional input noise reduction. Set to `null` to disable it. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - required: - - type - - type: 'null' - output: - type: object - properties: - language: - type: string - description: | - Target language for translated output audio and transcript deltas. - required: - - model - RealtimeTranslationSessionUpdateRequest: - type: object - title: Realtime translation session update - description: | - Realtime translation session fields that can be updated with `session.update`. - properties: - audio: - type: object - description: | - Configuration for translation input and output audio. + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseShellCallCommandWsDelta + description: A streaming event that indicated a shell command was incrementally updated. + allOf: + - $ref: '#/components/schemas/ResponseShellCallCommandDeltaStreamingEvent' + - type: object properties: - input: - type: object - properties: - transcription: - anyOf: - - type: object - description: | - Optional source-language transcription. When configured, the server emits - `session.input_transcript.delta` events. Translation itself still runs from - the input audio stream. - properties: - model: - type: string - description: The transcription model to use for source transcript deltas. - required: - - model - - type: 'null' - noise_reduction: - anyOf: - - type: object - description: | - Optional input noise reduction. Set to `null` to disable it. - properties: - type: - $ref: '#/components/schemas/NoiseReductionType' - required: - - type - - type: 'null' - output: - type: object - properties: - language: - type: string - description: | - Target language for translated output audio and transcript deltas. - RealtimeTruncation: - title: Realtime Truncation Controls - description: | - When the number of tokens in a conversation exceeds the model's input token limit, the conversation be truncated, meaning messages (starting from the oldest) will not be included in the model's context. A 32k context model with 4,096 max output tokens can only include 28,224 tokens in the context before truncation occurs. - - Clients can configure truncation behavior to truncate with a lower max token limit, which is an effective way to control token usage and cost. - - Truncation will reduce the number of cached tokens on the next turn (busting the cache), since messages are dropped from the beginning of the context. However, clients can also configure truncation to retain messages up to a fraction of the maximum context size, which will reduce the need for future truncations and thus improve the cache rate. + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseShellCallCommandWsDone + description: A streaming event that indicated a shell command was completed. + allOf: + - $ref: '#/components/schemas/ResponseShellCallCommandDoneStreamingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseShellCallOutputContentWsDelta + description: A streaming event that indicated shell call output was incrementally added. + allOf: + - $ref: '#/components/schemas/ResponseShellCallOutputContentDeltaStreamingEvent' + x-stainless-skip: + - go + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseShellCallOutputContentWsDone + description: A streaming event that indicated shell call output was completed. + allOf: + - $ref: '#/components/schemas/ResponseShellCallOutputContentDoneStreamingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseInWsProgress + description: Emitted when the response is in progress. + allOf: + - $ref: '#/components/schemas/ResponseInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWsFailed + description: | + An event that is emitted when a response fails. + allOf: + - $ref: '#/components/schemas/ResponseFailedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWsIncomplete + description: | + An event that is emitted when a response finishes as incomplete. - Truncation can be disabled entirely, which means the server will never truncate but would instead return an error if the conversation exceeds the model's input token limit. - anyOf: - - type: string - description: The truncation strategy to use for the session. `auto` is the default truncation strategy. `disabled` will disable truncation and emit errors when the conversation exceeds the input token limit. - enum: - - auto - - disabled - title: RealtimeTruncationStrategy - - type: object - title: Retention ratio truncation - description: Retain a fraction of the conversation tokens when the conversation exceeds the input token limit. This allows you to amortize truncations across multiple turns, which can help improve cached token usage. - properties: - type: - type: string - enum: - - retention_ratio - description: Use retention ratio truncation. - x-stainless-const: true - retention_ratio: - type: number - description: | - Fraction of post-instruction conversation tokens to retain (`0.0` - `1.0`) when the conversation exceeds the input token limit. Setting this to `0.8` means that messages will be dropped until 80% of the maximum allowed tokens are used. This helps reduce the frequency of truncations and improve cache rates. - minimum: 0 - maximum: 1 - token_limits: - type: object - description: Optional custom token limits for this truncation strategy. If not provided, the model's default token limits will be used. - properties: - post_instructions: - type: integer - description: Maximum tokens allowed in the conversation after instructions (which including tool definitions). For example, setting this to 5,000 would mean that truncation would occur when the conversation exceeds 5,000 tokens after instructions. This cannot be higher than the model's context window size minus the maximum output tokens. - minimum: 0 - required: - - type - - retention_ratio - RealtimeTurnDetection: - anyOf: - - title: Realtime Turn Detection + Over WebSocket, steering can finish a response with + `response.incomplete_details.reason` set to `steered`, followed automatically + by a successor `response.created` that commits the queued steering input. + allOf: + - $ref: '#/components/schemas/ResponseIncompleteEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseOutputItemWsAdded + description: Emitted when a new output item is added. + allOf: + - $ref: '#/components/schemas/ResponseOutputItemAddedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseOutputItemWsDone + description: Emitted when an output item is marked done. + allOf: + - $ref: '#/components/schemas/ResponseOutputItemDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseReasoningSummaryPartWsAdded + description: Emitted when a new reasoning summary part is added. + allOf: + - $ref: '#/components/schemas/ResponseReasoningSummaryPartAddedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseReasoningSummaryPartWsDone + description: Emitted when a reasoning summary part is completed. + allOf: + - $ref: '#/components/schemas/ResponseReasoningSummaryPartDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseReasoningSummaryTextWsDelta + description: Emitted when a delta is added to a reasoning summary text. + allOf: + - $ref: '#/components/schemas/ResponseReasoningSummaryTextDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseReasoningSummaryTextWsDone + description: Emitted when a reasoning summary text is completed. + allOf: + - $ref: '#/components/schemas/ResponseReasoningSummaryTextDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseReasoningTextWsDelta + description: Emitted when a delta is added to a reasoning text. + allOf: + - $ref: '#/components/schemas/ResponseReasoningTextDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseReasoningTextWsDone + description: Emitted when a reasoning text is completed. + allOf: + - $ref: '#/components/schemas/ResponseReasoningTextDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseRefusalWsDelta + description: Emitted when there is a partial refusal text. + allOf: + - $ref: '#/components/schemas/ResponseRefusalDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseRefusalWsDone + description: Emitted when refusal text is finalized. + allOf: + - $ref: '#/components/schemas/ResponseRefusalDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseTextWsDelta + description: Emitted when there is an additional text delta. + allOf: + - $ref: '#/components/schemas/ResponseTextDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseTextWsDone + description: Emitted when text content is finalized. + allOf: + - $ref: '#/components/schemas/ResponseTextDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWebSearchCallWsCompleted + description: Emitted when a web search call is completed. + allOf: + - $ref: '#/components/schemas/ResponseWebSearchCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWebSearchCallInWsProgress + description: Emitted when a web search call is initiated. + allOf: + - $ref: '#/components/schemas/ResponseWebSearchCallInProgressEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWebSearchCallWsSearching + description: Emitted when a web search call is executing. + allOf: + - $ref: '#/components/schemas/ResponseWebSearchCallSearchingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseImageGenCallWsCompleted + description: | + Emitted when an image generation tool call has completed and the final image is available. + allOf: + - $ref: '#/components/schemas/ResponseImageGenCallCompletedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseImageGenCallWsGenerating + description: | + Emitted when an image generation tool call is actively generating an image (intermediate state). + allOf: + - $ref: '#/components/schemas/ResponseImageGenCallGeneratingEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseImageGenCallInWsProgress description: | - Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to `null` to turn off, in which case the client must manually trigger model response. - - Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech. - - Semantic VAD is more advanced and uses a turn detection model (in conjunction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency. - - For `gpt-realtime-whisper` transcription sessions, turn detection must be - set to `null`; VAD is not supported. - discriminator: - propertyName: type - anyOf: + Emitted when an image generation tool call is in progress. + allOf: + - $ref: '#/components/schemas/ResponseImageGenCallInProgressEvent' - type: object - title: Server VAD - description: Server-side voice activity detection (VAD) which flips on when user speech is detected and off after a period of silence. - required: - - type properties: - type: + stream_id: type: string - default: server_vad - const: server_vad description: | - Type of turn detection, `server_vad` to turn on simple Server VAD. - threshold: - type: number + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseImageGenCallPartialWsImage + description: | + Emitted when a partial image is available during image generation streaming. + allOf: + - $ref: '#/components/schemas/ResponseImageGenCallPartialImageEvent' + - type: object + properties: + stream_id: + type: string description: | - Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A - higher threshold will require louder audio to activate the model, and - thus might perform better in noisy environments. - prefix_padding_ms: - type: integer + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpCallArgumentsWsDelta + description: | + Emitted when there is a delta (partial update) to the arguments of an MCP tool call. + allOf: + - $ref: '#/components/schemas/ResponseMCPCallArgumentsDeltaEvent' + - type: object + properties: + stream_id: + type: string description: | - Used only for `server_vad` mode. Amount of audio to include before the VAD detected speech (in - milliseconds). Defaults to 300ms. - silence_duration_ms: - type: integer + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpCallArgumentsWsDone + description: | + Emitted when the arguments for an MCP tool call are finalized. + allOf: + - $ref: '#/components/schemas/ResponseMCPCallArgumentsDoneEvent' + - type: object + properties: + stream_id: + type: string description: | - Used only for `server_vad` mode. Duration of silence to detect speech stop (in milliseconds). Defaults - to 500ms. With shorter values the model will respond more quickly, - but may jump in on short pauses from the user. - create_response: - type: boolean - default: true + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpCallWsCompleted + description: | + Emitted when an MCP tool call has completed successfully. + allOf: + - $ref: '#/components/schemas/ResponseMCPCallCompletedEvent' + - type: object + properties: + stream_id: + type: string description: | - Whether or not to automatically generate a response when a VAD stop event occurs. If `interrupt_response` is set to `false` this may fail to create a response if the model is already responding. - - If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted. - interrupt_response: - type: boolean - default: true + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpCallWsFailed + description: | + Emitted when an MCP tool call has failed. + allOf: + - $ref: '#/components/schemas/ResponseMCPCallFailedEvent' + - type: object + properties: + stream_id: + type: string description: | - Whether or not to automatically interrupt (cancel) any ongoing response with output to the default - conversation (i.e. `conversation` of `auto`) when a VAD start event occurs. If `true` then the response will be cancelled, otherwise it will continue until complete. - - If both `create_response` and `interrupt_response` are set to `false`, the model will never respond automatically but VAD events will still be emitted. - idle_timeout_ms: - anyOf: - - type: integer - minimum: 5000 - maximum: 30000 - description: | - Optional timeout after which a model response will be triggered automatically. This is - useful for situations in which a long pause from the user is unexpected, such as a phone - call. The model will effectively prompt the user to continue the conversation based - on the current context. - - The timeout value will be applied after the last model response's audio has finished playing, - i.e. it's set to the `response.done` time plus audio playback duration. - - An `input_audio_buffer.timeout_triggered` event (plus events - associated with the Response) will be emitted when the timeout is reached. - Idle timeout is currently only supported for `server_vad` mode. - - type: 'null' + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpCallInWsProgress + description: | + Emitted when an MCP tool call is in progress. + allOf: + - $ref: '#/components/schemas/ResponseMCPCallInProgressEvent' - type: object - title: Semantic VAD - description: Server-side semantic turn detection which uses a model to determine when the user has finished speaking. - required: - - type properties: - type: + stream_id: type: string - const: semantic_vad description: | - Type of turn detection, `semantic_vad` to turn on Semantic VAD. - eagerness: + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpListToolsWsCompleted + description: | + Emitted when the list of available MCP tools has been successfully retrieved. + allOf: + - $ref: '#/components/schemas/ResponseMCPListToolsCompletedEvent' + - type: object + properties: + stream_id: type: string - default: auto - enum: - - low - - medium - - high - - auto description: | - Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` will wait longer for the user to continue speaking, `high` will respond more quickly. `auto` is the default and is equivalent to `medium`. `low`, `medium`, and `high` have max timeouts of 8s, 4s, and 2s respectively. - create_response: - type: boolean - default: true + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpListToolsWsFailed + description: | + Emitted when the attempt to list available MCP tools has failed. + allOf: + - $ref: '#/components/schemas/ResponseMCPListToolsFailedEvent' + - type: object + properties: + stream_id: + type: string description: | - Whether or not to automatically generate a response when a VAD stop event occurs. - interrupt_response: - type: boolean - default: true + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseMcpListToolsInWsProgress + description: | + Emitted when the system is in the process of retrieving the list of available MCP tools. + allOf: + - $ref: '#/components/schemas/ResponseMCPListToolsInProgressEvent' + - type: object + properties: + stream_id: + type: string description: | - Whether or not to automatically interrupt any ongoing response with output to the default - conversation (i.e. `conversation` of `auto`) when a VAD start event occurs. - - type: 'null' - Reasoning: + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseOutputTextAnnotationWsAdded + description: | + Emitted when an annotation is added to output text content. + allOf: + - $ref: '#/components/schemas/ResponseOutputTextAnnotationAddedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseWsQueued + description: | + Emitted when a response is queued and waiting to be processed. + allOf: + - $ref: '#/components/schemas/ResponseQueuedEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCustomToolCallInputWsDelta + description: | + Event representing a delta (partial update) to the input of a custom tool call. + allOf: + - $ref: '#/components/schemas/ResponseCustomToolCallInputDeltaEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - title: ResponseCustomToolCallInputWsDone + description: | + Event indicating that input for a custom tool call is complete. + allOf: + - $ref: '#/components/schemas/ResponseCustomToolCallInputDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + - $ref: '#/components/schemas/ResponseWsError' + - $ref: '#/components/schemas/ResponseSteerAcceptedEvent' + - $ref: '#/components/schemas/ResponseSteerPendingEvent' + - $ref: '#/components/schemas/ResponseSteerFailedEvent' + ResponsesWebSocketStreamEvent: + allOf: + - anyOf: + - $ref: '#/components/schemas/ResponseAudioDeltaEvent' + - $ref: '#/components/schemas/ResponseAudioDoneEvent' + - $ref: '#/components/schemas/ResponseAudioTranscriptDeltaEvent' + - $ref: '#/components/schemas/ResponseAudioTranscriptDoneEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallCompletedEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallInProgressEvent' + - $ref: '#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent' + - $ref: '#/components/schemas/ResponseCompletedEvent' + - $ref: '#/components/schemas/ResponseContentPartAddedEvent' + - $ref: '#/components/schemas/ResponseContentPartDoneEvent' + - $ref: '#/components/schemas/ResponseCreatedEvent' + - $ref: '#/components/schemas/ResponseFileSearchCallCompletedEvent' + - $ref: '#/components/schemas/ResponseFileSearchCallInProgressEvent' + - $ref: '#/components/schemas/ResponseFileSearchCallSearchingEvent' + - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent' + - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDoneEvent' + - $ref: '#/components/schemas/ResponseShellCallCommandAddedStreamingEvent' + - $ref: '#/components/schemas/ResponseShellCallCommandDeltaStreamingEvent' + - $ref: '#/components/schemas/ResponseShellCallCommandDoneStreamingEvent' + - $ref: '#/components/schemas/ResponseShellCallOutputContentDeltaStreamingEvent' + x-stainless-skip: + - go + - $ref: '#/components/schemas/ResponseShellCallOutputContentDoneStreamingEvent' + - $ref: '#/components/schemas/ResponseInProgressEvent' + - $ref: '#/components/schemas/ResponseFailedEvent' + - $ref: '#/components/schemas/ResponseIncompleteEvent' + - $ref: '#/components/schemas/ResponseOutputItemAddedEvent' + - $ref: '#/components/schemas/ResponseOutputItemDoneEvent' + - $ref: '#/components/schemas/ResponseReasoningSummaryPartAddedEvent' + - $ref: '#/components/schemas/ResponseReasoningSummaryPartDoneEvent' + - $ref: '#/components/schemas/ResponseReasoningSummaryTextDeltaEvent' + - $ref: '#/components/schemas/ResponseReasoningSummaryTextDoneEvent' + - $ref: '#/components/schemas/ResponseReasoningTextDeltaEvent' + - $ref: '#/components/schemas/ResponseReasoningTextDoneEvent' + - $ref: '#/components/schemas/ResponseRefusalDeltaEvent' + - $ref: '#/components/schemas/ResponseRefusalDoneEvent' + - $ref: '#/components/schemas/ResponseTextDeltaEvent' + - $ref: '#/components/schemas/ResponseTextDoneEvent' + - $ref: '#/components/schemas/ResponseWebSearchCallCompletedEvent' + - $ref: '#/components/schemas/ResponseWebSearchCallInProgressEvent' + - $ref: '#/components/schemas/ResponseWebSearchCallSearchingEvent' + - $ref: '#/components/schemas/ResponseImageGenCallCompletedEvent' + - $ref: '#/components/schemas/ResponseImageGenCallGeneratingEvent' + - $ref: '#/components/schemas/ResponseImageGenCallInProgressEvent' + - $ref: '#/components/schemas/ResponseImageGenCallPartialImageEvent' + - $ref: '#/components/schemas/ResponseMCPCallArgumentsDeltaEvent' + - $ref: '#/components/schemas/ResponseMCPCallArgumentsDoneEvent' + - $ref: '#/components/schemas/ResponseMCPCallCompletedEvent' + - $ref: '#/components/schemas/ResponseMCPCallFailedEvent' + - $ref: '#/components/schemas/ResponseMCPCallInProgressEvent' + - $ref: '#/components/schemas/ResponseMCPListToolsCompletedEvent' + - $ref: '#/components/schemas/ResponseMCPListToolsFailedEvent' + - $ref: '#/components/schemas/ResponseMCPListToolsInProgressEvent' + - $ref: '#/components/schemas/ResponseOutputTextAnnotationAddedEvent' + - $ref: '#/components/schemas/ResponseQueuedEvent' + - $ref: '#/components/schemas/ResponseCustomToolCallInputDeltaEvent' + - $ref: '#/components/schemas/ResponseCustomToolCallInputDoneEvent' + - type: object + properties: + stream_id: + type: string + description: | + The WebSocket lane that emitted this event. This field is present + when the originating `response.create` event supplied a + `stream_id`. + Role: type: object - description: | - Configuration options for - [reasoning models](https://developers.openai.com/api/docs/guides/reasoning). - title: Reasoning + description: Details about a role that can be assigned through the public Roles API. properties: - mode: - $ref: '#/components/schemas/ReasoningModeEnum' - description: | - Controls the reasoning execution mode for the request. - - When returned on a response, this is the effective execution mode. - effort: - $ref: '#/components/schemas/ReasoningEffort' - summary: - anyOf: - - type: string - description: | - A summary of the reasoning performed by the model. This can be - useful for debugging and understanding the model's reasoning process. - One of `auto`, `concise`, or `detailed`. - - `concise` is supported for `computer-use-preview` models and all reasoning models after `gpt-5`. - enum: - - auto - - concise - - detailed - - type: 'null' - context: + object: + type: string + enum: + - role + description: Always `role`. + x-stainless-const: true + id: + type: string + description: Identifier for the role. + name: + type: string + description: Unique name for the role. + description: + description: Optional description of the role. anyOf: - type: string - description: | - Controls which reasoning items are rendered back to the model on later turns. - If omitted or set to `auto`, the model determines the context mode. The - `gpt-5.6` model family defaults to `all_turns`; earlier models default to - `current_turn`. - - When returned on a response, this is the effective reasoning context mode - used for the response. - enum: - - auto - - current_turn - - all_turns - type: 'null' - generate_summary: + permissions: + type: array + description: Permissions granted by the role. + items: + type: string + resource_type: + type: string + description: Resource type the role is bound to (for example `api.organization` or `api.project`). + predefined_role: + type: boolean + description: Whether the role is predefined and managed by OpenAI. + required: + - object + - id + - name + - description + - permissions + - resource_type + - predefined_role + x-oaiMeta: + name: The role object + example: | + { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } + RoleDeletedResource: + type: object + description: Confirmation payload returned after deleting a role. + properties: + object: + type: string + enum: + - role.deleted + description: Always `role.deleted`. + x-stainless-const: true + id: + type: string + description: Identifier of the deleted role. + deleted: + type: boolean + description: Whether the role was deleted. + required: + - object + - id + - deleted + x-oaiMeta: + name: Role deletion confirmation + example: | + { + "object": "role.deleted", + "id": "role_01J1F8ROLE01", + "deleted": true + } + RoleListResource: + type: object + description: Paginated list of roles assigned to a principal. + properties: + object: + type: string + enum: + - list + description: Always `list`. + x-stainless-const: true + data: + type: array + description: Role assignments returned in the current page. + items: + $ref: '#/components/schemas/AssignedRoleDetails' + has_more: + type: boolean + description: Whether additional assignments are available when paginating. + next: + description: Cursor to fetch the next page of results, or `null` when there are no more assignments. anyOf: - type: string - deprecated: true - description: | - **Deprecated:** use `summary` instead. - - A summary of the reasoning performed by the model. This can be - useful for debugging and understanding the model's reasoning process. - One of `auto`, `concise`, or `detailed`. - enum: - - auto - - concise - - detailed - type: 'null' - ReasoningEffort: + required: + - object + - data + - has_more + - next + x-oaiMeta: + name: Assigned role list + example: | + { + "object": "list", + "data": [ + { + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false, + "description": "Allows managing organization groups", + "created_at": 1711471533, + "updated_at": 1711472599, + "created_by": "user_abc123", + "created_by_user_obj": { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + }, + "metadata": {}, + "assignment_sources": null + } + ], + "has_more": false, + "next": null + } + RunCompletionUsage: anyOf: - - type: string - enum: - - none - - minimal - - low - - medium - - high - - xhigh - - max - default: medium - description: | - Constrains effort on reasoning for reasoning models. Currently supported - values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. - Reducing reasoning effort can result in faster responses and fewer tokens - used on reasoning in a response. Not all reasoning models support every - value. See the - [reasoning guide](https://developers.openai.com/api/docs/guides/reasoning) - for model-specific support. + - type: object + description: Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). + properties: + completion_tokens: + type: integer + description: Number of completion tokens used over the course of the run. + prompt_tokens: + type: integer + description: Number of prompt tokens used over the course of the run. + total_tokens: + type: integer + description: Total number of tokens used (prompt + completion). + required: + - prompt_tokens + - completion_tokens + - total_tokens - type: 'null' - ReasoningItem: + RunGraderRequest: type: object - description: | - A description of the chain of thought used by a reasoning model while generating - a response. Be sure to include these items in your `input` to the Responses API - for subsequent turns of a conversation if you are manually - [managing context](https://developers.openai.com/api/docs/guides/conversation-state). - title: Reasoning + title: RunGraderRequest properties: - type: - type: string - description: | - The type of the object. Always `reasoning`. - enum: - - reasoning - x-stainless-const: true - id: - type: string - description: | - The unique identifier of the reasoning content. - encrypted_content: + grader: + type: object + description: The grader used for the fine-tuning job. anyOf: - - type: string - description: | - The encrypted content of the reasoning item. This is populated by default - for reasoning items returned by `POST /v1/responses` and WebSocket - `response.create` requests. - - When streaming, use the completed reasoning item and its - `encrypted_content` from the `response.output_item.done` event in - subsequent requests. The `encrypted_content` in - `response.output_item.added` may be incomplete. This is especially - important when `store` is `false` or when using Zero Data Retention. - - type: 'null' - summary: - type: array - description: | - Reasoning summary content. - items: - $ref: '#/components/schemas/Summary' - content: - type: array + - $ref: '#/components/schemas/GraderStringCheck' + - $ref: '#/components/schemas/GraderTextSimilarity' + - $ref: '#/components/schemas/GraderPython' + - $ref: '#/components/schemas/GraderScoreModel' + - $ref: '#/components/schemas/GraderMulti' + discriminator: + propertyName: type + item: + type: object description: | - Reasoning text content. - items: - $ref: '#/components/schemas/ReasoningTextContent' - status: + The dataset item provided to the grader. This will be used to populate + the `item` namespace. See [the guide](https://developers.openai.com/api/docs/guides/graders) for more details. + model_sample: type: string description: | - The status of the item. One of `in_progress`, `completed`, or - `incomplete`. Populated when items are returned via API. - enum: - - in_progress - - completed - - incomplete + The model sample to be evaluated. This value will be used to populate + the `sample` namespace. See [the guide](https://developers.openai.com/api/docs/guides/graders) for more details. + The `output_json` variable will be populated if the model sample is a + valid JSON string. required: - - id - - summary - - type - Response: - title: The response object - allOf: - - $ref: '#/components/schemas/ModelResponseProperties' - - $ref: '#/components/schemas/ResponseProperties' - - type: object - properties: - service_tier: - $ref: '#/components/schemas/ServiceTierResponses' - truncation: - anyOf: - - type: string - description: | - The truncation strategy to use for the model response. - - `auto`: If the input to this Response exceeds - the model's context window size, the model will truncate the - response to fit the context window by dropping items from the beginning of the conversation. - - `disabled` (default): If the input size will exceed the context window - size for a model, the request will fail with a 400 error. - enum: - - auto - - disabled - default: disabled - - type: 'null' - id: - type: string - description: | - Unique identifier for this Response. - object: - type: string - description: | - The object type of this resource - always set to `response`. - enum: - - response - x-stainless-const: true - status: - type: string - description: | - The status of the response generation. One of `completed`, `failed`, - `in_progress`, `cancelled`, `queued`, or `incomplete`. - enum: - - completed - - failed - - in_progress - - cancelled - - queued - - incomplete - created_at: - type: number - format: unixtime - description: | - Unix timestamp (in seconds) of when this Response was created. - completed_at: - anyOf: - - type: number - format: unixtime - description: | - Unix timestamp (in seconds) of when this Response was completed. - Only present when the status is `completed`. - - type: 'null' - error: - $ref: '#/components/schemas/ResponseError' - incomplete_details: - anyOf: - - type: object - description: | - Details about why the response is incomplete. + - grader + - model_sample + RunGraderResponse: + type: object + properties: + reward: + type: number + metadata: + type: object + properties: + name: + type: string + type: + type: string + errors: + type: object properties: - reason: - type: string - description: | - The reason why the response is incomplete. `steered` means - the response stopped at a safe output boundary after a - WebSocket `response.steer` event. The server can then create - a successor response automatically with the queued input. - enum: - - max_output_tokens - - max_messages - - content_filter - - steered - - type: 'null' - output: - type: array - description: | - An array of content items generated by the model. - - - The length and order of items in the `output` array is dependent - on the model's response. - - Rather than accessing the first item in the `output` array and - assuming it's an `assistant` message with the content generated by - the model, you might consider using the `output_text` property where - supported in SDKs. - items: - $ref: '#/components/schemas/OutputItem' - reasoning: - anyOf: - - $ref: '#/components/schemas/Reasoning' - - type: 'null' - instructions: - anyOf: - - description: | - A system (or developer) message inserted into the model's context. - - When using along with `previous_response_id`, the instructions from a previous - response will not be carried over to the next response. This makes it simple - to swap out system (or developer) messages in new responses. + formula_parse_error: + type: boolean + sample_parse_error: + type: boolean + truncated_observation_error: + type: boolean + unresponsive_reward_error: + type: boolean + invalid_variable_error: + type: boolean + other_error: + type: boolean + python_grader_server_error: + type: boolean + python_grader_server_error_type: + anyOf: + - type: string + - type: 'null' + python_grader_runtime_error: + type: boolean + python_grader_runtime_error_details: + anyOf: + - type: string + - type: 'null' + model_grader_server_error: + type: boolean + model_grader_refusal_error: + type: boolean + model_grader_parse_error: + type: boolean + model_grader_server_error_details: + anyOf: + - type: string + - type: 'null' + required: + - formula_parse_error + - sample_parse_error + - truncated_observation_error + - unresponsive_reward_error + - invalid_variable_error + - other_error + - python_grader_server_error + - python_grader_server_error_type + - python_grader_runtime_error + - python_grader_runtime_error_details + - model_grader_server_error + - model_grader_refusal_error + - model_grader_parse_error + - model_grader_server_error_details + execution_time: + type: number + scores: + type: object + additionalProperties: {} + token_usage: + anyOf: + - type: integer + - type: 'null' + sampled_model_name: anyOf: - type: string - description: | - A text input to the model, equivalent to a text input with the - `developer` role. - - type: array - title: Input item list - description: | - A list of one or many input items to the model, containing - different content types. - items: - $ref: '#/components/schemas/InputItem' - - type: 'null' - output_text: - anyOf: - - type: string - description: | - SDK-only convenience property that contains the aggregated text output - from all `output_text` items in the `output` array, if any are present. - Supported in the Python and JavaScript SDKs. - x-oaiSupportedSDKs: - - python - - javascript - - type: 'null' - x-stainless-skip: true - usage: - $ref: '#/components/schemas/ResponseUsage' - prompt_cache_options: - $ref: '#/components/schemas/PromptCacheOptions' - prompt_cache_diagnostics: - $ref: '#/components/schemas/PromptCacheDiagnostics' - moderation: - anyOf: - - $ref: '#/components/schemas/Moderation' - description: | - Moderation results for the response input and output, if moderated completions were requested. - - type: 'null' - parallel_tool_calls: - type: boolean - description: | - Whether to allow the model to run tool calls in parallel. - default: true - conversation: - anyOf: - - $ref: '#/components/schemas/ResponseConversation' - - type: 'null' - max_output_tokens: - anyOf: - - description: | - An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](https://developers.openai.com/api/docs/guides/reasoning). - type: integer - - type: 'null' - required: - - id - - object - - created_at - - error - - incomplete_details - - instructions - - model - - tools - - output - - parallel_tool_calls - - metadata - - tool_choice - - temperature - - top_p - ResponseAudioDeltaEvent: + - type: 'null' + required: + - name + - type + - errors + - execution_time + - scores + - token_usage + - sampled_model_name + sub_rewards: + type: object + additionalProperties: {} + model_grader_token_usage_per_model: + type: object + additionalProperties: {} + required: + - reward + - metadata + - sub_rewards + - model_grader_token_usage_per_model + RunObject: type: object - description: Emitted when there is a partial audio response. + title: A run on a thread + description: Represents an execution run on a [thread](https://developers.openai.com/api/docs/assistants/migration). properties: - type: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `thread.run`. type: string - description: | - The type of the event. Always `response.audio.delta`. enum: - - response.audio.delta + - thread.run x-stainless-const: true - sequence_number: + created_at: + description: The Unix timestamp (in seconds) for when the run was created. type: integer - description: | - A sequence number for this chunk of the stream response. - delta: + format: unixtime + thread_id: + description: The ID of the [thread](https://developers.openai.com/api/docs/assistants/migration) that was executed on as a part of this run. type: string - description: | - A chunk of Base64 encoded response audio bytes. - required: - - type - - delta - - sequence_number - x-oaiMeta: - name: response.audio.delta - group: responses - example: | - { - "type": "response.audio.delta", - "response_id": "resp_123", - "delta": "base64encoded...", - "sequence_number": 1 - } - ResponseAudioDoneEvent: - type: object - description: Emitted when the audio response is complete. - properties: - type: + assistant_id: + description: The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for execution of this run. + type: string + status: + $ref: '#/components/schemas/RunStatus' + description: The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. + required_action: + type: object + description: Details on the action required to continue the run. Will be `null` if no action is required. + nullable: true + properties: + type: + description: For now, this is always `submit_tool_outputs`. + type: string + enum: + - submit_tool_outputs + x-stainless-const: true + submit_tool_outputs: + type: object + description: Details on the tool outputs needed for this run to continue. + properties: + tool_calls: + type: array + description: A list of the relevant tool calls. + items: + $ref: '#/components/schemas/RunToolCallObject' + required: + - tool_calls + required: + - type + - submit_tool_outputs + last_error: + type: object + description: The last error associated with this run. Will be `null` if there are no errors. + nullable: true + properties: + code: + type: string + description: One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`. + enum: + - server_error + - rate_limit_exceeded + - invalid_prompt + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + expires_at: + description: The Unix timestamp (in seconds) for when the run will expire. + type: integer + format: unixtime + nullable: true + started_at: + description: The Unix timestamp (in seconds) for when the run was started. + type: integer + format: unixtime + nullable: true + cancelled_at: + description: The Unix timestamp (in seconds) for when the run was cancelled. + type: integer + format: unixtime + nullable: true + failed_at: + description: The Unix timestamp (in seconds) for when the run failed. + type: integer + format: unixtime + nullable: true + completed_at: + description: The Unix timestamp (in seconds) for when the run was completed. + type: integer + format: unixtime + nullable: true + incomplete_details: + description: Details on why the run is incomplete. Will be `null` if the run is not incomplete. + type: object + nullable: true + properties: + reason: + description: The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run. + type: string + enum: + - max_completion_tokens + - max_prompt_tokens + model: + description: The model that the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for this run. + type: string + instructions: + description: The instructions that the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for this run. type: string + tools: + description: The list of tools that the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for this run. + default: [] + type: array + maxItems: 20 + items: + $ref: '#/components/schemas/AssistantTool' + metadata: + $ref: '#/components/schemas/Metadata' + usage: + $ref: '#/components/schemas/RunCompletionUsage' + temperature: + description: The sampling temperature used for this run. If not set, defaults to 1. + type: number + nullable: true + top_p: + description: The nucleus sampling value used for this run. If not set, defaults to 1. + type: number + nullable: true + max_prompt_tokens: + type: integer + nullable: true description: | - The type of the event. Always `response.audio.done`. - enum: - - response.audio.done - x-stainless-const: true - sequence_number: + The maximum number of prompt tokens specified to have been used over the course of the run. + minimum: 256 + max_completion_tokens: type: integer + nullable: true description: | - The sequence number of the delta. + The maximum number of completion tokens specified to have been used over the course of the run. + minimum: 256 + truncation_strategy: + allOf: + - $ref: '#/components/schemas/TruncationObject' + - nullable: true + tool_choice: + allOf: + - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' + - nullable: true + parallel_tool_calls: + $ref: '#/components/schemas/ParallelToolCalls' + response_format: + $ref: '#/components/schemas/AssistantsApiResponseFormatOption' + nullable: true required: - - type - - sequence_number - - response_id + - id + - object + - created_at + - thread_id + - assistant_id + - status + - required_action + - last_error + - expires_at + - started_at + - cancelled_at + - failed_at + - completed_at + - model + - instructions + - tools + - metadata + - usage + - incomplete_details + - max_prompt_tokens + - max_completion_tokens + - truncation_strategy + - tool_choice + - parallel_tool_calls + - response_format x-oaiMeta: - name: response.audio.done - group: responses + name: The run object + beta: true example: | { - "type": "response.audio.done", - "response_id": "resp-123", - "sequence_number": 1 + "id": "run_abc123", + "object": "thread.run", + "created_at": 1698107661, + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "status": "completed", + "started_at": 1699073476, + "expires_at": null, + "cancelled_at": null, + "failed_at": null, + "completed_at": 1699073498, + "last_error": null, + "model": "gpt-5", + "instructions": null, + "tools": [{"type": "file_search"}, {"type": "code_interpreter"}], + "metadata": {}, + "incomplete_details": null, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 + }, + "temperature": 1.0, + "top_p": 1.0, + "max_prompt_tokens": 1000, + "max_completion_tokens": 1000, + "truncation_strategy": { + "type": "auto", + "last_messages": null + }, + "response_format": "auto", + "tool_choice": "auto", + "parallel_tool_calls": true } - ResponseAudioTranscriptDeltaEvent: + RunStepCompletionUsage: + anyOf: + - type: object + description: Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. + properties: + completion_tokens: + type: integer + description: Number of completion tokens used over the course of the run step. + prompt_tokens: + type: integer + description: Number of prompt tokens used over the course of the run step. + total_tokens: + type: integer + description: Total number of tokens used (prompt + completion). + required: + - prompt_tokens + - completion_tokens + - total_tokens + - type: 'null' + RunStepDeltaObject: type: object - description: Emitted when there is a partial transcript of audio. + title: Run step delta object + description: | + Represents a run step delta i.e. any changed fields on a run step during streaming. properties: - type: + id: + description: The identifier of the run step, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `thread.run.step.delta`. type: string - description: | - The type of the event. Always `response.audio.transcript.delta`. enum: - - response.audio.transcript.delta + - thread.run.step.delta x-stainless-const: true delta: - type: string - description: | - The partial transcript of the audio response. - sequence_number: - type: integer - description: The sequence number of this event. + $ref: '#/components/schemas/RunStepDeltaObjectDelta' required: - - type - - response_id + - id + - object - delta - - sequence_number x-oaiMeta: - name: response.audio.transcript.delta - group: responses + name: The run step delta object + beta: true example: | { - "type": "response.audio.transcript.delta", - "response_id": "resp_123", - "delta": " ... partial transcript ... ", - "sequence_number": 1 + "id": "step_123", + "object": "thread.run.step.delta", + "delta": { + "step_details": { + "type": "tool_calls", + "tool_calls": [ + { + "index": 0, + "id": "call_123", + "type": "code_interpreter", + "code_interpreter": { "input": "", "outputs": [] } + } + ] + } + } } - ResponseAudioTranscriptDoneEvent: + RunStepDeltaStepDetailsMessageCreationObject: + title: Message creation type: object - description: Emitted when the full audio transcript is completed. + description: Details of the message creation by the run step. properties: type: + description: Always `message_creation`. type: string - description: | - The type of the event. Always `response.audio.transcript.done`. enum: - - response.audio.transcript.done + - message_creation x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of this event. + message_creation: + type: object + properties: + message_id: + type: string + description: The ID of the message that was created by this run step. required: - type - - response_id - - sequence_number - x-oaiMeta: - name: response.audio.transcript.done - group: responses - example: | - { - "type": "response.audio.transcript.done", - "response_id": "resp_123", - "sequence_number": 1 - } - ResponseCodeInterpreterCallCodeDeltaEvent: + RunStepDeltaStepDetailsToolCallsCodeObject: + title: Code interpreter tool call type: object - description: Emitted when a partial code snippet is streamed by the code interpreter. + description: Details of the Code Interpreter tool call the run step was involved in. properties: - type: - type: string - description: The type of the event. Always `response.code_interpreter_call_code.delta`. - enum: - - response.code_interpreter_call_code.delta - x-stainless-const: true - output_index: + index: type: integer - description: The index of the output item in the response for which the code is being streamed. - item_id: - type: string - description: The unique identifier of the code interpreter tool call item. - delta: + description: The index of the tool call in the tool calls array. + id: type: string - description: The partial code snippet being streamed by the code interpreter. - sequence_number: - type: integer - description: The sequence number of this event, used to order streaming events. - required: - - type - - output_index - - item_id - - delta - - sequence_number - x-oaiMeta: - name: response.code_interpreter_call_code.delta - group: responses - example: | - { - "type": "response.code_interpreter_call_code.delta", - "output_index": 0, - "item_id": "ci_12345", - "delta": "print('Hello, world')", - "sequence_number": 1 - } - ResponseCodeInterpreterCallCodeDoneEvent: - type: object - description: Emitted when the code snippet is finalized by the code interpreter. - properties: + description: The ID of the tool call. type: type: string - description: The type of the event. Always `response.code_interpreter_call_code.done`. + description: The type of tool call. This is always going to be `code_interpreter` for this type of tool call. enum: - - response.code_interpreter_call_code.done + - code_interpreter x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response for which the code is finalized. - item_id: - type: string - description: The unique identifier of the code interpreter tool call item. - code: - type: string - description: The final code snippet output by the code interpreter. - sequence_number: - type: integer - description: The sequence number of this event, used to order streaming events. + code_interpreter: + type: object + description: The Code Interpreter tool call definition. + properties: + input: + type: string + description: The input to the Code Interpreter tool call. + outputs: + type: array + description: The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. + items: + type: object + anyOf: + - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject' + - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputImageObject' + discriminator: + propertyName: type required: + - index - type - - output_index - - item_id - - code - - sequence_number - x-oaiMeta: - name: response.code_interpreter_call_code.done - group: responses - example: | - { - "type": "response.code_interpreter_call_code.done", - "output_index": 3, - "item_id": "ci_12345", - "code": "print('done')", - "sequence_number": 1 - } - ResponseCodeInterpreterCallCompletedEvent: + RunStepDeltaStepDetailsToolCallsCodeOutputImageObject: + title: Code interpreter image output type: object - description: Emitted when the code interpreter call is completed. properties: - type: - type: string - description: The type of the event. Always `response.code_interpreter_call.completed`. - enum: - - response.code_interpreter_call.completed - x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response for which the code interpreter call is completed. - item_id: - type: string - description: The unique identifier of the code interpreter tool call item. - sequence_number: + index: type: integer - description: The sequence number of this event, used to order streaming events. - required: - - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.code_interpreter_call.completed - group: responses - example: | - { - "type": "response.code_interpreter_call.completed", - "output_index": 5, - "item_id": "ci_12345", - "sequence_number": 1 - } - ResponseCodeInterpreterCallInProgressEvent: - type: object - description: Emitted when a code interpreter call is in progress. - properties: + description: The index of the output in the outputs array. type: + description: Always `image`. type: string - description: The type of the event. Always `response.code_interpreter_call.in_progress`. enum: - - response.code_interpreter_call.in_progress + - image x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response for which the code interpreter call is in progress. - item_id: - type: string - description: The unique identifier of the code interpreter tool call item. - sequence_number: - type: integer - description: The sequence number of this event, used to order streaming events. + image: + type: object + properties: + file_id: + description: The [file](https://developers.openai.com/api/reference/resources/files) ID of the image. + type: string required: + - index - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.code_interpreter_call.in_progress - group: responses - example: | - { - "type": "response.code_interpreter_call.in_progress", - "output_index": 0, - "item_id": "ci_12345", - "sequence_number": 1 - } - ResponseCodeInterpreterCallInterpretingEvent: + RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject: + title: Code interpreter log output type: object - description: Emitted when the code interpreter is actively interpreting the code snippet. + description: Text output from the Code Interpreter tool call as part of a run step. properties: + index: + type: integer + description: The index of the output in the outputs array. type: + description: Always `logs`. type: string - description: The type of the event. Always `response.code_interpreter_call.interpreting`. enum: - - response.code_interpreter_call.interpreting + - logs x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response for which the code interpreter is interpreting code. - item_id: + logs: type: string - description: The unique identifier of the code interpreter tool call item. - sequence_number: - type: integer - description: The sequence number of this event, used to order streaming events. + description: The text output from the Code Interpreter tool call. required: + - index - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.code_interpreter_call.interpreting - group: responses - example: | - { - "type": "response.code_interpreter_call.interpreting", - "output_index": 4, - "item_id": "ci_12345", - "sequence_number": 1 - } - ResponseCompletedEvent: + RunStepDeltaStepDetailsToolCallsFileSearchObject: + title: File search tool call type: object - description: Emitted when the model response is complete. properties: - type: - type: string - description: | - The type of the event. Always `response.completed`. - enum: - - response.completed - x-stainless-const: true - response: - $ref: '#/components/schemas/Response' - description: | - Properties of the completed response. - sequence_number: + index: type: integer - description: The sequence number for this event. - required: - - type - - response - - sequence_number - x-oaiMeta: - name: response.completed - group: responses - example: | - { - "type": "response.completed", - "response": { - "id": "resp_123", - "object": "response", - "created_at": 1740855869, - "status": "completed", - "completed_at": 1740855870, - "error": null, - "incomplete_details": null, - "input": [], - "instructions": null, - "max_output_tokens": null, - "model": "gpt-6-astra", - "output": [ - { - "id": "msg_123", - "type": "message", - "role": "assistant", - "content": [ - { - "type": "output_text", - "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", - "annotations": [] - } - ] - } - ], - "previous_response_id": null, - "reasoning_effort": null, - "store": false, - "temperature": 1, - "text": { - "format": { - "type": "text" - } - }, - "tool_choice": "auto", - "tools": [], - "top_p": 1, - "truncation": "disabled", - "usage": { - "input_tokens": 0, - "output_tokens": 0, - "output_tokens_details": { - "reasoning_tokens": 0 - }, - "total_tokens": 0 - }, - "user": null, - "metadata": {} - }, - "sequence_number": 1 - } - ResponseConfigurationUpdate: - type: object - description: | - A configuration update that applies to subsequent responses until it is - replaced by another configuration update. - properties: + description: The index of the tool call in the tool calls array. id: - type: string - description: The unique ID of the configuration update item. - example: cnfu_123 + type: string + description: The ID of the tool call object. type: type: string + description: The type of tool call. This is always going to be `file_search` for this type of tool call. enum: - - configuration_update - description: The item type. Always `configuration_update`. - default: configuration_update + - file_search x-stainless-const: true - reasoning: + file_search: type: object - description: The reasoning configuration applied by this update. - properties: - effort: - $ref: '#/components/schemas/ReasoningEffort' - description: | - The reasoning effort used for subsequent responses until another - configuration update replaces it. + description: For now, this is always going to be an empty object. + x-oaiTypeLabel: map required: - - id + - index - type - ResponseConfigurationUpdateItemParam: + - file_search + RunStepDeltaStepDetailsToolCallsFunctionObject: type: object - description: | - An update to the conversation's response configuration. The configuration - remains in effect for subsequent responses until it is replaced by another - configuration update. + title: Function tool call properties: + index: + type: integer + description: The index of the tool call in the tool calls array. id: - anyOf: - - type: string - description: The unique ID of the configuration update item. - example: cnfu_123 - - type: 'null' + type: string + description: The ID of the tool call object. type: type: string + description: The type of tool call. This is always going to be `function` for this type of tool call. enum: - - configuration_update - description: The item type. Always `configuration_update`. - default: configuration_update + - function x-stainless-const: true - reasoning: + function: type: object - description: Updates to reasoning configuration. Only effort is supported. + description: The definition of the function that was called. properties: - effort: - $ref: '#/components/schemas/ReasoningEffort' - description: | - The reasoning effort to use for subsequent responses until another - configuration update replaces it. + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments passed to the function. + output: + anyOf: + - type: string + description: The output of the function. This will be `null` if the outputs have not been [submitted](https://developers.openai.com/api/docs/assistants/migration) yet. + - type: 'null' required: + - index - type - ResponseContentPartAddedEvent: + RunStepDeltaStepDetailsToolCallsObject: + title: Tool calls type: object - description: Emitted when a new content part is added. + description: Details of the tool call. properties: type: + description: Always `tool_calls`. type: string - description: | - The type of the event. Always `response.content_part.added`. enum: - - response.content_part.added + - tool_calls x-stainless-const: true - item_id: - type: string - description: | - The ID of the output item that the content part was added to. - output_index: - type: integer - description: | - The index of the output item that the content part was added to. - content_index: - type: integer - description: | - The index of the content part that was added. - part: - $ref: '#/components/schemas/OutputContent' + tool_calls: + type: array description: | - The content part that was added. - sequence_number: - type: integer - description: The sequence number of this event. + An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`. + items: + $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCall' required: - type - - item_id - - output_index - - content_index - - part - - sequence_number - x-oaiMeta: - name: response.content_part.added - group: responses - example: | - { - "type": "response.content_part.added", - "item_id": "msg_123", - "output_index": 0, - "content_index": 0, - "part": { - "type": "output_text", - "text": "", - "annotations": [] - }, - "sequence_number": 1 - } - ResponseContentPartDoneEvent: + RunStepDetailsMessageCreationObject: + title: Message creation type: object - description: Emitted when a content part is done. + description: Details of the message creation by the run step. properties: type: + description: Always `message_creation`. type: string - description: | - The type of the event. Always `response.content_part.done`. enum: - - response.content_part.done + - message_creation x-stainless-const: true - item_id: - type: string - description: | - The ID of the output item that the content part was added to. - output_index: - type: integer - description: | - The index of the output item that the content part was added to. - content_index: - type: integer - description: | - The index of the content part that is done. - sequence_number: - type: integer - description: The sequence number of this event. - part: - $ref: '#/components/schemas/OutputContent' - description: | - The content part that is done. + message_creation: + type: object + properties: + message_id: + type: string + description: The ID of the message that was created by this run step. + required: + - message_id required: - type - - item_id - - output_index - - content_index - - part - - sequence_number - x-oaiMeta: - name: response.content_part.done - group: responses - example: | - { - "type": "response.content_part.done", - "item_id": "msg_123", - "output_index": 0, - "content_index": 0, - "sequence_number": 1, - "part": { - "type": "output_text", - "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", - "annotations": [] - } - } - ResponseCreatedEvent: + - message_creation + RunStepDetailsToolCallsCodeObject: + title: Code Interpreter tool call type: object - description: | - An event that is emitted when a response is created. + description: Details of the Code Interpreter tool call the run step was involved in. properties: + id: + type: string + description: The ID of the tool call. type: type: string - description: | - The type of the event. Always `response.created`. + description: The type of tool call. This is always going to be `code_interpreter` for this type of tool call. enum: - - response.created + - code_interpreter x-stainless-const: true - response: - $ref: '#/components/schemas/Response' - description: | - The response that was created. - sequence_number: - type: integer - description: The sequence number for this event. + code_interpreter: + type: object + description: The Code Interpreter tool call definition. + required: + - input + - outputs + properties: + input: + type: string + description: The input to the Code Interpreter tool call. + outputs: + type: array + description: The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. + items: + type: object + anyOf: + - $ref: '#/components/schemas/RunStepDetailsToolCallsCodeOutputLogsObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsCodeOutputImageObject' + discriminator: + propertyName: type required: + - id - type - - response - - sequence_number - x-oaiMeta: - name: response.created - group: responses - example: | - { - "type": "response.created", - "response": { - "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", - "object": "response", - "created_at": 1741487325, - "status": "in_progress", - "completed_at": null, - "error": null, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "model": "gpt-6-astra", - "output": [], - "parallel_tool_calls": true, - "previous_response_id": null, - "reasoning": { - "effort": null, - "summary": null - }, - "store": true, - "temperature": 1, - "text": { - "format": { - "type": "text" - } - }, - "tool_choice": "auto", - "tools": [], - "top_p": 1, - "truncation": "disabled", - "usage": null, - "user": null, - "metadata": {} - }, - "sequence_number": 1 - } - ResponseCustomToolCallInputDeltaEvent: - title: ResponseCustomToolCallInputDelta + - code_interpreter + RunStepDetailsToolCallsCodeOutputImageObject: + title: Code Interpreter image output type: object - description: | - Event representing a delta (partial update) to the input of a custom tool call. properties: type: + description: Always `image`. type: string enum: - - response.custom_tool_call_input.delta - description: The event type identifier. + - image x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of this event. - output_index: - type: integer - description: The index of the output this delta applies to. - item_id: + image: + type: object + properties: + file_id: + description: The [file](https://developers.openai.com/api/reference/resources/files) ID of the image. + type: string + required: + - file_id + required: + - type + - image + x-stainless-naming: + java: + type_name: ImageOutput + kotlin: + type_name: ImageOutput + RunStepDetailsToolCallsCodeOutputLogsObject: + title: Code Interpreter log output + type: object + description: Text output from the Code Interpreter tool call as part of a run step. + properties: + type: + description: Always `logs`. type: string - description: Unique identifier for the API item associated with this event. - delta: + enum: + - logs + x-stainless-const: true + logs: type: string - description: The incremental input data (delta) for the custom tool call. + description: The text output from the Code Interpreter tool call. required: - type - - output_index - - item_id - - delta - - sequence_number - x-oaiMeta: - name: response.custom_tool_call_input.delta - group: responses - example: | - { - "type": "response.custom_tool_call_input.delta", - "output_index": 0, - "item_id": "ctc_1234567890abcdef", - "delta": "partial input text" - } - ResponseCustomToolCallInputDoneEvent: - title: ResponseCustomToolCallInputDone + - logs + x-stainless-naming: + java: + type_name: LogsOutput + kotlin: + type_name: LogsOutput + RunStepDetailsToolCallsFileSearchObject: + title: File search tool call type: object - description: | - Event indicating that input for a custom tool call is complete. properties: + id: + type: string + description: The ID of the tool call object. type: type: string + description: The type of tool call. This is always going to be `file_search` for this type of tool call. enum: - - response.custom_tool_call_input.done - description: The event type identifier. + - file_search x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of this event. - output_index: - type: integer - description: The index of the output this event applies to. - item_id: + file_search: + type: object + description: For now, this is always going to be an empty object. + x-oaiTypeLabel: map + properties: + ranking_options: + $ref: '#/components/schemas/RunStepDetailsToolCallsFileSearchRankingOptionsObject' + results: + type: array + description: The results of the file search. + items: + $ref: '#/components/schemas/RunStepDetailsToolCallsFileSearchResultObject' + required: + - id + - type + - file_search + RunStepDetailsToolCallsFileSearchRankingOptionsObject: + title: File search tool call ranking options + type: object + description: The ranking options for the file search. + properties: + ranker: + $ref: '#/components/schemas/FileSearchRanker' + score_threshold: + type: number + description: The score threshold for the file search. All values must be a floating point number between 0 and 1. + minimum: 0 + maximum: 1 + required: + - ranker + - score_threshold + RunStepDetailsToolCallsFileSearchResultObject: + title: File search tool call result + type: object + description: A result instance of the file search. + x-oaiTypeLabel: map + properties: + file_id: type: string - description: Unique identifier for the API item associated with this event. - input: + description: The ID of the file that result was found in. + file_name: type: string - description: The complete input data for the custom tool call. + description: The name of the file that result was found in. + score: + type: number + description: The score of the result. All values must be a floating point number between 0 and 1. + minimum: 0 + maximum: 1 + content: + type: array + description: The content of the result that was found. The content is only included if requested via the include query parameter. + items: + type: object + properties: + type: + type: string + description: The type of the content. + enum: + - text + x-stainless-const: true + text: + type: string + description: The text content of the file. + required: + - file_id + - file_name + - score + RunStepDetailsToolCallsFunctionObject: + type: object + title: Function tool call + properties: + id: + type: string + description: The ID of the tool call object. + type: + type: string + description: The type of tool call. This is always going to be `function` for this type of tool call. + enum: + - function + x-stainless-const: true + function: + type: object + description: The definition of the function that was called. + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments passed to the function. + output: + anyOf: + - type: string + description: The output of the function. This will be `null` if the outputs have not been [submitted](https://developers.openai.com/api/docs/assistants/migration) yet. + - type: 'null' + required: + - name + - arguments + - output required: + - id - type - - output_index - - item_id - - input - - sequence_number - x-oaiMeta: - name: response.custom_tool_call_input.done - group: responses - example: | - { - "type": "response.custom_tool_call_input.done", - "output_index": 0, - "item_id": "ctc_1234567890abcdef", - "input": "final complete input text" - } - ResponseError: - anyOf: - - type: object - description: | - An error object returned when the model fails to generate a Response. - properties: - code: - $ref: '#/components/schemas/ResponseErrorCode' - message: - type: string - description: | - A human-readable description of the error. - misalignment: - $ref: '#/components/schemas/MisalignmentErrorDetailsResource' - required: - - code - - message - - type: 'null' - ResponseErrorCode: - type: string - description: | - The error code for the response. - enum: - - server_error - - rate_limit_exceeded - - invalid_prompt - - data_residency_mismatch - - bio_policy - - misalignment_policy_violation - - vector_store_timeout - - invalid_image - - invalid_image_format - - invalid_base64_image - - invalid_image_url - - image_too_large - - image_too_small - - image_parse_error - - image_content_policy_violation - - invalid_image_mode - - image_file_too_large - - unsupported_image_media_type - - empty_image_file - - failed_to_download_image - - image_file_not_found - ResponseErrorEvent: + - function + RunStepDetailsToolCallsObject: + title: Tool calls type: object - description: Emitted when an error occurs. + description: Details of the tool call. properties: type: + description: Always `tool_calls`. type: string - description: | - The type of the event. Always `error`. enum: - - error + - tool_calls x-stainless-const: true - code: - anyOf: - - type: string - description: | - The error code. - - type: 'null' - message: - type: string + tool_calls: + type: array description: | - The error message. - param: - anyOf: - - type: string - description: | - The error parameter. - - type: 'null' - sequence_number: - type: integer - description: The sequence number of this event. + An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`. + items: + $ref: '#/components/schemas/RunStepDetailsToolCall' required: - type - - code - - message - - param - - sequence_number - x-oaiMeta: - name: error - group: responses - example: | - { - "type": "error", - "code": "ERR_SOMETHING", - "message": "Something went wrong", - "param": null, - "sequence_number": 1 - } - ResponseFailedEvent: + - tool_calls + RunStepObject: type: object + title: Run steps description: | - An event that is emitted when a response fails. + Represents a step in execution of a run. properties: - type: + id: + description: The identifier of the run step, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `thread.run.step`. type: string - description: | - The type of the event. Always `response.failed`. enum: - - response.failed + - thread.run.step x-stainless-const: true - sequence_number: + created_at: + description: The Unix timestamp (in seconds) for when the run step was created. type: integer - description: The sequence number of this event. - response: - $ref: '#/components/schemas/Response' - description: | - The response that failed. + format: unixtime + assistant_id: + description: The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) associated with the run step. + type: string + thread_id: + description: The ID of the [thread](https://developers.openai.com/api/docs/assistants/migration) that was run. + type: string + run_id: + description: The ID of the [run](https://developers.openai.com/api/docs/assistants/migration) that this run step is a part of. + type: string + type: + description: The type of run step, which can be either `message_creation` or `tool_calls`. + type: string + enum: + - message_creation + - tool_calls + status: + description: The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`. + type: string + enum: + - in_progress + - cancelled + - failed + - completed + - expired + step_details: + type: object + description: The details of the run step. + anyOf: + - $ref: '#/components/schemas/RunStepDetailsMessageCreationObject' + - $ref: '#/components/schemas/RunStepDetailsToolCallsObject' + discriminator: + propertyName: type + last_error: + anyOf: + - type: object + description: The last error associated with this run step. Will be `null` if there are no errors. + properties: + code: + type: string + description: One of `server_error` or `rate_limit_exceeded`. + enum: + - server_error + - rate_limit_exceeded + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + - type: 'null' + expired_at: + anyOf: + - description: The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired. + type: integer + format: unixtime + - type: 'null' + cancelled_at: + anyOf: + - description: The Unix timestamp (in seconds) for when the run step was cancelled. + type: integer + format: unixtime + - type: 'null' + failed_at: + anyOf: + - description: The Unix timestamp (in seconds) for when the run step failed. + type: integer + format: unixtime + - type: 'null' + completed_at: + anyOf: + - description: The Unix timestamp (in seconds) for when the run step completed. + type: integer + format: unixtime + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + usage: + $ref: '#/components/schemas/RunStepCompletionUsage' required: + - id + - object + - created_at + - assistant_id + - thread_id + - run_id - type - - response - - sequence_number + - status + - step_details + - last_error + - expired_at + - cancelled_at + - failed_at + - completed_at + - metadata + - usage x-oaiMeta: - name: response.failed - group: responses + name: The run step object + beta: true example: | { - "type": "response.failed", - "response": { - "id": "resp_123", - "object": "response", - "created_at": 1740855869, - "status": "failed", - "completed_at": null, - "error": { - "code": "server_error", - "message": "The model failed to generate a response." - }, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "model": "gpt-6-astra", - "output": [], - "previous_response_id": null, - "reasoning_effort": null, - "store": false, - "temperature": 1, - "text": { - "format": { - "type": "text" - } - }, - "tool_choice": "auto", - "tools": [], - "top_p": 1, - "truncation": "disabled", - "usage": null, - "user": null, - "metadata": {} + "id": "step_abc123", + "object": "thread.run.step", + "created_at": 1699063291, + "run_id": "run_abc123", + "assistant_id": "asst_abc123", + "thread_id": "thread_abc123", + "type": "message_creation", + "status": "completed", + "cancelled_at": null, + "completed_at": 1699063291, + "expired_at": null, + "failed_at": null, + "last_error": null, + "step_details": { + "type": "message_creation", + "message_creation": { + "message_id": "msg_abc123" + } + }, + "usage": { + "prompt_tokens": 123, + "completion_tokens": 456, + "total_tokens": 579 } } - ResponseFileSearchCallCompletedEvent: + RunStepStreamEvent: + anyOf: + - type: object + properties: + event: + type: string + enum: + - thread.run.step.created + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) is created. + x-oaiMeta: + dataDescription: '`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.step.in_progress + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) moves to an `in_progress` state. + x-oaiMeta: + dataDescription: '`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.step.delta + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepDeltaObject' + required: + - event + - data + description: Occurs when parts of a [run step](https://developers.openai.com/api/docs/assistants/migration) are being streamed. + x-oaiMeta: + dataDescription: '`data` is a [run step delta](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.step.completed + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) is completed. + x-oaiMeta: + dataDescription: '`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.step.failed + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) fails. + x-oaiMeta: + dataDescription: '`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.step.cancelled + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) is cancelled. + x-oaiMeta: + dataDescription: '`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.step.expired + x-stainless-const: true + data: + $ref: '#/components/schemas/RunStepObject' + required: + - event + - data + description: Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) expires. + x-oaiMeta: + dataDescription: '`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)' + discriminator: + propertyName: event + RunStreamEvent: + anyOf: + - type: object + properties: + event: + type: string + enum: + - thread.run.created + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a new [run](https://developers.openai.com/api/docs/assistants/migration) is created. + x-oaiMeta: + dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.queued + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to a `queued` status. + x-oaiMeta: + dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.in_progress + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to an `in_progress` status. + x-oaiMeta: + dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.requires_action + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to a `requires_action` status. + x-oaiMeta: + dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.completed + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) is completed. + x-oaiMeta: + dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.incomplete + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) ends with status `incomplete`. + x-oaiMeta: + dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.failed + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) fails. + x-oaiMeta: + dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.cancelling + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to a `cancelling` status. + x-oaiMeta: + dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.cancelled + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) is cancelled. + x-oaiMeta: + dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' + - type: object + properties: + event: + type: string + enum: + - thread.run.expired + x-stainless-const: true + data: + $ref: '#/components/schemas/RunObject' + required: + - event + - data + description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) expires. + x-oaiMeta: + dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' + discriminator: + propertyName: event + RunToolCallObject: type: object - description: Emitted when a file search call is completed (results found). + description: Tool call objects properties: - type: - type: string - description: | - The type of the event. Always `response.file_search_call.completed`. - enum: - - response.file_search_call.completed - x-stainless-const: true - output_index: - type: integer - description: | - The index of the output item that the file search call is initiated. - item_id: - type: string - description: | - The ID of the output item that the file search call is initiated. - sequence_number: - type: integer - description: The sequence number of this event. + id: + type: string + description: The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](https://developers.openai.com/api/docs/assistants/migration) endpoint. + type: + type: string + description: The type of tool call the output is required for. For now, this is always `function`. + enum: + - function + x-stainless-const: true + function: + type: object + description: The function definition. + properties: + name: + type: string + description: The name of the function. + arguments: + type: string + description: The arguments that the model expects you to pass to the function. + required: + - name + - arguments required: + - id - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.file_search_call.completed - group: responses - example: | - { - "type": "response.file_search_call.completed", - "output_index": 0, - "item_id": "fs_123", - "sequence_number": 1 - } - ResponseFileSearchCallInProgressEvent: + - function + ServiceTier: + anyOf: + - type: string + description: | + Specifies the processing type used for serving the request. + - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. + - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model. + - If set to '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier. + - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request. + - When not set, the default behavior is 'auto'. + + When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. + enum: + - auto + - default + - flex + - scale + - priority + - fast + default: auto + - type: 'null' + ServiceTierResponses: + anyOf: + - type: string + description: | + Specifies the processing type used for serving the request. + - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. + - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model. + - If set to '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier. + - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request. + - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`. + - When not set, the default behavior is 'auto'. + + When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. + enum: + - auto + - default + - flex + - scale + - priority + - fast + - ultrafast + default: auto + - type: 'null' + SpeechAudioDeltaEvent: type: object - description: Emitted when a file search call is initiated. + description: Emitted for each chunk of audio data generated during speech synthesis. properties: type: type: string description: | - The type of the event. Always `response.file_search_call.in_progress`. + The type of the event. Always `speech.audio.delta`. enum: - - response.file_search_call.in_progress + - speech.audio.delta x-stainless-const: true - output_index: - type: integer - description: | - The index of the output item that the file search call is initiated. - item_id: + audio: type: string description: | - The ID of the output item that the file search call is initiated. - sequence_number: - type: integer - description: The sequence number of this event. + A chunk of Base64-encoded audio data. required: - type - - output_index - - item_id - - sequence_number + - audio x-oaiMeta: - name: response.file_search_call.in_progress - group: responses + name: Stream Event (speech.audio.delta) + group: speech example: | { - "type": "response.file_search_call.in_progress", - "output_index": 0, - "item_id": "fs_123", - "sequence_number": 1 + "type": "speech.audio.delta", + "audio": "base64-encoded-audio-data" } - ResponseFileSearchCallSearchingEvent: + SpeechAudioDoneEvent: type: object - description: Emitted when a file search is currently searching. + description: Emitted when the speech synthesis is complete and all audio has been streamed. properties: type: type: string description: | - The type of the event. Always `response.file_search_call.searching`. + The type of the event. Always `speech.audio.done`. enum: - - response.file_search_call.searching + - speech.audio.done x-stainless-const: true - output_index: - type: integer - description: | - The index of the output item that the file search call is searching. - item_id: - type: string + usage: + type: object description: | - The ID of the output item that the file search call is initiated. - sequence_number: - type: integer - description: The sequence number of this event. + Token usage statistics for the request. + properties: + input_tokens: + type: integer + description: Number of input tokens in the prompt. + output_tokens: + type: integer + description: Number of output tokens generated. + total_tokens: + type: integer + description: Total number of tokens used (input + output). + required: + - input_tokens + - output_tokens + - total_tokens required: - type - - output_index - - item_id - - sequence_number + - usage x-oaiMeta: - name: response.file_search_call.searching - group: responses + name: Stream Event (speech.audio.done) + group: speech example: | { - "type": "response.file_search_call.searching", - "output_index": 0, - "item_id": "fs_123", - "sequence_number": 1 + "type": "speech.audio.done", + "usage": { + "input_tokens": 14, + "output_tokens": 101, + "total_tokens": 115 + } } - ResponseFormatJsonObject: + SpendAlertNotificationChannel: type: object - title: JSON object - description: | - JSON object response format. An older method of generating JSON responses. - Using `json_schema` is recommended for models that support it. Note that the - model will not generate JSON without a system or user message instructing it - to do so. + description: Email notification settings for a spend alert. properties: type: type: string - description: The type of response format being defined. Always `json_object`. enum: - - json_object + - email + description: The notification channel type. Currently only `email` is supported. x-stainless-const: true + recipients: + type: array + description: Email addresses that receive the spend alert notification. + items: + type: string + subject_prefix: + anyOf: + - type: string + - type: 'null' + description: Optional subject prefix for alert emails. required: - type - ResponseFormatJsonSchema: + - recipients + StaticChunkingStrategy: type: object - title: JSON schema - description: | - JSON Schema response format. Used to generate structured JSON responses. - Learn more about [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + additionalProperties: false properties: - type: - type: string - description: The type of response format being defined. Always `json_schema`. - enum: - - json_schema - x-stainless-const: true - json_schema: - type: object - title: JSON schema + max_chunk_size_tokens: + type: integer + minimum: 100 + maximum: 4096 + description: The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`. + chunk_overlap_tokens: + type: integer description: | - Structured Outputs configuration options, including a JSON Schema. - properties: - description: - type: string - description: | - A description of what the response format is for, used by the model to - determine how to respond in the format. - name: - type: string - description: | - The name of the response format. Must be a-z, A-Z, 0-9, or contain - underscores and dashes, with a maximum length of 64. - schema: - $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' - strict: - anyOf: - - type: boolean - default: false - description: | - Whether to enable strict schema adherence when generating the output. - If set to true, the model will always follow the exact schema defined - in the `schema` field. Only a subset of JSON Schema is supported when - `strict` is `true`. To learn more, read the [Structured Outputs - guide](https://developers.openai.com/api/docs/guides/structured-outputs). - - type: 'null' - required: - - name + The number of tokens that overlap between chunks. The default value is `400`. + + Note that the overlap must not exceed half of `max_chunk_size_tokens`. required: - - type - - json_schema - ResponseFormatJsonSchemaSchema: - type: object - title: JSON schema - description: | - The schema for the response format, described as a JSON Schema object. - Learn how to build JSON schemas [here](https://json-schema.org/). - additionalProperties: true - ResponseFormatText: + - max_chunk_size_tokens + - chunk_overlap_tokens + StaticChunkingStrategyRequestParam: type: object - title: Text - description: | - Default response format. Used to generate text responses. + title: Static Chunking Strategy + description: Customize your own chunking strategy by setting chunk size and chunk overlap. + additionalProperties: false properties: type: type: string - description: The type of response format being defined. Always `text`. + description: Always `static`. enum: - - text + - static x-stainless-const: true + static: + $ref: '#/components/schemas/StaticChunkingStrategy' required: - type - ResponseFormatTextGrammar: + - static + StaticChunkingStrategyResponseParam: type: object - title: Text grammar - description: | - A custom grammar for the model to follow when generating text. - Learn more in the [custom grammars guide](https://developers.openai.com/api/docs/guides/function-calling#context-free-grammars). + title: Static Chunking Strategy + additionalProperties: false properties: type: type: string - description: The type of response format being defined. Always `grammar`. + description: Always `static`. enum: - - grammar + - static x-stainless-const: true - grammar: - type: string - description: The custom grammar for the model to follow. + static: + $ref: '#/components/schemas/StaticChunkingStrategy' required: - type - - grammar - ResponseFormatTextPython: - type: object - title: Python grammar + - static + StopConfiguration: description: | - Configure the model to generate valid Python code. See the - [custom grammars guide](https://developers.openai.com/api/docs/guides/function-calling#context-free-grammars) for more details. - properties: - type: + Not supported with latest reasoning models `o3` and `o4-mini`. + + Up to 4 sequences where the API will stop generating further tokens. The + returned text will not contain the stop sequence. + anyOf: + - type: string + default: <|endoftext|> + example: |2+ + + nullable: true + - type: array + minItems: 1 + maxItems: 4 + items: type: string - description: The type of response format being defined. Always `python`. - enum: - - python - x-stainless-const: true + example: '["\n"]' + nullable: true + SubmitToolOutputsRunRequest: + type: object + additionalProperties: false + properties: + tool_outputs: + description: A list of tools for which the outputs are being submitted. + type: array + items: + type: object + properties: + tool_call_id: + type: string + description: The ID of the tool call in the `required_action` object within the run object the output is being submitted for. + output: + type: string + description: The output of the tool call to be submitted to continue the run. + stream: + anyOf: + - type: boolean + description: | + If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message. + - type: 'null' required: - - type - ResponseFunctionCallArgumentsDeltaEvent: + - tool_outputs + TextResponseFormatConfiguration: + description: | + An object specifying the format that the model must output. + + Configuring `{ "type": "json_schema" }` enables Structured Outputs, + which ensures the model will match your supplied JSON schema. Learn more in the + [Structured Outputs guide](https://developers.openai.com/api/docs/guides/structured-outputs). + + The default format is `{ "type": "text" }` with no additional options. + + **Not recommended for gpt-4o and newer models:** + + Setting to `{ "type": "json_object" }` enables the older JSON mode, which + ensures the message the model generates is valid JSON. Using `json_schema` + is preferred for models that support it. + anyOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/TextResponseFormatJsonSchema' + - $ref: '#/components/schemas/ResponseFormatJsonObject' + discriminator: + propertyName: type + TextResponseFormatJsonSchema: type: object - description: Emitted when there is a partial function-call arguments delta. + title: JSON schema + description: | + JSON Schema response format. Used to generate structured JSON responses. + Learn more about [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). properties: type: type: string - description: | - The type of the event. Always `response.function_call_arguments.delta`. + description: The type of response format being defined. Always `json_schema`. enum: - - response.function_call_arguments.delta + - json_schema x-stainless-const: true - item_id: + description: type: string description: | - The ID of the output item that the function-call arguments delta is added to. - output_index: - type: integer - description: | - The index of the output item that the function-call arguments delta is added to. - sequence_number: - type: integer - description: The sequence number of this event. - delta: + A description of what the response format is for, used by the model to + determine how to respond in the format. + name: type: string description: | - The function-call arguments delta that is added. + The name of the response format. Must be a-z, A-Z, 0-9, or contain + underscores and dashes, with a maximum length of 64. + schema: + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + strict: + anyOf: + - type: boolean + default: false + description: | + Whether to enable strict schema adherence when generating the output. + If set to true, the model will always follow the exact schema defined + in the `schema` field. Only a subset of JSON Schema is supported when + `strict` is `true`. To learn more, read the [Structured Outputs + guide](https://developers.openai.com/api/docs/guides/structured-outputs). + - type: 'null' required: - type - - item_id - - output_index - - delta - - sequence_number - x-oaiMeta: - name: response.function_call_arguments.delta - group: responses - example: | - { - "type": "response.function_call_arguments.delta", - "item_id": "item-abc", - "output_index": 0, - "delta": "{ \"arg\":" - "sequence_number": 1 - } - ResponseFunctionCallArgumentsDoneEvent: + - schema + - name + ThreadObject: type: object - description: Emitted when function-call arguments are finalized. + title: Thread + description: Represents a thread that contains [messages](https://developers.openai.com/api/docs/assistants/migration). properties: - type: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `thread`. type: string enum: - - response.function_call_arguments.done + - thread x-stainless-const: true - item_id: - type: string - description: The ID of the item. - output_index: - type: integer - description: The index of the output item. - sequence_number: + created_at: + description: The Unix timestamp (in seconds) for when the thread was created. type: integer - description: The sequence number of this event. - arguments: - type: string - description: The function-call arguments. + format: unixtime + tool_resources: + anyOf: + - type: object + description: | + A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. + properties: + code_interpreter: + type: object + properties: + file_ids: + type: array + description: | + A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. + default: [] + maxItems: 20 + items: + type: string + file_search: + type: object + properties: + vector_store_ids: + type: array + description: | + The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread. + maxItems: 1 + items: + type: string + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' + required: + - id + - object + - created_at + - tool_resources + - metadata + x-oaiMeta: + name: The thread object + beta: true + example: | + { + "id": "thread_abc123", + "object": "thread", + "created_at": 1698107661, + "metadata": {} + } + ThreadStreamEvent: + anyOf: + - type: object + properties: + enabled: + type: boolean + description: Whether to enable input audio transcription. + event: + type: string + enum: + - thread.created + x-stainless-const: true + data: + $ref: '#/components/schemas/ThreadObject' + required: + - event + - data + description: Occurs when a new [thread](https://developers.openai.com/api/docs/assistants/migration) is created. + x-oaiMeta: + dataDescription: '`data` is a [thread](https://developers.openai.com/api/docs/assistants/migration)' + discriminator: + propertyName: event + ToggleCertificatesRequest: + type: object + properties: + certificate_ids: + type: array + items: + type: string + example: cert_abc + minItems: 1 + maxItems: 10 required: - - type - - item_id - - output_index - - arguments - - sequence_number - x-oaiMeta: - name: response.function_call_arguments.done - group: responses - example: | - { - "type": "response.function_call_arguments.done", - "item_id": "item-abc", - "output_index": 1, - "arguments": "{ \"arg\": 123 }", - "sequence_number": 1 - } - ResponseImageGenCallCompletedEvent: + - certificate_ids + Tool: + description: | + A tool that can be used to generate a response. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/FunctionTool' + - $ref: '#/components/schemas/FileSearchTool' + - $ref: '#/components/schemas/ComputerTool' + - $ref: '#/components/schemas/ComputerUsePreviewTool' + - $ref: '#/components/schemas/WebSearchTool' + - $ref: '#/components/schemas/MCPTool' + - $ref: '#/components/schemas/CodeInterpreterTool' + - $ref: '#/components/schemas/ProgrammaticToolCallingParam' + - $ref: '#/components/schemas/ImageGenTool' + - $ref: '#/components/schemas/LocalShellToolParam' + - $ref: '#/components/schemas/FunctionShellToolParam' + - $ref: '#/components/schemas/CustomToolParam' + - $ref: '#/components/schemas/NamespaceToolParam' + - $ref: '#/components/schemas/ToolSearchToolParam' + - $ref: '#/components/schemas/WebSearchPreviewTool' + - $ref: '#/components/schemas/ApplyPatchToolParam' + ToolChoiceAllowed: type: object - title: ResponseImageGenCallCompletedEvent + title: Allowed tools description: | - Emitted when an image generation tool call has completed and the final image is available. + Constrains the tools available to the model to a pre-defined set. properties: type: type: string enum: - - response.image_generation_call.completed - description: The type of the event. Always 'response.image_generation_call.completed'. + - allowed_tools + description: Allowed tool configuration type. Always `allowed_tools`. x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response's output array. - sequence_number: - type: integer - description: The sequence number of this event. - item_id: + mode: type: string - description: The unique identifier of the image generation item being processed. + enum: + - auto + - required + description: | + Constrains the tools available to the model to a pre-defined set. + + `auto` allows the model to pick from among the allowed tools and generate a + message. + + `required` requires the model to call one or more of the allowed tools. + tools: + type: array + description: | + A list of tool definitions that the model should be allowed to call. + + For the Responses API, the list of tool definitions might look like: + ```json + [ + { "type": "function", "name": "get_weather" }, + { "type": "mcp", "server_label": "deepwiki" }, + { "type": "image_generation" } + ] + ``` + items: + type: object + description: | + A tool definition that the model should be allowed to call. + additionalProperties: true + x-oaiExpandable: false required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.image_generation_call.completed - group: responses - example: | - { - "type": "response.image_generation_call.completed", - "output_index": 0, - "item_id": "item-123", - "sequence_number": 1 - } - ResponseImageGenCallGeneratingEvent: + - mode + - tools + ToolChoiceCustom: type: object - title: ResponseImageGenCallGeneratingEvent + title: Custom tool description: | - Emitted when an image generation tool call is actively generating an image (intermediate state). + Use this option to force the model to call a specific custom tool. properties: type: type: string enum: - - response.image_generation_call.generating - description: The type of the event. Always 'response.image_generation_call.generating'. + - custom + description: For custom tool calling, the type is always `custom`. x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response's output array. - item_id: + name: type: string - description: The unique identifier of the image generation item being processed. - sequence_number: - type: integer - description: The sequence number of the image generation item being processed. + description: The name of the custom tool to call. required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.image_generation_call.generating - group: responses - example: | - { - "type": "response.image_generation_call.generating", - "output_index": 0, - "item_id": "item-123", - "sequence_number": 0 - } - ResponseImageGenCallInProgressEvent: + - name + ToolChoiceFunction: type: object - title: ResponseImageGenCallInProgressEvent + title: Function tool description: | - Emitted when an image generation tool call is in progress. + Use this option to force the model to call a specific function. properties: type: type: string enum: - - response.image_generation_call.in_progress - description: The type of the event. Always 'response.image_generation_call.in_progress'. + - function + description: For function calling, the type is always `function`. x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response's output array. - item_id: + name: type: string - description: The unique identifier of the image generation item being processed. - sequence_number: - type: integer - description: The sequence number of the image generation item being processed. + description: The name of the function to call. required: - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.image_generation_call.in_progress - group: responses - example: | - { - "type": "response.image_generation_call.in_progress", - "output_index": 0, - "item_id": "item-123", - "sequence_number": 0 - } - ResponseImageGenCallPartialImageEvent: + - name + ToolChoiceMCP: type: object - title: ResponseImageGenCallPartialImageEvent + title: MCP tool description: | - Emitted when a partial image is available during image generation streaming. + Use this option to force the model to call a specific tool on a remote MCP server. properties: type: type: string enum: - - response.image_generation_call.partial_image - description: The type of the event. Always 'response.image_generation_call.partial_image'. + - mcp + description: For MCP tools, the type is always `mcp`. x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response's output array. - item_id: - type: string - description: The unique identifier of the image generation item being processed. - sequence_number: - type: integer - description: The sequence number of the image generation item being processed. - partial_image_index: - type: integer - description: 0-based index for the partial image (backend is 1-based, but this is 0-based for the user). - partial_image_b64: - type: string - description: Base64-encoded partial image data, suitable for rendering as an image. - size: - type: string - description: The image size that was used. - quality: - type: string - description: The image quality that was used. - background: - type: string - description: The background setting that was used. - output_format: + server_label: type: string - description: The output format that was used. + description: | + The label of the MCP server to use. + name: + anyOf: + - type: string + description: | + The name of the tool to call on the server. + - type: 'null' required: - type - - output_index - - item_id - - sequence_number - - partial_image_index - - partial_image_b64 - x-oaiMeta: - name: response.image_generation_call.partial_image - group: responses - example: | - { - "type": "response.image_generation_call.partial_image", - "output_index": 0, - "item_id": "item-123", - "sequence_number": 0, - "partial_image_index": 0, - "partial_image_b64": "..." - } - ResponseInProgressEvent: + - server_label + ToolChoiceOptions: + type: string + title: Tool choice mode + description: | + Controls which (if any) tool is called by the model. + + `none` means the model will not call any tool and instead generates a message. + + `auto` means the model can pick between generating a message or calling one or + more tools. + + `required` means the model must call one or more tools. + enum: + - none + - auto + - required + ToolChoiceParam: + description: | + How the model should select which tool (or tools) to use when generating + a response. See the `tools` parameter to see how to specify which tools + the model can call. + anyOf: + - $ref: '#/components/schemas/ToolChoiceOptions' + - $ref: '#/components/schemas/ToolChoiceAllowed' + - $ref: '#/components/schemas/ToolChoiceTypes' + - $ref: '#/components/schemas/ToolChoiceFunction' + - $ref: '#/components/schemas/ToolChoiceMCP' + - $ref: '#/components/schemas/ToolChoiceCustom' + - $ref: '#/components/schemas/SpecificProgrammaticToolCallingParam' + - $ref: '#/components/schemas/SpecificApplyPatchParam' + - $ref: '#/components/schemas/SpecificFunctionShellParam' + discriminator: + propertyName: type + ToolChoiceTypes: type: object - description: Emitted when the response is in progress. + title: Hosted tool + description: | + Indicates that the model should use a built-in tool to generate a response. + [Learn more about built-in tools](https://developers.openai.com/api/docs/guides/tools). properties: type: type: string description: | - The type of the event. Always `response.in_progress`. + The type of hosted tool the model should to use. Learn more about + [built-in tools](https://developers.openai.com/api/docs/guides/tools). + + Allowed values are: + - `file_search` + - `web_search_preview` + - `computer` + - `computer_use_preview` + - `computer_use` + - `code_interpreter` + - `image_generation` enum: - - response.in_progress - x-stainless-const: true - response: - $ref: '#/components/schemas/Response' - description: | - The response that is in progress. - sequence_number: - type: integer - description: The sequence number of this event. + - file_search + - web_search_preview + - computer + - computer_use_preview + - computer_use + - web_search_preview_2025_03_11 + - image_generation + - code_interpreter required: - type - - response - - sequence_number - x-oaiMeta: - name: response.in_progress - group: responses - example: | - { - "type": "response.in_progress", - "response": { - "id": "resp_67ccfcdd16748190a91872c75d38539e09e4d4aac714747c", - "object": "response", - "created_at": 1741487325, - "status": "in_progress", - "completed_at": null, - "error": null, - "incomplete_details": null, - "instructions": null, - "max_output_tokens": null, - "model": "gpt-6-astra", - "output": [], - "parallel_tool_calls": true, - "previous_response_id": null, - "reasoning": { - "effort": null, - "summary": null - }, - "store": true, - "temperature": 1, - "text": { - "format": { - "type": "text" - } - }, - "tool_choice": "auto", - "tools": [], - "top_p": 1, - "truncation": "disabled", - "usage": null, - "user": null, - "metadata": {} - }, - "sequence_number": 1 - } - ResponseIncompleteEvent: - type: object + ToolsArray: + type: array description: | - An event that is emitted when a response finishes as incomplete. + An array of tools the model may call while generating a response. You + can specify which tool to use by setting the `tool_choice` parameter. - Over WebSocket, steering can finish a response with - `response.incomplete_details.reason` set to `steered`, followed automatically - by a successor `response.created` that commits the queued steering input. + We support the following categories of tools: + - **Built-in tools**: Tools that are provided by OpenAI that extend the + model's capabilities, like [web search](https://developers.openai.com/api/docs/guides/tools-web-search) + or [file search](https://developers.openai.com/api/docs/guides/tools-file-search). Learn more about + [built-in tools](https://developers.openai.com/api/docs/guides/tools). + - **MCP Tools**: Integrations with third-party systems via custom MCP servers + or predefined connectors such as Google Drive and SharePoint. Learn more about + [MCP Tools](https://developers.openai.com/api/docs/guides/tools-connectors-mcp). + - **Function calls (custom tools)**: Functions that are defined by you, + enabling the model to call your own code with strongly typed arguments + and outputs. Learn more about + [function calling](https://developers.openai.com/api/docs/guides/function-calling). You can also use + custom tools to call your own code. + items: + $ref: '#/components/schemas/Tool' + TranscriptTextDeltaEvent: + type: object + description: Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`. properties: type: type: string description: | - The type of the event. Always `response.incomplete`. + The type of the event. Always `transcript.text.delta`. enum: - - response.incomplete + - transcript.text.delta x-stainless-const: true - response: - $ref: '#/components/schemas/Response' + delta: + type: string description: | - The response that was incomplete. - sequence_number: - type: integer - description: The sequence number of this event. - required: - - type - - response - - sequence_number - x-oaiMeta: - name: response.incomplete - group: responses - example: | - { - "type": "response.incomplete", - "response": { - "id": "resp_123", - "object": "response", - "created_at": 1740855869, - "status": "incomplete", - "completed_at": null, - "error": null, - "incomplete_details": { - "reason": "max_tokens" - }, - "instructions": null, - "max_output_tokens": null, - "model": "gpt-6-astra", - "output": [], - "previous_response_id": null, - "reasoning_effort": null, - "store": false, - "temperature": 1, - "text": { - "format": { - "type": "text" - } - }, - "tool_choice": "auto", - "tools": [], - "top_p": 1, - "truncation": "disabled", - "usage": null, - "user": null, - "metadata": {} - }, - "sequence_number": 1 - } - ResponseItemList: - type: object - description: A list of Response items. - properties: - object: - x-stainless-const: true - description: The type of object returned, must be `list`. - const: list - data: + The text delta that was additionally transcribed. + logprobs: type: array - description: A list of items used to generate this response. + description: | + The log probabilities of the delta. Only included if you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `include[]` parameter set to `logprobs`. items: - $ref: '#/components/schemas/ItemResource' - has_more: - type: boolean - description: Whether there are more items available. - first_id: - type: string - description: The ID of the first item in the list. - last_id: + type: object + properties: + token: + type: string + description: | + The token that was used to generate the log probability. + logprob: + type: number + description: | + The log probability of the token. + bytes: + type: array + items: + type: integer + description: | + The bytes that were used to generate the log probability. + segment_id: type: string - description: The ID of the last item in the list. + description: | + Identifier of the diarized segment that this delta belongs to. Only present when using `gpt-4o-transcribe-diarize`. required: - - object - - data - - has_more - - first_id - - last_id - x-oaiMeta: - name: The input item list - group: responses - example: | - { - "object": "list", - "data": [ - { - "id": "msg_abc123", - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "Tell me a three sentence bedtime story about a unicorn." - } - ] - } - ], - "first_id": "msg_abc123", - "last_id": "msg_abc123", - "has_more": false + - type + - delta + x-oaiMeta: + name: Stream Event (transcript.text.delta) + group: transcript + example: | + { + "type": "transcript.text.delta", + "delta": " wonderful" } - ResponseLogProb: + TranscriptTextDoneEvent: type: object - description: "A logprob is the logarithmic probability that the model assigns to producing \na particular token at a given position in the sequence. Less-negative (higher) \nlogprob values indicate greater model confidence in that token choice.\n" + description: Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`. properties: - token: - description: A possible text token. + type: type: string - logprob: description: | - The log probability of this token. - type: number - top_logprobs: + The type of the event. Always `transcript.text.done`. + enum: + - transcript.text.done + x-stainless-const: true + text: + type: string description: | - The log probabilities of up to 20 of the most likely tokens. + The text that was transcribed. + languages: + type: array + description: | + The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected. + items: + $ref: '#/components/schemas/TranscriptionLanguage' + logprobs: type: array + description: | + The log probabilities of the individual tokens in the transcription. Only included if you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `include[]` parameter set to `logprobs`. items: type: object properties: token: - description: A possible text token. type: string + description: | + The token that was used to generate the log probability. logprob: - description: The log probability of this token. type: number + description: | + The log probability of the token. + bytes: + type: array + items: + type: integer + description: | + The bytes that were used to generate the log probability. + usage: + $ref: '#/components/schemas/TranscriptTextUsageTokens' required: - - token - - logprob - ResponseMCPCallArgumentsDeltaEvent: + - type + - text + x-oaiMeta: + name: Stream Event (transcript.text.done) + group: transcript + example: | + { + "type": "transcript.text.done", + "text": "I see skies of blue and clouds of white, the bright blessed days, the dark sacred nights, and I think to myself, what a wonderful world.", + "usage": { + "type": "tokens", + "input_tokens": 14, + "input_token_details": { + "text_tokens": 10, + "audio_tokens": 4 + }, + "output_tokens": 31, + "total_tokens": 45 + } + } + TranscriptTextSegmentEvent: type: object - title: ResponseMCPCallArgumentsDeltaEvent description: | - Emitted when there is a delta (partial update) to the arguments of an MCP tool call. + Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with `stream` set to `true` and `response_format` set to `diarized_json`. properties: type: type: string + description: The type of the event. Always `transcript.text.segment`. enum: - - response.mcp_call_arguments.delta - description: The type of the event. Always 'response.mcp_call_arguments.delta'. + - transcript.text.segment x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response's output array. - item_id: + id: type: string - description: The unique identifier of the MCP tool call item being processed. - delta: + description: Unique identifier for the segment. + start: + type: number + format: double + description: Start timestamp of the segment in seconds. + end: + type: number + format: double + description: End timestamp of the segment in seconds. + text: type: string - description: | - A JSON string containing the partial update to the arguments for the MCP tool call. - sequence_number: - type: integer - description: The sequence number of this event. + description: Transcript text for this segment. + speaker: + type: string + description: Speaker label for this segment. required: - type - - output_index - - item_id - - delta - - sequence_number + - id + - start + - end + - text + - speaker x-oaiMeta: - name: response.mcp_call_arguments.delta - group: responses + name: Stream Event (transcript.text.segment) + group: transcript example: | { - "type": "response.mcp_call_arguments.delta", - "output_index": 0, - "item_id": "item-abc", - "delta": "{", - "sequence_number": 1 + "type": "transcript.text.segment", + "id": "seg_002", + "start": 5.2, + "end": 12.8, + "text": "Hi, I need help with diarization.", + "speaker": "A" } - ResponseMCPCallArgumentsDoneEvent: + TranscriptTextUsageDuration: type: object - title: ResponseMCPCallArgumentsDoneEvent - description: | - Emitted when the arguments for an MCP tool call are finalized. + title: TranscriptTextUsageDuration + description: Usage statistics for models billed by audio input duration. properties: type: type: string enum: - - response.mcp_call_arguments.done - description: The type of the event. Always 'response.mcp_call_arguments.done'. + - duration + description: The type of the usage object. Always `duration` for this variant. x-stainless-const: true - output_index: - type: integer - description: The index of the output item in the response's output array. - item_id: - type: string - description: The unique identifier of the MCP tool call item being processed. - arguments: - type: string - description: | - A JSON string containing the finalized arguments for the MCP tool call. - sequence_number: - type: integer - description: The sequence number of this event. + seconds: + type: number + format: double + description: Duration of the input audio in seconds. required: - type - - output_index - - item_id - - arguments - - sequence_number - x-oaiMeta: - name: response.mcp_call_arguments.done - group: responses - example: | - { - "type": "response.mcp_call_arguments.done", - "output_index": 0, - "item_id": "item-abc", - "arguments": "{\"arg1\": \"value1\", \"arg2\": \"value2\"}", - "sequence_number": 1 - } - ResponseMCPCallCompletedEvent: + - seconds + TranscriptTextUsageTokens: type: object - title: ResponseMCPCallCompletedEvent - description: | - Emitted when an MCP tool call has completed successfully. + title: TranscriptTextUsageTokens + description: Usage statistics for models billed by token usage. properties: type: type: string enum: - - response.mcp_call.completed - description: The type of the event. Always 'response.mcp_call.completed'. + - tokens + description: The type of the usage object. Always `tokens` for this variant. x-stainless-const: true - item_id: - type: string - description: The ID of the MCP tool call item that completed. - output_index: + input_tokens: type: integer - description: The index of the output item that completed. - sequence_number: + description: Number of input tokens billed for this request. + input_token_details: + type: object + description: Details about the input tokens billed for this request. + properties: + text_tokens: + type: integer + description: Number of text tokens billed for this request. + audio_tokens: + type: integer + description: Number of audio tokens billed for this request. + output_tokens: type: integer - description: The sequence number of this event. + description: Number of output tokens generated. + total_tokens: + type: integer + description: Total number of tokens used (input + output). required: - type - - item_id - - output_index - - sequence_number - x-oaiMeta: - name: response.mcp_call.completed - group: responses - example: | - { - "type": "response.mcp_call.completed", - "sequence_number": 1, - "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", - "output_index": 0 - } - ResponseMCPCallFailedEvent: + - input_tokens + - output_tokens + - total_tokens + TranscriptionChunkingStrategy: + anyOf: + - description: 'Controls how the audio is cut into chunks. When set to `"auto"`, the server first normalizes loudness and then uses voice activity detection (VAD) to choose boundaries. `server_vad` object can be provided to tweak VAD detection parameters manually. If unset, the audio is transcribed as a single block. Required when using `gpt-4o-transcribe-diarize` for inputs longer than 30 seconds. ' + anyOf: + - type: string + enum: + - auto + default: auto + description: | + Automatically set chunking parameters based on the audio. Must be set to `"auto"`. + x-stainless-const: true + - $ref: '#/components/schemas/VadConfig' + x-oaiTypeLabel: string + - type: 'null' + TranscriptionDiarizedSegment: type: object - title: ResponseMCPCallFailedEvent - description: | - Emitted when an MCP tool call has failed. + description: A segment of diarized transcript text with speaker metadata. properties: type: type: string + description: | + The type of the segment. Always `transcript.text.segment`. enum: - - response.mcp_call.failed - description: The type of the event. Always 'response.mcp_call.failed'. + - transcript.text.segment x-stainless-const: true - item_id: + id: type: string - description: The ID of the MCP tool call item that failed. - output_index: - type: integer - description: The index of the output item that failed. - sequence_number: - type: integer - description: The sequence number of this event. + description: Unique identifier for the segment. + start: + type: number + format: double + description: Start timestamp of the segment in seconds. + end: + type: number + format: double + description: End timestamp of the segment in seconds. + text: + type: string + description: Transcript text for this segment. + speaker: + type: string + description: | + Speaker label for this segment. When known speakers are provided, the label matches `known_speaker_names[]`. Otherwise speakers are labeled sequentially using capital letters (`A`, `B`, ...). required: - type - - item_id - - output_index - - sequence_number - x-oaiMeta: - name: response.mcp_call.failed - group: responses - example: | - { - "type": "response.mcp_call.failed", - "sequence_number": 1, - "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90", - "output_index": 0 - } - ResponseMCPCallInProgressEvent: + - id + - start + - end + - text + - speaker + TranscriptionInclude: + type: string + enum: + - logprobs + TranscriptionLanguage: type: object - title: ResponseMCPCallInProgressEvent - description: | - Emitted when an MCP tool call is in progress. + description: A language detected in transcribed audio. properties: - type: + code: type: string - enum: - - response.mcp_call.in_progress - description: The type of the event. Always 'response.mcp_call.in_progress'. - x-stainless-const: true - sequence_number: + description: The code of a language detected in the audio. + required: + - code + TranscriptionSegment: + type: object + properties: + id: type: integer - description: The sequence number of this event. - output_index: + description: Unique identifier of the segment. + seek: type: integer - description: The index of the output item in the response's output array. - item_id: + description: Seek offset of the segment. + start: + type: number + format: double + description: Start time of the segment in seconds. + end: + type: number + format: double + description: End time of the segment in seconds. + text: type: string - description: The unique identifier of the MCP tool call item being processed. + description: Text content of the segment. + tokens: + type: array + items: + type: integer + description: Array of token IDs for the text content. + temperature: + type: number + format: float + description: Temperature parameter used for generating the segment. + avg_logprob: + type: number + format: float + description: Average logprob of the segment. If the value is lower than -1, consider the logprobs failed. + compression_ratio: + type: number + format: float + description: Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed. + no_speech_prob: + type: number + format: float + description: Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent. + required: + - id + - seek + - start + - end + - text + - tokens + - temperature + - avg_logprob + - compression_ratio + - no_speech_prob + TranscriptionWord: + type: object + properties: + word: + type: string + description: The text content of the word. + start: + type: number + format: double + description: Start time of the word in seconds. + end: + type: number + format: double + description: End time of the word in seconds. + required: + - word + - start + - end + TruncationObject: + type: object + title: Thread Truncation Controls + description: Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. + properties: + type: + type: string + description: The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`. + enum: + - auto + - last_messages + last_messages: + anyOf: + - type: integer + description: The number of most recent messages from the thread when constructing the context for the run. + minimum: 1 + - type: 'null' required: - type - - output_index - - item_id - - sequence_number + UpdateGroupBody: + type: object + description: Request payload for updating the details of an existing group. + properties: + name: + type: string + description: New display name for the group. + minLength: 1 + maxLength: 255 + required: + - name x-oaiMeta: - name: response.mcp_call.in_progress - group: responses example: | { - "type": "response.mcp_call.in_progress", - "sequence_number": 1, - "output_index": 0, - "item_id": "mcp_682d437d90a88191bf88cd03aae0c3e503937d5f622d7a90" + "name": "Escalations" } - ResponseMCPListToolsCompletedEvent: + UpdateOrganizationDataRetentionBody: type: object - title: ResponseMCPListToolsCompletedEvent - description: | - Emitted when the list of available MCP tools has been successfully retrieved. + description: Parameters for updating organization data retention controls. properties: - type: + retention_type: type: string enum: - - response.mcp_list_tools.completed - description: The type of the event. Always 'response.mcp_list_tools.completed'. - x-stainless-const: true - item_id: + - zero_data_retention + - modified_abuse_monitoring + - enhanced_zero_data_retention + - enhanced_modified_abuse_monitoring + description: The desired organization data retention type. + required: + - retention_type + UpdateProjectDataRetentionBody: + type: object + description: Parameters for updating project data retention controls. + properties: + retention_type: type: string - description: The ID of the MCP tool call item that produced this output. - output_index: - type: integer - description: The index of the output item that was processed. - sequence_number: - type: integer - description: The sequence number of this event. + enum: + - organization_default + - none + - zero_data_retention + - modified_abuse_monitoring + - enhanced_zero_data_retention + - enhanced_modified_abuse_monitoring + description: The desired project data retention type. required: - - type - - item_id - - output_index - - sequence_number + - retention_type + UpdateProjectServiceAccountBody: + type: object + description: Parameters for updating a project service account. + properties: + name: + type: string + description: The updated service account name. + role: + type: string + enum: + - member + - owner + description: The updated service account role. + UpdateVectorStoreFileAttributesRequest: + type: object + additionalProperties: false + properties: + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + required: + - attributes x-oaiMeta: - name: response.mcp_list_tools.completed - group: responses - example: | - { - "type": "response.mcp_list_tools.completed", - "sequence_number": 1, - "output_index": 0, - "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" - } - ResponseMCPListToolsFailedEvent: + name: Update vector store file attributes request + UpdateVectorStoreRequest: + type: object + additionalProperties: false + properties: + name: + description: The name of the vector store. + type: string + nullable: true + expires_after: + allOf: + - $ref: '#/components/schemas/VectorStoreExpirationAfter' + - nullable: true + metadata: + $ref: '#/components/schemas/Metadata' + UpdateVoiceConsentRequest: type: object - title: ResponseMCPListToolsFailedEvent - description: | - Emitted when the attempt to list available MCP tools has failed. + additionalProperties: false properties: - type: - type: string - enum: - - response.mcp_list_tools.failed - description: The type of the event. Always 'response.mcp_list_tools.failed'. - x-stainless-const: true - item_id: + name: type: string - description: The ID of the MCP tool call item that failed. - output_index: - type: integer - description: The index of the output item that failed. - sequence_number: - type: integer - description: The sequence number of this event. + description: The updated label for this consent recording. required: - - type - - item_id - - output_index - - sequence_number - x-oaiMeta: - name: response.mcp_list_tools.failed - group: responses - example: | - { - "type": "response.mcp_list_tools.failed", - "sequence_number": 1, - "output_index": 0, - "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" - } - ResponseMCPListToolsInProgressEvent: + - name + Upload: type: object - title: ResponseMCPListToolsInProgressEvent + title: Upload description: | - Emitted when the system is in the process of retrieving the list of available MCP tools. + The Upload object can accept byte chunks in the form of Parts. properties: - type: - type: string - enum: - - response.mcp_list_tools.in_progress - description: The type of the event. Always 'response.mcp_list_tools.in_progress'. - x-stainless-const: true - item_id: + id: type: string - description: The ID of the MCP tool call item that is being processed. - output_index: + description: The Upload unique identifier, which can be referenced in API endpoints. + created_at: type: integer - description: The index of the output item that is being processed. - sequence_number: + format: unixtime + description: The Unix timestamp (in seconds) for when the Upload was created. + filename: + type: string + description: The name of the file to be uploaded. + bytes: type: integer - description: The sequence number of this event. - required: - - type - - item_id - - output_index - - sequence_number - x-oaiMeta: - name: response.mcp_list_tools.in_progress - group: responses - example: | - { - "type": "response.mcp_list_tools.in_progress", - "sequence_number": 1, - "output_index": 0, - "item_id": "mcpl_682d4379df088191886b70f4ec39f90403937d5f622d7a90" - } - ResponseModalities: - anyOf: - - type: array - description: | - Output types that you would like the model to generate. - Most models are capable of generating text, which is the default: - - `["text"]` - - The `gpt-4o-audio-preview` model can also be used to - [generate audio](https://developers.openai.com/api/docs/guides/audio). To request that this model generate - both text and audio responses, you can use: - - `["text", "audio"]` - items: + description: The intended number of bytes to be uploaded. + purpose: type: string + description: The intended purpose of the file. [Please refer here](https://developers.openai.com/api/reference/resources/files#%28resource%29%20files%20%3E%20%28model%29%20file_object%20%3E%20%28schema%29%20%3E%20%28property%29%20purpose) for acceptable values. + status: + type: string + description: The status of the Upload. enum: - - text - - audio - - type: 'null' - ResponseOutputItemAddedEvent: - type: object - description: Emitted when a new output item is added. - properties: - type: + - pending + - completed + - cancelled + - expired + expires_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the Upload will expire. + object: type: string - description: | - The type of the event. Always `response.output_item.added`. + description: The object type, which is always "upload". enum: - - response.output_item.added + - upload x-stainless-const: true - output_index: - type: integer - description: | - The index of the output item that was added. - sequence_number: - type: integer - description: | - The sequence number of this event. - item: - $ref: '#/components/schemas/OutputItem' - description: | - The output item that was added. For reasoning items, `encrypted_content` - may be incomplete while the item is in progress. Use the reasoning item - from the corresponding `response.output_item.done` event when passing it - as input to a subsequent request. + file: + allOf: + - $ref: '#/components/schemas/OpenAIFile' + - nullable: true + description: The ready File object after the Upload is completed. required: - - type - - output_index - - item - - sequence_number + - bytes + - created_at + - expires_at + - filename + - id + - purpose + - status + - object x-oaiMeta: - name: response.output_item.added - group: responses + name: The upload object example: | { - "type": "response.output_item.added", - "output_index": 0, - "item": { - "id": "msg_123", - "status": "in_progress", - "type": "message", - "role": "assistant", - "content": [] - }, - "sequence_number": 1 + "id": "upload_abc123", + "object": "upload", + "bytes": 2147483648, + "created_at": 1719184911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + "status": "completed", + "expires_at": 1719127296, + "file": { + "id": "file-xyz321", + "object": "file", + "bytes": 2147483648, + "created_at": 1719186911, + "filename": "training_examples.jsonl", + "purpose": "fine-tune", + } } - ResponseOutputItemDoneEvent: + UploadCertificateRequest: type: object - description: Emitted when an output item is marked done. properties: - type: + name: type: string - description: | - The type of the event. Always `response.output_item.done`. + description: An optional name for the certificate + certificate: + type: string + description: The certificate content in PEM format + required: + - certificate + UploadPart: + type: object + title: UploadPart + description: | + The upload Part represents a chunk of bytes we can add to an Upload object. + properties: + id: + type: string + description: The upload Part unique identifier, which can be referenced in API endpoints. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the Part was created. + upload_id: + type: string + description: The ID of the Upload object that this Part was added to. + object: + type: string + description: The object type, which is always `upload.part`. enum: - - response.output_item.done + - upload.part x-stainless-const: true - output_index: - type: integer - description: | - The index of the output item that was marked done. - sequence_number: - type: integer - description: | - The sequence number of this event. - item: - $ref: '#/components/schemas/OutputItem' - description: | - The output item that was marked done. required: - - type - - output_index - - item - - sequence_number + - created_at + - id + - object + - upload_id x-oaiMeta: - name: response.output_item.done - group: responses + name: The upload part object example: | { - "type": "response.output_item.done", - "output_index": 0, - "item": { - "id": "msg_123", - "status": "completed", - "type": "message", - "role": "assistant", - "content": [ - { - "type": "output_text", - "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", - "annotations": [] - } - ] - }, - "sequence_number": 1 + "id": "part_def456", + "object": "upload.part", + "created_at": 1719186911, + "upload_id": "upload_abc123" } - ResponseOutputTextAnnotationAddedEvent: + UsageAudioSpeechesResult: type: object - title: ResponseOutputTextAnnotationAddedEvent - description: | - Emitted when an annotation is added to output text content. + description: The aggregated audio speeches usage details of the specific time bucket. properties: - type: + object: type: string enum: - - response.output_text.annotation.added - description: The type of the event. Always 'response.output_text.annotation.added'. + - organization.usage.audio_speeches.result x-stainless-const: true - item_id: - type: string - description: The unique identifier of the item to which the annotation is being added. - output_index: - type: integer - description: The index of the output item in the response's output array. - content_index: - type: integer - description: The index of the content part within the output item. - annotation_index: + characters: type: integer - description: The index of the annotation within the content part. - sequence_number: + description: The number of characters processed. + num_model_requests: type: integer - description: The sequence number of this event. - annotation: + description: The count of requests made to the model. + project_id: anyOf: - - $ref: '#/components/schemas/Annotation' + - type: string + description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - type: 'null' - description: The annotation object being added. (See annotation schema for details.) - required: - - type - - item_id - - output_index - - content_index - - annotation_index - - annotation - - sequence_number - x-oaiMeta: - name: response.output_text.annotation.added - group: responses - example: | - { - "type": "response.output_text.annotation.added", - "item_id": "item-abc", - "output_index": 0, - "content_index": 0, - "annotation_index": 0, - "annotation": { - "type": "file_citation", - "file_id": "file-abc", - "index": 0, - "filename": "example.txt" - }, - "sequence_number": 1 - } - ResponsePromptVariables: - anyOf: - - type: object - title: Prompt Variables - description: | - Optional map of values to substitute in for variables in your - prompt. The substitution values can either be strings, or other - Response input types like images or files. - x-oaiExpandable: true - x-oaiTypeLabel: map - additionalProperties: - x-oaiExpandable: true - x-oaiTypeLabel: map + user_id: anyOf: - type: string - - $ref: '#/components/schemas/InputTextContent' - - $ref: '#/components/schemas/InputImageContent' - - $ref: '#/components/schemas/InputFileContent' - - type: 'null' - ResponseProperties: - type: object - properties: - previous_response_id: + description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - type: 'null' + api_key_id: anyOf: - type: string - description: | - The unique ID of the previous response to the model. Use this to - create multi-turn conversations. Learn more about - [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`. + description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - type: 'null' model: - description: | - Model ID used to generate the response, like `gpt-6-astra`. OpenAI - offers a wide range of models with different capabilities, performance - characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) - to browse and compare available models. - $ref: '#/components/schemas/ModelIdsResponses' - background: - anyOf: - - type: boolean - description: | - Whether to run the model response in the background. - [Learn more](https://developers.openai.com/api/docs/guides/background). - default: false - - type: 'null' - max_tool_calls: anyOf: - - description: | - The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored. - type: integer + - type: string + description: When `group_by=model`, this field provides the model name of the grouped usage result. - type: 'null' - text: - $ref: '#/components/schemas/ResponseTextParam' - tools: - $ref: '#/components/schemas/ToolsArray' - tool_choice: - $ref: '#/components/schemas/ToolChoiceParam' - prompt: - $ref: '#/components/schemas/Prompt' - ResponseQueuedEvent: - type: object - title: ResponseQueuedEvent - description: | - Emitted when a response is queued and waiting to be processed. - properties: - type: - type: string - enum: - - response.queued - description: The type of the event. Always 'response.queued'. - x-stainless-const: true - response: - $ref: '#/components/schemas/Response' - description: The full response object that is queued. - sequence_number: - type: integer - description: The sequence number for this event. required: - - type - - response - - sequence_number + - object + - characters + - num_model_requests x-oaiMeta: - name: response.queued - group: responses + name: Audio speeches usage object example: | { - "type": "response.queued", - "response": { - "id": "res_123", - "status": "queued", - "created_at": "2021-01-01T00:00:00Z", - "updated_at": "2021-01-01T00:00:00Z" - }, - "sequence_number": 1 + "object": "organization.usage.audio_speeches.result", + "characters": 45, + "num_model_requests": 1, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "tts-1" } - ResponseReasoningSummaryPartAddedEvent: + UsageAudioTranscriptionsResult: type: object - description: Emitted when a new reasoning summary part is added. + description: The aggregated audio transcriptions usage details of the specific time bucket. properties: - type: + object: type: string - description: | - The type of the event. Always `response.reasoning_summary_part.added`. enum: - - response.reasoning_summary_part.added + - organization.usage.audio_transcriptions.result x-stainless-const: true - item_id: - type: string - description: | - The ID of the item this summary part is associated with. - output_index: - type: integer - description: | - The index of the output item this summary part is associated with. - summary_index: + seconds: type: integer - description: | - The index of the summary part within the reasoning summary. - sequence_number: + format: int64 + description: The number of seconds processed. + num_model_requests: type: integer - description: | - The sequence number of this event. - part: - type: object - description: | - The summary part that was added. - properties: - type: - type: string - description: The type of the summary part. Always `summary_text`. - enum: - - summary_text - x-stainless-const: true - text: - type: string - description: The text of the summary part. - required: - - type - - text + description: The count of requests made to the model. + project_id: + anyOf: + - type: string + description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: When `group_by=model`, this field provides the model name of the grouped usage result. + - type: 'null' required: - - type - - item_id - - output_index - - summary_index - - part - - sequence_number + - object + - seconds + - num_model_requests x-oaiMeta: - name: response.reasoning_summary_part.added - group: responses + name: Audio transcriptions usage object example: | { - "type": "response.reasoning_summary_part.added", - "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", - "output_index": 0, - "summary_index": 0, - "part": { - "type": "summary_text", - "text": "" - }, - "sequence_number": 1 + "object": "organization.usage.audio_transcriptions.result", + "seconds": 10, + "num_model_requests": 1, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "tts-1" } - ResponseReasoningSummaryPartDoneEvent: + UsageCodeInterpreterSessionsResult: type: object - description: Emitted when a reasoning summary part is completed. + description: The aggregated code interpreter sessions usage details of the specific time bucket. properties: - type: + object: type: string - description: | - The type of the event. Always `response.reasoning_summary_part.done`. enum: - - response.reasoning_summary_part.done + - organization.usage.code_interpreter_sessions.result x-stainless-const: true - item_id: - type: string - description: | - The ID of the item this summary part is associated with. - output_index: - type: integer - description: | - The index of the output item this summary part is associated with. - summary_index: - type: integer - description: | - The index of the summary part within the reasoning summary. - status: - type: string - description: | - The completion status of the summary part. Omitted when the part completed - normally and set to `incomplete` when generation was interrupted. - enum: - - incomplete - sequence_number: + num_sessions: type: integer - description: | - The sequence number of this event. - part: - type: object - description: | - The completed summary part. - properties: - type: - type: string - description: The type of the summary part. Always `summary_text`. - enum: - - summary_text - x-stainless-const: true - text: - type: string - description: The text of the summary part. - required: - - type - - text + description: The number of code interpreter sessions. + project_id: + anyOf: + - type: string + description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - type: 'null' required: - - type - - item_id - - output_index - - summary_index - - part - - sequence_number + - object + - num_sessions x-oaiMeta: - name: response.reasoning_summary_part.done - group: responses + name: Code interpreter sessions usage object example: | { - "type": "response.reasoning_summary_part.done", - "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", - "output_index": 0, - "summary_index": 0, - "part": { - "type": "summary_text", - "text": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!" - }, - "sequence_number": 1 + "object": "organization.usage.code_interpreter_sessions.result", + "num_sessions": 1, + "project_id": "proj_abc" } - ResponseReasoningSummaryTextDeltaEvent: + UsageCompletionsResult: type: object - description: Emitted when a delta is added to a reasoning summary text. + description: The aggregated completions usage details of the specific time bucket. properties: - type: + object: type: string - description: | - The type of the event. Always `response.reasoning_summary_text.delta`. enum: - - response.reasoning_summary_text.delta + - organization.usage.completions.result x-stainless-const: true - item_id: - type: string - description: | - The ID of the item this summary text delta is associated with. - output_index: + input_tokens: type: integer - description: | - The index of the output item this summary text delta is associated with. - summary_index: + description: The aggregated number of input tokens used, including cached and cache-write tokens. This includes text, audio, and image tokens. For customers subscribed to Scale Tier, this includes Scale Tier tokens. + input_cached_tokens: type: integer - description: | - The index of the summary part within the reasoning summary. - delta: - type: string - description: | - The text delta that was added to the summary. - sequence_number: + description: The aggregated number of cached input tokens used across text, audio, and image inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens. + input_cache_write_tokens: type: integer - description: | - The sequence number of this event. + description: The aggregated number of input tokens written to the cache. + input_uncached_tokens: + type: integer + description: The aggregated number of uncached input tokens used across text, audio, and image inputs, excluding cache-write tokens. + output_tokens: + type: integer + description: The aggregated number of output tokens used across text, audio, and image outputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens. + input_text_tokens: + type: integer + description: The aggregated number of uncached text input tokens used, excluding cache-write tokens. + output_text_tokens: + type: integer + description: The aggregated number of text output tokens used. + input_cached_text_tokens: + type: integer + description: The aggregated number of cached text input tokens used. + input_audio_tokens: + type: integer + description: The aggregated number of uncached audio input tokens used. + input_cached_audio_tokens: + type: integer + description: The aggregated number of cached audio input tokens used. + output_audio_tokens: + type: integer + description: The aggregated number of audio output tokens used. + input_image_tokens: + type: integer + description: The aggregated number of uncached image input tokens used. + input_cached_image_tokens: + type: integer + description: The aggregated number of cached image input tokens used. + output_image_tokens: + type: integer + description: The aggregated number of image output tokens used. + num_model_requests: + type: integer + description: The count of requests made to the model. + project_id: + anyOf: + - type: string + description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: When `group_by=model`, this field provides the model name of the grouped usage result. + - type: 'null' + batch: + anyOf: + - type: boolean + description: When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + - type: 'null' + service_tier: + anyOf: + - type: string + description: When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + - type: 'null' required: - - type - - item_id - - output_index - - summary_index - - delta - - sequence_number + - object + - input_tokens + - output_tokens + - num_model_requests x-oaiMeta: - name: response.reasoning_summary_text.delta - group: responses + name: Completions usage object example: | { - "type": "response.reasoning_summary_text.delta", - "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", - "output_index": 0, - "summary_index": 0, - "delta": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!", - "sequence_number": 1 + "object": "organization.usage.completions.result", + "input_tokens": 5000, + "input_cached_tokens": 1800, + "input_cache_write_tokens": 200, + "input_uncached_tokens": 3000, + "output_tokens": 1000, + "input_text_tokens": 2500, + "output_text_tokens": 800, + "input_cached_text_tokens": 1500, + "input_audio_tokens": 300, + "input_cached_audio_tokens": 100, + "output_audio_tokens": 100, + "input_image_tokens": 200, + "input_cached_image_tokens": 200, + "output_image_tokens": 100, + "num_model_requests": 5, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "gpt-6-astra", + "batch": false, + "service_tier": "default" } - ResponseReasoningSummaryTextDoneEvent: + UsageEmbeddingsResult: type: object - description: Emitted when a reasoning summary text is completed. + description: The aggregated embeddings usage details of the specific time bucket. properties: - type: + object: type: string - description: | - The type of the event. Always `response.reasoning_summary_text.done`. enum: - - response.reasoning_summary_text.done + - organization.usage.embeddings.result x-stainless-const: true - item_id: - type: string - description: | - The ID of the item this summary text is associated with. - output_index: - type: integer - description: | - The index of the output item this summary text is associated with. - summary_index: + input_tokens: type: integer - description: | - The index of the summary part within the reasoning summary. - text: - type: string - description: | - The full text of the completed reasoning summary. - sequence_number: + description: The aggregated number of input tokens used. + num_model_requests: type: integer - description: | - The sequence number of this event. + description: The count of requests made to the model. + project_id: + anyOf: + - type: string + description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: When `group_by=model`, this field provides the model name of the grouped usage result. + - type: 'null' required: - - type - - item_id - - output_index - - summary_index - - text - - sequence_number + - object + - input_tokens + - num_model_requests x-oaiMeta: - name: response.reasoning_summary_text.done - group: responses + name: Embeddings usage object example: | { - "type": "response.reasoning_summary_text.done", - "item_id": "rs_6806bfca0b2481918a5748308061a2600d3ce51bdffd5476", - "output_index": 0, - "summary_index": 0, - "text": "**Responding to a greeting**\n\nThe user just said, \"Hello!\" So, it seems I need to engage. I'll greet them back and offer help since they're looking to chat. I could say something like, \"Hello! How can I assist you today?\" That feels friendly and open. They didn't ask a specific question, so this approach will work well for starting a conversation. Let's see where it goes from there!", - "sequence_number": 1 + "object": "organization.usage.embeddings.result", + "input_tokens": 20, + "num_model_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "text-embedding-ada-002-v2" } - ResponseReasoningTextDeltaEvent: + UsageFileSearchCallsResult: type: object - description: Emitted when a delta is added to a reasoning text. + description: The aggregated file search calls usage details of the specific time bucket. properties: - type: + object: type: string - description: | - The type of the event. Always `response.reasoning_text.delta`. enum: - - response.reasoning_text.delta + - organization.usage.file_searches.result x-stainless-const: true - item_id: - type: string - description: | - The ID of the item this reasoning text delta is associated with. - output_index: - type: integer - description: | - The index of the output item this reasoning text delta is associated with. - content_index: - type: integer - description: | - The index of the reasoning content part this delta is associated with. - delta: - type: string - description: | - The text delta that was added to the reasoning content. - sequence_number: + num_requests: type: integer - description: | - The sequence number of this event. + description: The count of file search calls. + project_id: + anyOf: + - type: string + description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + - type: 'null' + vector_store_id: + anyOf: + - type: string + description: When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + - type: 'null' required: - - type - - item_id - - output_index - - content_index - - delta - - sequence_number + - object + - num_requests x-oaiMeta: - name: response.reasoning_text.delta - group: responses + name: File search calls usage object example: | { - "type": "response.reasoning_text.delta", - "item_id": "rs_123", - "output_index": 0, - "content_index": 0, - "delta": "The", - "sequence_number": 1 + "object": "organization.usage.file_searches.result", + "num_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "vector_store_id": "vs_abc" } - ResponseReasoningTextDoneEvent: + UsageImagesResult: type: object - description: Emitted when a reasoning text is completed. + description: The aggregated images usage details of the specific time bucket. properties: - type: + object: type: string - description: | - The type of the event. Always `response.reasoning_text.done`. enum: - - response.reasoning_text.done + - organization.usage.images.result x-stainless-const: true - item_id: - type: string - description: | - The ID of the item this reasoning text is associated with. - output_index: - type: integer - description: | - The index of the output item this reasoning text is associated with. - content_index: + images: type: integer - description: | - The index of the reasoning content part. - text: - type: string - description: | - The full text of the completed reasoning content. - sequence_number: + description: The number of images processed. + num_model_requests: type: integer - description: | - The sequence number of this event. + description: The count of requests made to the model. + source: + anyOf: + - type: string + description: When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + - type: 'null' + size: + anyOf: + - type: string + description: When `group_by=size`, this field provides the image size of the grouped usage result. + - type: 'null' + project_id: + anyOf: + - type: string + description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: When `group_by=model`, this field provides the model name of the grouped usage result. + - type: 'null' required: - - type - - item_id - - output_index - - content_index - - text - - sequence_number + - object + - images + - num_model_requests x-oaiMeta: - name: response.reasoning_text.done - group: responses + name: Images usage object example: | { - "type": "response.reasoning_text.done", - "item_id": "rs_123", - "output_index": 0, - "content_index": 0, - "text": "The user is asking...", - "sequence_number": 4 + "object": "organization.usage.images.result", + "images": 2, + "num_model_requests": 2, + "size": "1024x1024", + "source": "image.generation", + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "dall-e-3" } - ResponseRefusalDeltaEvent: + UsageModerationsResult: type: object - description: Emitted when there is a partial refusal text. + description: The aggregated moderations usage details of the specific time bucket. properties: - type: + object: type: string - description: | - The type of the event. Always `response.refusal.delta`. enum: - - response.refusal.delta + - organization.usage.moderations.result x-stainless-const: true - item_id: - type: string - description: | - The ID of the output item that the refusal text is added to. - output_index: - type: integer - description: | - The index of the output item that the refusal text is added to. - content_index: + input_tokens: type: integer - description: | - The index of the content part that the refusal text is added to. - delta: - type: string - description: | - The refusal text that is added. - sequence_number: + description: The aggregated number of input tokens used. + num_model_requests: type: integer - description: | - The sequence number of this event. + description: The count of requests made to the model. + project_id: + anyOf: + - type: string + description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: When `group_by=model`, this field provides the model name of the grouped usage result. + - type: 'null' required: - - type - - item_id - - output_index - - content_index - - delta - - sequence_number + - object + - input_tokens + - num_model_requests x-oaiMeta: - name: response.refusal.delta - group: responses + name: Moderations usage object example: | { - "type": "response.refusal.delta", - "item_id": "msg_123", - "output_index": 0, - "content_index": 0, - "delta": "refusal text so far", - "sequence_number": 1 + "object": "organization.usage.moderations.result", + "input_tokens": 20, + "num_model_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "text-moderation" } - ResponseRefusalDoneEvent: + UsageResponse: type: object - description: Emitted when refusal text is finalized. properties: - type: + object: type: string - description: | - The type of the event. Always `response.refusal.done`. enum: - - response.refusal.done + - page x-stainless-const: true - item_id: + data: + type: array + items: + $ref: '#/components/schemas/UsageTimeBucket' + has_more: + type: boolean + next_page: + anyOf: + - type: string + - type: 'null' + required: + - object + - data + - has_more + - next_page + UsageTimeBucket: + type: object + properties: + object: type: string - description: | - The ID of the output item that the refusal text is finalized. - output_index: - type: integer - description: | - The index of the output item that the refusal text is finalized. - content_index: + enum: + - bucket + x-stainless-const: true + start_time: type: integer - description: | - The index of the content part that the refusal text is finalized. - refusal: - type: string - description: | - The refusal text that is finalized. - sequence_number: + end_time: type: integer - description: | - The sequence number of this event. + results: + type: array + items: + discriminator: + propertyName: object + anyOf: + - $ref: '#/components/schemas/UsageCompletionsResult' + - $ref: '#/components/schemas/UsageEmbeddingsResult' + - $ref: '#/components/schemas/UsageModerationsResult' + - $ref: '#/components/schemas/UsageImagesResult' + - $ref: '#/components/schemas/UsageAudioSpeechesResult' + - $ref: '#/components/schemas/UsageAudioTranscriptionsResult' + - $ref: '#/components/schemas/UsageVectorStoresResult' + - $ref: '#/components/schemas/UsageCodeInterpreterSessionsResult' + - $ref: '#/components/schemas/UsageFileSearchCallsResult' + - $ref: '#/components/schemas/UsageWebSearchCallsResult' + - $ref: '#/components/schemas/CostsResult' required: - - type - - item_id - - output_index - - content_index - - refusal - - sequence_number - x-oaiMeta: - name: response.refusal.done - group: responses - example: | - { - "type": "response.refusal.done", - "item_id": "item-abc", - "output_index": 1, - "content_index": 2, - "refusal": "final refusal text", - "sequence_number": 1 - } - ResponseSteerAcceptedEvent: + - object + - start_time + - end_time + - results + UsageVectorStoresResult: type: object - title: ResponseSteerAcceptedEvent - description: | - Emitted when steering input has been validated and queued. Acceptance means - the server owns the input, not that it has been applied. The successor's - `response.created` event is the commit point. If accepted input cannot be - committed, `response.steer.failed` returns it with the same steering ID. - - When the response stops for client-owned tool output or approval, the input - remains queued and `response.steer.pending` is emitted after - `response.completed`. Fill the pending event's `required_input` stubs with - saved results and send one matching explicit `response.create` per parent. - Do not resend accepted input while it is still queued. + description: The aggregated vector stores usage details of the specific time bucket. properties: - type: + object: type: string enum: - - response.steer.accepted - description: The event discriminator. Always `response.steer.accepted`. + - organization.usage.vector_stores.result x-stainless-const: true - sequence_number: + usage_bytes: type: integer - description: The sequence number for this event. - steer: - type: object - description: The accepted steering submission. - properties: - id: - type: string - description: The ID assigned to the steering submission. - previous_response_id: - type: string - description: The ID of the response being steered. - required: - - id - - previous_response_id - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present when - the target response's `response.create` event supplied a `stream_id`. + description: The vector stores usage in bytes. + project_id: + anyOf: + - type: string + description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - type: 'null' required: - - type - - sequence_number - - steer + - object + - usage_bytes x-oaiMeta: - name: response.steer.accepted - group: responses + name: Vector stores usage object example: | { - "type": "response.steer.accepted", - "sequence_number": 2, - "steer": { - "id": "steer_456", - "previous_response_id": "resp_123" - } + "object": "organization.usage.vector_stores.result", + "usage_bytes": 1024, + "project_id": "proj_abc" } - ResponseSteerErrorCode: - title: ResponseSteerErrorCode - description: | - A machine-readable steering error code. Clients should handle unknown - values because additional codes may be introduced. Known values include: - - `response_not_found`: The target response is not available on this connection. - - `invalid_input`: The event or input failed validation. - - `steering_not_supported`: The model or response execution mode does not support steering. - - `too_many_pending_steers`: Too much steering input is pending for the response. - - `response_already_completed`: The response completed and is no longer accepting steering input. - - `response_not_active`: The response is no longer accepting steering input. - - `successor_creation_failed`: The successor response could not be created. - anyOf: - - type: string - enum: - - response_not_found - - invalid_input - - steering_not_supported - - too_many_pending_steers - - response_already_completed - - response_not_active - - successor_creation_failed - - type: string - ResponseSteerEvent: + UsageWebSearchCallsResult: type: object - title: ResponseSteerEvent - additionalProperties: false - description: | - Queues user input to steer a response on this WebSocket connection. Input - can contain text, images, and files. Steering is supported only for - single-agent responses on models and execution modes that support steering. - Responses bound to a conversation or using automatic compaction do not - support steering. - - A `response.steer.accepted` event acknowledges that the server owns the - queued input, not that it has been applied. The successor's `response.created` - event is the commit point. Input that cannot be committed is returned in - `response.steer.failed`. - - Steering may cause the active response to finish at a safe output boundary - with `response.incomplete` and `incomplete_details.reason` set to `steered`, - followed automatically by a successor `response.created`. Normal completion - can also be followed by an automatic successor. Automatic successors inherit - the previous response's settings and continue from it with the queued input. - - If the response stops for client-owned tool output or approval, accepted - steering input remains queued and `response.steer.pending` is emitted after - `response.completed`. Fill the `required_input` stubs from that event with - saved tool results or approval decisions, and send one explicit - `response.create` per parent with the same `previous_response_id` and - WebSocket lane. Do not rerun tools or resend accepted steering input. The - queued input is prepended in submission order to that request's input, and - the explicit request retains its own settings. - - This event accepts only `type`, `previous_response_id`, and `input`. Do not - send `stream_id`; the target response determines the WebSocket lane. + description: The aggregated web search calls usage details of the specific time bucket. properties: - type: + object: type: string enum: - - response.steer - description: The event discriminator. Always `response.steer`. + - organization.usage.web_searches.result x-stainless-const: true - previous_response_id: - type: string - description: The ID of the response to steer on this WebSocket connection. - input: - $ref: '#/components/schemas/ResponseSteerInput' + num_model_requests: + type: integer + description: The count of model requests. + num_requests: + type: integer + description: The count of web search calls. + project_id: + anyOf: + - type: string + description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. + - type: 'null' + user_id: + anyOf: + - type: string + description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. + - type: 'null' + api_key_id: + anyOf: + - type: string + description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + - type: 'null' + model: + anyOf: + - type: string + description: When `group_by=model`, this field provides the model name of the grouped usage result. + - type: 'null' + context_level: + anyOf: + - type: string + description: When `group_by=context_level`, this field provides the search context size of the grouped usage result. + - type: 'null' required: - - type - - previous_response_id - - input + - object + - num_model_requests + - num_requests x-oaiMeta: - name: response.steer - group: responses + name: Web search calls usage object example: | { - "type": "response.steer", - "previous_response_id": "resp_123", - "input": [ - { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "Prioritize the database rollout." - } - ] - } - ] + "object": "organization.usage.web_searches.result", + "num_model_requests": 2, + "num_requests": 2, + "project_id": "proj_abc", + "user_id": "user-abc", + "api_key_id": "key_abc", + "model": "gpt-6-astra", + "context_level": "medium" } - ResponseSteerFailedEvent: + User: type: object - title: ResponseSteerFailedEvent - description: | - Emitted when steering input is rejected or cannot be committed to a - successor response. Returns the original, uncommitted input so the client - can carry it into `response.create` when appropriate. Invalid input must - be corrected before retrying. - - Failures after acceptance include the same steering ID. Failures before an - ID is allocated omit `steer.id`. A lost connection or missing acknowledgement - leaves the outcome unknown; it is not proof that the input was rejected. + description: Represents an individual `user` within an organization. properties: - type: + object: type: string enum: - - response.steer.failed - description: The event discriminator. Always `response.steer.failed`. + - organization.user + description: The object type, which is always `organization.user` x-stainless-const: true - sequence_number: + id: + type: string + description: The identifier, which can be referenced in API endpoints + name: + anyOf: + - type: string + - type: 'null' + description: The name of the user + email: + anyOf: + - type: string + - type: 'null' + description: The email address of the user + role: + anyOf: + - type: string + - type: 'null' + description: '`owner` or `reader`' + added_at: type: integer - description: The sequence number for this event. - steer: - type: object - description: The steering submission that could not be committed. - properties: - id: - type: string - description: | - The ID assigned to the steering submission, if one was allocated. - previous_response_id: - type: string - description: The ID of the response that was targeted for steering. - input: - $ref: '#/components/schemas/ResponseSteerInput' - required: - - previous_response_id - - input - error: + format: unixtime + description: The Unix timestamp (in seconds) of when the user was added. + is_default: + type: boolean + description: Whether this is the organization's default user. + created: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) of when the user was created. + user: type: object - description: Information about why the input could not be committed. + description: Nested user details. properties: - type: + object: type: string enum: - - invalid_request_error - description: The error type. Always `invalid_request_error`. + - user x-stainless-const: true - code: - $ref: '#/components/schemas/ResponseSteerErrorCode' - message: + id: type: string - description: A human-readable description of the error. + email: + anyOf: + - type: string + - type: 'null' + name: + anyOf: + - type: string + - type: 'null' + picture: + anyOf: + - type: string + - type: 'null' + enabled: + anyOf: + - type: boolean + - type: 'null' + banned: + anyOf: + - type: boolean + - type: 'null' + banned_at: + anyOf: + - type: integer + format: unixtime + - type: 'null' required: - - type - - code - - message - stream_id: - type: string - description: | - The WebSocket lane that emitted this event, when the target response is - available and its `response.create` event supplied a `stream_id`. + - object + - id + is_service_account: + type: boolean + description: Whether the user is a service account. + is_scale_tier_authorized_purchaser: + anyOf: + - type: boolean + - type: 'null' + description: Whether the user is an authorized purchaser for Scale Tier. + is_scim_managed: + type: boolean + description: Whether the user is managed through SCIM. + api_key_last_used_at: + anyOf: + - type: integer + format: unixtime + - type: 'null' + description: The Unix timestamp (in seconds) of the user's last API key usage. + technical_level: + anyOf: + - type: string + - type: 'null' + description: The technical level metadata for the user. + developer_persona: + anyOf: + - type: string + - type: 'null' + description: The developer persona metadata for the user. + projects: + anyOf: + - type: object + properties: + object: + type: string + enum: + - list + x-stainless-const: true + data: + type: array + items: + type: object + properties: + id: + anyOf: + - type: string + - type: 'null' + name: + anyOf: + - type: string + - type: 'null' + role: + anyOf: + - type: string + - type: 'null' + required: + - object + - data + - type: 'null' + description: Projects associated with the user, if included. required: - - type - - sequence_number - - steer - - error - x-oaiMeta: - name: response.steer.failed - group: responses - example: | - { - "type": "response.steer.failed", - "sequence_number": 5, - "steer": { - "id": "steer_456", - "previous_response_id": "resp_123", - "input": [ - { - "type": "message", - "role": "user", - "content": [ - { - "type": "input_text", - "text": "Prioritize the database rollout." - } - ] - } - ] - }, - "error": { - "type": "invalid_request_error", - "code": "successor_creation_failed", - "message": "We couldn't start the next response. Send this steering input again with response.create." - } + - object + - id + - added_at + x-oaiMeta: + name: The user object + example: | + { + "object": "organization.user", + "id": "user_abc", + "name": "First Last", + "email": "user@example.com", + "role": "owner", + "added_at": 1711471533 } - ResponseSteerInput: - title: ResponseSteerInput - description: | - Input to queue for a continuation of the response. Uses the same string or - input-item shape as `response.create.input`, with a non-empty array when - supplying input items. - - Steering accepts only messages with the `user` role. Each message may - contain only `type`, `role`, and `content`, with `content` as a string or an - array of `input_text`, `input_image`, and `input_file` parts. The optional - `type` must be `message`. Other roles, tool outputs, and item types are not - supported for steering. - anyOf: - - type: string - title: Text input - description: A text input, equivalent to a message with the `user` role. - - $ref: '#/components/schemas/ResponseSteerInputItemList' - ResponseSteerInputItem: - title: Response steer input item - anyOf: - - $ref: '#/components/schemas/UserMessageItemParam' - - $ref: '#/components/schemas/FunctionCallOutputItemParam' - discriminator: - propertyName: type - ResponseSteerInputItemList: - type: array - title: Response steer input item list - description: A non-empty list of message inputs to queue for the response. - minItems: 1 - items: - $ref: '#/components/schemas/ResponseSteerInputItem' - ResponseSteerPendingEvent: + UserDeleteResponse: type: object - title: ResponseSteerPendingEvent - description: | - Emitted when accepted steering input remains queued after the target - response completes. The server still owns the input. Do not resend it. - The successor's `response.created` event is the commit point. - - When `reason` is `waiting_for_required_input`, this event follows - `response.completed` while the response waits for the tool results or - approval decisions identified by `required_input`. Copy those stubs, fill - their result fields using the ordinary `response.create` input schemas, - and submit one continuation per parent with the same `previous_response_id` - and WebSocket lane. Use saved results without rerunning tools. The queued - steering input is prepended in submission order to the continuation's - input. That explicit request retains its own settings. - - This notification is emitted at most once per steering submission. Multiple - submissions for the same parent can report the same required inputs; they - do not each require a separate continuation. properties: - type: + object: type: string enum: - - response.steer.pending - description: The event discriminator. Always `response.steer.pending`. + - organization.user.deleted x-stainless-const: true - sequence_number: - type: integer - description: The sequence number for this event. - steer: - type: object - description: The steering submission that remains queued. - properties: - id: - type: string - description: The ID assigned to the steering submission. - previous_response_id: - type: string - description: The ID of the response being steered. - required: - - id - - previous_response_id - reason: - $ref: '#/components/schemas/ResponseSteerPendingReason' - required_input: + id: + type: string + deleted: + type: boolean + required: + - object + - id + - deleted + UserListResource: + type: object + description: Paginated list of user objects returned when inspecting group membership. + properties: + object: + type: string + enum: + - list + description: Always `list`. + x-stainless-const: true + data: type: array - minItems: 1 - description: | - Input stubs identifying outstanding client-owned tool results or - approval decisions. Each stub contains identifying fields only; the - client supplies the result before including it in `response.create`. + description: Users in the current page. items: - $ref: '#/components/schemas/ResponseSteerRequiredInput' - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present when - the target response's `response.create` event supplied a `stream_id`. + $ref: '#/components/schemas/GroupUser' + has_more: + type: boolean + description: Whether more users are available when paginating. + next: + description: Cursor to fetch the next page of results, or `null` when no further users are available. + anyOf: + - type: string + - type: 'null' required: - - type - - sequence_number - - steer - - reason - - required_input + - object + - data + - has_more + - next x-oaiMeta: - name: response.steer.pending - group: responses + name: Group user list example: | { - "type": "response.steer.pending", - "sequence_number": 10, - "steer": { - "id": "steer_456", - "previous_response_id": "resp_123" - }, - "reason": "waiting_for_required_input", - "required_input": [ - { - "type": "function_call_output", - "call_id": "call_789", - "name": "lookup" - } - ] + "object": "list", + "data": [ + { + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com" + } + ], + "has_more": false, + "next": null } - ResponseSteerPendingReason: - title: ResponseSteerPendingReason - description: | - An extensible enum describing why accepted steering input is still queued. - Clients should handle unknown values because additional reasons may be - introduced. Known values include: - - `waiting_for_required_input`: The response is waiting for the tool results or approval decisions identified by `required_input`. - anyOf: - - type: string - enum: - - waiting_for_required_input - - type: string - ResponseSteerRequiredInput: - title: ResponseSteerRequiredInput - description: | - An input stub identifying an outstanding client-owned tool result or - approval decision. Copy the stub and fill the result fields using the - corresponding `response.create` input schema. Use saved results without - rerunning the tool. The server does not supply results, approval decisions, - or safety acknowledgements in these stubs. - discriminator: - propertyName: type - anyOf: - - type: object - title: Required function tool call output - additionalProperties: false - description: | - Supply `output` using the function tool call output input schema. - properties: - type: - type: string - enum: - - function_call_output - x-stainless-const: true - call_id: - type: string - name: - type: string - required: - - type - - call_id - - name - - type: object - title: Required custom tool call output - additionalProperties: false - description: | - Supply `output` using the custom tool call output input schema. The - original custom tool call supplies the tool's name. - properties: - type: - type: string - enum: - - custom_tool_call_output - x-stainless-const: true - call_id: - type: string - required: - - type - - call_id - - type: object - title: Required computer tool call output - additionalProperties: false - description: | - Supply `output` using the computer tool call output input schema, - including any required `acknowledged_safety_checks`. - properties: - type: - type: string - enum: - - computer_call_output - x-stainless-const: true - call_id: - type: string - required: - - type - - call_id - - type: object - title: Required shell tool call output - additionalProperties: false - description: | - Supply `output` using the shell tool call output input schema. Each - output entry includes `stdout`, `stderr`, and `outcome`. - properties: - type: - type: string - enum: - - shell_call_output - x-stainless-const: true - call_id: - type: string - required: - - type - - call_id - - type: object - title: Required apply patch tool call output - additionalProperties: false - description: | - Supply `status` and optional `output` using the apply patch tool call - output input schema. - properties: - type: - type: string - enum: - - apply_patch_call_output - x-stainless-const: true - call_id: - type: string - required: - - type - - call_id - - type: object - title: Required tool search output - additionalProperties: false - description: | - Supply `tools` using the tool search output input schema, retaining - `execution: "client"`. - properties: - type: - type: string - enum: - - tool_search_output - x-stainless-const: true - call_id: - type: string - execution: - type: string - enum: - - client - x-stainless-const: true - required: - - type - - call_id - - execution - - type: object - title: Required MCP approval response - additionalProperties: false - description: | - Supply `approve` using the MCP approval response input schema. An - optional `reason` can be supplied when denying the request. The original - approval request identifies the tool and server. - properties: - type: - type: string - enum: - - mcp_approval_response - x-stainless-const: true - approval_request_id: - type: string - required: - - type - - approval_request_id - ResponseStreamEvent: - description: Event emitted while a response is streamed. - anyOf: - - $ref: '#/components/schemas/ResponseAudioDeltaEvent' - - $ref: '#/components/schemas/ResponseAudioDoneEvent' - - $ref: '#/components/schemas/ResponseAudioTranscriptDeltaEvent' - - $ref: '#/components/schemas/ResponseAudioTranscriptDoneEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallCompletedEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallInProgressEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent' - - $ref: '#/components/schemas/ResponseCompletedEvent' - - $ref: '#/components/schemas/ResponseContentPartAddedEvent' - - $ref: '#/components/schemas/ResponseContentPartDoneEvent' - - $ref: '#/components/schemas/ResponseCreatedEvent' - - $ref: '#/components/schemas/ResponseErrorEvent' - - $ref: '#/components/schemas/ResponseFileSearchCallCompletedEvent' - - $ref: '#/components/schemas/ResponseFileSearchCallInProgressEvent' - - $ref: '#/components/schemas/ResponseFileSearchCallSearchingEvent' - - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent' - - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDoneEvent' - - $ref: '#/components/schemas/ResponseShellCallCommandAddedStreamingEvent' - - $ref: '#/components/schemas/ResponseShellCallCommandDeltaStreamingEvent' - - $ref: '#/components/schemas/ResponseShellCallCommandDoneStreamingEvent' - - $ref: '#/components/schemas/ResponseShellCallOutputContentDeltaStreamingEvent' - x-stainless-skip: - - go - - $ref: '#/components/schemas/ResponseShellCallOutputContentDoneStreamingEvent' - - $ref: '#/components/schemas/ResponseInProgressEvent' - - $ref: '#/components/schemas/ResponseFailedEvent' - - $ref: '#/components/schemas/ResponseIncompleteEvent' - - $ref: '#/components/schemas/ResponseOutputItemAddedEvent' - - $ref: '#/components/schemas/ResponseOutputItemDoneEvent' - - $ref: '#/components/schemas/ResponseReasoningSummaryPartAddedEvent' - - $ref: '#/components/schemas/ResponseReasoningSummaryPartDoneEvent' - - $ref: '#/components/schemas/ResponseReasoningSummaryTextDeltaEvent' - - $ref: '#/components/schemas/ResponseReasoningSummaryTextDoneEvent' - - $ref: '#/components/schemas/ResponseReasoningTextDeltaEvent' - - $ref: '#/components/schemas/ResponseReasoningTextDoneEvent' - - $ref: '#/components/schemas/ResponseRefusalDeltaEvent' - - $ref: '#/components/schemas/ResponseRefusalDoneEvent' - - $ref: '#/components/schemas/ResponseTextDeltaEvent' - - $ref: '#/components/schemas/ResponseTextDoneEvent' - - $ref: '#/components/schemas/ResponseWebSearchCallCompletedEvent' - - $ref: '#/components/schemas/ResponseWebSearchCallInProgressEvent' - - $ref: '#/components/schemas/ResponseWebSearchCallSearchingEvent' - - $ref: '#/components/schemas/ResponseImageGenCallCompletedEvent' - - $ref: '#/components/schemas/ResponseImageGenCallGeneratingEvent' - - $ref: '#/components/schemas/ResponseImageGenCallInProgressEvent' - - $ref: '#/components/schemas/ResponseImageGenCallPartialImageEvent' - - $ref: '#/components/schemas/ResponseMCPCallArgumentsDeltaEvent' - - $ref: '#/components/schemas/ResponseMCPCallArgumentsDoneEvent' - - $ref: '#/components/schemas/ResponseMCPCallCompletedEvent' - - $ref: '#/components/schemas/ResponseMCPCallFailedEvent' - - $ref: '#/components/schemas/ResponseMCPCallInProgressEvent' - - $ref: '#/components/schemas/ResponseMCPListToolsCompletedEvent' - - $ref: '#/components/schemas/ResponseMCPListToolsFailedEvent' - - $ref: '#/components/schemas/ResponseMCPListToolsInProgressEvent' - - $ref: '#/components/schemas/ResponseOutputTextAnnotationAddedEvent' - - $ref: '#/components/schemas/ResponseQueuedEvent' - - $ref: '#/components/schemas/ResponseCustomToolCallInputDeltaEvent' - - $ref: '#/components/schemas/ResponseCustomToolCallInputDoneEvent' - discriminator: - propertyName: type - ResponseStreamOptions: - anyOf: - - description: | - Options for streaming responses. Only set this when you set `stream: true`. - type: object - properties: - include_obfuscation: - type: boolean - description: | - When true, stream obfuscation will be enabled. Stream obfuscation adds - random characters to an `obfuscation` field on streaming delta events to - normalize payload sizes as a mitigation to certain side-channel attacks. - These obfuscation fields are included by default, but add a small amount - of overhead to the data stream. You can set `include_obfuscation` to - false to optimize for bandwidth if you trust the network links between - your application and the OpenAI API. - - type: 'null' - ResponseTextDeltaEvent: + UserListResponse: type: object - description: Emitted when there is an additional text delta. properties: - type: + object: type: string - description: | - The type of the event. Always `response.output_text.delta`. enum: - - response.output_text.delta + - list x-stainless-const: true - item_id: - type: string - description: | - The ID of the output item that the text delta was added to. - output_index: - type: integer - description: | - The index of the output item that the text delta was added to. - content_index: - type: integer - description: | - The index of the content part that the text delta was added to. - delta: - type: string - description: | - The text delta that was added. - sequence_number: - type: integer - description: The sequence number for this event. - logprobs: + data: type: array - description: | - The log probabilities of the tokens in the delta. items: - $ref: '#/components/schemas/ResponseLogProb' + $ref: '#/components/schemas/User' + first_id: + anyOf: + - type: string + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: + type: boolean required: - - type - - item_id - - output_index - - content_index - - delta - - sequence_number - - logprobs + - object + - data + - has_more + UserRoleAssignment: + type: object + description: Role assignment linking a user to a role. + properties: + object: + type: string + enum: + - user.role + description: Always `user.role`. + x-stainless-const: true + user: + $ref: '#/components/schemas/User' + role: + $ref: '#/components/schemas/Role' + required: + - object + - user + - role x-oaiMeta: - name: response.output_text.delta - group: responses + name: The user role object example: | { - "type": "response.output_text.delta", - "item_id": "msg_123", - "output_index": 0, - "content_index": 0, - "delta": "In", - "sequence_number": 1 + "object": "user.role", + "user": { + "object": "organization.user", + "id": "user_abc123", + "name": "Ada Lovelace", + "email": "ada@example.com", + "role": "owner", + "added_at": 1711470000 + }, + "role": { + "object": "role", + "id": "role_01J1F8ROLE01", + "name": "API Group Manager", + "description": "Allows managing organization groups", + "permissions": [ + "api.groups.read", + "api.groups.write" + ], + "resource_type": "api.organization", + "predefined_role": false + } } - ResponseTextDoneEvent: + UserRoleUpdateRequest: + type: object + properties: + role: + anyOf: + - type: string + - type: 'null' + description: '`owner` or `reader`' + role_id: + anyOf: + - type: string + - type: 'null' + description: Role ID to assign to the user. + technical_level: + anyOf: + - type: string + - type: 'null' + description: Technical level metadata. + developer_persona: + anyOf: + - type: string + - type: 'null' + description: Developer persona metadata. + VadConfig: type: object - description: Emitted when text content is finalized. + additionalProperties: false + required: + - type properties: type: type: string - description: | - The type of the event. Always `response.output_text.done`. enum: - - response.output_text.done - x-stainless-const: true - item_id: - type: string - description: | - The ID of the output item that the text content is finalized. - output_index: - type: integer - description: | - The index of the output item that the text content is finalized. - content_index: + - server_vad + description: Must be set to `server_vad` to enable manual chunking using server side VAD. + prefix_padding_ms: type: integer - description: | - The index of the content part that the text content is finalized. - text: - type: string - description: | - The text content that is finalized. - sequence_number: + default: 300 + description: "Amount of audio to include before the VAD detected speech (in \nmilliseconds).\n" + silence_duration_ms: type: integer - description: The sequence number for this event. - logprobs: - type: array - description: | - The log probabilities of the tokens in the delta. - items: - $ref: '#/components/schemas/ResponseLogProb' - required: - - type - - item_id - - output_index - - content_index - - text - - sequence_number - - logprobs - x-oaiMeta: - name: response.output_text.done - group: responses - example: | - { - "type": "response.output_text.done", - "item_id": "msg_123", - "output_index": 0, - "content_index": 0, - "text": "In a shimmering forest under a sky full of stars, a lonely unicorn named Lila discovered a hidden pond that glowed with moonlight. Every night, she would leave sparkling, magical flowers by the water's edge, hoping to share her beauty with others. One enchanting evening, she woke to find a group of friendly animals gathered around, eager to be friends and share in her magic.", - "sequence_number": 1 - } - ResponseTextParam: + default: 200 + description: "Duration of silence to detect speech stop (in milliseconds).\nWith shorter values the model will respond more quickly, \nbut may jump in on short pauses from the user.\n" + threshold: + type: number + default: 0.5 + description: "Sensitivity threshold (0.0 to 1.0) for voice activity detection. A \nhigher threshold will require louder audio to activate the model, and \nthus might perform better in noisy environments.\n" + ValidateGraderRequest: type: object - description: | - Configuration options for a text response from the model. Can be plain - text or structured JSON data. Learn more: - - [Text inputs and outputs](https://developers.openai.com/api/docs/guides/text) - - [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs) + title: ValidateGraderRequest properties: - format: - $ref: '#/components/schemas/TextResponseFormatConfiguration' - verbosity: - $ref: '#/components/schemas/Verbosity' - ResponseUsage: + grader: + type: object + description: The grader used for the fine-tuning job. + anyOf: + - $ref: '#/components/schemas/GraderStringCheck' + - $ref: '#/components/schemas/GraderTextSimilarity' + - $ref: '#/components/schemas/GraderPython' + - $ref: '#/components/schemas/GraderScoreModel' + - $ref: '#/components/schemas/GraderMulti' + required: + - grader + ValidateGraderResponse: type: object - description: | - Represents token usage details including input tokens, output tokens, - a breakdown of output tokens, and the total tokens used. + title: ValidateGraderResponse properties: - input_tokens: - type: integer - description: The number of input tokens. - input_tokens_details: - type: object - description: A detailed breakdown of the input tokens. - properties: - cached_tokens: - type: integer - description: | - The number of tokens that were retrieved from the cache. - [More on prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching). - cache_write_tokens: - type: integer - description: The number of input tokens that were written to the cache. - required: - - cached_tokens - - cache_write_tokens - output_tokens: - type: integer - description: The number of output tokens. - output_tokens_details: + grader: type: object - description: A detailed breakdown of the output tokens. - properties: - reasoning_tokens: - type: integer - description: The number of reasoning tokens. - required: - - reasoning_tokens - total_tokens: + description: The grader used for the fine-tuning job. + anyOf: + - $ref: '#/components/schemas/GraderStringCheck' + - $ref: '#/components/schemas/GraderTextSimilarity' + - $ref: '#/components/schemas/GraderPython' + - $ref: '#/components/schemas/GraderScoreModel' + - $ref: '#/components/schemas/GraderMulti' + VectorStoreExpirationAfter: + type: object + title: Vector store expiration policy + description: The expiration policy for a vector store. + properties: + anchor: + description: 'Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.' + type: string + enum: + - last_active_at + x-stainless-const: true + days: + description: The number of days after the anchor time that the vector store will expire. type: integer - description: The total number of tokens used. + minimum: 1 + maximum: 365 required: - - input_tokens - - input_tokens_details - - output_tokens - - output_tokens_details - - total_tokens - ResponseWebSearchCallCompletedEvent: + - anchor + - days + VectorStoreFileAttributes: + anyOf: + - type: object + description: | + Set of 16 key-value pairs that can be attached to an object. This can be + useful for storing additional information about the object in a structured + format, and querying for objects via API or the dashboard. Keys are strings + with a maximum length of 64 characters. Values are strings with a maximum + length of 512 characters, booleans, or numbers. + maxProperties: 16 + propertyNames: + type: string + maxLength: 64 + additionalProperties: + anyOf: + - type: string + maxLength: 512 + - type: number + - type: boolean + x-oaiTypeLabel: map + - type: 'null' + VectorStoreFileBatchObject: type: object - description: Emitted when a web search call is completed. + title: Vector store file batch + description: A batch of files attached to a vector store. properties: - type: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `vector_store.file_batch`. type: string - description: | - The type of the event. Always `response.web_search_call.completed`. enum: - - response.web_search_call.completed + - vector_store.files_batch x-stainless-const: true - output_index: + created_at: + description: The Unix timestamp (in seconds) for when the vector store files batch was created. type: integer - description: | - The index of the output item that the web search call is associated with. - item_id: + format: unixtime + vector_store_id: + description: The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) that the [File](https://developers.openai.com/api/reference/resources/files) is attached to. type: string - description: | - Unique ID for the output item associated with the web search call. - sequence_number: - type: integer - description: The sequence number of the web search call being processed. + status: + description: The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`. + type: string + enum: + - in_progress + - completed + - cancelled + - failed + file_counts: + type: object + properties: + in_progress: + description: The number of files that are currently being processed. + type: integer + completed: + description: The number of files that have been processed. + type: integer + failed: + description: The number of files that have failed to process. + type: integer + cancelled: + description: The number of files that where cancelled. + type: integer + total: + description: The total number of files. + type: integer + required: + - in_progress + - completed + - cancelled + - failed + - total required: - - type - - output_index - - item_id - - sequence_number + - id + - object + - created_at + - vector_store_id + - status + - file_counts x-oaiMeta: - name: response.web_search_call.completed - group: responses + name: The vector store files batch object + beta: true example: | { - "type": "response.web_search_call.completed", - "output_index": 0, - "item_id": "ws_123", - "sequence_number": 0 + "id": "vsfb_123", + "object": "vector_store.files_batch", + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "failed": 0, + "cancelled": 0, + "total": 100 + } } - ResponseWebSearchCallInProgressEvent: + VectorStoreFileContentResponse: type: object - description: Emitted when a web search call is initiated. + description: Represents the parsed content of a vector store file. properties: - type: + object: type: string - description: | - The type of the event. Always `response.web_search_call.in_progress`. enum: - - response.web_search_call.in_progress + - vector_store.file_content.page + description: The object type, which is always `vector_store.file_content.page` x-stainless-const: true - output_index: - type: integer - description: | - The index of the output item that the web search call is associated with. - item_id: - type: string - description: | - Unique ID for the output item associated with the web search call. - sequence_number: - type: integer - description: The sequence number of the web search call being processed. + data: + type: array + description: Parsed content of the file. + items: + type: object + properties: + type: + type: string + description: The content type (currently only `"text"`) + text: + type: string + description: The text content + has_more: + type: boolean + description: Indicates if there are more content pages to fetch. + next_page: + anyOf: + - type: string + description: The token for the next page, if any. + - type: 'null' required: - - type - - output_index - - item_id - - sequence_number - x-oaiMeta: - name: response.web_search_call.in_progress - group: responses - example: | - { - "type": "response.web_search_call.in_progress", - "output_index": 0, - "item_id": "ws_123", - "sequence_number": 0 - } - ResponseWebSearchCallSearchingEvent: + - object + - data + - has_more + - next_page + VectorStoreFileObject: type: object - description: Emitted when a web search call is executing. + title: Vector store files + description: A list of files attached to a vector store. properties: - type: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `vector_store.file`. type: string - description: | - The type of the event. Always `response.web_search_call.searching`. enum: - - response.web_search_call.searching + - vector_store.file x-stainless-const: true - output_index: + usage_bytes: + description: The total vector store usage in bytes. Note that this may be different from the original file size. type: integer - description: | - The index of the output item that the web search call is associated with. - item_id: - type: string - description: | - Unique ID for the output item associated with the web search call. - sequence_number: + created_at: + description: The Unix timestamp (in seconds) for when the vector store file was created. type: integer - description: The sequence number of the web search call being processed. + format: unixtime + vector_store_id: + description: The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) that the [File](https://developers.openai.com/api/reference/resources/files) is attached to. + type: string + status: + description: The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use. + type: string + enum: + - in_progress + - completed + - cancelled + - failed + last_error: + anyOf: + - type: object + description: The last error associated with this vector store file. Will be `null` if there are no errors. + properties: + code: + type: string + description: One of `server_error`, `unsupported_file`, or `invalid_file`. + enum: + - server_error + - unsupported_file + - invalid_file + message: + type: string + description: A human-readable description of the error. + required: + - code + - message + - type: 'null' + chunking_strategy: + $ref: '#/components/schemas/ChunkingStrategyResponse' + description: The strategy used to chunk the file. + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' required: - - type - - output_index - - item_id - - sequence_number + - id + - object + - usage_bytes + - created_at + - vector_store_id + - status + - last_error x-oaiMeta: - name: response.web_search_call.searching - group: responses + name: The vector store file object + beta: true example: | { - "type": "response.web_search_call.searching", - "output_index": 0, - "item_id": "ws_123", - "sequence_number": 0 + "id": "file-abc123", + "object": "vector_store.file", + "usage_bytes": 1234, + "created_at": 1698107661, + "vector_store_id": "vs_abc123", + "status": "completed", + "last_error": null, + "chunking_strategy": { + "type": "static", + "static": { + "max_chunk_size_tokens": 800, + "chunk_overlap_tokens": 400 + } + } } - ResponseWsError: + VectorStoreObject: type: object - title: ResponseWsError - description: Emitted when an error occurs while processing a Responses WebSocket request. + title: Vector store + description: A vector store is a collection of processed files can be used by the `file_search` tool. properties: - type: + id: + description: The identifier, which can be referenced in API endpoints. + type: string + object: + description: The object type, which is always `vector_store`. type: string - description: The type of the event. Always `error`. enum: - - error + - vector_store x-stainless-const: true - status: + created_at: + description: The Unix timestamp (in seconds) for when the vector store was created. type: integer - description: The HTTP status code associated with a WebSocket protocol error. - sequence_number: + format: unixtime + name: + description: The name of the vector store. + type: string + usage_bytes: + description: The total number of bytes used by the files in the vector store. type: integer - description: The sequence number of an error emitted by the response stream. - error: - $ref: '#/components/schemas/ErrorPayload' - description: Details about the error. - stream_id: + file_counts: + type: object + properties: + in_progress: + description: The number of files that are currently being processed. + type: integer + completed: + description: The number of files that have been successfully processed. + type: integer + failed: + description: The number of files that have failed to process. + type: integer + cancelled: + description: The number of files that were cancelled. + type: integer + total: + description: The total number of files. + type: integer + required: + - in_progress + - completed + - failed + - cancelled + - total + status: + description: The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use. type: string - description: | - The WebSocket lane that emitted this event. This field is present when the - originating `response.create` event supplied a `stream_id`. + enum: + - expired + - in_progress + - completed + expires_after: + $ref: '#/components/schemas/VectorStoreExpirationAfter' + expires_at: + anyOf: + - description: The Unix timestamp (in seconds) for when the vector store will expire. + type: integer + format: unixtime + - type: 'null' + last_active_at: + anyOf: + - description: The Unix timestamp (in seconds) for when the vector store was last active. + type: integer + format: unixtime + - type: 'null' + metadata: + $ref: '#/components/schemas/Metadata' required: - - type - - error - x-oaiMeta: - name: error - group: responses - example: | - { - "type": "error", - "status": 400, - "stream_id": "agent_1", - "error": { - "type": "invalid_request_error", - "code": "websocket_stream_limit_reached", - "message": "This WebSocket connection has reached its stream limit.", - "param": "stream_id" - } - } - ResponsesClientEvent: - discriminator: - propertyName: type - description: | - Client events accepted by the Responses WebSocket server. - anyOf: - - $ref: '#/components/schemas/ResponsesClientEventResponseCreate' - - $ref: '#/components/schemas/ResponseSteerEvent' - ResponsesClientEventResponseCreate: - allOf: - - type: object - properties: - type: - type: string - enum: - - response.create - description: | - The type of the client event. Always `response.create`. - x-stainless-const: true - stream_id: - type: string - minLength: 1 - maxLength: 256 - pattern: ^[A-Za-z0-9_.-]+$ - description: | - The WebSocket lane for this response. Requests with the same - `stream_id` are processed FIFO, and events for the response echo the - same `stream_id`. - - `stream_id` controls routing; `previous_response_id` controls - conversation lineage, so a new lane can fork from a response created - on another lane. - required: - - type - - $ref: '#/components/schemas/CreateResponse' - description: | - Client event for creating a response over a persistent WebSocket connection. - This payload uses the same top-level fields as `POST /v1/responses`, plus - WebSocket-only envelope metadata. - - Notes: - - `stream` is implicit over WebSocket and should not be sent. - - `background` is not supported over WebSocket. - - `stream_id` is WebSocket-only and is not part of `POST /v1/responses`. + - id + - object + - usage_bytes + - created_at + - status + - last_active_at + - name + - file_counts + - metadata x-oaiMeta: + name: The vector store object example: | { - "type": "response.create", - "stream_id": "agent_1", - "model": "gpt-6-astra", - "input": "Say hello." + "id": "vs_123", + "object": "vector_store", + "created_at": 1698107661, + "usage_bytes": 123456, + "last_active_at": 1698107661, + "name": "my_vector_store", + "status": "completed", + "file_counts": { + "in_progress": 0, + "completed": 100, + "cancelled": 0, + "failed": 0, + "total": 100 + }, + "last_used_at": 1698107661 } - ResponsesServerEvent: - discriminator: - propertyName: type - description: | - Server events emitted by the Responses WebSocket server. - anyOf: - - title: ResponseAudioWsDelta - description: Emitted when there is a partial audio response. - allOf: - - $ref: '#/components/schemas/ResponseAudioDeltaEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseAudioWsDone - description: Emitted when the audio response is complete. - allOf: - - $ref: '#/components/schemas/ResponseAudioDoneEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseAudioTranscriptWsDelta - description: Emitted when there is a partial transcript of audio. - allOf: - - $ref: '#/components/schemas/ResponseAudioTranscriptDeltaEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseAudioTranscriptWsDone - description: Emitted when the full audio transcript is completed. - allOf: - - $ref: '#/components/schemas/ResponseAudioTranscriptDoneEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseCodeInterpreterCallCodeWsDelta - description: Emitted when a partial code snippet is streamed by the code interpreter. - allOf: - - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseCodeInterpreterCallCodeWsDone - description: Emitted when the code snippet is finalized by the code interpreter. - allOf: - - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseCodeInterpreterCallWsCompleted - description: Emitted when the code interpreter call is completed. - allOf: - - $ref: '#/components/schemas/ResponseCodeInterpreterCallCompletedEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseCodeInterpreterCallInWsProgress - description: Emitted when a code interpreter call is in progress. - allOf: - - $ref: '#/components/schemas/ResponseCodeInterpreterCallInProgressEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseCodeInterpreterCallWsInterpreting - description: Emitted when the code interpreter is actively interpreting the code snippet. - allOf: - - $ref: '#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseWsCompleted - description: Emitted when the model response is complete. - allOf: - - $ref: '#/components/schemas/ResponseCompletedEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseContentPartWsAdded - description: Emitted when a new content part is added. - allOf: - - $ref: '#/components/schemas/ResponseContentPartAddedEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseContentPartWsDone - description: Emitted when a content part is done. - allOf: - - $ref: '#/components/schemas/ResponseContentPartDoneEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseWsCreated - description: | - An event that is emitted when a response is created. - allOf: - - $ref: '#/components/schemas/ResponseCreatedEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseFileSearchCallWsCompleted - description: Emitted when a file search call is completed (results found). - allOf: - - $ref: '#/components/schemas/ResponseFileSearchCallCompletedEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseFileSearchCallInWsProgress - description: Emitted when a file search call is initiated. - allOf: - - $ref: '#/components/schemas/ResponseFileSearchCallInProgressEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseFileSearchCallWsSearching - description: Emitted when a file search is currently searching. - allOf: - - $ref: '#/components/schemas/ResponseFileSearchCallSearchingEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseFunctionCallArgumentsWsDelta - description: Emitted when there is a partial function-call arguments delta. - allOf: - - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseFunctionCallArgumentsWsDone - description: Emitted when function-call arguments are finalized. - allOf: - - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDoneEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseShellCallCommandWsAdded - description: A streaming event that indicated a shell command was added to a tool call. - allOf: - - $ref: '#/components/schemas/ResponseShellCallCommandAddedStreamingEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseShellCallCommandWsDelta - description: A streaming event that indicated a shell command was incrementally updated. - allOf: - - $ref: '#/components/schemas/ResponseShellCallCommandDeltaStreamingEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseShellCallCommandWsDone - description: A streaming event that indicated a shell command was completed. - allOf: - - $ref: '#/components/schemas/ResponseShellCallCommandDoneStreamingEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseShellCallOutputContentWsDelta - description: A streaming event that indicated shell call output was incrementally added. - allOf: - - $ref: '#/components/schemas/ResponseShellCallOutputContentDeltaStreamingEvent' - x-stainless-skip: - - go - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseShellCallOutputContentWsDone - description: A streaming event that indicated shell call output was completed. - allOf: - - $ref: '#/components/schemas/ResponseShellCallOutputContentDoneStreamingEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseInWsProgress - description: Emitted when the response is in progress. - allOf: - - $ref: '#/components/schemas/ResponseInProgressEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseWsFailed - description: | - An event that is emitted when a response fails. - allOf: - - $ref: '#/components/schemas/ResponseFailedEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseWsIncomplete - description: | - An event that is emitted when a response finishes as incomplete. - - Over WebSocket, steering can finish a response with - `response.incomplete_details.reason` set to `steered`, followed automatically - by a successor `response.created` that commits the queued steering input. - allOf: - - $ref: '#/components/schemas/ResponseIncompleteEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseOutputItemWsAdded - description: Emitted when a new output item is added. - allOf: - - $ref: '#/components/schemas/ResponseOutputItemAddedEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseOutputItemWsDone - description: Emitted when an output item is marked done. - allOf: - - $ref: '#/components/schemas/ResponseOutputItemDoneEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseReasoningSummaryPartWsAdded - description: Emitted when a new reasoning summary part is added. - allOf: - - $ref: '#/components/schemas/ResponseReasoningSummaryPartAddedEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseReasoningSummaryPartWsDone - description: Emitted when a reasoning summary part is completed. - allOf: - - $ref: '#/components/schemas/ResponseReasoningSummaryPartDoneEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseReasoningSummaryTextWsDelta - description: Emitted when a delta is added to a reasoning summary text. - allOf: - - $ref: '#/components/schemas/ResponseReasoningSummaryTextDeltaEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseReasoningSummaryTextWsDone - description: Emitted when a reasoning summary text is completed. - allOf: - - $ref: '#/components/schemas/ResponseReasoningSummaryTextDoneEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseReasoningTextWsDelta - description: Emitted when a delta is added to a reasoning text. - allOf: - - $ref: '#/components/schemas/ResponseReasoningTextDeltaEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseReasoningTextWsDone - description: Emitted when a reasoning text is completed. - allOf: - - $ref: '#/components/schemas/ResponseReasoningTextDoneEvent' - - type: object + VectorStoreSearchRequest: + type: object + additionalProperties: false + properties: + query: + description: A query string for a search + anyOf: + - type: string + - type: array + items: + type: string + description: A list of queries to search for. + minItems: 1 + rewrite_query: + description: Whether to rewrite the natural language query for vector search. + type: boolean + default: false + max_num_results: + description: The maximum number of results to return. This number should be between 1 and 50 inclusive. + type: integer + default: 10 + minimum: 1 + maximum: 50 + filters: + description: A filter to apply based on file attributes. + anyOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $ref: '#/components/schemas/CompoundFilter' + ranking_options: + description: Ranking options for search. + type: object + additionalProperties: false properties: - stream_id: + ranker: + description: Enable re-ranking; set to `none` to disable, which can help reduce latency. type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseRefusalWsDelta - description: Emitted when there is a partial refusal text. - allOf: - - $ref: '#/components/schemas/ResponseRefusalDeltaEvent' - - type: object + enum: + - none + - auto + - default-2024-11-15 + default: auto + score_threshold: + type: number + minimum: 0 + maximum: 1 + default: 0 + required: + - query + x-oaiMeta: + name: Vector store search request + VectorStoreSearchResultContentObject: + type: object + additionalProperties: false + properties: + type: + description: The type of content. + type: string + enum: + - text + text: + description: The text content returned from search. + type: string + required: + - type + - text + x-oaiMeta: + name: Vector store search result content object + VectorStoreSearchResultItem: + type: object + additionalProperties: false + properties: + file_id: + type: string + description: The ID of the vector store file. + filename: + type: string + description: The name of the vector store file. + score: + type: number + description: The similarity score for the result. + minimum: 0 + maximum: 1 + attributes: + $ref: '#/components/schemas/VectorStoreFileAttributes' + content: + type: array + description: Content chunks from the file. + items: + $ref: '#/components/schemas/VectorStoreSearchResultContentObject' + required: + - file_id + - filename + - score + - attributes + - content + x-oaiMeta: + name: Vector store search result item + VectorStoreSearchResultsPage: + type: object + additionalProperties: false + properties: + object: + type: string + enum: + - vector_store.search_results.page + description: The object type, which is always `vector_store.search_results.page` + x-stainless-const: true + search_query: + type: array + items: + type: string + description: The query used for this search. + minItems: 1 + data: + type: array + description: The list of search result items. + items: + $ref: '#/components/schemas/VectorStoreSearchResultItem' + has_more: + type: boolean + description: Indicates if there are more results to fetch. + next_page: + anyOf: + - type: string + description: The token for the next page, if any. + - type: 'null' + required: + - object + - search_query + - data + - has_more + - next_page + x-oaiMeta: + name: Vector store search results page + Verbosity: + anyOf: + - type: string + enum: + - low + - medium + - high + default: medium + description: | + Constrains the verbosity of the model's response. Lower values will result in + more concise responses, while higher values will result in more verbose responses. + Currently supported values are `low`, `medium`, and `high`. The default is + `medium`. + - type: 'null' + VoiceConsentDeletedResource: + type: object + additionalProperties: false + properties: + id: + type: string + description: The consent recording identifier. + example: cons_1234 + object: + type: string + enum: + - audio.voice_consent + x-stainless-const: true + deleted: + type: boolean + required: + - id + - object + - deleted + x-oaiMeta: + name: The voice consent deletion object + example: | + { + "object": "audio.voice_consent", + "id": "cons_1234", + "deleted": true + } + VoiceConsentListResource: + type: object + additionalProperties: false + properties: + object: + type: string + enum: + - list + x-stainless-const: true + data: + type: array + items: + $ref: '#/components/schemas/VoiceConsentResource' + first_id: + anyOf: + - type: string + - type: 'null' + last_id: + anyOf: + - type: string + - type: 'null' + has_more: + type: boolean + required: + - object + - data + - has_more + x-oaiMeta: + name: The voice consent list object + example: | + { + "object": "list", + "data": [ + { + "object": "audio.voice_consent", + "id": "cons_1234", + "name": "John Doe", + "language": "en-US", + "created_at": 1734220800 + } + ], + "first_id": "cons_1234", + "last_id": "cons_1234", + "has_more": false + } + VoiceConsentResource: + type: object + title: Voice consent + description: A consent recording used to authorize creation of a custom voice. + additionalProperties: false + properties: + object: + type: string + description: The object type, which is always `audio.voice_consent`. + enum: + - audio.voice_consent + x-stainless-const: true + id: + type: string + description: The consent recording identifier. + example: cons_1234 + name: + type: string + description: The label provided when the consent recording was uploaded. + language: + type: string + description: The BCP 47 language tag for the consent phrase (for example, `en-US`). + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the consent recording was created. + required: + - object + - id + - name + - language + - created_at + x-oaiMeta: + name: The voice consent object + example: | + { + "object": "audio.voice_consent", + "id": "cons_1234", + "name": "John Doe", + "language": "en-US", + "created_at": 1734220800 + } + VoiceIdsOrCustomVoice: + title: Voice + description: | + A built-in voice name or a custom voice reference. + anyOf: + - $ref: '#/components/schemas/VoiceIdsShared' + - type: object + description: Custom voice reference. + additionalProperties: false + required: + - id + properties: + id: + type: string + description: The custom voice ID, e.g. `voice_1234`. + example: voice_1234 + VoiceIdsShared: + example: ash + anyOf: + - type: string + - type: string + enum: + - alloy + - ash + - ballad + - coral + - echo + - sage + - shimmer + - verse + - marin + - cedar + VoiceResource: + type: object + title: Voice + description: A custom voice that can be used for audio output. + additionalProperties: false + properties: + object: + type: string + description: The object type, which is always `audio.voice`. + enum: + - audio.voice + x-stainless-const: true + id: + type: string + description: The voice identifier, which can be referenced in API endpoints. + name: + type: string + description: The name of the voice. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) for when the voice was created. + required: + - object + - id + - name + - created_at + x-oaiMeta: + name: The voice object + example: | + { + "object": "audio.voice", + "id": "voice_123abc", + "name": "My new voice", + "created_at": 1734220800 + } + WebSearchActionFind: + type: object + title: Find action + description: | + Action type "find_in_page": Searches for a pattern within a loaded page. + properties: + type: + type: string + enum: + - find_in_page + description: | + The action type. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the page searched for the pattern. + pattern: + type: string + description: | + The pattern or text to search for within the page. + required: + - type + - url + - pattern + WebSearchActionOpenPage: + type: object + title: Open page action + description: | + Action type "open_page" - Opens a specific URL from search results. + properties: + type: + type: string + enum: + - open_page + description: | + The action type. + x-stainless-const: true + url: + description: | + The URL opened by the model. + anyOf: + - type: string + format: uri + - type: 'null' + required: + - type + WebSearchActionSearch: + type: object + title: Search action + description: | + Action type "search" - Performs a web search query. + properties: + type: + type: string + enum: + - search + description: | + The action type. + x-stainless-const: true + query: + type: string + deprecated: true + description: | + The search query. + queries: + type: array + title: Search queries + description: | + The search queries. + items: + type: string + description: | + A search query. + sources: + type: array + title: Web search sources + description: | + The sources used in the search. + items: + type: object + title: Web search source + description: | + A source used in the search. + properties: + type: + type: string + enum: + - url + description: | + The type of source. Always `url`. + x-stainless-const: true + url: + type: string + format: uri + description: | + The URL of the source. + required: + - type + - url + required: + - type + WebSearchApproximateLocation: + anyOf: + - type: object + title: Web search approximate location + description: | + The approximate location of the user. + properties: + type: + type: string + enum: + - approximate + description: The type of location approximation. Always `approximate`. + default: approximate + x-stainless-const: true + country: + anyOf: + - type: string + description: The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`. + - type: 'null' + region: + anyOf: + - type: string + description: Free text input for the region of the user, e.g. `California`. + - type: 'null' + city: + anyOf: + - type: string + description: Free text input for the city of the user, e.g. `San Francisco`. + - type: 'null' + timezone: + anyOf: + - type: string + description: The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`. + - type: 'null' + - type: 'null' + WebSearchContextSize: + type: string + description: "High level guidance for the amount of context window space to use for the \nsearch. One of `low`, `medium`, or `high`. `medium` is the default.\n" + enum: + - low + - medium + - high + default: medium + WebSearchLocation: + type: object + title: Web search location + description: Approximate location parameters for the search. + properties: + country: + type: string + description: "The two-letter \n[ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user,\ne.g. `US`.\n" + region: + type: string + description: | + Free text input for the region of the user, e.g. `California`. + city: + type: string + description: | + Free text input for the city of the user, e.g. `San Francisco`. + timezone: + type: string + description: "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) \nof the user, e.g. `America/Los_Angeles`.\n" + WebSearchTool: + type: object + title: Web search + description: | + Search the Internet for sources related to the prompt. Learn more about the + [web search tool](https://developers.openai.com/api/docs/guides/tools-web-search). + properties: + type: + type: string + enum: + - web_search + - web_search_2025_08_26 + description: The type of the web search tool. One of `web_search` or `web_search_2025_08_26`. + default: web_search + external_web_access: + type: boolean + default: true + description: Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content. + filters: + anyOf: + - type: object + description: | + Filters for the search. + properties: + allowed_domains: + anyOf: + - type: array + title: Allowed domains for the search. + description: | + Allowed domains for the search. If not provided, all domains are allowed. + Subdomains of the provided domains are allowed as well. + + Example: `["pubmed.ncbi.nlm.nih.gov"]` + items: + type: string + description: Allowed domain for the search. + default: [] + - type: 'null' + - type: 'null' + user_location: + $ref: '#/components/schemas/WebSearchApproximateLocation' + search_context_size: + type: string + enum: + - low + - medium + - high + default: medium + description: High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default. + required: + - type + WebSearchToolCall: + type: object + title: Web search tool call + description: | + The results of a web search tool call. See the + [web search guide](https://developers.openai.com/api/docs/guides/tools-web-search) for more information. + properties: + id: + type: string + description: | + The unique ID of the web search tool call. + type: + type: string + enum: + - web_search_call + description: | + The type of the web search tool call. Always `web_search_call`. + x-stainless-const: true + status: + description: | + The status of the web search tool call. + $ref: '#/components/schemas/WebSearchCallStatus' + action: + type: object + description: | + An object describing the specific action taken in this web search call. + Includes details on how the model used the web (search, open_page, find_in_page). + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/WebSearchActionSearch' + - $ref: '#/components/schemas/WebSearchActionOpenPage' + - $ref: '#/components/schemas/WebSearchActionFind' + required: + - id + - type + - status + - action + WebhookBatchCancelled: + type: object + title: batch.cancelled + description: | + Sent when a batch API request has been cancelled. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the batch API request was cancelled. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseRefusalWsDone - description: Emitted when refusal text is finalized. - allOf: - - $ref: '#/components/schemas/ResponseRefusalDoneEvent' - - type: object + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `batch.cancelled`. + enum: + - batch.cancelled + x-stainless-const: true + x-oaiMeta: + name: batch.cancelled + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "batch.cancelled", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } + } + WebhookBatchCompleted: + type: object + title: batch.completed + description: | + Sent when a batch API request has been completed. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the batch API request was completed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseTextWsDelta - description: Emitted when there is an additional text delta. - allOf: - - $ref: '#/components/schemas/ResponseTextDeltaEvent' - - type: object + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `batch.completed`. + enum: + - batch.completed + x-stainless-const: true + x-oaiMeta: + name: batch.completed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "batch.completed", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } + } + WebhookBatchExpired: + type: object + title: batch.expired + description: | + Sent when a batch API request has expired. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the batch API request expired. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseTextWsDone - description: Emitted when text content is finalized. - allOf: - - $ref: '#/components/schemas/ResponseTextDoneEvent' - - type: object + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `batch.expired`. + enum: + - batch.expired + x-stainless-const: true + x-oaiMeta: + name: batch.expired + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "batch.expired", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } + } + WebhookBatchFailed: + type: object + title: batch.failed + description: | + Sent when a batch API request has failed. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the batch API request failed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseWebSearchCallWsCompleted - description: Emitted when a web search call is completed. - allOf: - - $ref: '#/components/schemas/ResponseWebSearchCallCompletedEvent' - - type: object + The unique ID of the batch API request. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `batch.failed`. + enum: + - batch.failed + x-stainless-const: true + x-oaiMeta: + name: batch.failed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "batch.failed", + "created_at": 1719168000, + "data": { + "id": "batch_abc123" + } + } + WebhookEvalRunCanceled: + type: object + title: eval.run.canceled + description: | + Sent when an eval run has been canceled. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the eval run was canceled. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseWebSearchCallInWsProgress - description: Emitted when a web search call is initiated. - allOf: - - $ref: '#/components/schemas/ResponseWebSearchCallInProgressEvent' - - type: object + The unique ID of the eval run. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `eval.run.canceled`. + enum: + - eval.run.canceled + x-stainless-const: true + x-oaiMeta: + name: eval.run.canceled + group: webhook-events + example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"eval.run.canceled\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"evalrun_abc123\"\n }\n} \n" + WebhookEvalRunFailed: + type: object + title: eval.run.failed + description: | + Sent when an eval run has failed. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the eval run failed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseWebSearchCallWsSearching - description: Emitted when a web search call is executing. - allOf: - - $ref: '#/components/schemas/ResponseWebSearchCallSearchingEvent' - - type: object + The unique ID of the eval run. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `eval.run.failed`. + enum: + - eval.run.failed + x-stainless-const: true + x-oaiMeta: + name: eval.run.failed + group: webhook-events + example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"eval.run.failed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"evalrun_abc123\"\n }\n} \n" + WebhookEvalRunSucceeded: + type: object + title: eval.run.succeeded + description: | + Sent when an eval run has succeeded. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the eval run succeeded. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseImageGenCallWsCompleted - description: | - Emitted when an image generation tool call has completed and the final image is available. - allOf: - - $ref: '#/components/schemas/ResponseImageGenCallCompletedEvent' - - type: object + The unique ID of the eval run. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `eval.run.succeeded`. + enum: + - eval.run.succeeded + x-stainless-const: true + x-oaiMeta: + name: eval.run.succeeded + group: webhook-events + example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"eval.run.succeeded\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"evalrun_abc123\"\n }\n} \n" + WebhookFineTuningJobCancelled: + type: object + title: fine_tuning.job.cancelled + description: | + Sent when a fine-tuning job has been cancelled. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the fine-tuning job was cancelled. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseImageGenCallWsGenerating - description: | - Emitted when an image generation tool call is actively generating an image (intermediate state). - allOf: - - $ref: '#/components/schemas/ResponseImageGenCallGeneratingEvent' - - type: object + The unique ID of the fine-tuning job. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `fine_tuning.job.cancelled`. + enum: + - fine_tuning.job.cancelled + x-stainless-const: true + x-oaiMeta: + name: fine_tuning.job.cancelled + group: webhook-events + example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"fine_tuning.job.cancelled\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"ftjob_abc123\"\n }\n} \n" + WebhookFineTuningJobFailed: + type: object + title: fine_tuning.job.failed + description: | + Sent when a fine-tuning job has failed. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the fine-tuning job failed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseImageGenCallInWsProgress - description: | - Emitted when an image generation tool call is in progress. - allOf: - - $ref: '#/components/schemas/ResponseImageGenCallInProgressEvent' - - type: object + The unique ID of the fine-tuning job. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `fine_tuning.job.failed`. + enum: + - fine_tuning.job.failed + x-stainless-const: true + x-oaiMeta: + name: fine_tuning.job.failed + group: webhook-events + example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"fine_tuning.job.failed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"ftjob_abc123\"\n }\n} \n" + WebhookFineTuningJobSucceeded: + type: object + title: fine_tuning.job.succeeded + description: | + Sent when a fine-tuning job has succeeded. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the fine-tuning job succeeded. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseImageGenCallPartialWsImage - description: | - Emitted when a partial image is available during image generation streaming. - allOf: - - $ref: '#/components/schemas/ResponseImageGenCallPartialImageEvent' - - type: object + The unique ID of the fine-tuning job. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `fine_tuning.job.succeeded`. + enum: + - fine_tuning.job.succeeded + x-stainless-const: true + x-oaiMeta: + name: fine_tuning.job.succeeded + group: webhook-events + example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"fine_tuning.job.succeeded\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"ftjob_abc123\"\n }\n} \n" + WebhookLiveCallIncoming: + type: object + title: live.call.incoming + deprecated: true + description: | + Deprecated: use `live.transport.incoming`. Retained for existing subscriptions + during migration; new subscriptions to this event are not allowed. + Sent when an incoming API SIP session is available for Live acceptance. The + same pending session can also emit `realtime.call.incoming`; the first + successful Realtime or Live accept endpoint selects the runtime surface. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the event was created. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - session_id + - sip_headers properties: - stream_id: + session_id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseMcpCallArgumentsWsDelta - description: | - Emitted when there is a delta (partial update) to the arguments of an MCP tool call. - allOf: - - $ref: '#/components/schemas/ResponseMCPCallArgumentsDeltaEvent' - - type: object - properties: - stream_id: - type: string + The `live_...` ID of the pending SIP session. Pass this value unchanged + to Live call controls and sideband connections. The corresponding + `realtime.call.incoming` event uses a separate `rtc_...` call ID. + sip_headers: + type: array description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseMcpCallArgumentsWsDone - description: | - Emitted when the arguments for an MCP tool call are finalized. - allOf: - - $ref: '#/components/schemas/ResponseMCPCallArgumentsDoneEvent' - - type: object + Headers from the SIP INVITE, excluding SIP authorization headers. + Retained names, values, repeated entries, and order are preserved. + Treat these values as untrusted call metadata. + items: + type: object + description: | + A header from the SIP Invite. + required: + - name + - value + properties: + name: + type: string + description: | + Name of the SIP Header. + value: + type: string + description: | + Value of the SIP Header. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `live.call.incoming`. + enum: + - live.call.incoming + x-stainless-const: true + x-oaiMeta: + name: live.call.incoming + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "live.call.incoming", + "created_at": 1719168000, + "data": { + "session_id": "live_u0_479a275623b54bdb9b6fbae2f7cbd408", + "sip_headers": [ + {"name": "From", "value": ";tag=abc123"}, + {"name": "To", "value": ""}, + {"name": "Call-ID", "value": "call-123@example.com"} + ] + } + } + WebhookLiveTransportIncoming: + type: object + title: live.transport.incoming + description: | + Sent when an incoming API SIP session is available for Live acceptance. The + same pending session can also emit `realtime.call.incoming`; the first + successful Realtime or Live accept endpoint selects the runtime surface. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the event was created. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - type + - session_id + - sip_headers properties: - stream_id: + type: type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseMcpCallWsCompleted - description: | - Emitted when an MCP tool call has completed successfully. - allOf: - - $ref: '#/components/schemas/ResponseMCPCallCompletedEvent' - - type: object - properties: - stream_id: + description: The incoming transport type. Always `sip`. + enum: + - sip + x-stainless-const: true + session_id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseMcpCallWsFailed - description: | - Emitted when an MCP tool call has failed. - allOf: - - $ref: '#/components/schemas/ResponseMCPCallFailedEvent' - - type: object - properties: - stream_id: - type: string + The `live_...` ID of the pending SIP session. Forward this value + unchanged when accepting or rejecting the call through the Live API. + sip_headers: + type: array description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseMcpCallInWsProgress - description: | - Emitted when an MCP tool call is in progress. - allOf: - - $ref: '#/components/schemas/ResponseMCPCallInProgressEvent' - - type: object + Headers from the SIP INVITE, excluding SIP authorization headers. + Retained names, values, repeated entries, and order are preserved. + Treat these values as untrusted call metadata. + items: + type: object + description: | + A header from the SIP Invite. + required: + - name + - value + properties: + name: + type: string + description: | + Name of the SIP Header. + value: + type: string + description: | + Value of the SIP Header. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `live.transport.incoming`. + enum: + - live.transport.incoming + x-stainless-const: true + x-oaiMeta: + name: live.transport.incoming + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "live.transport.incoming", + "created_at": 1719168000, + "data": { + "type": "sip", + "session_id": "live_u0_479a275623b54bdb9b6fbae2f7cbd408", + "sip_headers": [ + {"name": "From", "value": ";tag=abc123"}, + {"name": "To", "value": ""}, + {"name": "Call-ID", "value": "call-123@example.com"} + ] + } + } + WebhookRealtimeCallIncoming: + type: object + title: realtime.call.incoming + description: | + Sent when an incoming API SIP session is available for Realtime acceptance. + The same pending session can also emit `live.transport.incoming`; the first + successful Realtime or Live accept endpoint selects the runtime surface. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the model response was completed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - call_id + - sip_headers properties: - stream_id: + call_id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseMcpListToolsWsCompleted - description: | - Emitted when the list of available MCP tools has been successfully retrieved. - allOf: - - $ref: '#/components/schemas/ResponseMCPListToolsCompletedEvent' - - type: object - properties: - stream_id: - type: string + The Transceiver `rtc_...` ID of the pending SIP session. The paired + `live.transport.incoming` event derives its `session_id` by replacing the + `rtc_` prefix with `live_`. Use the ID returned by the event with the + corresponding Realtime or Live API. + sip_headers: + type: array description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseMcpListToolsWsFailed - description: | - Emitted when the attempt to list available MCP tools has failed. - allOf: - - $ref: '#/components/schemas/ResponseMCPListToolsFailedEvent' - - type: object + Headers from the SIP INVITE, excluding SIP authorization headers. + Retained names, values, repeated entries, and order are preserved. + Treat these values as untrusted call metadata. + items: + type: object + description: | + A header from the SIP Invite. + required: + - name + - value + properties: + name: + type: string + description: | + Name of the SIP Header. + value: + type: string + description: | + Value of the SIP Header. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `realtime.call.incoming`. + enum: + - realtime.call.incoming + x-stainless-const: true + x-oaiMeta: + name: realtime.call.incoming + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "realtime.call.incoming", + "created_at": 1719168000, + "data": { + "call_id": "rtc_479a275623b54bdb9b6fbae2f7cbd408", + "sip_headers": [ + {"name": "Max-Forwards", "value": "63"}, + {"name": "CSeq", "value": "851287 INVITE"}, + {"name": "Content-Type", "value": "application/sdp"} + ] + } + } + WebhookResponseCancelled: + type: object + title: response.cancelled + description: | + Sent when a background response has been cancelled. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the model response was cancelled. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseMcpListToolsInWsProgress - description: | - Emitted when the system is in the process of retrieving the list of available MCP tools. - allOf: - - $ref: '#/components/schemas/ResponseMCPListToolsInProgressEvent' - - type: object + The unique ID of the model response. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `response.cancelled`. + enum: + - response.cancelled + x-stainless-const: true + x-oaiMeta: + name: response.cancelled + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.cancelled", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + WebhookResponseCompleted: + type: object + title: response.completed + description: | + Sent when a background response has been completed. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the model response was completed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseOutputTextAnnotationWsAdded - description: | - Emitted when an annotation is added to output text content. - allOf: - - $ref: '#/components/schemas/ResponseOutputTextAnnotationAddedEvent' - - type: object + The unique ID of the model response. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `response.completed`. + enum: + - response.completed + x-stainless-const: true + x-oaiMeta: + name: response.completed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.completed", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + WebhookResponseFailed: + type: object + title: response.failed + description: | + Sent when a background response has failed. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the model response failed. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseWsQueued - description: | - Emitted when a response is queued and waiting to be processed. - allOf: - - $ref: '#/components/schemas/ResponseQueuedEvent' - - type: object + The unique ID of the model response. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `response.failed`. + enum: + - response.failed + x-stainless-const: true + x-oaiMeta: + name: response.failed + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.failed", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + WebhookResponseIncomplete: + type: object + title: response.incomplete + description: | + Sent when a background response has been interrupted. + required: + - created_at + - id + - data + - type + properties: + created_at: + type: integer + format: unixtime + description: | + The Unix timestamp (in seconds) of when the model response was interrupted. + id: + type: string + description: | + The unique ID of the event. + data: + type: object + description: | + Event data payload. + required: + - id properties: - stream_id: + id: type: string description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseCustomToolCallInputWsDelta - description: | - Event representing a delta (partial update) to the input of a custom tool call. - allOf: - - $ref: '#/components/schemas/ResponseCustomToolCallInputDeltaEvent' - - type: object + The unique ID of the model response. + object: + type: string + description: | + The object of the event. Always `event`. + enum: + - event + x-stainless-const: true + type: + type: string + description: | + The type of the event. Always `response.incomplete`. + enum: + - response.incomplete + x-stainless-const: true + x-oaiMeta: + name: response.incomplete + group: webhook-events + example: | + { + "id": "evt_abc123", + "type": "response.incomplete", + "created_at": 1719168000, + "data": { + "id": "resp_abc123" + } + } + WebhookSafetyAlertCreated: + type: object + title: safety.alert.created + description: Sent when an approved safety alert is available for an API project. + required: + - id + - object + - created_at + - type + - data + properties: + id: + type: string + description: The unique ID of the webhook event. + object: + type: string + enum: + - event + x-stainless-const: true + description: Always `event`. + created_at: + type: integer + format: unixtime + description: The Unix timestamp in seconds when the event was created. + type: + type: string + enum: + - safety.alert.created + x-stainless-const: true + description: Always `safety.alert.created`. + data: + type: object + additionalProperties: false + required: + - id properties: - stream_id: + id: type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - title: ResponseCustomToolCallInputWsDone - description: | - Event indicating that input for a custom tool call is complete. - allOf: - - $ref: '#/components/schemas/ResponseCustomToolCallInputDoneEvent' - - type: object + pattern: ^alert_[0-9a-f]{32}$ + description: The safety alert ID to pass to `GET /v1/safety/alerts/{id}`. + x-oaiMeta: + name: safety.alert.created + group: webhook-events + example: | + { + "id": "evt_123", + "object": "event", + "created_at": 1787659200, + "type": "safety.alert.created", + "data": {"id": "alert_0123456789abcdef0123456789abcdef"} + } + WebhookSafetyOrgAlertCreated: + type: object + title: safety.org_alert.created + description: Sent when an approved safety alert is available for an enterprise workspace. + required: + - id + - object + - created_at + - type + - data + properties: + id: + type: string + description: The unique ID of the webhook event. + object: + type: string + enum: + - event + x-stainless-const: true + description: Always `event`. + created_at: + type: integer + format: unixtime + description: The Unix timestamp in seconds when the event was created. + type: + type: string + enum: + - safety.org_alert.created + x-stainless-const: true + description: Always `safety.org_alert.created`. + data: + type: object + additionalProperties: false + required: + - id properties: - stream_id: + id: type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - - $ref: '#/components/schemas/ResponseWsError' - - $ref: '#/components/schemas/ResponseSteerAcceptedEvent' - - $ref: '#/components/schemas/ResponseSteerPendingEvent' - - $ref: '#/components/schemas/ResponseSteerFailedEvent' - ResponsesWebSocketStreamEvent: - allOf: - - anyOf: - - $ref: '#/components/schemas/ResponseAudioDeltaEvent' - - $ref: '#/components/schemas/ResponseAudioDoneEvent' - - $ref: '#/components/schemas/ResponseAudioTranscriptDeltaEvent' - - $ref: '#/components/schemas/ResponseAudioTranscriptDoneEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDeltaEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallCodeDoneEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallCompletedEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallInProgressEvent' - - $ref: '#/components/schemas/ResponseCodeInterpreterCallInterpretingEvent' - - $ref: '#/components/schemas/ResponseCompletedEvent' - - $ref: '#/components/schemas/ResponseContentPartAddedEvent' - - $ref: '#/components/schemas/ResponseContentPartDoneEvent' - - $ref: '#/components/schemas/ResponseCreatedEvent' - - $ref: '#/components/schemas/ResponseFileSearchCallCompletedEvent' - - $ref: '#/components/schemas/ResponseFileSearchCallInProgressEvent' - - $ref: '#/components/schemas/ResponseFileSearchCallSearchingEvent' - - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDeltaEvent' - - $ref: '#/components/schemas/ResponseFunctionCallArgumentsDoneEvent' - - $ref: '#/components/schemas/ResponseShellCallCommandAddedStreamingEvent' - - $ref: '#/components/schemas/ResponseShellCallCommandDeltaStreamingEvent' - - $ref: '#/components/schemas/ResponseShellCallCommandDoneStreamingEvent' - - $ref: '#/components/schemas/ResponseShellCallOutputContentDeltaStreamingEvent' - x-stainless-skip: - - go - - $ref: '#/components/schemas/ResponseShellCallOutputContentDoneStreamingEvent' - - $ref: '#/components/schemas/ResponseInProgressEvent' - - $ref: '#/components/schemas/ResponseFailedEvent' - - $ref: '#/components/schemas/ResponseIncompleteEvent' - - $ref: '#/components/schemas/ResponseOutputItemAddedEvent' - - $ref: '#/components/schemas/ResponseOutputItemDoneEvent' - - $ref: '#/components/schemas/ResponseReasoningSummaryPartAddedEvent' - - $ref: '#/components/schemas/ResponseReasoningSummaryPartDoneEvent' - - $ref: '#/components/schemas/ResponseReasoningSummaryTextDeltaEvent' - - $ref: '#/components/schemas/ResponseReasoningSummaryTextDoneEvent' - - $ref: '#/components/schemas/ResponseReasoningTextDeltaEvent' - - $ref: '#/components/schemas/ResponseReasoningTextDoneEvent' - - $ref: '#/components/schemas/ResponseRefusalDeltaEvent' - - $ref: '#/components/schemas/ResponseRefusalDoneEvent' - - $ref: '#/components/schemas/ResponseTextDeltaEvent' - - $ref: '#/components/schemas/ResponseTextDoneEvent' - - $ref: '#/components/schemas/ResponseWebSearchCallCompletedEvent' - - $ref: '#/components/schemas/ResponseWebSearchCallInProgressEvent' - - $ref: '#/components/schemas/ResponseWebSearchCallSearchingEvent' - - $ref: '#/components/schemas/ResponseImageGenCallCompletedEvent' - - $ref: '#/components/schemas/ResponseImageGenCallGeneratingEvent' - - $ref: '#/components/schemas/ResponseImageGenCallInProgressEvent' - - $ref: '#/components/schemas/ResponseImageGenCallPartialImageEvent' - - $ref: '#/components/schemas/ResponseMCPCallArgumentsDeltaEvent' - - $ref: '#/components/schemas/ResponseMCPCallArgumentsDoneEvent' - - $ref: '#/components/schemas/ResponseMCPCallCompletedEvent' - - $ref: '#/components/schemas/ResponseMCPCallFailedEvent' - - $ref: '#/components/schemas/ResponseMCPCallInProgressEvent' - - $ref: '#/components/schemas/ResponseMCPListToolsCompletedEvent' - - $ref: '#/components/schemas/ResponseMCPListToolsFailedEvent' - - $ref: '#/components/schemas/ResponseMCPListToolsInProgressEvent' - - $ref: '#/components/schemas/ResponseOutputTextAnnotationAddedEvent' - - $ref: '#/components/schemas/ResponseQueuedEvent' - - $ref: '#/components/schemas/ResponseCustomToolCallInputDeltaEvent' - - $ref: '#/components/schemas/ResponseCustomToolCallInputDoneEvent' - - type: object - properties: - stream_id: - type: string - description: | - The WebSocket lane that emitted this event. This field is present - when the originating `response.create` event supplied a - `stream_id`. - Role: + pattern: ^alert_[0-9a-f]{32}$ + description: The safety alert ID to pass to `GET /v1/safety/alerts/{id}`. + x-oaiMeta: + name: safety.org_alert.created + group: webhook-events + example: | + { + "id": "evt_123", + "object": "event", + "created_at": 1787659200, + "type": "safety.org_alert.created", + "data": {"id": "alert_0123456789abcdef0123456789abcdef"} + } + ModerationInputType: + type: string + enum: + - text + - image + ModerationResultBody: + properties: + type: + type: string + enum: + - moderation_result + description: The object type, which was always `moderation_result` for successful moderation results. + default: moderation_result + x-stainless-const: true + model: + type: string + description: The moderation model that produced this result. + flagged: + type: boolean + description: A boolean indicating whether the content was flagged by any category. + categories: + additionalProperties: + type: boolean + type: object + description: A dictionary of moderation categories to booleans, True if the input is flagged under this category. + x-oaiTypeLabel: map + category_scores: + additionalProperties: + type: number + type: object + description: A dictionary of moderation categories to scores. + x-oaiTypeLabel: map + category_applied_input_types: + additionalProperties: + items: + $ref: '#/components/schemas/ModerationInputType' + type: array + type: object + description: Which modalities of input are reflected by the score for each category. + x-oaiTypeLabel: map + type: object + required: + - type + - model + - flagged + - categories + - category_scores + - category_applied_input_types + title: Moderation result + description: A moderation result produced for the response input or output. + PromptCacheTTLEnum: + type: string + enum: + - 30m + PromptCacheModeEnum: + type: string + enum: + - implicit + - explicit + PromptCacheOptionsParam: + properties: + ttl: + $ref: '#/components/schemas/PromptCacheTTLEnum' + description: The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer. + mode: + $ref: '#/components/schemas/PromptCacheModeEnum' + description: Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching. + type: object + required: [] + title: Prompt cache options + description: Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details. + PromptCacheBreakpointParam: + properties: + mode: + type: string + enum: + - explicit + description: The breakpoint mode. Always `explicit`. + default: explicit + x-stainless-const: true + type: object + required: + - mode + title: Prompt cache breakpoint + description: Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block. + ModerationMode: + type: string + enum: + - score + - block + ModerationConfigParam: + properties: + mode: + $ref: '#/components/schemas/ModerationMode' type: object - description: Details about a role that can be assigned through the public Roles API. + required: + - mode + description: The moderation policy for the response input. + ModerationPolicyParam: properties: - object: + input: + anyOf: + - $ref: '#/components/schemas/ModerationConfigParam' + description: The moderation policy for the response input. + - type: 'null' + output: + anyOf: + - $ref: '#/components/schemas/ModerationConfigParam' + description: The moderation policy for the response output. + - type: 'null' + type: object + required: [] + description: The policy to apply to moderated response input and output. + ModerationParam: + properties: + model: + type: string + description: The moderation model to use for moderated completions, e.g. 'omni-moderation-latest'. + policy: + anyOf: + - $ref: '#/components/schemas/ModerationPolicyParam' + description: The policy to apply to moderated response input and output. + - type: 'null' + type: object + required: + - model + description: Configuration for running moderation on the input and output of this response. + SkillReferenceParam: + properties: + type: type: string enum: - - role - description: Always `role`. + - skill_reference + description: References a skill created with the /v1/skills endpoint. + default: skill_reference x-stainless-const: true - id: + skill_id: type: string - description: Identifier for the role. + maxLength: 64 + minLength: 1 + description: The ID of the referenced skill. + version: + type: string + description: Optional skill version. Use a positive integer or 'latest'. Omit for default. + type: object + required: + - type + - skill_id + InlineSkillSourceParam: + properties: + type: + type: string + enum: + - base64 + description: The type of the inline skill source. Must be `base64`. + default: base64 + x-stainless-const: true + media_type: + type: string + enum: + - application/zip + description: The media type of the inline skill payload. Must be `application/zip`. + default: application/zip + x-stainless-const: true + data: + type: string + maxLength: 70254592 + minLength: 1 + description: Base64-encoded skill zip bundle. + type: object + required: + - type + - media_type + - data + description: Inline skill payload + InlineSkillParam: + properties: + type: + type: string + enum: + - inline + description: Defines an inline skill for this request. + default: inline + x-stainless-const: true name: type: string - description: Unique name for the role. + description: The name of the skill. description: - description: Optional description of the role. - anyOf: - - type: string - - type: 'null' - permissions: - type: array - description: Permissions granted by the role. - items: - type: string - resource_type: type: string - description: Resource type the role is bound to (for example `api.organization` or `api.project`). - predefined_role: - type: boolean - description: Whether the role is predefined and managed by OpenAI. + description: The description of the skill. + source: + $ref: '#/components/schemas/InlineSkillSourceParam' + description: Inline skill payload + type: object required: - - object - - id + - type - name - description - - permissions - - resource_type - - predefined_role - x-oaiMeta: - name: The role object - example: | - { - "object": "role", - "id": "role_01J1F8ROLE01", - "name": "API Group Manager", - "description": "Allows managing organization groups", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "resource_type": "api.organization", - "predefined_role": false - } - RoleDeletedResource: + - source + ContainerNetworkPolicyDisabledParam: + properties: + type: + type: string + enum: + - disabled + description: Disable outbound network access. Always `disabled`. + default: disabled + x-stainless-const: true type: object - description: Confirmation payload returned after deleting a role. + required: + - type + ContainerNetworkPolicyDomainSecretParam: + properties: + domain: + type: string + minLength: 1 + description: The domain associated with the secret. + name: + type: string + minLength: 1 + description: The name of the secret to inject for the domain. + value: + type: string + maxLength: 10485760 + minLength: 1 + description: The secret value to inject for the domain. + type: object + required: + - domain + - name + - value + ContainerNetworkPolicyAllowlistParam: + properties: + type: + type: string + enum: + - allowlist + description: Allow outbound network access only to specified domains. Always `allowlist`. + default: allowlist + x-stainless-const: true + allowed_domains: + items: + type: string + type: array + minItems: 1 + description: A list of allowed domains when type is `allowlist`. + domain_secrets: + items: + $ref: '#/components/schemas/ContainerNetworkPolicyDomainSecretParam' + type: array + minItems: 1 + description: Optional domain-scoped secrets for allowlisted domains. + type: object + required: + - type + - allowed_domains + IncludeEnum: + type: string + enum: + - file_search_call.results + - web_search_call.results + - web_search_call.action.sources + - message.input_image.image_url + - computer_call_output.output.image_url + - code_interpreter_call.outputs + - reasoning.encrypted_content + - message.output_text.logprobs + description: |- + Specify additional output data to include in the model response. Currently supported values are: + - `web_search_call.results`: Include the search results of the web search tool call. + - `web_search_call.action.sources`: Include the sources of the web search tool call. + - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items. + - `computer_call_output.output.image_url`: Include image urls from the computer call output. + - `file_search_call.results`: Include the search results of the file search tool call. + - `message.input_image.image_url`: Include image urls from the input message. + - `message.output_text.logprobs`: Include logprobs with assistant messages. + - `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program). + MessageStatus: + type: string + enum: + - in_progress + - completed + - incomplete + MessageRole: + type: string + enum: + - unknown + - user + - assistant + - system + - critic + - discriminator + - developer + - tool + PromptCacheBreakpointConfig: + properties: + mode: + type: string + enum: + - explicit + description: The breakpoint mode. Always `explicit`. + default: explicit + x-stainless-const: true + type: object + required: + - mode + title: Prompt cache breakpoint + description: Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block. + InputTextContent: + properties: + type: + type: string + enum: + - input_text + description: The type of the input item. Always `input_text`. + default: input_text + x-stainless-const: true + text: + type: string + description: The text input to the model. + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointConfig' + type: object + required: + - type + - text + title: Input text + description: A text input to the model. + FileCitationBody: + properties: + type: + type: string + enum: + - file_citation + description: The type of the file citation. Always `file_citation`. + default: file_citation + x-stainless-const: true + file_id: + type: string + description: The ID of the file. + index: + type: integer + description: The index of the file in the list of files. + filename: + type: string + description: The filename of the file cited. + type: object + required: + - type + - file_id + - index + - filename + title: File citation + description: A citation to a file. + UrlCitationBody: + properties: + type: + type: string + enum: + - url_citation + description: The type of the URL citation. Always `url_citation`. + default: url_citation + x-stainless-const: true + url: + type: string + format: uri + description: The URL of the web resource. + start_index: + type: integer + description: The index of the first character of the URL citation in the message. + end_index: + type: integer + description: The index of the last character of the URL citation in the message. + title: + type: string + description: The title of the web resource. + type: object + required: + - type + - url + - start_index + - end_index + - title + title: URL citation + description: A citation for a web resource used to generate a model response. + ContainerFileCitationBody: + properties: + type: + type: string + enum: + - container_file_citation + description: The type of the container file citation. Always `container_file_citation`. + default: container_file_citation + x-stainless-const: true + container_id: + type: string + description: The ID of the container file. + file_id: + type: string + description: The ID of the file. + start_index: + type: integer + description: The index of the first character of the container file citation in the message. + end_index: + type: integer + description: The index of the last character of the container file citation in the message. + filename: + type: string + description: The filename of the container file cited. + type: object + required: + - type + - container_id + - file_id + - start_index + - end_index + - filename + title: Container file citation + description: A citation for a container file used to generate a model response. + Annotation: + discriminator: + propertyName: type + description: An annotation that applies to a span of output text. + anyOf: + - $ref: '#/components/schemas/FileCitationBody' + - $ref: '#/components/schemas/UrlCitationBody' + - $ref: '#/components/schemas/ContainerFileCitationBody' + - $ref: '#/components/schemas/FilePath' + TopLogProb: + properties: + token: + type: string + logprob: + type: number + bytes: + items: + type: integer + type: array + type: object + required: + - token + - logprob + - bytes + title: Top log probability + description: The top log probability of a token. + LogProb: + properties: + token: + type: string + logprob: + type: number + bytes: + items: + type: integer + type: array + top_logprobs: + items: + $ref: '#/components/schemas/TopLogProb' + type: array + type: object + required: + - token + - logprob + - bytes + - top_logprobs + title: Log probability + description: The log probability of a token. + OutputTextContent: + properties: + type: + type: string + enum: + - output_text + description: The type of the output text. Always `output_text`. + default: output_text + x-stainless-const: true + text: + type: string + description: The text output from the model. + annotations: + items: + $ref: '#/components/schemas/Annotation' + type: array + description: The annotations of the text output. + logprobs: + items: + $ref: '#/components/schemas/LogProb' + type: array + type: object + required: + - type + - text + - annotations + title: Output text + description: A text output from the model. + TextContent: + properties: + type: + type: string + enum: + - text + default: text + x-stainless-const: true + text: + type: string + type: object + required: + - type + - text + title: Text Content + description: A text content. + SummaryTextContent: + properties: + type: + type: string + enum: + - summary_text + description: The type of the object. Always `summary_text`. + default: summary_text + x-stainless-const: true + text: + type: string + description: A summary of the reasoning output from the model so far. + type: object + required: + - type + - text + title: Summary text + description: A summary text from the model. + ReasoningTextContent: + properties: + type: + type: string + enum: + - reasoning_text + description: The type of the reasoning text. Always `reasoning_text`. + default: reasoning_text + x-stainless-const: true + text: + type: string + description: The reasoning text from the model. + type: object + required: + - type + - text + title: ReasoningTextContent + description: Reasoning text from the model. + RefusalContent: + properties: + type: + type: string + enum: + - refusal + description: The type of the refusal. Always `refusal`. + default: refusal + x-stainless-const: true + refusal: + type: string + description: The refusal explanation from the model. + type: object + required: + - type + - refusal + title: Refusal + description: A refusal from the model. + ImageDetail: + type: string + enum: + - low + - high + - auto + - original + InputImageContent: properties: - object: + type: type: string enum: - - role.deleted - description: Always `role.deleted`. + - input_image + description: The type of the input item. Always `input_image`. + default: input_image x-stainless-const: true - id: - type: string - description: Identifier of the deleted role. - deleted: - type: boolean - description: Whether the role was deleted. - required: - - object - - id - - deleted - x-oaiMeta: - name: Role deletion confirmation - example: | - { - "object": "role.deleted", - "id": "role_01J1F8ROLE01", - "deleted": true - } - RoleListResource: + image_url: + anyOf: + - type: string + format: uri + description: The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL. + - type: 'null' + file_id: + anyOf: + - type: string + description: The ID of the file to be sent to the model. + - type: 'null' + detail: + $ref: '#/components/schemas/ImageDetail' + description: The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`. + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointConfig' type: object - description: Paginated list of roles assigned to a principal. + required: + - type + - detail + title: Input image + description: An image input to the model. Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision). + ComputerScreenshotContent: properties: - object: + type: type: string enum: - - list - description: Always `list`. + - computer_screenshot + description: Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`. + default: computer_screenshot x-stainless-const: true - data: - type: array - description: Role assignments returned in the current page. - items: - $ref: '#/components/schemas/AssignedRoleDetails' - has_more: - type: boolean - description: Whether additional assignments are available when paginating. - next: - description: Cursor to fetch the next page of results, or `null` when there are no more assignments. + image_url: anyOf: - type: string + format: uri + description: The URL of the screenshot image. - type: 'null' - required: - - object - - data - - has_more - - next - x-oaiMeta: - name: Assigned role list - example: | - { - "object": "list", - "data": [ - { - "id": "role_01J1F8ROLE01", - "name": "API Group Manager", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "resource_type": "api.organization", - "predefined_role": false, - "description": "Allows managing organization groups", - "created_at": 1711471533, - "updated_at": 1711472599, - "created_by": "user_abc123", - "created_by_user_obj": { - "id": "user_abc123", - "name": "Ada Lovelace", - "email": "ada@example.com" - }, - "metadata": {}, - "assignment_sources": null - } - ], - "has_more": false, - "next": null - } - RunCompletionUsage: - anyOf: - - type: object - description: Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). - properties: - completion_tokens: - type: integer - description: Number of completion tokens used over the course of the run. - prompt_tokens: - type: integer - description: Number of prompt tokens used over the course of the run. - total_tokens: - type: integer - description: Total number of tokens used (prompt + completion). - required: - - prompt_tokens - - completion_tokens - - total_tokens - - type: 'null' - RunGraderRequest: - type: object - title: RunGraderRequest - properties: - grader: - type: object - description: The grader used for the fine-tuning job. + file_id: anyOf: - - $ref: '#/components/schemas/GraderStringCheck' - - $ref: '#/components/schemas/GraderTextSimilarity' - - $ref: '#/components/schemas/GraderPython' - - $ref: '#/components/schemas/GraderScoreModel' - - $ref: '#/components/schemas/GraderMulti' - discriminator: - propertyName: type - item: - type: object - description: | - The dataset item provided to the grader. This will be used to populate - the `item` namespace. See [the guide](https://developers.openai.com/api/docs/guides/graders) for more details. - model_sample: - type: string - description: | - The model sample to be evaluated. This value will be used to populate - the `sample` namespace. See [the guide](https://developers.openai.com/api/docs/guides/graders) for more details. - The `output_json` variable will be populated if the model sample is a - valid JSON string. - required: - - grader - - model_sample - RunGraderResponse: + - type: string + description: The identifier of an uploaded file that contains the screenshot. + - type: 'null' + detail: + $ref: '#/components/schemas/ImageDetail' + description: The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`. + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointConfig' type: object - properties: - reward: - type: number - metadata: - type: object - properties: - name: - type: string - type: - type: string - errors: - type: object - properties: - formula_parse_error: - type: boolean - sample_parse_error: - type: boolean - truncated_observation_error: - type: boolean - unresponsive_reward_error: - type: boolean - invalid_variable_error: - type: boolean - other_error: - type: boolean - python_grader_server_error: - type: boolean - python_grader_server_error_type: - anyOf: - - type: string - - type: 'null' - python_grader_runtime_error: - type: boolean - python_grader_runtime_error_details: - anyOf: - - type: string - - type: 'null' - model_grader_server_error: - type: boolean - model_grader_refusal_error: - type: boolean - model_grader_parse_error: - type: boolean - model_grader_server_error_details: - anyOf: - - type: string - - type: 'null' - required: - - formula_parse_error - - sample_parse_error - - truncated_observation_error - - unresponsive_reward_error - - invalid_variable_error - - other_error - - python_grader_server_error - - python_grader_server_error_type - - python_grader_runtime_error - - python_grader_runtime_error_details - - model_grader_server_error - - model_grader_refusal_error - - model_grader_parse_error - - model_grader_server_error_details - execution_time: - type: number - scores: - type: object - additionalProperties: {} - token_usage: - anyOf: - - type: integer - - type: 'null' - sampled_model_name: - anyOf: - - type: string - - type: 'null' - required: - - name - - type - - errors - - execution_time - - scores - - token_usage - - sampled_model_name - sub_rewards: - type: object - additionalProperties: {} - model_grader_token_usage_per_model: - type: object - additionalProperties: {} required: - - reward - - metadata - - sub_rewards - - model_grader_token_usage_per_model - RunObject: - type: object - title: A run on a thread - description: Represents an execution run on a [thread](https://developers.openai.com/api/docs/assistants/migration). + - type + - image_url + - file_id + - detail + title: Computer screenshot + description: A screenshot of a computer. + FileInputDetail: + type: string + enum: + - auto + - low + - high + InputFileContent: properties: - id: - description: The identifier, which can be referenced in API endpoints. - type: string - object: - description: The object type, which is always `thread.run`. + type: type: string enum: - - thread.run - x-stainless-const: true - created_at: - description: The Unix timestamp (in seconds) for when the run was created. - type: integer - format: unixtime - thread_id: - description: The ID of the [thread](https://developers.openai.com/api/docs/assistants/migration) that was executed on as a part of this run. - type: string - assistant_id: - description: The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for execution of this run. - type: string - status: - $ref: '#/components/schemas/RunStatus' - description: The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. - required_action: - type: object - description: Details on the action required to continue the run. Will be `null` if no action is required. - nullable: true - properties: - type: - description: For now, this is always `submit_tool_outputs`. - type: string - enum: - - submit_tool_outputs - x-stainless-const: true - submit_tool_outputs: - type: object - description: Details on the tool outputs needed for this run to continue. - properties: - tool_calls: - type: array - description: A list of the relevant tool calls. - items: - $ref: '#/components/schemas/RunToolCallObject' - required: - - tool_calls - required: - - type - - submit_tool_outputs - last_error: - type: object - description: The last error associated with this run. Will be `null` if there are no errors. - nullable: true - properties: - code: - type: string - description: One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`. - enum: - - server_error - - rate_limit_exceeded - - invalid_prompt - message: - type: string - description: A human-readable description of the error. - required: - - code - - message - expires_at: - description: The Unix timestamp (in seconds) for when the run will expire. - type: integer - format: unixtime - nullable: true - started_at: - description: The Unix timestamp (in seconds) for when the run was started. - type: integer - format: unixtime - nullable: true - cancelled_at: - description: The Unix timestamp (in seconds) for when the run was cancelled. - type: integer - format: unixtime - nullable: true - failed_at: - description: The Unix timestamp (in seconds) for when the run failed. - type: integer - format: unixtime - nullable: true - completed_at: - description: The Unix timestamp (in seconds) for when the run was completed. - type: integer - format: unixtime - nullable: true - incomplete_details: - description: Details on why the run is incomplete. Will be `null` if the run is not incomplete. - type: object - nullable: true - properties: - reason: - description: The reason why the run is incomplete. This will point to which specific token limit was reached over the course of the run. - type: string - enum: - - max_completion_tokens - - max_prompt_tokens - model: - description: The model that the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for this run. - type: string - instructions: - description: The instructions that the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for this run. - type: string - tools: - description: The list of tools that the [assistant](https://developers.openai.com/api/docs/assistants/migration) used for this run. - default: [] - type: array - maxItems: 20 - items: - $ref: '#/components/schemas/AssistantTool' - metadata: - $ref: '#/components/schemas/Metadata' - usage: - $ref: '#/components/schemas/RunCompletionUsage' - temperature: - description: The sampling temperature used for this run. If not set, defaults to 1. - type: number - nullable: true - top_p: - description: The nucleus sampling value used for this run. If not set, defaults to 1. - type: number - nullable: true - max_prompt_tokens: - type: integer - nullable: true - description: | - The maximum number of prompt tokens specified to have been used over the course of the run. - minimum: 256 - max_completion_tokens: - type: integer - nullable: true - description: | - The maximum number of completion tokens specified to have been used over the course of the run. - minimum: 256 - truncation_strategy: - allOf: - - $ref: '#/components/schemas/TruncationObject' - - nullable: true - tool_choice: - allOf: - - $ref: '#/components/schemas/AssistantsApiToolChoiceOption' - - nullable: true - parallel_tool_calls: - $ref: '#/components/schemas/ParallelToolCalls' - response_format: - $ref: '#/components/schemas/AssistantsApiResponseFormatOption' - nullable: true - required: - - id - - object - - created_at - - thread_id - - assistant_id - - status - - required_action - - last_error - - expires_at - - started_at - - cancelled_at - - failed_at - - completed_at - - model - - instructions - - tools - - metadata - - usage - - incomplete_details - - max_prompt_tokens - - max_completion_tokens - - truncation_strategy - - tool_choice - - parallel_tool_calls - - response_format - x-oaiMeta: - name: The run object - beta: true - example: | - { - "id": "run_abc123", - "object": "thread.run", - "created_at": 1698107661, - "assistant_id": "asst_abc123", - "thread_id": "thread_abc123", - "status": "completed", - "started_at": 1699073476, - "expires_at": null, - "cancelled_at": null, - "failed_at": null, - "completed_at": 1699073498, - "last_error": null, - "model": "gpt-5", - "instructions": null, - "tools": [{"type": "file_search"}, {"type": "code_interpreter"}], - "metadata": {}, - "incomplete_details": null, - "usage": { - "prompt_tokens": 123, - "completion_tokens": 456, - "total_tokens": 579 - }, - "temperature": 1.0, - "top_p": 1.0, - "max_prompt_tokens": 1000, - "max_completion_tokens": 1000, - "truncation_strategy": { - "type": "auto", - "last_messages": null - }, - "response_format": "auto", - "tool_choice": "auto", - "parallel_tool_calls": true - } - RunStepCompletionUsage: - anyOf: - - type: object - description: Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. - properties: - completion_tokens: - type: integer - description: Number of completion tokens used over the course of the run step. - prompt_tokens: - type: integer - description: Number of prompt tokens used over the course of the run step. - total_tokens: - type: integer - description: Total number of tokens used (prompt + completion). - required: - - prompt_tokens - - completion_tokens - - total_tokens - - type: 'null' - RunStepDeltaObject: + - input_file + description: The type of the input item. Always `input_file`. + default: input_file + x-stainless-const: true + file_id: + anyOf: + - type: string + description: The ID of the file to be sent to the model. + - type: 'null' + filename: + type: string + description: The name of the file to be sent to the model. + file_data: + type: string + description: | + The content of the file to be sent to the model. + prompt_cache_breakpoint: + $ref: '#/components/schemas/PromptCacheBreakpointConfig' + file_url: + type: string + format: uri + description: The URL of the file to be sent to the model. + detail: + $ref: '#/components/schemas/FileInputDetail' + description: The detail level of the file to be sent to the model. Use `auto` to let the system select the detail level; for GPT-5.6 and later models, `auto` uses high-quality rendering, which may increase input token usage. Use `low` for lower-cost rendering, or `high` to render the file at higher quality. Defaults to `auto`. type: object - title: Run step delta object - description: | - Represents a run step delta i.e. any changed fields on a run step during streaming. + required: + - type + title: Input file + description: A file input to the model. + MessagePhase-2: + type: string + enum: + - commentary + - final_answer + Message: properties: + type: + type: string + enum: + - message + description: The type of the message. Always set to `message`. + default: message + x-stainless-const: true id: - description: The identifier of the run step, which can be referenced in API endpoints. type: string - object: - description: The object type, which is always `thread.run.step.delta`. + description: The unique ID of the message. + status: + $ref: '#/components/schemas/MessageStatus' + description: The status of item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API. + role: + $ref: '#/components/schemas/MessageRole' + description: The role of the message. One of `unknown`, `user`, `assistant`, `system`, `critic`, `discriminator`, `developer`, or `tool`. + content: + items: + discriminator: + propertyName: type + description: A content part that makes up an input or output item. + anyOf: + - $ref: '#/components/schemas/InputTextContent' + - $ref: '#/components/schemas/OutputTextContent' + - $ref: '#/components/schemas/TextContent' + - $ref: '#/components/schemas/SummaryTextContent' + - $ref: '#/components/schemas/ReasoningTextContent' + - $ref: '#/components/schemas/RefusalContent' + - $ref: '#/components/schemas/InputImageContent' + - $ref: '#/components/schemas/ComputerScreenshotContent' + - $ref: '#/components/schemas/InputFileContent' + type: array + description: The content of the message + phase: + anyOf: + - $ref: '#/components/schemas/MessagePhase-2' + description: Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages. + - type: 'null' + type: object + required: + - type + - id + - status + - role + - content + title: Message + description: A message to or from the model. + DirectToolCallCaller: + properties: + type: type: string enum: - - thread.run.step.delta + - direct + default: direct x-stainless-const: true - delta: - $ref: '#/components/schemas/RunStepDeltaObjectDelta' + type: object required: - - id - - object - - delta - x-oaiMeta: - name: The run step delta object - beta: true - example: | - { - "id": "step_123", - "object": "thread.run.step.delta", - "delta": { - "step_details": { - "type": "tool_calls", - "tool_calls": [ - { - "index": 0, - "id": "call_123", - "type": "code_interpreter", - "code_interpreter": { "input": "", "outputs": [] } - } - ] - } - } - } - RunStepDeltaStepDetailsMessageCreationObject: - title: Message creation + - type + ProgramToolCallCaller: + properties: + type: + type: string + enum: + - program + default: program + x-stainless-const: true + caller_id: + type: string + description: The call ID of the program item that produced this tool call. type: object - description: Details of the message creation by the run step. + required: + - type + - caller_id + ToolCallCaller: + discriminator: + propertyName: type + description: The execution context that produced this tool call. + anyOf: + - $ref: '#/components/schemas/DirectToolCallCaller' + - $ref: '#/components/schemas/ProgramToolCallCaller' + FunctionCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + DirectToolCallCallerParam: properties: type: - description: Always `message_creation`. type: string enum: - - message_creation + - direct + description: The caller type. Always `direct`. + default: direct x-stainless-const: true - message_creation: - type: object - properties: - message_id: - type: string - description: The ID of the message that was created by this run step. + type: object required: - type - RunStepDeltaStepDetailsToolCallsCodeObject: - title: Code interpreter tool call + ProgramToolCallCallerParam: + properties: + type: + type: string + enum: + - program + description: The caller type. Always `program`. + default: program + x-stainless-const: true + caller_id: + type: string + maxLength: 64 + minLength: 1 + description: The call ID of the program item that produced this tool call. type: object - description: Details of the Code Interpreter tool call the run step was involved in. + required: + - type + - caller_id + ToolCallCallerParam: + discriminator: + propertyName: type + description: The execution context that produced this tool call. + anyOf: + - $ref: '#/components/schemas/DirectToolCallCallerParam' + - $ref: '#/components/schemas/ProgramToolCallCallerParam' + FunctionCallOutputStatusEnum: + type: string + enum: + - in_progress + - completed + - incomplete + WebSearchCallStatus: + type: string + enum: + - in_progress + - searching + - completed + - failed + - incomplete + ImageGenActionEnum: + type: string + enum: + - generate + - edit + - auto + ImageBackground: + type: string + enum: + - transparent + - opaque + - auto + ImageOutputFormat: + type: string + enum: + - png + - webp + - jpeg + ImageGenToolCall: properties: - index: - type: integer - description: The index of the tool call in the tool calls array. + type: + type: string + enum: + - image_generation_call + description: The type of the image generation call. Always `image_generation_call`. + x-stainless-const: true id: type: string - description: The ID of the tool call. + description: The unique ID of the image generation call. + status: + type: string + enum: + - in_progress + - completed + - generating + - failed + description: The status of the image generation call. + result: + anyOf: + - type: string + description: The generated image encoded in base64. + - type: 'null' + size: + anyOf: + - anyOf: + - type: string + - type: string + enum: + - 1024x1024 + - 1024x1536 + - 1536x1024 + description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. + - type: 'null' + quality: + anyOf: + - type: string + enum: + - low + - medium + - high + - xhigh + - max + - auto + description: The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. + - type: 'null' + action: + anyOf: + - $ref: '#/components/schemas/ImageGenActionEnum' + description: The action used for image generation. + - type: 'null' + x-openai-go-optional-enum: true + background: + anyOf: + - $ref: '#/components/schemas/ImageBackground' + description: The background setting used for generation. + - type: 'null' + x-openai-go-optional-enum: true + output_format: + anyOf: + - $ref: '#/components/schemas/ImageOutputFormat' + description: The output format used for generation. + - type: 'null' + x-openai-go-optional-enum: true + revised_prompt: + anyOf: + - type: string + description: The prompt that was used after any model prompt rewriting. + - type: 'null' + type: object + required: + - type + - id + - status + - result + title: Image generation call + description: An image generation request made by the model. + ClickButtonType: + type: string + enum: + - left + - right + - wheel + - back + - forward + ClickParam: + properties: type: type: string - description: The type of tool call. This is always going to be `code_interpreter` for this type of tool call. enum: - - code_interpreter + - click + description: Specifies the event type. For a click action, this property is always `click`. + default: click x-stainless-const: true - code_interpreter: - type: object - description: The Code Interpreter tool call definition. - properties: - input: + button: + $ref: '#/components/schemas/ClickButtonType' + description: Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`. + x: + type: integer + description: The x-coordinate where the click occurred. + y: + type: integer + description: The y-coordinate where the click occurred. + keys: + anyOf: + - items: type: string - description: The input to the Code Interpreter tool call. - outputs: - type: array - description: The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. - items: - type: object - anyOf: - - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject' - - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsCodeOutputImageObject' - discriminator: - propertyName: type + type: array + description: The keys being held while clicking. + - type: 'null' + type: object required: - - index - type - RunStepDeltaStepDetailsToolCallsCodeOutputImageObject: - title: Code interpreter image output - type: object + - button + - x + - y + title: Click + description: A click action. + DoubleClickAction: properties: - index: - type: integer - description: The index of the output in the outputs array. type: - description: Always `image`. type: string enum: - - image + - double_click + description: Specifies the event type. For a double click action, this property is always set to `double_click`. + default: double_click x-stainless-const: true - image: - type: object - properties: - file_id: - description: The [file](https://developers.openai.com/api/reference/resources/files) ID of the image. + x: + type: integer + description: The x-coordinate where the double click occurred. + y: + type: integer + description: The y-coordinate where the double click occurred. + keys: + anyOf: + - items: type: string + type: array + description: The keys being held while double-clicking. + - type: 'null' + type: object required: - - index - type - RunStepDeltaStepDetailsToolCallsCodeOutputLogsObject: - title: Code interpreter log output - type: object - description: Text output from the Code Interpreter tool call as part of a run step. + - x + - y + - keys + title: DoubleClick + description: A double click action. + CoordParam: properties: - index: + x: type: integer - description: The index of the output in the outputs array. + description: The x-coordinate. + y: + type: integer + description: The y-coordinate. + type: object + required: + - x + - y + title: Coordinate + description: 'An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.' + DragParam: + properties: type: - description: Always `logs`. type: string enum: - - logs + - drag + description: Specifies the event type. For a drag action, this property is always set to `drag`. + default: drag x-stainless-const: true - logs: - type: string - description: The text output from the Code Interpreter tool call. + path: + items: + $ref: '#/components/schemas/CoordParam' + type: array + description: |- + An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg + ``` + [ + { x: 100, y: 200 }, + { x: 200, y: 300 } + ] + ``` + keys: + anyOf: + - items: + type: string + type: array + description: The keys being held while dragging the mouse. + - type: 'null' + type: object required: - - index - type - RunStepDeltaStepDetailsToolCallsFileSearchObject: - title: File search tool call - type: object + - path + title: Drag + description: A drag action. + KeyPressAction: properties: - index: - type: integer - description: The index of the tool call in the tool calls array. - id: - type: string - description: The ID of the tool call object. type: type: string - description: The type of tool call. This is always going to be `file_search` for this type of tool call. enum: - - file_search + - keypress + description: Specifies the event type. For a keypress action, this property is always set to `keypress`. + default: keypress x-stainless-const: true - file_search: - type: object - description: For now, this is always going to be an empty object. - x-oaiTypeLabel: map + keys: + items: + type: string + description: One of the keys the model is requesting to be pressed. + type: array + description: The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key. + type: object required: - - index - type - - file_search - RunStepDeltaStepDetailsToolCallsFunctionObject: - type: object - title: Function tool call + - keys + title: KeyPress + description: A collection of keypresses the model would like to perform. + MoveParam: properties: - index: - type: integer - description: The index of the tool call in the tool calls array. - id: - type: string - description: The ID of the tool call object. type: type: string - description: The type of tool call. This is always going to be `function` for this type of tool call. enum: - - function + - move + description: Specifies the event type. For a move action, this property is always set to `move`. + default: move x-stainless-const: true - function: - type: object - description: The definition of the function that was called. - properties: - name: - type: string - description: The name of the function. - arguments: - type: string - description: The arguments passed to the function. - output: - anyOf: - - type: string - description: The output of the function. This will be `null` if the outputs have not been [submitted](https://developers.openai.com/api/docs/assistants/migration) yet. - - type: 'null' + x: + type: integer + description: The x-coordinate to move to. + y: + type: integer + description: The y-coordinate to move to. + keys: + anyOf: + - items: + type: string + type: array + description: The keys being held while moving the mouse. + - type: 'null' + type: object required: - - index - type - RunStepDeltaStepDetailsToolCallsObject: - title: Tool calls - type: object - description: Details of the tool call. + - x + - y + title: Move + description: A mouse move action. + ScreenshotParam: properties: type: - description: Always `tool_calls`. type: string enum: - - tool_calls + - screenshot + description: Specifies the event type. For a screenshot action, this property is always set to `screenshot`. + default: screenshot x-stainless-const: true - tool_calls: - type: array - description: | - An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`. - items: - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCall' + type: object required: - type - RunStepDetailsMessageCreationObject: - title: Message creation - type: object - description: Details of the message creation by the run step. + title: Screenshot + description: A screenshot action. + ScrollParam: properties: type: - description: Always `message_creation`. type: string enum: - - message_creation + - scroll + description: Specifies the event type. For a scroll action, this property is always set to `scroll`. + default: scroll x-stainless-const: true - message_creation: - type: object - properties: - message_id: + x: + type: integer + description: The x-coordinate where the scroll occurred. + y: + type: integer + description: The y-coordinate where the scroll occurred. + scroll_x: + type: integer + description: The horizontal scroll distance. + scroll_y: + type: integer + description: The vertical scroll distance. + keys: + anyOf: + - items: type: string - description: The ID of the message that was created by this run step. - required: - - message_id + type: array + description: The keys being held while scrolling. + - type: 'null' + type: object required: - type - - message_creation - RunStepDetailsToolCallsCodeObject: - title: Code Interpreter tool call - type: object - description: Details of the Code Interpreter tool call the run step was involved in. + - x + - y + - scroll_x + - scroll_y + title: Scroll + description: A scroll action. + TypeParam: properties: - id: - type: string - description: The ID of the tool call. type: type: string - description: The type of tool call. This is always going to be `code_interpreter` for this type of tool call. enum: - - code_interpreter + - type + description: Specifies the event type. For a type action, this property is always set to `type`. + default: type x-stainless-const: true - code_interpreter: - type: object - description: The Code Interpreter tool call definition. - required: - - input - - outputs - properties: - input: - type: string - description: The input to the Code Interpreter tool call. - outputs: - type: array - description: The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. - items: - type: object - anyOf: - - $ref: '#/components/schemas/RunStepDetailsToolCallsCodeOutputLogsObject' - - $ref: '#/components/schemas/RunStepDetailsToolCallsCodeOutputImageObject' - discriminator: - propertyName: type + text: + type: string + description: The text to type. + type: object required: - - id - type - - code_interpreter - RunStepDetailsToolCallsCodeOutputImageObject: - title: Code Interpreter image output - type: object + - text + title: Type + description: An action to type in text. + WaitParam: properties: type: - description: Always `image`. type: string enum: - - image + - wait + description: Specifies the event type. For a wait action, this property is always set to `wait`. + default: wait x-stainless-const: true - image: - type: object - properties: - file_id: - description: The [file](https://developers.openai.com/api/reference/resources/files) ID of the image. - type: string - required: - - file_id + type: object required: - type - - image - x-stainless-naming: - java: - type_name: ImageOutput - kotlin: - type_name: ImageOutput - RunStepDetailsToolCallsCodeOutputLogsObject: - title: Code Interpreter log output + title: Wait + description: A wait action. + ComputerCallSafetyCheckParam: + properties: + id: + type: string + description: The ID of the pending safety check. + code: + anyOf: + - type: string + description: The type of the pending safety check. + - type: 'null' + message: + anyOf: + - type: string + description: Details about the pending safety check. + - type: 'null' type: object - description: Text output from the Code Interpreter tool call as part of a run step. + required: + - id + description: A pending safety check for the computer call. + ComputerCallOutputStatus: + type: string + enum: + - completed + - incomplete + - failed + ToolSearchExecutionType: + type: string + enum: + - server + - client + ToolSearchCall: properties: type: - description: Always `logs`. type: string enum: - - logs + - tool_search_call + description: The type of the item. Always `tool_search_call`. + default: tool_search_call x-stainless-const: true - logs: + id: type: string - description: The text output from the Code Interpreter tool call. + description: The unique ID of the tool search call item. + call_id: + anyOf: + - type: string + description: The unique ID of the tool search call generated by the model. + - type: 'null' + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search was executed by the server or by the client. + arguments: + description: Arguments used for the tool search call. + status: + $ref: '#/components/schemas/FunctionCallStatus' + description: The status of the tool search call item that was recorded. + created_by: + type: string + description: The identifier of the actor that created the item. + type: object required: - type - - logs - x-stainless-naming: - java: - type_name: LogsOutput - kotlin: - type_name: LogsOutput - RunStepDetailsToolCallsFileSearchObject: - title: File search tool call - type: object + - id + - call_id + - execution + - arguments + - status + CallableToolAllowedCaller: + type: string + enum: + - direct + - programmatic + FunctionTool: properties: - id: - type: string - description: The ID of the tool call object. type: type: string - description: The type of tool call. This is always going to be `file_search` for this type of tool call. enum: - - file_search + - function + description: The type of the function tool. Always `function`. + default: function x-stainless-const: true - file_search: - type: object - description: For now, this is always going to be an empty object. - x-oaiTypeLabel: map - properties: - ranking_options: - $ref: '#/components/schemas/RunStepDetailsToolCallsFileSearchRankingOptionsObject' - results: - type: array - description: The results of the file search. - items: - $ref: '#/components/schemas/RunStepDetailsToolCallsFileSearchResultObject' + name: + type: string + description: The name of the function to call. + async: + type: boolean + description: + anyOf: + - type: string + description: A description of the function. Used by the model to determine whether or not to call the function. + - type: 'null' + parameters: + anyOf: + - additionalProperties: {} + type: object + description: A JSON schema object describing the parameters of the function. + x-oaiTypeLabel: map + - type: 'null' + output_schema: + anyOf: + - additionalProperties: {} + type: object + description: A JSON schema object describing the JSON value encoded in string outputs for this function. + x-oaiTypeLabel: map + - type: 'null' + strict: + anyOf: + - type: boolean + description: Whether strict parameter validation is enforced for this function tool. + - type: 'null' + defer_loading: + type: boolean + description: Whether this function is deferred and loaded via tool search. + allowed_callers: + anyOf: + - items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + type: array + description: The tool invocation context(s). + - type: 'null' + type: object required: - - id - type - - file_search - RunStepDetailsToolCallsFileSearchRankingOptionsObject: - title: File search tool call ranking options + - name + - strict + - parameters + title: Function + description: Defines a function in your own code the model can choose to call. Learn more about [function calling](https://developers.openai.com/api/docs/guides/function-calling). + RankerVersionType: + type: string + enum: + - auto + - default-2024-11-15 + HybridSearchOptions: + properties: + embedding_weight: + type: number + description: The weight of the embedding in the reciprocal ranking fusion. + text_weight: + type: number + description: The weight of the text in the reciprocal ranking fusion. type: object - description: The ranking options for the file search. + required: + - embedding_weight + - text_weight + RankingOptions: properties: ranker: - $ref: '#/components/schemas/FileSearchRanker' + $ref: '#/components/schemas/RankerVersionType' + description: The ranker to use for the file search. score_threshold: type: number - description: The score threshold for the file search. All values must be a floating point number between 0 and 1. - minimum: 0 - maximum: 1 - required: - - ranker - - score_threshold - RunStepDetailsToolCallsFileSearchResultObject: - title: File search tool call result + description: The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results. + hybrid_search: + $ref: '#/components/schemas/HybridSearchOptions' + description: Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled. type: object - description: A result instance of the file search. - x-oaiTypeLabel: map + required: [] + Filters: + anyOf: + - $ref: '#/components/schemas/ComparisonFilter' + - $ref: '#/components/schemas/CompoundFilter' + FileSearchTool: properties: - file_id: - type: string - description: The ID of the file that result was found in. - file_name: + type: type: string - description: The name of the file that result was found in. - score: - type: number - description: The score of the result. All values must be a floating point number between 0 and 1. - minimum: 0 - maximum: 1 - content: - type: array - description: The content of the result that was found. The content is only included if requested via the include query parameter. + enum: + - file_search + description: The type of the file search tool. Always `file_search`. + default: file_search + x-stainless-const: true + vector_store_ids: items: - type: object - properties: - type: - type: string - description: The type of the content. - enum: - - text - x-stainless-const: true - text: - type: string - description: The text content of the file. - required: - - file_id - - file_name - - score - RunStepDetailsToolCallsFunctionObject: + type: string + type: array + description: The IDs of the vector stores to search. + max_num_results: + type: integer + description: The maximum number of results to return. This number should be between 1 and 50 inclusive. + ranking_options: + $ref: '#/components/schemas/RankingOptions' + description: Ranking options for search. + filters: + anyOf: + - $ref: '#/components/schemas/Filters' + description: A filter to apply. + - type: 'null' type: object - title: Function tool call + required: + - type + - vector_store_ids + title: File search + description: A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://developers.openai.com/api/docs/guides/tools-file-search). + ComputerTool: properties: - id: - type: string - description: The ID of the tool call object. type: type: string - description: The type of tool call. This is always going to be `function` for this type of tool call. enum: - - function + - computer + description: The type of the computer tool. Always `computer`. + default: computer x-stainless-const: true - function: - type: object - description: The definition of the function that was called. - properties: - name: - type: string - description: The name of the function. - arguments: - type: string - description: The arguments passed to the function. - output: - anyOf: - - type: string - description: The output of the function. This will be `null` if the outputs have not been [submitted](https://developers.openai.com/api/docs/assistants/migration) yet. - - type: 'null' - required: - - name - - arguments - - output + type: object required: - - id - type - - function - RunStepDetailsToolCallsObject: - title: Tool calls - type: object - description: Details of the tool call. + title: Computer + description: A tool that controls a virtual computer. Learn more about the [computer tool](https://developers.openai.com/api/docs/guides/tools-computer-use). + ComputerEnvironment: + type: string + enum: + - windows + - mac + - linux + - ubuntu + - browser + ComputerUsePreviewTool: properties: type: - description: Always `tool_calls`. type: string enum: - - tool_calls + - computer_use_preview + description: The type of the computer use tool. Always `computer_use_preview`. + default: computer_use_preview x-stainless-const: true - tool_calls: - type: array - description: | - An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`. - items: - $ref: '#/components/schemas/RunStepDetailsToolCall' + environment: + $ref: '#/components/schemas/ComputerEnvironment' + description: The type of computer environment to control. + display_width: + type: integer + description: The width of the computer display. + display_height: + type: integer + description: The height of the computer display. + type: object required: - type - - tool_calls - RunStepObject: + - environment + - display_width + - display_height + title: Computer use preview + description: A tool that controls a virtual computer. Learn more about the [computer tool](https://developers.openai.com/api/docs/guides/tools-computer-use). + ContainerMemoryLimit: + type: string + enum: + - 1g + - 4g + - 16g + - 64g + RunStepDeltaObjectDelta: + description: The delta containing the fields that have changed on the run step. type: object - title: Run steps - description: | - Represents a step in execution of a run. properties: - id: - description: The identifier of the run step, which can be referenced in API endpoints. - type: string - object: - description: The object type, which is always `thread.run.step`. + step_details: + type: object + description: The details of the run step. + anyOf: + - $ref: '#/components/schemas/RunStepDeltaStepDetailsMessageCreationObject' + - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsObject' + discriminator: + propertyName: type + ProgrammaticToolCallingParam: + properties: + type: type: string enum: - - thread.run.step + - programmatic_tool_calling + description: The type of the tool. Always `programmatic_tool_calling`. + default: programmatic_tool_calling x-stainless-const: true - created_at: - description: The Unix timestamp (in seconds) for when the run step was created. - type: integer - format: unixtime - assistant_id: - description: The ID of the [assistant](https://developers.openai.com/api/docs/assistants/migration) associated with the run step. - type: string - thread_id: - description: The ID of the [thread](https://developers.openai.com/api/docs/assistants/migration) that was run. - type: string - run_id: - description: The ID of the [run](https://developers.openai.com/api/docs/assistants/migration) that this run step is a part of. - type: string + type: object + required: + - type + InputFidelity: + type: string + enum: + - high + - low + description: Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`. + LocalShellToolParam: + properties: type: - description: The type of run step, which can be either `message_creation` or `tool_calls`. type: string enum: - - message_creation - - tool_calls - status: - description: The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`. + - local_shell + description: The type of the local shell tool. Always `local_shell`. + default: local_shell + x-stainless-const: true + type: object + required: + - type + title: Local shell tool + description: A tool that allows the model to execute shell commands in a local environment. + ContainerAutoParam: + properties: + type: type: string enum: - - in_progress - - cancelled - - failed - - completed - - expired - step_details: - type: object - description: The details of the run step. + - container_auto + description: Automatically creates a container for this request + default: container_auto + x-stainless-const: true + file_ids: + items: + type: string + example: file-123 + type: array + maxItems: 50 + description: An optional list of uploaded files to make available to your code. + memory_limit: anyOf: - - $ref: '#/components/schemas/RunStepDetailsMessageCreationObject' - - $ref: '#/components/schemas/RunStepDetailsToolCallsObject' + - $ref: '#/components/schemas/ContainerMemoryLimit' + description: The memory limit for the container. + - type: 'null' + network_policy: discriminator: propertyName: type - last_error: - anyOf: - - type: object - description: The last error associated with this run step. Will be `null` if there are no errors. - properties: - code: - type: string - description: One of `server_error` or `rate_limit_exceeded`. - enum: - - server_error - - rate_limit_exceeded - message: - type: string - description: A human-readable description of the error. - required: - - code - - message - - type: 'null' - expired_at: - anyOf: - - description: The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired. - type: integer - format: unixtime - - type: 'null' - cancelled_at: - anyOf: - - description: The Unix timestamp (in seconds) for when the run step was cancelled. - type: integer - format: unixtime - - type: 'null' - failed_at: - anyOf: - - description: The Unix timestamp (in seconds) for when the run step failed. - type: integer - format: unixtime - - type: 'null' - completed_at: + description: Network access policy for the container. anyOf: - - description: The Unix timestamp (in seconds) for when the run step completed. - type: integer - format: unixtime - - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - usage: - $ref: '#/components/schemas/RunStepCompletionUsage' + - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' + - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' + skills: + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/SkillReferenceParam' + - $ref: '#/components/schemas/InlineSkillParam' + type: array + maxItems: 200 + description: An optional list of skills referenced by id or inline data. + type: object required: - - id - - object - - created_at - - assistant_id - - thread_id - - run_id - type - - status - - step_details - - last_error - - expired_at - - cancelled_at - - failed_at - - completed_at - - metadata - - usage - x-oaiMeta: - name: The run step object - beta: true - example: | - { - "id": "step_abc123", - "object": "thread.run.step", - "created_at": 1699063291, - "run_id": "run_abc123", - "assistant_id": "asst_abc123", - "thread_id": "thread_abc123", - "type": "message_creation", - "status": "completed", - "cancelled_at": null, - "completed_at": 1699063291, - "expired_at": null, - "failed_at": null, - "last_error": null, - "step_details": { - "type": "message_creation", - "message_creation": { - "message_id": "msg_abc123" - } - }, - "usage": { - "prompt_tokens": 123, - "completion_tokens": 456, - "total_tokens": 579 - } - } - RunStepStreamEvent: - anyOf: - - type: object - properties: - event: - type: string - enum: - - thread.run.step.created - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepObject' - required: - - event - - data - description: Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) is created. - x-oaiMeta: - dataDescription: '`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.step.in_progress - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepObject' - required: - - event - - data - description: Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) moves to an `in_progress` state. - x-oaiMeta: - dataDescription: '`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.step.delta - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepDeltaObject' - required: - - event - - data - description: Occurs when parts of a [run step](https://developers.openai.com/api/docs/assistants/migration) are being streamed. - x-oaiMeta: - dataDescription: '`data` is a [run step delta](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.step.completed - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepObject' - required: - - event - - data - description: Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) is completed. - x-oaiMeta: - dataDescription: '`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.step.failed - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepObject' - required: - - event - - data - description: Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) fails. - x-oaiMeta: - dataDescription: '`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.step.cancelled - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepObject' - required: - - event - - data - description: Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) is cancelled. - x-oaiMeta: - dataDescription: '`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.step.expired - x-stainless-const: true - data: - $ref: '#/components/schemas/RunStepObject' - required: - - event - - data - description: Occurs when a [run step](https://developers.openai.com/api/docs/assistants/migration) expires. - x-oaiMeta: - dataDescription: '`data` is a [run step](https://developers.openai.com/api/docs/assistants/migration)' - discriminator: - propertyName: event - RunStreamEvent: - anyOf: - - type: object - properties: - event: - type: string - enum: - - thread.run.created - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a new [run](https://developers.openai.com/api/docs/assistants/migration) is created. - x-oaiMeta: - dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.queued - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to a `queued` status. - x-oaiMeta: - dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.in_progress - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to an `in_progress` status. - x-oaiMeta: - dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.requires_action - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to a `requires_action` status. - x-oaiMeta: - dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.completed - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) is completed. - x-oaiMeta: - dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.incomplete - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) ends with status `incomplete`. - x-oaiMeta: - dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.failed - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) fails. - x-oaiMeta: - dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.cancelling - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) moves to a `cancelling` status. - x-oaiMeta: - dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.cancelled - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) is cancelled. - x-oaiMeta: - dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' - - type: object - properties: - event: - type: string - enum: - - thread.run.expired - x-stainless-const: true - data: - $ref: '#/components/schemas/RunObject' - required: - - event - - data - description: Occurs when a [run](https://developers.openai.com/api/docs/assistants/migration) expires. - x-oaiMeta: - dataDescription: '`data` is a [run](https://developers.openai.com/api/docs/assistants/migration)' - discriminator: - propertyName: event - RunToolCallObject: - type: object - description: Tool call objects + LocalSkillParam: properties: - id: + name: type: string - description: The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](https://developers.openai.com/api/docs/assistants/migration) endpoint. - type: + description: The name of the skill. + description: type: string - description: The type of tool call the output is required for. For now, this is always `function`. - enum: - - function - x-stainless-const: true - function: - type: object - description: The function definition. - properties: - name: - type: string - description: The name of the function. - arguments: - type: string - description: The arguments that the model expects you to pass to the function. - required: - - name - - arguments - required: - - id - - type - - function - ServiceTier: - anyOf: - - type: string - description: | - Specifies the processing type used for serving the request. - - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. - - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model. - - If set to '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier. - - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request. - - When not set, the default behavior is 'auto'. - - When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. - enum: - - auto - - default - - flex - - scale - - priority - - fast - default: auto - - type: 'null' - ServiceTierResponses: - anyOf: - - type: string - description: | - Specifies the processing type used for serving the request. - - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. - - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model. - - If set to '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier. - - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. The response will show `service_tier=priority` regardless of if you specify `service_tier=fast` or `priority` in your request. - - If set to 'ultrafast', then the request will be processed with the access-controlled Ultrafast Processing service tier. This tier is currently available for `gpt-5.6-sol`; a response served through it will show `service_tier=ultrafast`. - - When not set, the default behavior is 'auto'. - - When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. - enum: - - auto - - default - - flex - - scale - - priority - - fast - - ultrafast - default: auto - - type: 'null' - SpeechAudioDeltaEvent: + description: The description of the skill. + path: + type: string + description: The path to the directory containing the skill. type: object - description: Emitted for each chunk of audio data generated during speech synthesis. + required: + - name + - description + - path + LocalEnvironmentParam: properties: type: type: string - description: | - The type of the event. Always `speech.audio.delta`. enum: - - speech.audio.delta + - local + description: Use a local computer environment. + default: local x-stainless-const: true - audio: - type: string - description: | - A chunk of Base64-encoded audio data. + skills: + items: + $ref: '#/components/schemas/LocalSkillParam' + type: array + maxItems: 200 + description: An optional list of skills. + type: object required: - type - - audio - x-oaiMeta: - name: Stream Event (speech.audio.delta) - group: speech - example: | - { - "type": "speech.audio.delta", - "audio": "base64-encoded-audio-data" - } - SpeechAudioDoneEvent: - type: object - description: Emitted when the speech synthesis is complete and all audio has been streamed. + ContainerReferenceParam: properties: type: type: string - description: | - The type of the event. Always `speech.audio.done`. enum: - - speech.audio.done + - container_reference + description: References a container created with the /v1/containers endpoint + default: container_reference x-stainless-const: true - usage: - type: object - description: | - Token usage statistics for the request. - properties: - input_tokens: - type: integer - description: Number of input tokens in the prompt. - output_tokens: - type: integer - description: Number of output tokens generated. - total_tokens: - type: integer - description: Total number of tokens used (input + output). - required: - - input_tokens - - output_tokens - - total_tokens + container_id: + type: string + description: The ID of the referenced container. + example: cntr_123 + type: object required: - type - - usage - x-oaiMeta: - name: Stream Event (speech.audio.done) - group: speech - example: | - { - "type": "speech.audio.done", - "usage": { - "input_tokens": 14, - "output_tokens": 101, - "total_tokens": 115 - } - } - SpendAlertNotificationChannel: - type: object - description: Email notification settings for a spend alert. + - container_id + FunctionShellToolParam: properties: type: type: string enum: - - email - description: The notification channel type. Currently only `email` is supported. + - shell + description: The type of the shell tool. Always `shell`. + default: shell x-stainless-const: true - recipients: - type: array - description: Email addresses that receive the spend alert notification. - items: - type: string - subject_prefix: + environment: anyOf: - - type: string + - discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/ContainerAutoParam' + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' + - type: 'null' + allowed_callers: + anyOf: + - items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + type: array + minItems: 1 + description: The tool invocation context(s). - type: 'null' - description: Optional subject prefix for alert emails. - required: - - type - - recipients - StaticChunkingStrategy: type: object - additionalProperties: false - properties: - max_chunk_size_tokens: - type: integer - minimum: 100 - maximum: 4096 - description: The maximum number of tokens in each chunk. The default value is `800`. The minimum value is `100` and the maximum value is `4096`. - chunk_overlap_tokens: - type: integer - description: | - The number of tokens that overlap between chunks. The default value is `400`. - - Note that the overlap must not exceed half of `max_chunk_size_tokens`. required: - - max_chunk_size_tokens - - chunk_overlap_tokens - StaticChunkingStrategyRequestParam: - type: object - title: Static Chunking Strategy - description: Customize your own chunking strategy by setting chunk size and chunk overlap. - additionalProperties: false + - type + title: Shell tool + description: A tool that allows the model to execute shell commands. + CustomTextFormatParam: properties: type: type: string - description: Always `static`. enum: - - static + - text + description: Unconstrained text format. Always `text`. + default: text x-stainless-const: true - static: - $ref: '#/components/schemas/StaticChunkingStrategy' + type: object required: - type - - static - StaticChunkingStrategyResponseParam: - type: object - title: Static Chunking Strategy - additionalProperties: false + title: Text format + description: Unconstrained free-form text. + GrammarSyntax1: + type: string + enum: + - lark + - regex + CustomGrammarFormatParam: properties: type: type: string - description: Always `static`. enum: - - static + - grammar + description: Grammar format. Always `grammar`. + default: grammar x-stainless-const: true - static: - $ref: '#/components/schemas/StaticChunkingStrategy' - required: - - type - - static - StopConfiguration: - description: | - Not supported with latest reasoning models `o3` and `o4-mini`. - - Up to 4 sequences where the API will stop generating further tokens. The - returned text will not contain the stop sequence. - anyOf: - - type: string - default: <|endoftext|> - example: |2+ - - nullable: true - - type: array - minItems: 1 - maxItems: 4 - items: + syntax: + $ref: '#/components/schemas/GrammarSyntax1' + description: The syntax of the grammar definition. One of `lark` or `regex`. + definition: type: string - example: '["\n"]' - nullable: true - SubmitToolOutputsRunRequest: + description: The grammar definition. type: object - additionalProperties: false - properties: - tool_outputs: - description: A list of tools for which the outputs are being submitted. - type: array - items: - type: object - properties: - tool_call_id: - type: string - description: The ID of the tool call in the `required_action` object within the run object the output is being submitted for. - output: - type: string - description: The output of the tool call to be submitted to continue the run. - stream: - anyOf: - - type: boolean - description: | - If `true`, returns a stream of events that happen during the Run as server-sent events, terminating when the Run enters a terminal state with a `data: [DONE]` message. - - type: 'null' required: - - tool_outputs - TextResponseFormatConfiguration: - description: | - An object specifying the format that the model must output. - - Configuring `{ "type": "json_schema" }` enables Structured Outputs, - which ensures the model will match your supplied JSON schema. Learn more in the - [Structured Outputs guide](https://developers.openai.com/api/docs/guides/structured-outputs). - - The default format is `{ "type": "text" }` with no additional options. - - **Not recommended for gpt-4o and newer models:** - - Setting to `{ "type": "json_object" }` enables the older JSON mode, which - ensures the message the model generates is valid JSON. Using `json_schema` - is preferred for models that support it. - anyOf: - - $ref: '#/components/schemas/ResponseFormatText' - - $ref: '#/components/schemas/TextResponseFormatJsonSchema' - - $ref: '#/components/schemas/ResponseFormatJsonObject' - discriminator: - propertyName: type - TextResponseFormatJsonSchema: - type: object - title: JSON schema - description: | - JSON Schema response format. Used to generate structured JSON responses. - Learn more about [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). + - type + - syntax + - definition + title: Grammar format + description: A grammar defined by the user. + CustomToolParam: properties: type: type: string - description: The type of response format being defined. Always `json_schema`. enum: - - json_schema + - custom + description: The type of the custom tool. Always `custom`. + default: custom x-stainless-const: true - description: - type: string - description: | - A description of what the response format is for, used by the model to - determine how to respond in the format. name: type: string - description: | - The name of the response format. Must be a-z, A-Z, 0-9, or contain - underscores and dashes, with a maximum length of 64. - schema: - $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' - strict: + description: The name of the custom tool, used to identify it in tool calls. + async: + type: boolean + description: Whether the tool response can be returned asynchronously versus immediately returned on next response creation. + description: + type: string + description: Optional description of the custom tool, used to provide more context. + format: + discriminator: + propertyName: type + description: The input format for the custom tool. Default is unconstrained text. anyOf: - - type: boolean - default: false - description: | - Whether to enable strict schema adherence when generating the output. - If set to true, the model will always follow the exact schema defined - in the `schema` field. Only a subset of JSON Schema is supported when - `strict` is `true`. To learn more, read the [Structured Outputs - guide](https://developers.openai.com/api/docs/guides/structured-outputs). + - $ref: '#/components/schemas/CustomTextFormatParam' + - $ref: '#/components/schemas/CustomGrammarFormatParam' + defer_loading: + type: boolean + description: Whether this tool should be deferred and discovered via tool search. + allowed_callers: + anyOf: + - items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + type: array + minItems: 1 + description: The tool invocation context(s). - type: 'null' + type: object required: - type - - schema - name - ThreadObject: + title: Custom tool + description: A custom tool that processes input using a specified format. Learn more about [custom tools](https://developers.openai.com/api/docs/guides/function-calling#custom-tools) + EmptyModelParam: + properties: {} type: object - title: Thread - description: Represents a thread that contains [messages](https://developers.openai.com/api/docs/assistants/migration). + required: [] + FunctionToolParam: properties: - id: - description: The identifier, which can be referenced in API endpoints. + name: type: string - object: - description: The object type, which is always `thread`. + maxLength: 128 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: + anyOf: + - type: string + - type: 'null' + parameters: + anyOf: + - $ref: '#/components/schemas/EmptyModelParam' + - type: 'null' + strict: + anyOf: + - type: boolean + description: Whether to enforce strict parameter validation. If omitted, Responses attempts to use strict validation when the schema is compatible, and falls back to non-strict validation otherwise. + - type: 'null' + type: type: string enum: - - thread + - function + default: function x-stainless-const: true - created_at: - description: The Unix timestamp (in seconds) for when the thread was created. - type: integer - format: unixtime - tool_resources: + async: + type: boolean + description: Whether the tool response can be returned asynchronously versus immediately returned on next response creation. + output_schema: anyOf: - - type: object - description: | - A set of resources that are made available to the assistant's tools in this thread. The resources are specific to the type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - properties: - code_interpreter: - type: object - properties: - file_ids: - type: array - description: | - A list of [file](https://developers.openai.com/api/reference/resources/files) IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. - default: [] - maxItems: 20 - items: - type: string - file_search: - type: object - properties: - vector_store_ids: - type: array - description: | - The [vector store](https://developers.openai.com/api/reference/resources/vector_stores) attached to this thread. There can be a maximum of 1 vector store attached to the thread. - maxItems: 1 - items: - type: string + - additionalProperties: {} + type: object + description: A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs. + x-oaiTypeLabel: map + - type: 'null' + defer_loading: + type: boolean + description: Whether this function should be deferred and discovered via tool search. + allowed_callers: + anyOf: + - items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + type: array + minItems: 1 + description: The tool invocation context(s). - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' - required: - - id - - object - - created_at - - tool_resources - - metadata - x-oaiMeta: - name: The thread object - beta: true - example: | - { - "id": "thread_abc123", - "object": "thread", - "created_at": 1698107661, - "metadata": {} - } - ThreadStreamEvent: - anyOf: - - type: object - properties: - enabled: - type: boolean - description: Whether to enable input audio transcription. - event: - type: string - enum: - - thread.created - x-stainless-const: true - data: - $ref: '#/components/schemas/ThreadObject' - required: - - event - - data - description: Occurs when a new [thread](https://developers.openai.com/api/docs/assistants/migration) is created. - x-oaiMeta: - dataDescription: '`data` is a [thread](https://developers.openai.com/api/docs/assistants/migration)' - discriminator: - propertyName: event - ToggleCertificatesRequest: type: object + required: + - name + - type + NamespaceToolParam: properties: - certificate_ids: - type: array + type: + type: string + enum: + - namespace + description: The type of the tool. Always `namespace`. + default: namespace + x-stainless-const: true + name: + type: string + minLength: 1 + description: The namespace name used in tool calls (for example, `crm`). + description: + type: string + description: A description of the namespace shown to the model. + tools: items: - type: string - example: cert_abc + discriminator: + propertyName: type + description: A function or custom tool that belongs to a namespace. + anyOf: + - $ref: '#/components/schemas/FunctionToolParam' + - $ref: '#/components/schemas/CustomToolParam' + type: array minItems: 1 - maxItems: 10 + description: The function/custom tools available inside this namespace. + type: object required: - - certificate_ids - Tool: - description: | - A tool that can be used to generate a response. - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/FunctionTool' - - $ref: '#/components/schemas/FileSearchTool' - - $ref: '#/components/schemas/ComputerTool' - - $ref: '#/components/schemas/ComputerUsePreviewTool' - - $ref: '#/components/schemas/WebSearchTool' - - $ref: '#/components/schemas/MCPTool' - - $ref: '#/components/schemas/CodeInterpreterTool' - - $ref: '#/components/schemas/ProgrammaticToolCallingParam' - - $ref: '#/components/schemas/ImageGenTool' - - $ref: '#/components/schemas/LocalShellToolParam' - - $ref: '#/components/schemas/FunctionShellToolParam' - - $ref: '#/components/schemas/CustomToolParam' - - $ref: '#/components/schemas/NamespaceToolParam' - - $ref: '#/components/schemas/ToolSearchToolParam' - - $ref: '#/components/schemas/WebSearchPreviewTool' - - $ref: '#/components/schemas/ApplyPatchToolParam' - ToolChoiceAllowed: + - type + - name + - description + - tools + title: Namespace + description: Groups function/custom tools under a shared namespace. + ToolSearchToolParam: + properties: + type: + type: string + enum: + - tool_search + description: The type of the tool. Always `tool_search`. + default: tool_search + x-stainless-const: true + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search is executed by the server or by the client. + description: + anyOf: + - type: string + description: Description shown to the model for a client-executed tool search tool. + - type: 'null' + parameters: + anyOf: + - $ref: '#/components/schemas/EmptyModelParam' + description: Parameter schema for a client-executed tool search tool. + - type: 'null' + type: object + required: + - type + title: Tool search tool + description: Hosted or BYOT tool search configuration for deferred tools. + ApproximateLocation: + properties: + type: + type: string + enum: + - approximate + description: The type of location approximation. Always `approximate`. + default: approximate + x-stainless-const: true + country: + anyOf: + - type: string + description: The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`. + - type: 'null' + region: + anyOf: + - type: string + description: Free text input for the region of the user, e.g. `California`. + - type: 'null' + city: + anyOf: + - type: string + description: Free text input for the city of the user, e.g. `San Francisco`. + - type: 'null' + timezone: + anyOf: + - type: string + description: The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`. + - type: 'null' type: object - title: Allowed tools - description: | - Constrains the tools available to the model to a pre-defined set. + required: + - type + SearchContextSize: + type: string + enum: + - low + - medium + - high + SearchContentType: + type: string + enum: + - text + - image + WebSearchPreviewTool: properties: type: type: string enum: - - allowed_tools - description: Allowed tool configuration type. Always `allowed_tools`. + - web_search_preview + - web_search_preview_2025_03_11 + description: The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`. + default: web_search_preview x-stainless-const: true - mode: - type: string - enum: - - auto - - required - description: | - Constrains the tools available to the model to a pre-defined set. - - `auto` allows the model to pick from among the allowed tools and generate a - message. - - `required` requires the model to call one or more of the allowed tools. - tools: - type: array - description: | - A list of tool definitions that the model should be allowed to call. - - For the Responses API, the list of tool definitions might look like: - ```json - [ - { "type": "function", "name": "get_weather" }, - { "type": "mcp", "server_label": "deepwiki" }, - { "type": "image_generation" } - ] - ``` + user_location: + anyOf: + - $ref: '#/components/schemas/ApproximateLocation' + description: The user's location. + - type: 'null' + search_context_size: + $ref: '#/components/schemas/SearchContextSize' + description: High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default. + search_content_types: items: - type: object - description: | - A tool definition that the model should be allowed to call. - additionalProperties: true - x-oaiExpandable: false + $ref: '#/components/schemas/SearchContentType' + type: array + type: object required: - type - - mode - - tools - ToolChoiceCustom: + title: Web search preview + description: This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://developers.openai.com/api/docs/guides/tools-web-search). + ApplyPatchToolParam: + properties: + type: + type: string + enum: + - apply_patch + description: The type of the tool. Always `apply_patch`. + default: apply_patch + x-stainless-const: true + allowed_callers: + anyOf: + - items: + $ref: '#/components/schemas/CallableToolAllowedCaller' + type: array + minItems: 1 + description: The tool invocation context(s). + - type: 'null' type: object - title: Custom tool - description: | - Use this option to force the model to call a specific custom tool. + required: + - type + title: Apply patch tool + description: Allows the assistant to create, delete, or update files using unified diffs. + ToolSearchOutput: properties: type: type: string enum: - - custom - description: For custom tool calling, the type is always `custom`. + - tool_search_output + description: The type of the item. Always `tool_search_output`. + default: tool_search_output x-stainless-const: true - name: + id: type: string - description: The name of the custom tool to call. + description: The unique ID of the tool search output item. + call_id: + anyOf: + - type: string + description: The unique ID of the tool search call generated by the model. + - type: 'null' + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search was executed by the server or by the client. + tools: + items: + $ref: '#/components/schemas/Tool' + type: array + description: The loaded tool definitions returned by tool search. + status: + $ref: '#/components/schemas/FunctionCallOutputStatusEnum' + description: The status of the tool search output item that was recorded. + created_by: + type: string + description: The identifier of the actor that created the item. + type: object required: - type - - name - ToolChoiceFunction: - type: object - title: Function tool - description: | - Use this option to force the model to call a specific function. + - id + - call_id + - execution + - tools + - status + AdditionalTools: properties: type: type: string enum: - - function - description: For function calling, the type is always `function`. + - additional_tools + description: The type of the item. Always `additional_tools`. + default: additional_tools x-stainless-const: true - name: + id: type: string - description: The name of the function to call. + description: The unique ID of the additional tools item. + role: + $ref: '#/components/schemas/MessageRole' + description: The role that provided the additional tools. + tools: + items: + $ref: '#/components/schemas/Tool' + type: array + description: The additional tool definitions made available at this item. + type: object required: - type - - name - ToolChoiceMCP: - type: object - title: MCP tool - description: | - Use this option to force the model to call a specific tool on a remote MCP server. + - id + - role + - tools + Program: properties: type: type: string enum: - - mcp - description: For MCP tools, the type is always `mcp`. + - program + description: The type of the item. Always `program`. + default: program x-stainless-const: true - server_label: + id: type: string - description: | - The label of the MCP server to use. - name: - anyOf: - - type: string - description: | - The name of the tool to call on the server. - - type: 'null' + description: The unique ID of the program item. + call_id: + type: string + description: The stable call ID of the program item. + code: + type: string + description: The JavaScript source executed by programmatic tool calling. + fingerprint: + type: string + description: Opaque program replay fingerprint that must be round-tripped. + type: object required: - type - - server_label - ToolChoiceOptions: + - id + - call_id + - code + - fingerprint + ProgramOutputStatus: type: string - title: Tool choice mode - description: | - Controls which (if any) tool is called by the model. - - `none` means the model will not call any tool and instead generates a message. - - `auto` means the model can pick between generating a message or calling one or - more tools. - - `required` means the model must call one or more tools. enum: - - none - - auto - - required - ToolChoiceParam: - description: | - How the model should select which tool (or tools) to use when generating - a response. See the `tools` parameter to see how to specify which tools - the model can call. - anyOf: - - $ref: '#/components/schemas/ToolChoiceOptions' - - $ref: '#/components/schemas/ToolChoiceAllowed' - - $ref: '#/components/schemas/ToolChoiceTypes' - - $ref: '#/components/schemas/ToolChoiceFunction' - - $ref: '#/components/schemas/ToolChoiceMCP' - - $ref: '#/components/schemas/ToolChoiceCustom' - - $ref: '#/components/schemas/SpecificProgrammaticToolCallingParam' - - $ref: '#/components/schemas/SpecificApplyPatchParam' - - $ref: '#/components/schemas/SpecificFunctionShellParam' - discriminator: - propertyName: type - ToolChoiceTypes: - type: object - title: Hosted tool - description: | - Indicates that the model should use a built-in tool to generate a response. - [Learn more about built-in tools](https://developers.openai.com/api/docs/guides/tools). + - completed + - incomplete + ProgramOutput: properties: type: type: string - description: | - The type of hosted tool the model should to use. Learn more about - [built-in tools](https://developers.openai.com/api/docs/guides/tools). - - Allowed values are: - - `file_search` - - `web_search_preview` - - `computer` - - `computer_use_preview` - - `computer_use` - - `code_interpreter` - - `image_generation` enum: - - file_search - - web_search_preview - - computer - - computer_use_preview - - computer_use - - web_search_preview_2025_03_11 - - image_generation - - code_interpreter + - program_output + description: The type of the item. Always `program_output`. + default: program_output + x-stainless-const: true + id: + type: string + description: The unique ID of the program output item. + call_id: + type: string + description: The call ID of the program item. + result: + type: string + description: The result produced by the program item. + status: + $ref: '#/components/schemas/ProgramOutputStatus' + description: The terminal status of the program output item. + type: object required: - type - ToolsArray: - type: array - description: | - An array of tools the model may call while generating a response. You - can specify which tool to use by setting the `tool_choice` parameter. - - We support the following categories of tools: - - **Built-in tools**: Tools that are provided by OpenAI that extend the - model's capabilities, like [web search](https://developers.openai.com/api/docs/guides/tools-web-search) - or [file search](https://developers.openai.com/api/docs/guides/tools-file-search). Learn more about - [built-in tools](https://developers.openai.com/api/docs/guides/tools). - - **MCP Tools**: Integrations with third-party systems via custom MCP servers - or predefined connectors such as Google Drive and SharePoint. Learn more about - [MCP Tools](https://developers.openai.com/api/docs/guides/tools-connectors-mcp). - - **Function calls (custom tools)**: Functions that are defined by you, - enabling the model to call your own code with strongly typed arguments - and outputs. Learn more about - [function calling](https://developers.openai.com/api/docs/guides/function-calling). You can also use - custom tools to call your own code. - items: - $ref: '#/components/schemas/Tool' - TranscriptTextDeltaEvent: - type: object - description: Emitted when there is an additional text delta. This is also the first event emitted when the transcription starts. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`. + - id + - call_id + - result + - status + CompactionBody: properties: type: type: string - description: | - The type of the event. Always `transcript.text.delta`. enum: - - transcript.text.delta + - compaction + description: The type of the item. Always `compaction`. + default: compaction x-stainless-const: true - delta: + id: type: string - description: | - The text delta that was additionally transcribed. - logprobs: - type: array - description: | - The log probabilities of the delta. Only included if you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `include[]` parameter set to `logprobs`. - items: - type: object - properties: - token: - type: string - description: | - The token that was used to generate the log probability. - logprob: - type: number - description: | - The log probability of the token. - bytes: - type: array - items: - type: integer - description: | - The bytes that were used to generate the log probability. - segment_id: + description: The unique ID of the compaction item. + encrypted_content: type: string - description: | - Identifier of the diarized segment that this delta belongs to. Only present when using `gpt-4o-transcribe-diarize`. + description: The encrypted content that was produced by compaction. + created_by: + type: string + description: The identifier of the actor that created the item. + type: object required: - type - - delta - x-oaiMeta: - name: Stream Event (transcript.text.delta) - group: transcript - example: | - { - "type": "transcript.text.delta", - "delta": " wonderful" - } - TranscriptTextDoneEvent: - type: object - description: Emitted when the transcription is complete. Contains the complete transcription text. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `Stream` parameter set to `true`. + - id + - encrypted_content + title: Compaction item + description: A compaction item generated by the [`v1/responses/compact` API](https://developers.openai.com/api/reference/resources/responses/methods/compact). + CodeInterpreterOutputLogs: properties: type: type: string - description: | - The type of the event. Always `transcript.text.done`. enum: - - transcript.text.done + - logs + description: The type of the output. Always `logs`. + default: logs x-stainless-const: true - text: + logs: type: string - description: | - The text that was transcribed. - languages: - type: array - description: | - The languages detected in the audio. Returned by `gpt-transcribe`. An empty array indicates that no language could be reliably detected. - items: - $ref: '#/components/schemas/TranscriptionLanguage' - logprobs: - type: array - description: | - The log probabilities of the individual tokens in the transcription. Only included if you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with the `include[]` parameter set to `logprobs`. - items: - type: object - properties: - token: - type: string - description: | - The token that was used to generate the log probability. - logprob: - type: number - description: | - The log probability of the token. - bytes: - type: array - items: - type: integer - description: | - The bytes that were used to generate the log probability. - usage: - $ref: '#/components/schemas/TranscriptTextUsageTokens' + description: The logs output from the code interpreter. + type: object required: - type - - text - x-oaiMeta: - name: Stream Event (transcript.text.done) - group: transcript - example: | - { - "type": "transcript.text.done", - "text": "I see skies of blue and clouds of white, the bright blessed days, the dark sacred nights, and I think to myself, what a wonderful world.", - "usage": { - "type": "tokens", - "input_tokens": 14, - "input_token_details": { - "text_tokens": 10, - "audio_tokens": 4 - }, - "output_tokens": 31, - "total_tokens": 45 - } - } - TranscriptTextSegmentEvent: - type: object - description: | - Emitted when a diarized transcription returns a completed segment with speaker information. Only emitted when you [create a transcription](https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create) with `stream` set to `true` and `response_format` set to `diarized_json`. + - logs + title: Code interpreter output logs + description: The logs output from the code interpreter. + CodeInterpreterOutputImage: properties: type: type: string - description: The type of the event. Always `transcript.text.segment`. enum: - - transcript.text.segment + - image + description: The type of the output. Always `image`. + default: image x-stainless-const: true - id: - type: string - description: Unique identifier for the segment. - start: - type: number - format: double - description: Start timestamp of the segment in seconds. - end: - type: number - format: double - description: End timestamp of the segment in seconds. - text: - type: string - description: Transcript text for this segment. - speaker: + url: type: string - description: Speaker label for this segment. + format: uri + description: The URL of the image output from the code interpreter. + type: object required: - type - - id - - start - - end - - text - - speaker - x-oaiMeta: - name: Stream Event (transcript.text.segment) - group: transcript - example: | - { - "type": "transcript.text.segment", - "id": "seg_002", - "start": 5.2, - "end": 12.8, - "text": "Hi, I need help with diarization.", - "speaker": "A" - } - TranscriptTextUsageDuration: + - url + title: Code interpreter output image + description: The image output from the code interpreter. + LocalShellExecAction: + properties: + type: + type: string + enum: + - exec + description: The type of the local shell action. Always `exec`. + default: exec + x-stainless-const: true + command: + items: + type: string + type: array + description: The command to run. + timeout_ms: + anyOf: + - type: integer + description: Optional timeout in milliseconds for the command. + - type: 'null' + working_directory: + anyOf: + - type: string + description: Optional working directory to run the command in. + - type: 'null' + env: + additionalProperties: + type: string + type: object + description: Environment variables to set for the command. + x-oaiTypeLabel: map + user: + anyOf: + - type: string + description: Optional user to run the command as. + - type: 'null' type: object - title: TranscriptTextUsageDuration - description: Usage statistics for models billed by audio input duration. + required: + - type + - command + - env + title: Local shell exec action + description: Execute a shell command on the server. + FunctionShellAction: + properties: + commands: + items: + type: string + description: A list of commands to run. + type: array + timeout_ms: + anyOf: + - type: integer + description: Optional timeout in milliseconds for the commands. + - type: 'null' + max_output_length: + anyOf: + - type: integer + description: Optional maximum number of characters to return from each command. + - type: 'null' + type: object + required: + - commands + - timeout_ms + - max_output_length + title: Shell exec action + description: Execute a shell command. + FunctionShellCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + LocalEnvironmentResource: properties: type: type: string enum: - - duration - description: The type of the usage object. Always `duration` for this variant. + - local + description: The environment type. Always `local`. + default: local x-stainless-const: true - seconds: - type: number - format: double - description: Duration of the input audio in seconds. + type: object required: - type - - seconds - TranscriptTextUsageTokens: - type: object - title: TranscriptTextUsageTokens - description: Usage statistics for models billed by token usage. + title: Local Environment + description: Represents the use of a local environment to perform shell actions. + ContainerReferenceResource: properties: type: type: string enum: - - tokens - description: The type of the usage object. Always `tokens` for this variant. + - container_reference + description: The environment type. Always `container_reference`. + default: container_reference x-stainless-const: true - input_tokens: - type: integer - description: Number of input tokens billed for this request. - input_token_details: - type: object - description: Details about the input tokens billed for this request. - properties: - text_tokens: - type: integer - description: Number of text tokens billed for this request. - audio_tokens: - type: integer - description: Number of audio tokens billed for this request. - output_tokens: - type: integer - description: Number of output tokens generated. - total_tokens: - type: integer - description: Total number of tokens used (input + output). + container_id: + type: string + type: object required: - type - - input_tokens - - output_tokens - - total_tokens - TranscriptionChunkingStrategy: - anyOf: - - description: 'Controls how the audio is cut into chunks. When set to `"auto"`, the server first normalizes loudness and then uses voice activity detection (VAD) to choose boundaries. `server_vad` object can be provided to tweak VAD detection parameters manually. If unset, the audio is transcribed as a single block. Required when using `gpt-4o-transcribe-diarize` for inputs longer than 30 seconds. ' - anyOf: - - type: string - enum: - - auto - default: auto - description: | - Automatically set chunking parameters based on the audio. Must be set to `"auto"`. - x-stainless-const: true - - $ref: '#/components/schemas/VadConfig' - x-oaiTypeLabel: string - - type: 'null' - TranscriptionDiarizedSegment: - type: object - description: A segment of diarized transcript text with speaker metadata. + - container_id + title: Container Reference + description: Represents a container created with /v1/containers. + FunctionShellCall: properties: type: type: string - description: | - The type of the segment. Always `transcript.text.segment`. enum: - - transcript.text.segment + - shell_call + description: The type of the item. Always `shell_call`. + default: shell_call x-stainless-const: true id: type: string - description: Unique identifier for the segment. - start: - type: number - format: double - description: Start timestamp of the segment in seconds. - end: - type: number - format: double - description: End timestamp of the segment in seconds. - text: + description: The unique ID of the shell tool call. Populated when this item is returned via API. + call_id: type: string - description: Transcript text for this segment. - speaker: + description: The unique ID of the shell tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCaller' + description: The execution context that produced this tool call. + - type: 'null' + action: + $ref: '#/components/schemas/FunctionShellAction' + description: The shell commands and limits that describe how to run the tool call. + status: + $ref: '#/components/schemas/FunctionShellCallStatus' + description: The status of the shell call. One of `in_progress`, `completed`, or `incomplete`. + environment: + anyOf: + - discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LocalEnvironmentResource' + - $ref: '#/components/schemas/ContainerReferenceResource' + - type: 'null' + created_by: type: string - description: | - Speaker label for this segment. When known speakers are provided, the label matches `known_speaker_names[]`. Otherwise speakers are labeled sequentially using capital letters (`A`, `B`, ...). + description: The ID of the entity that created this tool call. + type: object required: - type - id - - start - - end - - text - - speaker - TranscriptionInclude: + - call_id + - action + - status + - environment + title: Shell tool call + description: A tool call that executes one or more shell commands in a managed environment. + FunctionShellCallOutputStatusEnum: type: string enum: - - logprobs - TranscriptionLanguage: - type: object - description: A language detected in transcribed audio. - properties: - code: - type: string - description: The code of a language detected in the audio. - required: - - code - TranscriptionSegment: - type: object - properties: - id: - type: integer - description: Unique identifier of the segment. - seek: - type: integer - description: Seek offset of the segment. - start: - type: number - format: double - description: Start time of the segment in seconds. - end: - type: number - format: double - description: End time of the segment in seconds. - text: - type: string - description: Text content of the segment. - tokens: - type: array - items: - type: integer - description: Array of token IDs for the text content. - temperature: - type: number - format: float - description: Temperature parameter used for generating the segment. - avg_logprob: - type: number - format: float - description: Average logprob of the segment. If the value is lower than -1, consider the logprobs failed. - compression_ratio: - type: number - format: float - description: Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed. - no_speech_prob: - type: number - format: float - description: Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent. - required: - - id - - seek - - start - - end - - text - - tokens - - temperature - - avg_logprob - - compression_ratio - - no_speech_prob - TranscriptionWord: - type: object - properties: - word: - type: string - description: The text content of the word. - start: - type: number - format: double - description: Start time of the word in seconds. - end: - type: number - format: double - description: End time of the word in seconds. - required: - - word - - start - - end - TruncationObject: - type: object - title: Thread Truncation Controls - description: Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. + - in_progress + - completed + - incomplete + FunctionShellCallOutputTimeoutOutcome: properties: type: type: string - description: The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`. enum: - - auto - - last_messages - last_messages: - anyOf: - - type: integer - description: The number of most recent messages from the thread when constructing the context for the run. - minimum: 1 - - type: 'null' - required: - - type - UpdateGroupBody: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true type: object - description: Request payload for updating the details of an existing group. - properties: - name: - type: string - description: New display name for the group. - minLength: 1 - maxLength: 255 required: - - name - x-oaiMeta: - example: | - { - "name": "Escalations" - } - UpdateOrganizationDataRetentionBody: - type: object - description: Parameters for updating organization data retention controls. + - type + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + FunctionShellCallOutputExitOutcome: properties: - retention_type: + type: type: string enum: - - zero_data_retention - - modified_abuse_monitoring - - enhanced_zero_data_retention - - enhanced_modified_abuse_monitoring - description: The desired organization data retention type. - required: - - retention_type - UpdateProjectDataRetentionBody: + - exit + description: The outcome type. Always `exit`. + default: exit + x-stainless-const: true + exit_code: + type: integer + description: Exit code from the shell process. type: object - description: Parameters for updating project data retention controls. - properties: - retention_type: - type: string - enum: - - organization_default - - none - - zero_data_retention - - modified_abuse_monitoring - - enhanced_zero_data_retention - - enhanced_modified_abuse_monitoring - description: The desired project data retention type. required: - - retention_type - UpdateProjectServiceAccountBody: - type: object - description: Parameters for updating a project service account. + - type + - exit_code + title: Shell call exit outcome + description: Indicates that the shell commands finished and returned an exit code. + FunctionShellCallOutputContent: properties: - name: + stdout: type: string - description: The updated service account name. - role: + description: The standard output that was captured. + stderr: type: string - enum: - - member - - owner - description: The updated service account role. - UpdateVectorStoreFileAttributesRequest: - type: object - additionalProperties: false - properties: - attributes: - $ref: '#/components/schemas/VectorStoreFileAttributes' - required: - - attributes - x-oaiMeta: - name: Update vector store file attributes request - UpdateVectorStoreRequest: - type: object - additionalProperties: false - properties: - name: - description: The name of the vector store. + description: The standard error output that was captured. + outcome: + discriminator: + propertyName: type + title: Shell call outcome + description: Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk. + anyOf: + - $ref: '#/components/schemas/FunctionShellCallOutputTimeoutOutcome' + - $ref: '#/components/schemas/FunctionShellCallOutputExitOutcome' + created_by: type: string - nullable: true - expires_after: - allOf: - - $ref: '#/components/schemas/VectorStoreExpirationAfter' - - nullable: true - metadata: - $ref: '#/components/schemas/Metadata' - UpdateVoiceConsentRequest: + description: The identifier of the actor that created the item. type: object - additionalProperties: false - properties: - name: - type: string - description: The updated label for this consent recording. required: - - name - Upload: - type: object - title: Upload - description: | - The Upload object can accept byte chunks in the form of Parts. + - stdout + - stderr + - outcome + title: Shell call output content + description: The content of a shell tool call output that was emitted. + FunctionShellCallOutput: properties: - id: + type: type: string - description: The Upload unique identifier, which can be referenced in API endpoints. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the Upload was created. - filename: + enum: + - shell_call_output + description: The type of the shell call output. Always `shell_call_output`. + default: shell_call_output + x-stainless-const: true + id: type: string - description: The name of the file to be uploaded. - bytes: - type: integer - description: The intended number of bytes to be uploaded. - purpose: + description: The unique ID of the shell call output. Populated when this item is returned via API. + call_id: type: string - description: The intended purpose of the file. [Please refer here](https://developers.openai.com/api/reference/resources/files#%28resource%29%20files%20%3E%20%28model%29%20file_object%20%3E%20%28schema%29%20%3E%20%28property%29%20purpose) for acceptable values. + description: The unique ID of the shell tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCaller' + description: The execution context that produced this tool call. + - type: 'null' status: + $ref: '#/components/schemas/FunctionShellCallOutputStatusEnum' + description: The status of the shell call output. One of `in_progress`, `completed`, or `incomplete`. + output: + items: + $ref: '#/components/schemas/FunctionShellCallOutputContent' + type: array + description: An array of shell call output contents + max_output_length: + anyOf: + - type: integer + description: The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output. + - type: 'null' + created_by: type: string - description: The status of the Upload. - enum: - - pending - - completed - - cancelled - - expired - expires_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the Upload will expire. - object: - type: string - description: The object type, which is always "upload". - enum: - - upload - x-stainless-const: true - file: - allOf: - - $ref: '#/components/schemas/OpenAIFile' - - nullable: true - description: The ready File object after the Upload is completed. + description: The identifier of the actor that created the item. + type: object required: - - bytes - - created_at - - expires_at - - filename + - type - id - - purpose + - call_id - status - - object - x-oaiMeta: - name: The upload object - example: | - { - "id": "upload_abc123", - "object": "upload", - "bytes": 2147483648, - "created_at": 1719184911, - "filename": "training_examples.jsonl", - "purpose": "fine-tune", - "status": "completed", - "expires_at": 1719127296, - "file": { - "id": "file-xyz321", - "object": "file", - "bytes": 2147483648, - "created_at": 1719186911, - "filename": "training_examples.jsonl", - "purpose": "fine-tune", - } - } - UploadCertificateRequest: + - output + - max_output_length + title: Shell call output + description: The output of a shell tool call that was emitted. + ApplyPatchCallStatus: + type: string + enum: + - in_progress + - completed + ApplyPatchCreateFileOperation: + properties: + type: + type: string + enum: + - create_file + description: Create a new file with the provided diff. + default: create_file + x-stainless-const: true + path: + type: string + description: Path of the file to create. + diff: + type: string + description: Diff to apply. type: object + required: + - type + - path + - diff + title: Apply patch create file operation + description: Instruction describing how to create a file via the apply_patch tool. + ApplyPatchDeleteFileOperation: properties: - name: + type: type: string - description: An optional name for the certificate - certificate: + enum: + - delete_file + description: Delete the specified file. + default: delete_file + x-stainless-const: true + path: type: string - description: The certificate content in PEM format - required: - - certificate - UploadPart: + description: Path of the file to delete. type: object - title: UploadPart - description: | - The upload Part represents a chunk of bytes we can add to an Upload object. + required: + - type + - path + title: Apply patch delete file operation + description: Instruction describing how to delete a file via the apply_patch tool. + ApplyPatchUpdateFileOperation: properties: - id: - type: string - description: The upload Part unique identifier, which can be referenced in API endpoints. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the Part was created. - upload_id: - type: string - description: The ID of the Upload object that this Part was added to. - object: + type: type: string - description: The object type, which is always `upload.part`. enum: - - upload.part + - update_file + description: Update an existing file with the provided diff. + default: update_file x-stainless-const: true - required: - - created_at - - id - - object - - upload_id - x-oaiMeta: - name: The upload part object - example: | - { - "id": "part_def456", - "object": "upload.part", - "created_at": 1719186911, - "upload_id": "upload_abc123" - } - UsageAudioSpeechesResult: + path: + type: string + description: Path of the file to update. + diff: + type: string + description: Diff to apply. type: object - description: The aggregated audio speeches usage details of the specific time bucket. + required: + - type + - path + - diff + title: Apply patch update file operation + description: Instruction describing how to update a file via the apply_patch tool. + ApplyPatchToolCall: properties: - object: + type: type: string enum: - - organization.usage.audio_speeches.result + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_call x-stainless-const: true - characters: - type: integer - description: The number of characters processed. - num_model_requests: - type: integer - description: The count of requests made to the model. - project_id: - anyOf: - - type: string - description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - type: 'null' - user_id: - anyOf: - - type: string - description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - type: 'null' - api_key_id: + id: + type: string + description: The unique ID of the apply patch tool call. Populated when this item is returned via API. + call_id: + type: string + description: The unique ID of the apply patch tool call generated by the model. + caller: anyOf: - - type: string - description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + - $ref: '#/components/schemas/ToolCallCaller' + description: The execution context that produced this tool call. - type: 'null' - model: + status: + $ref: '#/components/schemas/ApplyPatchCallStatus' + description: The status of the apply patch tool call. One of `in_progress` or `completed`. + operation: + discriminator: + propertyName: type + title: Apply patch operation + description: One of the create_file, delete_file, or update_file operations applied via apply_patch. anyOf: - - type: string - description: When `group_by=model`, this field provides the model name of the grouped usage result. - - type: 'null' - required: - - object - - characters - - num_model_requests - x-oaiMeta: - name: Audio speeches usage object - example: | - { - "object": "organization.usage.audio_speeches.result", - "characters": 45, - "num_model_requests": 1, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "tts-1" - } - UsageAudioTranscriptionsResult: + - $ref: '#/components/schemas/ApplyPatchCreateFileOperation' + - $ref: '#/components/schemas/ApplyPatchDeleteFileOperation' + - $ref: '#/components/schemas/ApplyPatchUpdateFileOperation' + created_by: + type: string + description: The ID of the entity that created this tool call. type: object - description: The aggregated audio transcriptions usage details of the specific time bucket. + required: + - type + - id + - call_id + - status + - operation + title: Apply patch tool call + description: A tool call that applies file diffs by creating, deleting, or updating files. + ApplyPatchCallOutputStatus: + type: string + enum: + - completed + - failed + ApplyPatchToolCallOutput: properties: - object: + type: type: string enum: - - organization.usage.audio_transcriptions.result + - apply_patch_call_output + description: The type of the item. Always `apply_patch_call_output`. + default: apply_patch_call_output x-stainless-const: true - seconds: - type: integer - format: int64 - description: The number of seconds processed. - num_model_requests: - type: integer - description: The count of requests made to the model. - project_id: - anyOf: - - type: string - description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - type: 'null' - user_id: - anyOf: - - type: string - description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - type: 'null' - api_key_id: + id: + type: string + description: The unique ID of the apply patch tool call output. Populated when this item is returned via API. + call_id: + type: string + description: The unique ID of the apply patch tool call generated by the model. + caller: anyOf: - - type: string - description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + - $ref: '#/components/schemas/ToolCallCaller' + description: The execution context that produced this tool call. - type: 'null' - model: + status: + $ref: '#/components/schemas/ApplyPatchCallOutputStatus' + description: The status of the apply patch tool call output. One of `completed` or `failed`. + output: anyOf: - type: string - description: When `group_by=model`, this field provides the model name of the grouped usage result. + description: Optional textual output returned by the apply patch tool. - type: 'null' - required: - - object - - seconds - - num_model_requests - x-oaiMeta: - name: Audio transcriptions usage object - example: | - { - "object": "organization.usage.audio_transcriptions.result", - "seconds": 10, - "num_model_requests": 1, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "tts-1" - } - UsageCodeInterpreterSessionsResult: + created_by: + type: string + description: The ID of the entity that created this tool call output. type: object - description: The aggregated code interpreter sessions usage details of the specific time bucket. + required: + - type + - id + - call_id + - status + title: Apply patch tool call output + description: The output emitted by an apply patch tool call. + MCPProtocolError: properties: - object: + type: type: string enum: - - organization.usage.code_interpreter_sessions.result + - mcp_protocol_error + default: mcp_protocol_error x-stainless-const: true - num_sessions: + code: type: integer - description: The number of code interpreter sessions. - project_id: - anyOf: - - type: string - description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - type: 'null' + message: + type: string + type: object required: - - object - - num_sessions - x-oaiMeta: - name: Code interpreter sessions usage object - example: | - { - "object": "organization.usage.code_interpreter_sessions.result", - "num_sessions": 1, - "project_id": "proj_abc" - } - UsageCompletionsResult: + - type + - code + - message + MCPToolExecutionError: + properties: + type: + type: string + enum: + - mcp_tool_execution_error + default: mcp_tool_execution_error + x-stainless-const: true + content: {} type: object - description: The aggregated completions usage details of the specific time bucket. + required: + - type + - content + HTTPError: properties: - object: + type: type: string enum: - - organization.usage.completions.result + - http_error + default: http_error x-stainless-const: true - input_tokens: - type: integer - description: The aggregated number of input tokens used, including cached and cache-write tokens. This includes text, audio, and image tokens. For customers subscribed to Scale Tier, this includes Scale Tier tokens. - input_cached_tokens: - type: integer - description: The aggregated number of cached input tokens used across text, audio, and image inputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens. - input_cache_write_tokens: - type: integer - description: The aggregated number of input tokens written to the cache. - input_uncached_tokens: - type: integer - description: The aggregated number of uncached input tokens used across text, audio, and image inputs, excluding cache-write tokens. - output_tokens: - type: integer - description: The aggregated number of output tokens used across text, audio, and image outputs. For customers subscribed to Scale Tier, this includes Scale Tier tokens. - input_text_tokens: - type: integer - description: The aggregated number of uncached text input tokens used, excluding cache-write tokens. - output_text_tokens: - type: integer - description: The aggregated number of text output tokens used. - input_cached_text_tokens: - type: integer - description: The aggregated number of cached text input tokens used. - input_audio_tokens: - type: integer - description: The aggregated number of uncached audio input tokens used. - input_cached_audio_tokens: - type: integer - description: The aggregated number of cached audio input tokens used. - output_audio_tokens: - type: integer - description: The aggregated number of audio output tokens used. - input_image_tokens: - type: integer - description: The aggregated number of uncached image input tokens used. - input_cached_image_tokens: - type: integer - description: The aggregated number of cached image input tokens used. - output_image_tokens: - type: integer - description: The aggregated number of image output tokens used. - num_model_requests: + code: type: integer - description: The count of requests made to the model. - project_id: - anyOf: - - type: string - description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - type: 'null' - user_id: - anyOf: - - type: string - description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - type: 'null' - api_key_id: - anyOf: - - type: string - description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - type: 'null' - model: + message: + type: string + type: object + required: + - type + - code + - message + MCPToolCallStatus: + type: string + enum: + - in_progress + - completed + - incomplete + - calling + - failed + DetailEnum: + type: string + enum: + - low + - high + - auto + - original + FunctionCallItemStatus: + type: string + enum: + - in_progress + - completed + - incomplete + ComputerCallOutputItemParam: + properties: + id: anyOf: - type: string - description: When `group_by=model`, this field provides the model name of the grouped usage result. + description: The ID of the computer tool call output. + example: cuo_123 - type: 'null' - batch: + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The ID of the computer tool call that produced the output. + type: + type: string + enum: + - computer_call_output + description: The type of the computer tool call output. Always `computer_call_output`. + default: computer_call_output + x-stainless-const: true + output: + $ref: '#/components/schemas/ComputerScreenshotImage' + acknowledged_safety_checks: anyOf: - - type: boolean - description: When `group_by=batch`, this field tells whether the grouped usage result is batch or not. + - items: + $ref: '#/components/schemas/ComputerCallSafetyCheckParam' + type: array + description: The safety checks reported by the API that have been acknowledged by the developer. - type: 'null' - service_tier: + status: anyOf: - - type: string - description: When `group_by=service_tier`, this field provides the service tier of the grouped usage result. + - $ref: '#/components/schemas/FunctionCallItemStatus' + description: The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API. - type: 'null' - required: - - object - - input_tokens - - output_tokens - - num_model_requests - x-oaiMeta: - name: Completions usage object - example: | - { - "object": "organization.usage.completions.result", - "input_tokens": 5000, - "input_cached_tokens": 1800, - "input_cache_write_tokens": 200, - "input_uncached_tokens": 3000, - "output_tokens": 1000, - "input_text_tokens": 2500, - "output_text_tokens": 800, - "input_cached_text_tokens": 1500, - "input_audio_tokens": 300, - "input_cached_audio_tokens": 100, - "output_audio_tokens": 100, - "input_image_tokens": 200, - "input_cached_image_tokens": 200, - "output_image_tokens": 100, - "num_model_requests": 5, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "gpt-6-astra", - "batch": false, - "service_tier": "default" - } - UsageEmbeddingsResult: type: object - description: The aggregated embeddings usage details of the specific time bucket. + required: + - call_id + - type + - output + title: Computer tool call output + description: The output of a computer tool call. + InputTextContentParam: properties: - object: + type: type: string enum: - - organization.usage.embeddings.result + - input_text + description: The type of the input item. Always `input_text`. + default: input_text x-stainless-const: true - input_tokens: - type: integer - description: The aggregated number of input tokens used. - num_model_requests: - type: integer - description: The count of requests made to the model. - project_id: - anyOf: - - type: string - description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - type: 'null' - user_id: - anyOf: - - type: string - description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - type: 'null' - api_key_id: - anyOf: - - type: string - description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - type: 'null' - model: + text: + type: string + maxLength: 10485760 + description: The text input to the model. + prompt_cache_breakpoint: anyOf: - - type: string - description: When `group_by=model`, this field provides the model name of the grouped usage result. + - $ref: '#/components/schemas/PromptCacheBreakpointParam' - type: 'null' - required: - - object - - input_tokens - - num_model_requests - x-oaiMeta: - name: Embeddings usage object - example: | - { - "object": "organization.usage.embeddings.result", - "input_tokens": 20, - "num_model_requests": 2, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "text-embedding-ada-002-v2" - } - UsageFileSearchCallsResult: type: object - description: The aggregated file search calls usage details of the specific time bucket. + required: + - type + - text + title: Input text + description: A text input to the model. + InputImageContentParamAutoParam: properties: - object: + type: type: string enum: - - organization.usage.file_searches.result + - input_image + description: The type of the input item. Always `input_image`. + default: input_image x-stainless-const: true - num_requests: - type: integer - description: The count of file search calls. - project_id: + image_url: anyOf: - type: string - description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. + maxLength: 20971520 + format: uri + description: The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL. - type: 'null' - user_id: + file_id: anyOf: - type: string - description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. + description: The ID of the file to be sent to the model. + example: file-123 - type: 'null' - api_key_id: + detail: anyOf: - - type: string - description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + - $ref: '#/components/schemas/DetailEnum' + description: The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`. - type: 'null' - vector_store_id: + prompt_cache_breakpoint: anyOf: - - type: string - description: When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result. + - $ref: '#/components/schemas/PromptCacheBreakpointParam' - type: 'null' - required: - - object - - num_requests - x-oaiMeta: - name: File search calls usage object - example: | - { - "object": "organization.usage.file_searches.result", - "num_requests": 2, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "vector_store_id": "vs_abc" - } - UsageImagesResult: type: object - description: The aggregated images usage details of the specific time bucket. + required: + - type + title: Input image + description: An image input to the model. Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision) + FileDetailEnum: + type: string + enum: + - auto + - low + - high + InputFileContentParam: properties: - object: + type: type: string enum: - - organization.usage.images.result + - input_file + description: The type of the input item. Always `input_file`. + default: input_file x-stainless-const: true - images: - type: integer - description: The number of images processed. - num_model_requests: - type: integer - description: The count of requests made to the model. - source: + file_id: anyOf: - type: string - description: When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`. + description: The ID of the file to be sent to the model. + example: file-123 - type: 'null' - size: + filename: anyOf: - type: string - description: When `group_by=size`, this field provides the image size of the grouped usage result. + description: The name of the file to be sent to the model. - type: 'null' - project_id: + file_data: anyOf: - type: string - description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. + maxLength: 73400320 + description: The base64-encoded data of the file to be sent to the model. - type: 'null' - user_id: + file_url: anyOf: - type: string - description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. + format: uri + description: The URL of the file to be sent to the model. - type: 'null' - api_key_id: + detail: + $ref: '#/components/schemas/FileDetailEnum' + description: The detail level of the file to be sent to the model. Use `auto` to let the system select the detail level; for GPT-5.6 and later models, `auto` uses high-quality rendering, which may increase input token usage. Use `low` for lower-cost rendering, or `high` to render the file at higher quality. Defaults to `auto`. + prompt_cache_breakpoint: + anyOf: + - $ref: '#/components/schemas/PromptCacheBreakpointParam' + - type: 'null' + type: object + required: + - type + title: Input file + description: A file input to the model. + FunctionCallOutputItemParam: + properties: + id: anyOf: - type: string - description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + description: The unique ID of the function tool call output. Populated when this item is returned via API. + example: fc_123 - type: 'null' - model: + call_id: anyOf: - type: string - description: When `group_by=model`, this field provides the model name of the grouped usage result. + maxLength: 64 + minLength: 1 + description: The unique ID of the function tool call generated by the model. - type: 'null' - required: - - object - - images - - num_model_requests - x-oaiMeta: - name: Images usage object - example: | - { - "object": "organization.usage.images.result", - "images": 2, - "num_model_requests": 2, - "size": "1024x1024", - "source": "image.generation", - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "dall-e-3" - } - UsageModerationsResult: - type: object - description: The aggregated moderations usage details of the specific time bucket. - properties: - object: + type: type: string enum: - - organization.usage.moderations.result + - function_call_output + description: The type of the function tool call output. Always `function_call_output`. + default: function_call_output x-stainless-const: true - input_tokens: - type: integer - description: The aggregated number of input tokens used. - num_model_requests: - type: integer - description: The count of requests made to the model. - project_id: + output: + description: Text, image, or file output of the function tool call. anyOf: - type: string - description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - type: 'null' - user_id: + maxLength: 10485760 + description: A JSON string of the output of the function tool call. + - items: + discriminator: + propertyName: type + description: A piece of message content, such as text, an image, or a file. + anyOf: + - $ref: '#/components/schemas/InputTextContentParam' + - $ref: '#/components/schemas/InputImageContentParamAutoParam' + - $ref: '#/components/schemas/InputFileContentParam' + type: array + description: An array of content outputs (text, image, file) for the function tool call. + name: anyOf: - type: string - description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. + maxLength: 128 + minLength: 1 + description: The name of the tool that produced the output. - type: 'null' - api_key_id: + namespace: anyOf: - type: string - description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. + maxLength: 64 + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + description: The namespace of the tool that produced the output. - type: 'null' - model: + caller: anyOf: - - type: string - description: When `group_by=model`, this field provides the model name of the grouped usage result. + - $ref: '#/components/schemas/ToolCallCallerParam' + description: The execution context that produced this tool call. - type: 'null' - required: - - object - - input_tokens - - num_model_requests - x-oaiMeta: - name: Moderations usage object - example: | - { - "object": "organization.usage.moderations.result", - "input_tokens": 20, - "num_model_requests": 2, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "text-moderation" - } - UsageResponse: - type: object - properties: - object: - type: string - enum: - - page - x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/UsageTimeBucket' - has_more: - type: boolean - next_page: + status: anyOf: - - type: string + - $ref: '#/components/schemas/FunctionCallItemStatus' + description: The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API. - type: 'null' - required: - - object - - data - - has_more - - next_page - UsageTimeBucket: type: object + required: + - type + - output + title: Function tool call output + description: The output of a function tool call. + FileCitationParam: properties: - object: + type: type: string enum: - - bucket + - file_citation + description: The citation type. Always `file_citation`. + default: file_citation x-stainless-const: true - start_time: - type: integer - end_time: + index: type: integer - results: - type: array - items: - discriminator: - propertyName: object - anyOf: - - $ref: '#/components/schemas/UsageCompletionsResult' - - $ref: '#/components/schemas/UsageEmbeddingsResult' - - $ref: '#/components/schemas/UsageModerationsResult' - - $ref: '#/components/schemas/UsageImagesResult' - - $ref: '#/components/schemas/UsageAudioSpeechesResult' - - $ref: '#/components/schemas/UsageAudioTranscriptionsResult' - - $ref: '#/components/schemas/UsageVectorStoresResult' - - $ref: '#/components/schemas/UsageCodeInterpreterSessionsResult' - - $ref: '#/components/schemas/UsageFileSearchCallsResult' - - $ref: '#/components/schemas/UsageWebSearchCallsResult' - - $ref: '#/components/schemas/CostsResult' - required: - - object - - start_time - - end_time - - results - UsageVectorStoresResult: + minimum: 0 + description: The index of the file in the list of files. + file_id: + type: string + description: The ID of the file. + example: file-123 + filename: + type: string + description: The filename of the file cited. type: object - description: The aggregated vector stores usage details of the specific time bucket. + required: + - type + - index + - file_id + - filename + UrlCitationParam: properties: - object: + type: type: string enum: - - organization.usage.vector_stores.result + - url_citation + description: The citation type. Always `url_citation`. + default: url_citation x-stainless-const: true - usage_bytes: + start_index: type: integer - description: The vector stores usage in bytes. - project_id: - anyOf: - - type: string - description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - type: 'null' - required: - - object - - usage_bytes - x-oaiMeta: - name: Vector stores usage object - example: | - { - "object": "organization.usage.vector_stores.result", - "usage_bytes": 1024, - "project_id": "proj_abc" - } - UsageWebSearchCallsResult: + minimum: 0 + description: The index of the first character of the citation in the message. + end_index: + type: integer + minimum: 0 + description: The index of the last character of the citation in the message. + url: + type: string + format: uri + description: The URL of the cited resource. + title: + type: string + description: The title of the cited resource. type: object - description: The aggregated web search calls usage details of the specific time bucket. + required: + - type + - start_index + - end_index + - url + - title + ContainerFileCitationParam: properties: - object: + type: type: string enum: - - organization.usage.web_searches.result + - container_file_citation + description: The citation type. Always `container_file_citation`. + default: container_file_citation x-stainless-const: true - num_model_requests: + start_index: type: integer - description: The count of model requests. - num_requests: + minimum: 0 + description: The index of the first character of the citation in the message. + end_index: type: integer - description: The count of web search calls. - project_id: - anyOf: - - type: string - description: When `group_by=project_id`, this field provides the project ID of the grouped usage result. - - type: 'null' - user_id: - anyOf: - - type: string - description: When `group_by=user_id`, this field provides the user ID of the grouped usage result. - - type: 'null' - api_key_id: - anyOf: - - type: string - description: When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result. - - type: 'null' - model: - anyOf: - - type: string - description: When `group_by=model`, this field provides the model name of the grouped usage result. - - type: 'null' - context_level: - anyOf: - - type: string - description: When `group_by=context_level`, this field provides the search context size of the grouped usage result. - - type: 'null' - required: - - object - - num_model_requests - - num_requests - x-oaiMeta: - name: Web search calls usage object - example: | - { - "object": "organization.usage.web_searches.result", - "num_model_requests": 2, - "num_requests": 2, - "project_id": "proj_abc", - "user_id": "user-abc", - "api_key_id": "key_abc", - "model": "gpt-6-astra", - "context_level": "medium" - } - User: + minimum: 0 + description: The index of the last character of the citation in the message. + container_id: + type: string + description: The ID of the container. + example: cntr_123 + file_id: + type: string + description: The ID of the container file. + example: cfile_123 + filename: + type: string + description: The filename of the container file cited. type: object - description: Represents an individual `user` within an organization. + required: + - type + - start_index + - end_index + - container_id + - file_id + - filename + ToolSearchCallItemParam: properties: - object: - type: string - enum: - - organization.user - description: The object type, which is always `organization.user` - x-stainless-const: true id: - type: string - description: The identifier, which can be referenced in API endpoints - name: - anyOf: - - type: string - - type: 'null' - description: The name of the user - email: anyOf: - type: string + description: The unique ID of this tool search call. + example: tsc_123 - type: 'null' - description: The email address of the user - role: + call_id: anyOf: - type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the tool search call generated by the model. - type: 'null' - description: '`owner` or `reader`' - added_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the user was added. - is_default: - type: boolean - description: Whether this is the organization's default user. - created: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) of when the user was created. - user: - type: object - description: Nested user details. - properties: - object: - type: string - enum: - - user - x-stainless-const: true - id: - type: string - email: - anyOf: - - type: string - - type: 'null' - name: - anyOf: - - type: string - - type: 'null' - picture: - anyOf: - - type: string - - type: 'null' - enabled: - anyOf: - - type: boolean - - type: 'null' - banned: - anyOf: - - type: boolean - - type: 'null' - banned_at: - anyOf: - - type: integer - format: unixtime - - type: 'null' - required: - - object - - id - is_service_account: - type: boolean - description: Whether the user is a service account. - is_scale_tier_authorized_purchaser: - anyOf: - - type: boolean - - type: 'null' - description: Whether the user is an authorized purchaser for Scale Tier. - is_scim_managed: - type: boolean - description: Whether the user is managed through SCIM. - api_key_last_used_at: + type: + type: string + enum: + - tool_search_call + description: The item type. Always `tool_search_call`. + default: tool_search_call + x-stainless-const: true + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search was executed by the server or by the client. + arguments: + $ref: '#/components/schemas/EmptyModelParam' + description: The arguments supplied to the tool search call. + status: anyOf: - - type: integer - format: unixtime + - $ref: '#/components/schemas/FunctionCallItemStatus' + description: The status of the tool search call. - type: 'null' - description: The Unix timestamp (in seconds) of the user's last API key usage. - technical_level: + type: object + required: + - type + - arguments + ToolSearchOutputItemParam: + properties: + id: anyOf: - type: string + description: The unique ID of this tool search output. + example: tso_123 - type: 'null' - description: The technical level metadata for the user. - developer_persona: + call_id: anyOf: - type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the tool search call generated by the model. - type: 'null' - description: The developer persona metadata for the user. - projects: + type: + type: string + enum: + - tool_search_output + description: The item type. Always `tool_search_output`. + default: tool_search_output + x-stainless-const: true + execution: + $ref: '#/components/schemas/ToolSearchExecutionType' + description: Whether tool search was executed by the server or by the client. + tools: + items: + $ref: '#/components/schemas/Tool' + type: array + description: The loaded tool definitions returned by the tool search output. + status: anyOf: - - type: object - properties: - object: - type: string - enum: - - list - x-stainless-const: true - data: - type: array - items: - type: object - properties: - id: - anyOf: - - type: string - - type: 'null' - name: - anyOf: - - type: string - - type: 'null' - role: - anyOf: - - type: string - - type: 'null' - required: - - object - - data + - $ref: '#/components/schemas/FunctionCallItemStatus' + description: The status of the tool search output. - type: 'null' - description: Projects associated with the user, if included. - required: - - object - - id - - added_at - x-oaiMeta: - name: The user object - example: | - { - "object": "organization.user", - "id": "user_abc", - "name": "First Last", - "email": "user@example.com", - "role": "owner", - "added_at": 1711471533 - } - UserDeleteResponse: type: object + required: + - type + - tools + AdditionalToolsItemParam: properties: - object: + id: + anyOf: + - type: string + description: The unique ID of this additional tools item. + example: at_123 + - type: 'null' + type: type: string enum: - - organization.user.deleted + - additional_tools + description: The item type. Always `additional_tools`. + default: additional_tools x-stainless-const: true - id: - type: string - deleted: - type: boolean - required: - - object - - id - - deleted - UserListResource: - type: object - description: Paginated list of user objects returned when inspecting group membership. - properties: - object: + role: type: string enum: - - list - description: Always `list`. + - developer + description: The role that provided the additional tools. Only `developer` is supported. + default: developer x-stainless-const: true - data: - type: array - description: Users in the current page. + tools: items: - $ref: '#/components/schemas/GroupUser' - has_more: - type: boolean - description: Whether more users are available when paginating. - next: - description: Cursor to fetch the next page of results, or `null` when no further users are available. + $ref: '#/components/schemas/Tool' + type: array + description: A list of additional tools made available at this item. + type: object + required: + - type + - role + - tools + CompactionSummaryItemParam: + properties: + id: anyOf: - type: string + description: The ID of the compaction item. + example: cmp_123 - type: 'null' - required: - - object - - data - - has_more - - next - x-oaiMeta: - name: Group user list - example: | - { - "object": "list", - "data": [ - { - "id": "user_abc123", - "name": "Ada Lovelace", - "email": "ada@example.com" - } - ], - "has_more": false, - "next": null - } - UserListResponse: - type: object - properties: - object: + type: type: string enum: - - list + - compaction + description: The type of the item. Always `compaction`. + default: compaction x-stainless-const: true - data: - type: array + encrypted_content: + type: string + maxLength: 20971520 + description: The encrypted content of the compaction summary. + type: object + required: + - type + - encrypted_content + title: Compaction item + description: A compaction item generated by the [`v1/responses/compact` API](https://developers.openai.com/api/reference/resources/responses/methods/compact). + FunctionShellActionParam: + properties: + commands: items: - $ref: '#/components/schemas/User' - first_id: + type: string + type: array + description: Ordered shell commands for the execution environment to run. + timeout_ms: anyOf: - - type: string + - type: integer + description: Maximum wall-clock time in milliseconds to allow the shell commands to run. - type: 'null' - last_id: + max_output_length: anyOf: - - type: string + - type: integer + description: Maximum number of UTF-8 characters to capture from combined stdout and stderr output. - type: 'null' - has_more: - type: boolean - required: - - object - - data - - has_more - UserRoleAssignment: type: object - description: Role assignment linking a user to a role. - properties: - object: - type: string - enum: - - user.role - description: Always `user.role`. - x-stainless-const: true - user: - $ref: '#/components/schemas/User' - role: - $ref: '#/components/schemas/Role' required: - - object - - user - - role - x-oaiMeta: - name: The user role object - example: | - { - "object": "user.role", - "user": { - "object": "organization.user", - "id": "user_abc123", - "name": "Ada Lovelace", - "email": "ada@example.com", - "role": "owner", - "added_at": 1711470000 - }, - "role": { - "object": "role", - "id": "role_01J1F8ROLE01", - "name": "API Group Manager", - "description": "Allows managing organization groups", - "permissions": [ - "api.groups.read", - "api.groups.write" - ], - "resource_type": "api.organization", - "predefined_role": false - } - } - UserRoleUpdateRequest: - type: object + - commands + title: Shell action + description: Commands and limits describing how to run the shell tool call. + FunctionShellCallItemStatus: + type: string + enum: + - in_progress + - completed + - incomplete + title: Shell call status + description: Status values reported for shell tool calls. + FunctionShellCallItemParam: properties: - role: + id: anyOf: - type: string + description: The unique ID of the shell tool call. Populated when this item is returned via API. + example: sh_123 - type: 'null' - description: '`owner` or `reader`' - role_id: + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the shell tool call generated by the model. + caller: anyOf: - - type: string + - $ref: '#/components/schemas/ToolCallCallerParam' + description: The execution context that produced this tool call. - type: 'null' - description: Role ID to assign to the user. - technical_level: + type: + type: string + enum: + - shell_call + description: The type of the item. Always `shell_call`. + default: shell_call + x-stainless-const: true + action: + $ref: '#/components/schemas/FunctionShellActionParam' + description: The shell commands and limits that describe how to run the tool call. + status: anyOf: - - type: string + - $ref: '#/components/schemas/FunctionShellCallItemStatus' + description: The status of the shell call. One of `in_progress`, `completed`, or `incomplete`. - type: 'null' - description: Technical level metadata. - developer_persona: + environment: anyOf: - - type: string + - discriminator: + propertyName: type + description: The environment to execute the shell commands in. + anyOf: + - $ref: '#/components/schemas/LocalEnvironmentParam' + - $ref: '#/components/schemas/ContainerReferenceParam' - type: 'null' - description: Developer persona metadata. - VadConfig: type: object - additionalProperties: false required: + - call_id - type + - action + title: Shell tool call + description: A tool representing a request to execute one or more shell commands. + FunctionShellCallOutputTimeoutOutcomeParam: properties: type: type: string enum: - - server_vad - description: Must be set to `server_vad` to enable manual chunking using server side VAD. - prefix_padding_ms: - type: integer - default: 300 - description: "Amount of audio to include before the VAD detected speech (in \nmilliseconds).\n" - silence_duration_ms: - type: integer - default: 200 - description: "Duration of silence to detect speech stop (in milliseconds).\nWith shorter values the model will respond more quickly, \nbut may jump in on short pauses from the user.\n" - threshold: - type: number - default: 0.5 - description: "Sensitivity threshold (0.0 to 1.0) for voice activity detection. A \nhigher threshold will require louder audio to activate the model, and \nthus might perform better in noisy environments.\n" - ValidateGraderRequest: + - timeout + description: The outcome type. Always `timeout`. + default: timeout + x-stainless-const: true type: object - title: ValidateGraderRequest - properties: - grader: - type: object - description: The grader used for the fine-tuning job. - anyOf: - - $ref: '#/components/schemas/GraderStringCheck' - - $ref: '#/components/schemas/GraderTextSimilarity' - - $ref: '#/components/schemas/GraderPython' - - $ref: '#/components/schemas/GraderScoreModel' - - $ref: '#/components/schemas/GraderMulti' required: - - grader - ValidateGraderResponse: - type: object - title: ValidateGraderResponse - properties: - grader: - type: object - description: The grader used for the fine-tuning job. - anyOf: - - $ref: '#/components/schemas/GraderStringCheck' - - $ref: '#/components/schemas/GraderTextSimilarity' - - $ref: '#/components/schemas/GraderPython' - - $ref: '#/components/schemas/GraderScoreModel' - - $ref: '#/components/schemas/GraderMulti' - VectorStoreExpirationAfter: - type: object - title: Vector store expiration policy - description: The expiration policy for a vector store. + - type + title: Shell call timeout outcome + description: Indicates that the shell call exceeded its configured time limit. + FunctionShellCallOutputExitOutcomeParam: properties: - anchor: - description: 'Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`.' + type: type: string enum: - - last_active_at + - exit + description: The outcome type. Always `exit`. + default: exit x-stainless-const: true - days: - description: The number of days after the anchor time that the vector store will expire. + exit_code: type: integer - minimum: 1 - maximum: 365 + description: The exit code returned by the shell process. + type: object required: - - anchor - - days - VectorStoreFileAttributes: + - type + - exit_code + title: Shell call exit outcome + description: Indicates that the shell commands finished and returned an exit code. + FunctionShellCallOutputOutcomeParam: + discriminator: + propertyName: type + title: Shell call outcome + description: The exit or timeout outcome associated with this shell call. anyOf: - - type: object - description: | - Set of 16 key-value pairs that can be attached to an object. This can be - useful for storing additional information about the object in a structured - format, and querying for objects via API or the dashboard. Keys are strings - with a maximum length of 64 characters. Values are strings with a maximum - length of 512 characters, booleans, or numbers. - maxProperties: 16 - propertyNames: - type: string - maxLength: 64 - additionalProperties: - anyOf: - - type: string - maxLength: 512 - - type: number - - type: boolean - x-oaiTypeLabel: map - - type: 'null' - VectorStoreFileBatchObject: - type: object - title: Vector store file batch - description: A batch of files attached to a vector store. + - $ref: '#/components/schemas/FunctionShellCallOutputTimeoutOutcomeParam' + - $ref: '#/components/schemas/FunctionShellCallOutputExitOutcomeParam' + FunctionShellCallOutputContentParam: properties: - id: - description: The identifier, which can be referenced in API endpoints. - type: string - object: - description: The object type, which is always `vector_store.file_batch`. - type: string - enum: - - vector_store.files_batch - x-stainless-const: true - created_at: - description: The Unix timestamp (in seconds) for when the vector store files batch was created. - type: integer - format: unixtime - vector_store_id: - description: The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) that the [File](https://developers.openai.com/api/reference/resources/files) is attached to. + stdout: type: string - status: - description: The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`. + maxLength: 10485760 + description: Captured stdout output for the shell call. + stderr: type: string - enum: - - in_progress - - completed - - cancelled - - failed - file_counts: - type: object - properties: - in_progress: - description: The number of files that are currently being processed. - type: integer - completed: - description: The number of files that have been processed. - type: integer - failed: - description: The number of files that have failed to process. - type: integer - cancelled: - description: The number of files that where cancelled. - type: integer - total: - description: The total number of files. - type: integer - required: - - in_progress - - completed - - cancelled - - failed - - total - required: - - id - - object - - created_at - - vector_store_id - - status - - file_counts - x-oaiMeta: - name: The vector store files batch object - beta: true - example: | - { - "id": "vsfb_123", - "object": "vector_store.files_batch", - "created_at": 1698107661, - "vector_store_id": "vs_abc123", - "status": "completed", - "file_counts": { - "in_progress": 0, - "completed": 100, - "failed": 0, - "cancelled": 0, - "total": 100 - } - } - VectorStoreFileContentResponse: + maxLength: 10485760 + description: Captured stderr output for the shell call. + outcome: + $ref: '#/components/schemas/FunctionShellCallOutputOutcomeParam' + description: The exit or timeout outcome associated with this shell call. type: object - description: Represents the parsed content of a vector store file. + required: + - stdout + - stderr + - outcome + title: Shell output content + description: Captured stdout and stderr for a portion of a shell tool call output. + FunctionShellCallOutputItemParam: properties: - object: + id: + anyOf: + - type: string + description: The unique ID of the shell tool call output. Populated when this item is returned via API. + example: sho_123 + - type: 'null' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the shell tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCallerParam' + description: The execution context that produced this tool call. + - type: 'null' + type: type: string enum: - - vector_store.file_content.page - description: The object type, which is always `vector_store.file_content.page` + - shell_call_output + description: The type of the item. Always `shell_call_output`. + default: shell_call_output x-stainless-const: true - data: - type: array - description: Parsed content of the file. + output: items: - type: object - properties: - type: - type: string - description: The content type (currently only `"text"`) - text: - type: string - description: The text content - has_more: - type: boolean - description: Indicates if there are more content pages to fetch. - next_page: + $ref: '#/components/schemas/FunctionShellCallOutputContentParam' + type: array + description: Captured chunks of stdout and stderr output, along with their associated outcomes. + status: anyOf: - - type: string - description: The token for the next page, if any. + - $ref: '#/components/schemas/FunctionShellCallItemStatus' + description: The status of the shell call output. + - type: 'null' + max_output_length: + anyOf: + - type: integer + description: The maximum number of UTF-8 characters captured for this shell call's combined output. - type: 'null' + type: object required: - - object - - data - - has_more - - next_page - VectorStoreFileObject: + - call_id + - type + - output + title: Shell tool call output + description: The streamed output items emitted by a shell tool call. + ApplyPatchCallStatusParam: + type: string + enum: + - in_progress + - completed + title: Apply patch call status + description: Status values reported for apply_patch tool calls. + ApplyPatchCreateFileOperationParam: + properties: + type: + type: string + enum: + - create_file + description: The operation type. Always `create_file`. + default: create_file + x-stainless-const: true + path: + type: string + minLength: 1 + description: Path of the file to create relative to the workspace root. + diff: + type: string + maxLength: 10485760 + description: Unified diff content to apply when creating the file. type: object - title: Vector store files - description: A list of files attached to a vector store. + required: + - type + - path + - diff + title: Apply patch create file operation + description: Instruction for creating a new file via the apply_patch tool. + ApplyPatchDeleteFileOperationParam: properties: - id: - description: The identifier, which can be referenced in API endpoints. + type: type: string - object: - description: The object type, which is always `vector_store.file`. + enum: + - delete_file + description: The operation type. Always `delete_file`. + default: delete_file + x-stainless-const: true + path: + type: string + minLength: 1 + description: Path of the file to delete relative to the workspace root. + type: object + required: + - type + - path + title: Apply patch delete file operation + description: Instruction for deleting an existing file via the apply_patch tool. + ApplyPatchUpdateFileOperationParam: + properties: + type: type: string enum: - - vector_store.file + - update_file + description: The operation type. Always `update_file`. + default: update_file x-stainless-const: true - usage_bytes: - description: The total vector store usage in bytes. Note that this may be different from the original file size. - type: integer - created_at: - description: The Unix timestamp (in seconds) for when the vector store file was created. - type: integer - format: unixtime - vector_store_id: - description: The ID of the [vector store](https://developers.openai.com/api/reference/resources/vector_stores) that the [File](https://developers.openai.com/api/reference/resources/files) is attached to. + path: type: string - status: - description: The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use. + minLength: 1 + description: Path of the file to update relative to the workspace root. + diff: + type: string + maxLength: 10485760 + description: Unified diff content to apply to the existing file. + type: object + required: + - type + - path + - diff + title: Apply patch update file operation + description: Instruction for updating an existing file via the apply_patch tool. + ApplyPatchOperationParam: + discriminator: + propertyName: type + title: Apply patch operation + description: One of the create_file, delete_file, or update_file operations supplied to the apply_patch tool. + anyOf: + - $ref: '#/components/schemas/ApplyPatchCreateFileOperationParam' + - $ref: '#/components/schemas/ApplyPatchDeleteFileOperationParam' + - $ref: '#/components/schemas/ApplyPatchUpdateFileOperationParam' + ApplyPatchToolCallItemParam: + properties: + type: type: string enum: - - in_progress - - completed - - cancelled - - failed - last_error: + - apply_patch_call + description: The type of the item. Always `apply_patch_call`. + default: apply_patch_call + x-stainless-const: true + id: anyOf: - - type: object - description: The last error associated with this vector store file. Will be `null` if there are no errors. - properties: - code: - type: string - description: One of `server_error`, `unsupported_file`, or `invalid_file`. - enum: - - server_error - - unsupported_file - - invalid_file - message: - type: string - description: A human-readable description of the error. - required: - - code - - message + - type: string + description: The unique ID of the apply patch tool call. Populated when this item is returned via API. + example: apc_123 - type: 'null' - chunking_strategy: - $ref: '#/components/schemas/ChunkingStrategyResponse' - description: The strategy used to chunk the file. - attributes: - $ref: '#/components/schemas/VectorStoreFileAttributes' + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + caller: + anyOf: + - $ref: '#/components/schemas/ToolCallCallerParam' + description: The execution context that produced this tool call. + - type: 'null' + status: + $ref: '#/components/schemas/ApplyPatchCallStatusParam' + description: The status of the apply patch tool call. One of `in_progress` or `completed`. + operation: + $ref: '#/components/schemas/ApplyPatchOperationParam' + description: The specific create, delete, or update instruction for the apply_patch tool call. + type: object required: - - id - - object - - usage_bytes - - created_at - - vector_store_id + - type + - call_id - status - - last_error - x-oaiMeta: - name: The vector store file object - beta: true - example: | - { - "id": "file-abc123", - "object": "vector_store.file", - "usage_bytes": 1234, - "created_at": 1698107661, - "vector_store_id": "vs_abc123", - "status": "completed", - "last_error": null, - "chunking_strategy": { - "type": "static", - "static": { - "max_chunk_size_tokens": 800, - "chunk_overlap_tokens": 400 - } - } - } - VectorStoreObject: - type: object - title: Vector store - description: A vector store is a collection of processed files can be used by the `file_search` tool. + - operation + title: Apply patch tool call + description: A tool call representing a request to create, delete, or update files using diff patches. + ApplyPatchCallOutputStatusParam: + type: string + enum: + - completed + - failed + title: Apply patch call output status + description: Outcome values reported for apply_patch tool call outputs. + ApplyPatchToolCallOutputItemParam: properties: - id: - description: The identifier, which can be referenced in API endpoints. - type: string - object: - description: The object type, which is always `vector_store`. + type: type: string enum: - - vector_store + - apply_patch_call_output + description: The type of the item. Always `apply_patch_call_output`. + default: apply_patch_call_output x-stainless-const: true - created_at: - description: The Unix timestamp (in seconds) for when the vector store was created. - type: integer - format: unixtime - name: - description: The name of the vector store. - type: string - usage_bytes: - description: The total number of bytes used by the files in the vector store. - type: integer - file_counts: - type: object - properties: - in_progress: - description: The number of files that are currently being processed. - type: integer - completed: - description: The number of files that have been successfully processed. - type: integer - failed: - description: The number of files that have failed to process. - type: integer - cancelled: - description: The number of files that were cancelled. - type: integer - total: - description: The total number of files. - type: integer - required: - - in_progress - - completed - - failed - - cancelled - - total - status: - description: The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use. + id: + anyOf: + - type: string + description: The unique ID of the apply patch tool call output. Populated when this item is returned via API. + example: apco_123 + - type: 'null' + call_id: type: string - enum: - - expired - - in_progress - - completed - expires_after: - $ref: '#/components/schemas/VectorStoreExpirationAfter' - expires_at: + maxLength: 64 + minLength: 1 + description: The unique ID of the apply patch tool call generated by the model. + caller: anyOf: - - description: The Unix timestamp (in seconds) for when the vector store will expire. - type: integer - format: unixtime + - $ref: '#/components/schemas/ToolCallCallerParam' + description: The execution context that produced this tool call. - type: 'null' - last_active_at: + status: + $ref: '#/components/schemas/ApplyPatchCallOutputStatusParam' + description: The status of the apply patch tool call output. One of `completed` or `failed`. + output: anyOf: - - description: The Unix timestamp (in seconds) for when the vector store was last active. - type: integer - format: unixtime + - type: string + maxLength: 10485760 + description: Optional human-readable log text from the apply patch tool (e.g., patch results or errors). - type: 'null' - metadata: - $ref: '#/components/schemas/Metadata' + type: object required: - - id - - object - - usage_bytes - - created_at + - type + - call_id - status - - last_active_at - - name - - file_counts - - metadata - x-oaiMeta: - name: The vector store object - example: | - { - "id": "vs_123", - "object": "vector_store", - "created_at": 1698107661, - "usage_bytes": 123456, - "last_active_at": 1698107661, - "name": "my_vector_store", - "status": "completed", - "file_counts": { - "in_progress": 0, - "completed": 100, - "cancelled": 0, - "failed": 0, - "total": 100 - }, - "last_used_at": 1698107661 - } - VectorStoreSearchRequest: + title: Apply patch tool call output + description: The streamed output emitted by an apply patch tool call. + CompactionTriggerItemParam: + properties: + type: + type: string + enum: + - compaction_trigger + description: The type of the item. Always `compaction_trigger`. + default: compaction_trigger + x-stainless-const: true type: object - additionalProperties: false + required: + - type + title: Compaction trigger + description: Compacts the current context. Must be the final input item. + ItemReferenceParam: properties: - query: - description: A query string for a search + type: anyOf: - type: string - - type: array - items: - type: string - description: A list of queries to search for. - minItems: 1 - rewrite_query: - description: Whether to rewrite the natural language query for vector search. - type: boolean - default: false - max_num_results: - description: The maximum number of results to return. This number should be between 1 and 50 inclusive. - type: integer - default: 10 - minimum: 1 - maximum: 50 - filters: - description: A filter to apply based on file attributes. - anyOf: - - $ref: '#/components/schemas/ComparisonFilter' - - $ref: '#/components/schemas/CompoundFilter' - ranking_options: - description: Ranking options for search. - type: object - additionalProperties: false - properties: - ranker: - description: Enable re-ranking; set to `none` to disable, which can help reduce latency. - type: string - enum: - - none - - auto - - default-2024-11-15 - default: auto - score_threshold: - type: number - minimum: 0 - maximum: 1 - default: 0 - required: - - query - x-oaiMeta: - name: Vector store search request - VectorStoreSearchResultContentObject: + enum: + - item_reference + description: The type of item to reference. Always `item_reference`. + default: item_reference + x-stainless-const: true + - type: 'null' + id: + type: string + description: The ID of the item to reference. type: object - additionalProperties: false + required: + - id + title: Item reference + description: An internal identifier for an item to reference. + ProgramItemParam: properties: + id: + type: string + description: The unique ID of this program item. + example: cm_123 type: - description: The type of content. type: string enum: - - text - text: - description: The text content returned from search. + - program + description: The item type. Always `program`. + default: program + x-stainless-const: true + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The stable call ID of the program item. + code: + type: string + maxLength: 10485760 + description: The JavaScript source executed by programmatic tool calling. + fingerprint: type: string + maxLength: 10485760 + description: Opaque program replay fingerprint that must be round-tripped. + type: object required: + - id - type - - text - x-oaiMeta: - name: Vector store search result content object - VectorStoreSearchResultItem: - type: object - additionalProperties: false + - call_id + - code + - fingerprint + ProgramOutputItemStatus: + type: string + enum: + - completed + - incomplete + ProgramOutputItemParam: properties: - file_id: + id: type: string - description: The ID of the vector store file. - filename: + description: The unique ID of this program output item. + example: cmo_123 + type: type: string - description: The name of the vector store file. - score: - type: number - description: The similarity score for the result. - minimum: 0 - maximum: 1 - attributes: - $ref: '#/components/schemas/VectorStoreFileAttributes' - content: - type: array - description: Content chunks from the file. - items: - $ref: '#/components/schemas/VectorStoreSearchResultContentObject' - required: - - file_id - - filename - - score - - attributes - - content - x-oaiMeta: - name: Vector store search result item - VectorStoreSearchResultsPage: + enum: + - program_output + description: The item type. Always `program_output`. + default: program_output + x-stainless-const: true + call_id: + type: string + maxLength: 64 + minLength: 1 + description: The call ID of the program item. + result: + type: string + maxLength: 10485760 + description: The result produced by the program item. + status: + $ref: '#/components/schemas/ProgramOutputItemStatus' + description: The terminal status of the program output. type: object - additionalProperties: false + required: + - id + - type + - call_id + - result + - status + ConversationResource: properties: + id: + type: string + description: The unique ID of the conversation. object: type: string enum: - - vector_store.search_results.page - description: The object type, which is always `vector_store.search_results.page` + - conversation + description: The object type, which is always `conversation`. + default: conversation x-stainless-const: true - search_query: - type: array - items: - type: string - description: The query used for this search. - minItems: 1 - data: - type: array - description: The list of search result items. - items: - $ref: '#/components/schemas/VectorStoreSearchResultItem' - has_more: - type: boolean - description: Indicates if there are more results to fetch. - next_page: - anyOf: - - type: string - description: The token for the next page, if any. - - type: 'null' + metadata: + description: |- + Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + created_at: + type: integer + format: unixtime + description: The time at which the conversation was created, measured in seconds since the Unix epoch. + type: object required: + - id - object - - search_query - - data - - has_more - - next_page - x-oaiMeta: - name: Vector store search results page - Verbosity: + - metadata + - created_at + _MisalignmentErrorType: anyOf: + - type: string - type: string enum: - - low - - medium - - high - default: medium - description: | - Constrains the verbosity of the model's response. Lower values will result in - more concise responses, while higher values will result in more verbose responses. - Currently supported values are `low`, `medium`, and `high`. The default is - `medium`. + - potentially_unintended_data_transfer + - potentially_unintended_data_access + - potentially_unintended_destructive_activity + - other + _MisalignmentSteer: + properties: + message: + type: string + description: The public continuation instruction. + type: object + required: + - message + MisalignmentErrorDetailsResource: + properties: + error_type: + $ref: '#/components/schemas/_MisalignmentErrorType' + description: An optional classification; clients must accept additional values. + detailed_explanation: + type: string + description: The public explanation for this block. + steer: + $ref: '#/components/schemas/_MisalignmentSteer' + description: An optional public continuation instruction. + type: object + required: [] + ImageGenOutputTokensDetails: + properties: + image_tokens: + type: integer + description: The number of image output tokens generated by the model. + text_tokens: + type: integer + description: The number of text output tokens generated by the model. + type: object + required: + - image_tokens + - text_tokens + title: Image generation output token details + description: The output token details for the image generation. + ImageGenInputUsageDetails: + properties: + text_tokens: + type: integer + description: The number of text tokens in the input prompt. + image_tokens: + type: integer + description: The number of image tokens in the input prompt. + type: object + required: + - text_tokens + - image_tokens + title: Input usage details + description: The input tokens detailed information for the image generation. + ImageGenUsage: + properties: + input_tokens: + type: integer + description: The number of tokens (images and text) in the input prompt. + total_tokens: + type: integer + description: The total number of tokens (images and text) used for the image generation. + output_tokens: + type: integer + description: The number of output tokens generated by the model. + output_tokens_details: + $ref: '#/components/schemas/ImageGenOutputTokensDetails' + input_tokens_details: + $ref: '#/components/schemas/ImageGenInputUsageDetails' + type: object + required: + - input_tokens + - total_tokens + - output_tokens + - input_tokens_details + title: Image generation usage + description: For `gpt-image-1` only, the token usage information for the image generation. + instructions: + anyOf: + - description: Frontend instructions for voice, conversation, interruptions, and when to delegate. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); put business rules and tool workflows in a separate [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). Limited to 16,384 client-supplied tokens. Omitted or blank instructions use server defaults. Immutable after startup. + type: string - type: 'null' - VoiceConsentDeletedResource: + LiveCustomVoiceParam: type: object - additionalProperties: false properties: id: type: string - description: The consent recording identifier. - example: cons_1234 - object: - type: string - enum: - - audio.voice_consent - x-stainless-const: true - deleted: - type: boolean + minLength: 1 + maxLength: 128 required: - id - - object - - deleted - x-oaiMeta: - name: The voice consent deletion object - example: | - { - "object": "audio.voice_consent", - "id": "cons_1234", - "deleted": true - } - VoiceConsentListResource: + LiveInitialSessionAudioOutputParam: + description: Settings for speech generated by the Live model. Choose the voice before starting the session. type: object - additionalProperties: false properties: - object: + voice: + description: The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup. + anyOf: + - anyOf: + - type: string + - $ref: '#/components/schemas/LiveBuiltInVoice' + - $ref: '#/components/schemas/LiveCustomVoiceParam' + required: [] + LiveClientDelegationParam: + description: Delegate tasks to your application. The Live session emits delegation events that your backend handles. + type: object + properties: + type: + description: The delegation owner. Always `client` for tasks handled by your application. + default: client + x-stainless-const: true type: string enum: - - list + - client + required: + - type + LiveResponsesServiceTier: + type: string + enum: + - auto + - default + - fast_tier_temp_pilot + - flex + - priority + - ultrafast + LiveReasoningEffort: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + LiveReasoningSummary: + type: string + enum: + - concise + - detailed + - auto + LiveDelegationReasoningInputParam: + description: Reasoning options for Responses requests made on behalf of the Live session. + type: object + properties: + effort: + anyOf: + - description: How much reasoning effort the delegated Responses model should use. Supported values depend on the backend model. + $ref: '#/components/schemas/LiveReasoningEffort' + - type: 'null' + summary: + anyOf: + - description: The reasoning summary to request from the delegated Responses model, when supported. + $ref: '#/components/schemas/LiveReasoningSummary' + - type: 'null' + required: [] + LiveTextVerbosity: + type: string + enum: + - low + - medium + - high + LiveDelegationTextInputParam: + description: Text generation options for the Live session’s Responses backend. + type: object + properties: + verbosity: + anyOf: + - description: The amount of detail in text generated by the Responses backend. This does not configure the Live model’s spoken delivery. + $ref: '#/components/schemas/LiveTextVerbosity' + - type: 'null' + required: [] + LiveFunctionToolInputParam: + description: A function tool available to the Responses backend when the Live model delegates a task. + type: object + properties: + type: + description: The tool type. Always `function`. + default: function x-stainless-const: true - data: - type: array - items: - $ref: '#/components/schemas/VoiceConsentResource' - first_id: + type: string + enum: + - function + name: + description: The name the delegated Responses model uses when calling this function. + type: string + description: anyOf: - - type: string + - description: What the function does and when the delegated Responses model should call it. + type: string - type: 'null' - last_id: + parameters: anyOf: - - type: string + - description: A JSON Schema object describing the arguments accepted by the function. + type: object + additionalProperties: {} + - type: 'null' + strict: + anyOf: + - description: Whether the delegated Responses model must follow the function’s parameter schema exactly. + type: boolean - type: 'null' - has_more: - type: boolean required: - - object - - data - - has_more - x-oaiMeta: - name: The voice consent list object - example: | - { - "object": "list", - "data": [ - { - "object": "audio.voice_consent", - "id": "cons_1234", - "name": "John Doe", - "language": "en-US", - "created_at": 1734220800 - } - ], - "first_id": "cons_1234", - "last_id": "cons_1234", - "has_more": false - } - VoiceConsentResource: + - type + - name + LiveWebSearchToolInputParam: + description: A web search tool available to the Live session’s Responses backend. type: object - title: Voice consent - description: A consent recording used to authorize creation of a custom voice. - additionalProperties: false properties: - object: + type: + description: The tool type. Always `web_search`. + default: web_search + x-stainless-const: true type: string - description: The object type, which is always `audio.voice_consent`. enum: - - audio.voice_consent + - web_search + required: + - type + LiveToolChoiceEnum: + type: string + enum: + - auto + - none + - required + LiveFunctionToolChoiceParam: + type: object + properties: + type: + default: function x-stainless-const: true - id: type: string - description: The consent recording identifier. - example: cons_1234 + enum: + - function name: type: string - description: The label provided when the consent recording was uploaded. - language: - type: string - description: The BCP 47 language tag for the consent phrase (for example, `en-US`). - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the consent recording was created. + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ required: - - object - - id + - type - name - - language - - created_at - x-oaiMeta: - name: The voice consent object - example: | - { - "object": "audio.voice_consent", - "id": "cons_1234", - "name": "John Doe", - "language": "en-US", - "created_at": 1734220800 - } - VoiceIdsOrCustomVoice: - title: Voice - description: | - A built-in voice name or a custom voice reference. - anyOf: - - $ref: '#/components/schemas/VoiceIdsShared' - - type: object - description: Custom voice reference. - additionalProperties: false - required: - - id - properties: - id: - type: string - description: The custom voice ID, e.g. `voice_1234`. - example: voice_1234 - VoiceIdsShared: - example: ash - anyOf: - - type: string - - type: string - enum: - - alloy - - ash - - ballad - - coral - - echo - - sage - - shimmer - - verse - - marin - - cedar - VoiceResource: + LiveMCPToolChoiceParam: type: object - title: Voice - description: A custom voice that can be used for audio output. - additionalProperties: false properties: - object: + type: + default: mcp + x-stainless-const: true type: string - description: The object type, which is always `audio.voice`. enum: - - audio.voice - x-stainless-const: true - id: + - mcp + server_label: type: string - description: The voice identifier, which can be referenced in API endpoints. + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ name: type: string - description: The name of the voice. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) for when the voice was created. + minLength: 1 + maxLength: 64 + pattern: ^[a-zA-Z0-9_-]+$ required: - - object - - id + - type + - server_label - name - - created_at - x-oaiMeta: - name: The voice object - example: | - { - "object": "audio.voice", - "id": "voice_123abc", - "name": "My new voice", - "created_at": 1734220800 - } - WebSearchActionFind: + LiveResponsesDelegationSettingsInputParam: + description: Model, prompt, and tool settings for tasks delegated by the Live session to a Responses backend. + type: object + properties: + model: + description: The model used for server-owned Responses delegations. + type: string + instructions: + anyOf: + - description: Instructions for the delegated Responses model, separate from Live instructions. See [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + type: string + - type: 'null' + max_output_tokens: + anyOf: + - description: Maximum number of output tokens for each delegated response. + type: integer + minimum: 16 + - type: 'null' + service_tier: + anyOf: + - description: Service tier for delegated Responses requests. + $ref: '#/components/schemas/LiveResponsesServiceTier' + - type: 'null' + reasoning: + anyOf: + - description: Reasoning settings passed to each delegated Responses request. + $ref: '#/components/schemas/LiveDelegationReasoningInputParam' + - type: 'null' + text: + anyOf: + - description: Text generation settings passed to each delegated Responses request. + $ref: '#/components/schemas/LiveDelegationTextInputParam' + - type: 'null' + tools: + description: Tools available to the Responses backend while it handles tasks delegated by the Live model. + type: array + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveFunctionToolInputParam' + - $ref: '#/components/schemas/LiveWebSearchToolInputParam' + tool_choice: + description: Controls which tool the Responses backend uses when handling a task delegated by the Live model. + anyOf: + - $ref: '#/components/schemas/LiveToolChoiceEnum' + - $ref: '#/components/schemas/LiveFunctionToolChoiceParam' + - $ref: '#/components/schemas/LiveMCPToolChoiceParam' + parallel_tool_calls: + anyOf: + - description: Whether the delegated Responses model may request multiple tool calls in a single response. + type: boolean + - type: 'null' + required: + - model + LiveResponsesDelegationParam: + description: Delegate tasks to a Responses model managed by the Live session. + type: object + properties: + type: + description: The delegation owner. Always `responses` for tasks handled by the Responses API. + default: responses + x-stainless-const: true + type: string + enum: + - responses + responses: + description: Backend model, prompt, and tools used when the Live session delegates a task to Responses. + $ref: '#/components/schemas/LiveResponsesDelegationSettingsInputParam' + required: + - type + - responses + delegation: + anyOf: + - description: Who handles tasks delegated by the Live model. Omitted or null selects your application; use `responses` to let the API manage a Responses backend. + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveClientDelegationParam' + - $ref: '#/components/schemas/LiveResponsesDelegationParam' + - type: 'null' + store: + description: Whether to store the session for later forking and recording download. Defaults to false for new sessions. + type: boolean + LiveInitialMessageStatus: + type: string + enum: + - incomplete + - completed + LiveInitialInputTextContentPartParam: + description: Text supplied in a developer or user message when starting a Live session. type: object - title: Find action - description: | - Action type "find_in_page": Searches for a pattern within a loaded page. properties: type: - type: string - enum: - - find_in_page - description: | - The action type. + description: The text content type. Always `input_text`. + default: input_text x-stainless-const: true - url: type: string - format: uri - description: | - The URL of the page searched for the pattern. - pattern: + enum: + - input_text + text: + description: The message text to include in the Live session’s initial conversation history. type: string - description: | - The pattern or text to search for within the page. required: - - type - - url - - pattern - WebSearchActionOpenPage: + - text + LiveInitialDeveloperMessageItemParam: + description: A developer message included in the initial text history of a Live session. type: object - title: Open page action - description: | - Action type "open_page" - Opens a specific URL from search results. properties: + id: + anyOf: + - description: An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation. + type: string + - type: 'null' type: + description: The history item type. Always `message`. + default: message + x-stainless-const: true type: string enum: - - open_page - description: | - The action type. - x-stainless-const: true - url: - description: | - The URL opened by the model. + - message + status: anyOf: - - type: string - format: uri + - description: The supplied message’s status. Live uses its text as history and does not resume an incomplete message. + $ref: '#/components/schemas/LiveInitialMessageStatus' - type: 'null' + role: + description: The author of this history message. Always `developer`. + default: developer + x-stainless-const: true + type: string + enum: + - developer + content: + description: The message content. Supply exactly one text part for the initial Live conversation history. + type: array + items: + $ref: '#/components/schemas/LiveInitialInputTextContentPartParam' + minItems: 1 + maxItems: 1 required: - - type - WebSearchActionSearch: + - role + - content + LiveInitialUserMessageItemParam: + description: A user message included in the initial text history of a Live session. type: object - title: Search action - description: | - Action type "search" - Performs a web search query. properties: + id: + anyOf: + - description: An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation. + type: string + - type: 'null' type: + description: The history item type. Always `message`. + default: message + x-stainless-const: true type: string enum: - - search - description: | - The action type. + - message + status: + anyOf: + - description: The supplied message’s status. Live uses its text as history and does not resume an incomplete message. + $ref: '#/components/schemas/LiveInitialMessageStatus' + - type: 'null' + role: + description: The author of this history message. Always `user`. + default: user x-stainless-const: true - query: type: string - deprecated: true - description: | - The search query. - queries: - type: array - title: Search queries - description: | - The search queries. - items: - type: string - description: | - A search query. - sources: + enum: + - user + content: + description: The message content. Supply exactly one text part for the initial Live conversation history. type: array - title: Web search sources - description: | - The sources used in the search. items: - type: object - title: Web search source - description: | - A source used in the search. - properties: - type: - type: string - enum: - - url - description: | - The type of source. Always `url`. - x-stainless-const: true - url: - type: string - format: uri - description: | - The URL of the source. - required: - - type - - url + $ref: '#/components/schemas/LiveInitialInputTextContentPartParam' + minItems: 1 + maxItems: 1 required: - - type - WebSearchApproximateLocation: - anyOf: - - type: object - title: Web search approximate location - description: | - The approximate location of the user. - properties: - type: - type: string - enum: - - approximate - description: The type of location approximation. Always `approximate`. - default: approximate - x-stainless-const: true - country: - anyOf: - - type: string - description: The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`. - - type: 'null' - region: - anyOf: - - type: string - description: Free text input for the region of the user, e.g. `California`. - - type: 'null' - city: - anyOf: - - type: string - description: Free text input for the city of the user, e.g. `San Francisco`. - - type: 'null' - timezone: - anyOf: - - type: string - description: The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`. - - type: 'null' - - type: 'null' - WebSearchContextSize: - type: string - description: "High level guidance for the amount of context window space to use for the \nsearch. One of `low`, `medium`, or `high`. `medium` is the default.\n" - enum: - - low - - medium - - high - default: medium - WebSearchLocation: + - role + - content + LiveInitialTextContentPartParam: + description: Assistant text supplied as conversation history when starting a Live session. type: object - title: Web search location - description: Approximate location parameters for the search. properties: - country: - type: string - description: "The two-letter \n[ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user,\ne.g. `US`.\n" - region: - type: string - description: | - Free text input for the region of the user, e.g. `California`. - city: + type: + description: The text content type. Always `text`. + default: text + x-stainless-const: true type: string - description: | - Free text input for the city of the user, e.g. `San Francisco`. - timezone: + enum: + - text + text: + description: The message text to include in the Live session’s initial conversation history. type: string - description: "The [IANA timezone](https://timeapi.io/documentation/iana-timezones) \nof the user, e.g. `America/Los_Angeles`.\n" - WebSearchTool: + required: + - text + LiveInitialOutputTextContentPartParam: + description: Assistant output text supplied as conversation history when starting a Live session. type: object - title: Web search - description: | - Search the Internet for sources related to the prompt. Learn more about the - [web search tool](https://developers.openai.com/api/docs/guides/tools-web-search). properties: type: + description: The text content type. Always `output_text`. + default: output_text + x-stainless-const: true type: string enum: - - web_search - - web_search_2025_08_26 - description: The type of the web search tool. One of `web_search` or `web_search_2025_08_26`. - default: web_search - external_web_access: - type: boolean - default: true - description: Allow live internet access for web search. Defaults to true when omitted. When false, the web search tool runs in offline/cache-only mode and will not fetch new external content. - filters: - anyOf: - - type: object - description: | - Filters for the search. - properties: - allowed_domains: - anyOf: - - type: array - title: Allowed domains for the search. - description: | - Allowed domains for the search. If not provided, all domains are allowed. - Subdomains of the provided domains are allowed as well. - - Example: `["pubmed.ncbi.nlm.nih.gov"]` - items: - type: string - description: Allowed domain for the search. - default: [] - - type: 'null' - - type: 'null' - user_location: - $ref: '#/components/schemas/WebSearchApproximateLocation' - search_context_size: + - output_text + text: + description: The message text to include in the Live session’s initial conversation history. type: string - enum: - - low - - medium - - high - default: medium - description: High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default. required: - type - WebSearchToolCall: + - text + LiveInitialAssistantMessageItemParam: + description: An assistant message included in the initial text history of a Live session. type: object - title: Web search tool call - description: | - The results of a web search tool call. See the - [web search guide](https://developers.openai.com/api/docs/guides/tools-web-search) for more information. properties: id: - type: string - description: | - The unique ID of the web search tool call. + anyOf: + - description: An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation. + type: string + - type: 'null' type: + description: The history item type. Always `message`. + default: message + x-stainless-const: true type: string enum: - - web_search_call - description: | - The type of the web search tool call. Always `web_search_call`. - x-stainless-const: true + - message status: - description: | - The status of the web search tool call. - $ref: '#/components/schemas/WebSearchCallStatus' - action: - type: object - description: | - An object describing the specific action taken in this web search call. - Includes details on how the model used the web (search, open_page, find_in_page). - discriminator: - propertyName: type anyOf: - - $ref: '#/components/schemas/WebSearchActionSearch' - - $ref: '#/components/schemas/WebSearchActionOpenPage' - - $ref: '#/components/schemas/WebSearchActionFind' + - description: The supplied message’s status. Live uses its text as history and does not resume an incomplete message. + $ref: '#/components/schemas/LiveInitialMessageStatus' + - type: 'null' + role: + description: The author of this history message. Always `assistant`. + default: assistant + x-stainless-const: true + type: string + enum: + - assistant + content: + description: The message content. Supply exactly one text part for the initial Live conversation history. + type: array + items: + discriminator: + propertyName: type + x-oai-default-discriminator-value: text + anyOf: + - $ref: '#/components/schemas/LiveInitialTextContentPartParam' + - $ref: '#/components/schemas/LiveInitialOutputTextContentPartParam' + minItems: 1 + maxItems: 1 required: - - id - - type - - status - - action - WebhookBatchCancelled: + - role + - content + LiveInitialItem: + description: A developer, user, or assistant message supplied as text history before the Live session starts. + discriminator: + propertyName: role + anyOf: + - $ref: '#/components/schemas/LiveInitialDeveloperMessageItemParam' + - $ref: '#/components/schemas/LiveInitialUserMessageItemParam' + - $ref: '#/components/schemas/LiveInitialAssistantMessageItemParam' + input: + description: Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total. + type: array + items: + $ref: '#/components/schemas/LiveInitialItem' + maxItems: 128 + LiveAllowedServerEventParam: + description: A Live server event selector for the WebRTC frontend data channel. + example: + type: session.started type: object - title: batch.cancelled - description: | - Sent when a batch API request has been cancelled. + properties: + type: + description: The outer Live server event type. Use 'response.event' for Responses events. + type: string + minLength: 1 + maxLength: 256 + response_event: + description: The nested Responses event type. Required when type is 'response.event'; forbidden for other event types. + type: string + minLength: 1 + maxLength: 256 required: - - created_at - - id - - data - type + additionalProperties: false + x-oaiMeta: + example: + type: session.started + LiveDataChannelConfigParam: + description: Control which Live events an untrusted WebRTC frontend can send and receive over its data channel. These restrictions do not apply to trusted sideband connections. + type: object properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the batch API request was cancelled. - id: - type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: + allowed_client_events: + description: Client event types that the frontend data channel may send. Use 'all' to allow every client event; an empty array allows none. Omission preserves the existing allow-all behavior. + anyOf: + - default: all + x-stainless-const: true + type: string + enum: + - all + - type: array + items: + description: A Live client event type allowed on the frontend data channel, such as `session.input_audio.mute`. type: string - description: | - The unique ID of the batch API request. - object: + minLength: 1 + maxLength: 256 + pattern: ^(?:error|info|[a-z][a-z0-9_-]*(?:\.[a-z0-9_-]+)+)$ + maxItems: 256 + allowed_server_events: + description: Server events that may be sent to the frontend data channel. Use 'all' to allow every server event; an empty array allows none. Omission preserves the existing allow-all behavior. Responses events use an object with type 'response.event' and a response_event selector. + anyOf: + - default: all + x-stainless-const: true + type: string + enum: + - all + - type: array + items: + $ref: '#/components/schemas/LiveAllowedServerEventParam' + maxItems: 256 + x-stainless-variantName: event_selectors + required: [] + LiveClientConfigParam: + description: Startup-only capabilities for an untrusted frontend attached to a unified WebRTC session. Trusted sideband connections are unaffected. + type: object + properties: + data_channel: + description: Client and server event permissions for the WebRTC frontend data channel. + $ref: '#/components/schemas/LiveDataChannelConfigParam' + required: + - data_channel + properties-store: + description: Whether to store the forked session. Omission inherits the stored session's setting. + type: boolean + LiveResponsesDelegationSettingsUpdateInputParam: + description: Updates to the Responses backend of an existing Live session. Omitted settings retain their current values. + type: object + properties: + model: + description: The Responses backend model to use for subsequent delegated requests. Omit to keep the current backend model. + type: string + instructions: + anyOf: + - description: Instructions for the delegated Responses model, separate from Live instructions. See [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). + type: string + - type: 'null' + max_output_tokens: + anyOf: + - description: Maximum number of output tokens for each delegated response. + type: integer + minimum: 16 + - type: 'null' + service_tier: + anyOf: + - description: Service tier for delegated Responses requests. + $ref: '#/components/schemas/LiveResponsesServiceTier' + - type: 'null' + reasoning: + anyOf: + - description: Reasoning settings passed to each delegated Responses request. + $ref: '#/components/schemas/LiveDelegationReasoningInputParam' + - type: 'null' + text: + anyOf: + - description: Text generation settings passed to each delegated Responses request. + $ref: '#/components/schemas/LiveDelegationTextInputParam' + - type: 'null' + tools: + description: Tools available to the Responses backend while it handles tasks delegated by the Live model. + type: array + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/LiveFunctionToolInputParam' + - $ref: '#/components/schemas/LiveWebSearchToolInputParam' + tool_choice: + description: Controls which tool the Responses backend uses when handling a task delegated by the Live model. + anyOf: + - $ref: '#/components/schemas/LiveToolChoiceEnum' + - $ref: '#/components/schemas/LiveFunctionToolChoiceParam' + - $ref: '#/components/schemas/LiveMCPToolChoiceParam' + parallel_tool_calls: + anyOf: + - description: Whether the delegated Responses model may request multiple tool calls in a single response. + type: boolean + - type: 'null' + required: [] + LiveResponsesDelegationUpdateParam: + description: Update the Responses backend for an existing Live session without changing delegation ownership. + type: object + properties: + type: + description: The delegation owner. Always `responses` for tasks handled by the Responses API. + default: responses + x-stainless-const: true type: string - description: | - The object of the event. Always `event`. enum: - - event - x-stainless-const: true + - responses + responses: + description: Responses backend settings to update. Omitted settings keep their existing values. + $ref: '#/components/schemas/LiveResponsesDelegationSettingsUpdateInputParam' + required: + - type + target_uri: + type: string + description: |- + URI that should appear in the SIP Refer-To header. Supports values like + `tel:+14155550123` or `sip:agent@example.com`. + example: tel:+14155550123 + PublicProjectResidency: + type: string + enum: + - GLOBAL + - US_STORAGE_PROCESSING + - EU_STORAGE_PROCESSING + - JP_STORAGE + - KR_STORAGE + - CA_STORAGE + - SG_STORAGE + - IN_STORAGE + - AU_STORAGE + - GB_STORAGE + - AE_STORAGE + - AE_STORAGE_PROCESSING + SpecificProgrammaticToolCallingParam: + properties: type: type: string - description: | - The type of the event. Always `batch.cancelled`. enum: - - batch.cancelled + - programmatic_tool_calling + description: The tool to call. Always `programmatic_tool_calling`. + default: programmatic_tool_calling x-stainless-const: true - x-oaiMeta: - name: batch.cancelled - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "batch.cancelled", - "created_at": 1719168000, - "data": { - "id": "batch_abc123" - } - } - WebhookBatchCompleted: type: object - title: batch.completed - description: | - Sent when a batch API request has been completed. required: - - created_at - - id - - data - type + SpecificApplyPatchParam: properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the batch API request was completed. - id: - type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the batch API request. - object: + type: type: string - description: | - The object of the event. Always `event`. enum: - - event + - apply_patch + description: The tool to call. Always `apply_patch`. + default: apply_patch x-stainless-const: true + type: object + required: + - type + title: Specific apply patch tool choice + description: Forces the model to call the apply_patch tool when executing a tool call. + SpecificFunctionShellParam: + properties: type: type: string - description: | - The type of the event. Always `batch.completed`. enum: - - batch.completed + - shell + description: The tool to call. Always `shell`. + default: shell x-stainless-const: true - x-oaiMeta: - name: batch.completed - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "batch.completed", - "created_at": 1719168000, - "data": { - "id": "batch_abc123" - } - } - WebhookBatchExpired: type: object - title: batch.expired - description: | - Sent when a batch API request has expired. required: - - created_at - - id - - data - type + title: Specific shell tool choice + description: Forces the model to call the shell tool when a tool call is required. + ResponsePromptCacheOptionsParam: + properties: + ttl: + $ref: '#/components/schemas/PromptCacheTTLEnum' + description: The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer. + mode: + $ref: '#/components/schemas/PromptCacheModeEnum' + description: Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching. + comparison_response_id: + anyOf: + - type: string + description: The ID of a response to compare when diagnosing prompt cache reuse. Supplying this field requests prompt cache diagnostics when the feature is enabled. + example: resp_123 + - type: 'null' + type: object + required: [] + title: Prompt cache options + description: Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details. + ReasoningModeEnum: + anyOf: + - type: string + - type: string + enum: + - standard + - pro + ConversationParam-2: properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the batch API request expired. id: type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the batch API request. - object: + description: The unique ID of the conversation. + example: conv_123 + type: object + required: + - id + title: Conversation object + description: The conversation that this response belongs to. + ContextManagementParam: + properties: + type: type: string - description: | - The object of the event. Always `event`. - enum: - - event - x-stainless-const: true + description: The context management entry type. Currently only 'compaction' is supported. + compact_threshold: + anyOf: + - type: integer + minimum: 1000 + description: Token threshold at which compaction should be triggered for this entry. + - type: 'null' + type: object + required: + - type + PromptCacheOptions: + properties: + ttl: + $ref: '#/components/schemas/PromptCacheTTLEnum' + description: The minimum lifetime applied to each cache breakpoint. + mode: + $ref: '#/components/schemas/PromptCacheModeEnum' + description: Whether implicit prompt-cache breakpoints were enabled. + comparison_response_id: + anyOf: + - type: string + description: The response ID supplied as the prompt cache diagnostics comparison. + - type: 'null' + type: object + required: + - ttl + - mode + title: Prompt cache options + description: The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models. + CacheMissReasonTypeEnum: + type: string + enum: + - model_changed + - prompt_cache_key_changed + - tools_changed + - text_format_changed + - reasoning_effort_changed + - verbosity_changed + - context_compacted + - input_changed + - service_tier_changed + PromptCacheMissDiagnosticsBody: + properties: type: type: string - description: | - The type of the event. Always `batch.expired`. enum: - - batch.expired + - cache_miss + default: cache_miss x-stainless-const: true - x-oaiMeta: - name: batch.expired - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "batch.expired", - "created_at": 1719168000, - "data": { - "id": "batch_abc123" - } - } - WebhookBatchFailed: + reason: + $ref: '#/components/schemas/CacheMissReasonTypeEnum' + description: The reason prompt cache reuse did not occur. + cache_missed_tokens: + type: integer + description: The estimated number of input tokens affected after the first detected divergence. + comparison_reusable_tokens: + type: integer + description: The raw token count of the reusable prefix in the compared response. type: object - title: batch.failed - description: | - Sent when a batch API request has failed. required: - - created_at - - id - - data - type + - reason + - cache_missed_tokens + PromptCacheHitDiagnosticsBody: properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the batch API request failed. - id: - type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the batch API request. - object: + type: type: string - description: | - The object of the event. Always `event`. enum: - - event + - cache_hit + default: cache_hit x-stainless-const: true + type: object + required: + - type + PromptCacheComparisonResponseNotFoundDiagnosticsBody: + properties: type: type: string - description: | - The type of the event. Always `batch.failed`. enum: - - batch.failed + - comparison_response_not_found + default: comparison_response_not_found x-stainless-const: true - x-oaiMeta: - name: batch.failed - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "batch.failed", - "created_at": 1719168000, - "data": { - "id": "batch_abc123" - } - } - WebhookEvalRunCanceled: type: object - title: eval.run.canceled - description: | - Sent when an eval run has been canceled. required: - - created_at - - id - - data - type + PromptCacheUnavailableDiagnosticsBody: properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the eval run was canceled. - id: - type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the eval run. - object: + type: type: string - description: | - The object of the event. Always `event`. enum: - - event + - unavailable + default: unavailable x-stainless-const: true + type: object + required: + - type + PromptCacheDiagnostics: + discriminator: + propertyName: type + description: Prompt cache diagnostics requested for this response. + anyOf: + - $ref: '#/components/schemas/PromptCacheMissDiagnosticsBody' + - $ref: '#/components/schemas/PromptCacheHitDiagnosticsBody' + - $ref: '#/components/schemas/PromptCacheComparisonResponseNotFoundDiagnosticsBody' + - $ref: '#/components/schemas/PromptCacheUnavailableDiagnosticsBody' + ModerationErrorBody: + properties: type: type: string - description: | - The type of the event. Always `eval.run.canceled`. enum: - - eval.run.canceled + - error + description: The object type, which was always `error` for moderation failures. + default: error x-stainless-const: true - x-oaiMeta: - name: eval.run.canceled - group: webhook-events - example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"eval.run.canceled\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"evalrun_abc123\"\n }\n} \n" - WebhookEvalRunFailed: + code: + type: string + description: The error code. + message: + type: string + description: The error message. type: object - title: eval.run.failed - description: | - Sent when an eval run has failed. required: - - created_at - - id - - data - type + - code + - message + title: Moderation error + description: An error produced while attempting moderation for the response input or output. + Moderation: + properties: + input: + discriminator: + propertyName: type + description: Moderation for the response input. + anyOf: + - $ref: '#/components/schemas/ModerationResultBody' + - $ref: '#/components/schemas/ModerationErrorBody' + output: + discriminator: + propertyName: type + description: Moderation for the response output. + anyOf: + - $ref: '#/components/schemas/ModerationResultBody' + - $ref: '#/components/schemas/ModerationErrorBody' + type: object + required: + - input + - output + title: Moderation + description: Moderation results or errors for the response input and output. + ResponseConversation: properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the eval run failed. id: type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the eval run. - object: - type: string - description: | - The object of the event. Always `event`. - enum: - - event - x-stainless-const: true + description: The unique ID of the conversation that this response was associated with. + type: object + required: + - id + title: Conversation + description: The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation. + ResponseShellCallCommandAddedStreamingEvent: + properties: type: type: string - description: | - The type of the event. Always `eval.run.failed`. enum: - - eval.run.failed + - response.shell_call_command.added + description: The type of the event, always `response.shell_call_command.added`. + default: response.shell_call_command.added x-stainless-const: true - x-oaiMeta: - name: eval.run.failed - group: webhook-events - example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"eval.run.failed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"evalrun_abc123\"\n }\n} \n" - WebhookEvalRunSucceeded: + sequence_number: + type: integer + description: The sequence number of the event that was emitted. + output_index: + type: integer + description: The index of the output item that was updated. + command_index: + type: integer + description: The index of the shell command that was added. + command: + type: string + description: The shell command that was added. type: object - title: eval.run.succeeded - description: | - Sent when an eval run has succeeded. required: - - created_at - - id - - data - type + - sequence_number + - output_index + - command_index + - command + title: Response shell command added event + description: A streaming event that indicated a shell command was added to a tool call. + ResponseShellCallCommandDeltaStreamingEvent: properties: - created_at: + type: + type: string + enum: + - response.shell_call_command.delta + description: The type of the event, always `response.shell_call_command.delta`. + default: response.shell_call_command.delta + x-stainless-const: true + sequence_number: type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the eval run succeeded. - id: + description: The sequence number of the event that was emitted. + output_index: + type: integer + description: The index of the output item that was updated. + command_index: + type: integer + description: The index of the shell command that was updated. + delta: type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the eval run. - object: + description: The shell command delta that was appended. + obfuscation: type: string - description: | - The object of the event. Always `event`. - enum: - - event - x-stainless-const: true + description: An obfuscation string that was added to pad the event payload. + type: object + required: + - type + - sequence_number + - output_index + - command_index + - delta + title: Response shell command delta event + description: A streaming event that indicated a shell command was incrementally updated. + ResponseShellCallCommandDoneStreamingEvent: + properties: type: type: string - description: | - The type of the event. Always `eval.run.succeeded`. enum: - - eval.run.succeeded + - response.shell_call_command.done + description: The type of the event, always `response.shell_call_command.done`. + default: response.shell_call_command.done x-stainless-const: true - x-oaiMeta: - name: eval.run.succeeded - group: webhook-events - example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"eval.run.succeeded\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"evalrun_abc123\"\n }\n} \n" - WebhookFineTuningJobCancelled: + sequence_number: + type: integer + description: The sequence number of the event that was emitted. + output_index: + type: integer + description: The index of the output item that was updated. + command_index: + type: integer + description: The index of the shell command that was completed. + command: + type: string + description: The final shell command that was emitted. type: object - title: fine_tuning.job.cancelled - description: | - Sent when a fine-tuning job has been cancelled. required: - - created_at - - id - - data - type + - sequence_number + - output_index + - command_index + - command + title: Response shell command done event + description: A streaming event that indicated a shell command was completed. + ShellCallOutputDelta: properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the fine-tuning job was cancelled. - id: + stdout: type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the fine-tuning job. - object: + description: The stdout delta that was emitted. + stderr: type: string - description: | - The object of the event. Always `event`. - enum: - - event - x-stainless-const: true + description: The stderr delta that was emitted. + type: object + required: [] + title: Shell call output delta + description: A delta of stdout/stderr emitted while a shell call was running. + ResponseShellCallOutputContentDeltaStreamingEvent: + properties: type: type: string - description: | - The type of the event. Always `fine_tuning.job.cancelled`. enum: - - fine_tuning.job.cancelled + - response.shell_call_output_content.delta + description: The type of the event, always `response.shell_call_output_content.delta`. + default: response.shell_call_output_content.delta x-stainless-const: true - x-oaiMeta: - name: fine_tuning.job.cancelled - group: webhook-events - example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"fine_tuning.job.cancelled\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"ftjob_abc123\"\n }\n} \n" - WebhookFineTuningJobFailed: + sequence_number: + type: integer + description: The sequence number of the event that was emitted. + item_id: + type: string + description: The ID of the output item that was updated. + output_index: + type: integer + description: The index of the output item that was updated. + command_index: + type: integer + description: The index of the shell command that produced output. + delta: + $ref: '#/components/schemas/ShellCallOutputDelta' + description: The stdout/stderr delta that was emitted. type: object - title: fine_tuning.job.failed - description: | - Sent when a fine-tuning job has failed. required: - - created_at - - id - - data - type + - sequence_number + - item_id + - output_index + - command_index + - delta + title: Response shell call output content delta event + description: A streaming event that indicated shell call output was incrementally added. + ResponseShellCallOutputContentDoneStreamingEvent: properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the fine-tuning job failed. - id: - type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the fine-tuning job. - object: - type: string - description: | - The object of the event. Always `event`. - enum: - - event - x-stainless-const: true type: type: string - description: | - The type of the event. Always `fine_tuning.job.failed`. enum: - - fine_tuning.job.failed + - response.shell_call_output_content.done + description: The type of the event, always `response.shell_call_output_content.done`. + default: response.shell_call_output_content.done x-stainless-const: true - x-oaiMeta: - name: fine_tuning.job.failed - group: webhook-events - example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"fine_tuning.job.failed\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"ftjob_abc123\"\n }\n} \n" - WebhookFineTuningJobSucceeded: + sequence_number: + type: integer + description: The sequence number of the event that was emitted. + item_id: + type: string + description: The ID of the output item that was updated. + output_index: + type: integer + description: The index of the output item that was updated. + command_index: + type: integer + description: The index of the shell command that produced output. + output: + items: + $ref: '#/components/schemas/FunctionShellCallOutputContent' + type: array + description: The output contents emitted for the shell command. type: object - title: fine_tuning.job.succeeded - description: | - Sent when a fine-tuning job has succeeded. required: - - created_at - - id - - data - type + - sequence_number + - item_id + - output_index + - command_index + - output + title: Response shell call output content done event + description: A streaming event that indicated shell call output was completed. + CreateConversationBody: + properties: + metadata: + anyOf: + - $ref: '#/components/schemas/Metadata' + description: |- + Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + - type: 'null' + items: + anyOf: + - items: + $ref: '#/components/schemas/InputItem' + type: array + maxItems: 20 + description: Initial items to include in the conversation context. You may add up to 20 items at a time. + - type: 'null' + type: object + required: [] + UpdateConversationBody: + properties: + metadata: + $ref: '#/components/schemas/Metadata' + description: |- + Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. + Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + type: object + required: + - metadata + DeletedConversationResource: properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the fine-tuning job succeeded. - id: - type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the fine-tuning job. object: type: string - description: | - The object of the event. Always `event`. enum: - - event + - conversation.deleted + default: conversation.deleted x-stainless-const: true - type: + deleted: + type: boolean + id: type: string - description: | - The type of the event. Always `fine_tuning.job.succeeded`. - enum: - - fine_tuning.job.succeeded - x-stainless-const: true - x-oaiMeta: - name: fine_tuning.job.succeeded - group: webhook-events - example: "{\n \"id\": \"evt_abc123\",\n \"type\": \"fine_tuning.job.succeeded\",\n \"created_at\": 1719168000,\n \"data\": {\n \"id\": \"ftjob_abc123\"\n }\n} \n" - WebhookLiveCallIncoming: type: object - title: live.call.incoming - deprecated: true - description: | - Deprecated: use `live.transport.incoming`. Retained for existing subscriptions - during migration; new subscriptions to this event are not allowed. - Sent when an incoming API SIP session is available for Live acceptance. The - same pending session can also emit `realtime.call.incoming`; the first - successful Realtime or Live accept endpoint selects the runtime surface. required: - - created_at + - object + - deleted - id - - data - - type + SafetyAlertErrorType: + type: string + enum: + - potentially_unintended_data_transfer + - potentially_unintended_data_access + - potentially_unintended_destructive_activity + - other + SafetyAlertResource: properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the event was created. id: type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - session_id - - sip_headers - properties: - session_id: - type: string - description: | - The `live_...` ID of the pending SIP session. Pass this value unchanged - to Live call controls and sideband connections. The corresponding - `realtime.call.incoming` event uses a separate `rtc_...` call ID. - sip_headers: - type: array - description: | - Headers from the SIP INVITE, excluding SIP authorization headers. - Retained names, values, repeated entries, and order are preserved. - Treat these values as untrusted call metadata. - items: - type: object - description: | - A header from the SIP Invite. - required: - - name - - value - properties: - name: - type: string - description: | - Name of the SIP Header. - value: - type: string - description: | - Value of the SIP Header. object: type: string - description: | - The object of the event. Always `event`. enum: - - event + - safety.alert + default: safety.alert x-stainless-const: true - type: + created_at: + type: integer + format: unixtime + request_id: type: string - description: | - The type of the event. Always `live.call.incoming`. - enum: - - live.call.incoming - x-stainless-const: true - x-oaiMeta: - name: live.call.incoming - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "live.call.incoming", - "created_at": 1719168000, - "data": { - "session_id": "live_u0_479a275623b54bdb9b6fbae2f7cbd408", - "sip_headers": [ - {"name": "From", "value": ";tag=abc123"}, - {"name": "To", "value": ""}, - {"name": "Call-ID", "value": "call-123@example.com"} - ] - } - } - WebhookLiveTransportIncoming: + response_id: + type: string + model: + type: string + request_paused: + type: boolean + description: Whether block registration succeeded for this request. This does not confirm that response execution stopped. + error_type: + $ref: '#/components/schemas/SafetyAlertErrorType' + reason: + anyOf: + - type: string + description: A customer-safe description derived from error_type, or null for zero data retention requests. + - type: 'null' type: object - title: live.transport.incoming - description: | - Sent when an incoming API SIP session is available for Live acceptance. The - same pending session can also emit `realtime.call.incoming`; the first - successful Realtime or Live accept endpoint selects the runtime surface. required: - - created_at - id - - data - - type + - object + - created_at + - request_id + - response_id + - model + - request_paused + - error_type + - reason + SpendLimitCurrency: + anyOf: + - type: string + - type: string + enum: + - USD + SpendLimitInterval: + anyOf: + - type: string + - type: string + enum: + - month + SpendLimitEnforcementStatus: + anyOf: + - type: string + - type: string + enum: + - inactive + - enforcing + SpendLimitEnforcement: + properties: + status: + $ref: '#/components/schemas/SpendLimitEnforcementStatus' + description: Whether the hard spend limit is currently enforcing. + type: object + required: + - status + description: The current enforcement state of a hard spend limit. + OrganizationSpendLimitResource: properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the event was created. - id: - type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - type - - session_id - - sip_headers - properties: - type: - type: string - description: The incoming transport type. Always `sip`. - enum: - - sip - x-stainless-const: true - session_id: - type: string - description: | - The `live_...` ID of the pending SIP session. Forward this value - unchanged when accepting or rejecting the call through the Live API. - sip_headers: - type: array - description: | - Headers from the SIP INVITE, excluding SIP authorization headers. - Retained names, values, repeated entries, and order are preserved. - Treat these values as untrusted call metadata. - items: - type: object - description: | - A header from the SIP Invite. - required: - - name - - value - properties: - name: - type: string - description: | - Name of the SIP Header. - value: - type: string - description: | - Value of the SIP Header. object: type: string - description: | - The object of the event. Always `event`. - enum: - - event - x-stainless-const: true - type: - type: string - description: | - The type of the event. Always `live.transport.incoming`. enum: - - live.transport.incoming + - organization.spend_limit + description: The object type, which is always `organization.spend_limit`. + default: organization.spend_limit x-stainless-const: true - x-oaiMeta: - name: live.transport.incoming - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "live.transport.incoming", - "created_at": 1719168000, - "data": { - "type": "sip", - "session_id": "live_u0_479a275623b54bdb9b6fbae2f7cbd408", - "sip_headers": [ - {"name": "From", "value": ";tag=abc123"}, - {"name": "To", "value": ""}, - {"name": "Call-ID", "value": "call-123@example.com"} - ] - } - } - WebhookRealtimeCallIncoming: + threshold_amount: + type: integer + description: The hard spend limit amount, in cents. + currency: + $ref: '#/components/schemas/SpendLimitCurrency' + description: The currency for the threshold amount. Currently, only `USD` is supported. + interval: + $ref: '#/components/schemas/SpendLimitInterval' + description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. + enforcement: + $ref: '#/components/schemas/SpendLimitEnforcement' + description: The current enforcement state of the hard spend limit. type: object - title: realtime.call.incoming - description: | - Sent when an incoming API SIP session is available for Realtime acceptance. - The same pending session can also emit `live.transport.incoming`; the first - successful Realtime or Live accept endpoint selects the runtime surface. required: - - created_at - - id - - data - - type + - object + - threshold_amount + - currency + - interval + - enforcement + description: Represents a hard spend limit configured at the organization level. + UpdateOrganizationSpendLimitBody: properties: - created_at: + threshold_amount: type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the model response was completed. - id: + minimum: 1 + description: The hard spend limit amount, in cents. + currency: type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - call_id - - sip_headers - properties: - call_id: - type: string - description: | - The Transceiver `rtc_...` ID of the pending SIP session. The paired - `live.transport.incoming` event derives its `session_id` by replacing the - `rtc_` prefix with `live_`. Use the ID returned by the event with the - corresponding Realtime or Live API. - sip_headers: - type: array - description: | - Headers from the SIP INVITE, excluding SIP authorization headers. - Retained names, values, repeated entries, and order are preserved. - Treat these values as untrusted call metadata. - items: - type: object - description: | - A header from the SIP Invite. - required: - - name - - value - properties: - name: - type: string - description: | - Name of the SIP Header. - value: - type: string - description: | - Value of the SIP Header. + enum: + - USD + description: The currency for the threshold amount. Currently, only `USD` is supported. + interval: + type: string + enum: + - month + description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. + type: object + required: + - threshold_amount + - currency + - interval + description: Parameters for the hard spend limit you want to create or replace. + OrganizationSpendLimitDeletedResource: + properties: object: type: string - description: | - The object of the event. Always `event`. enum: - - event + - organization.spend_limit.deleted + description: The object type, which is always `organization.spend_limit.deleted`. + default: organization.spend_limit.deleted x-stainless-const: true - type: + deleted: + type: boolean + description: Whether the hard spend limit was deleted. + type: object + required: + - object + - deleted + description: Confirmation payload returned after deleting an organization hard spend limit. + ProjectSpendLimitResource: + properties: + object: type: string - description: | - The type of the event. Always `realtime.call.incoming`. enum: - - realtime.call.incoming + - project.spend_limit + description: The object type, which is always `project.spend_limit`. + default: project.spend_limit x-stainless-const: true - x-oaiMeta: - name: realtime.call.incoming - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "realtime.call.incoming", - "created_at": 1719168000, - "data": { - "call_id": "rtc_479a275623b54bdb9b6fbae2f7cbd408", - "sip_headers": [ - {"name": "Max-Forwards", "value": "63"}, - {"name": "CSeq", "value": "851287 INVITE"}, - {"name": "Content-Type", "value": "application/sdp"} - ] - } - } - WebhookResponseCancelled: + threshold_amount: + type: integer + description: The hard spend limit amount, in cents. + currency: + $ref: '#/components/schemas/SpendLimitCurrency' + description: The currency for the threshold amount. Currently, only `USD` is supported. + interval: + $ref: '#/components/schemas/SpendLimitInterval' + description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. + enforcement: + $ref: '#/components/schemas/SpendLimitEnforcement' + description: The current enforcement state of the hard spend limit. type: object - title: response.cancelled - description: | - Sent when a background response has been cancelled. required: - - created_at - - id - - data - - type + - object + - threshold_amount + - currency + - interval + - enforcement + description: Represents a hard spend limit configured at the project level. + UpdateProjectSpendLimitBody: properties: - created_at: + threshold_amount: type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the model response was cancelled. - id: + minimum: 1 + description: The hard spend limit amount, in cents. + currency: type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the model response. - object: + enum: + - USD + description: The currency for the threshold amount. Currently, only `USD` is supported. + interval: type: string - description: | - The object of the event. Always `event`. enum: - - event - x-stainless-const: true - type: + - month + description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. + type: object + required: + - threshold_amount + - currency + - interval + description: Parameters for the hard spend limit you want to create or replace. + ProjectSpendLimitDeletedResource: + properties: + object: type: string - description: | - The type of the event. Always `response.cancelled`. enum: - - response.cancelled + - project.spend_limit.deleted + description: The object type, which is always `project.spend_limit.deleted`. + default: project.spend_limit.deleted x-stainless-const: true - x-oaiMeta: - name: response.cancelled - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "response.cancelled", - "created_at": 1719168000, - "data": { - "id": "resp_abc123" - } - } - WebhookResponseCompleted: + deleted: + type: boolean + description: Whether the hard spend limit was deleted. type: object - title: response.completed - description: | - Sent when a background response has been completed. required: - - created_at - - id - - data - - type + - object + - deleted + description: Confirmation payload returned after deleting a project hard spend limit. + CreateProjectServiceAccountApiKeyBody: properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the model response was completed. - id: + name: type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the model response. + description: API key name. + scopes: + items: + type: string + description: API key scope. + type: array + description: API key scopes. + expires_in_seconds: + anyOf: + - type: integer + maximum: 31536000 + minimum: 1 + description: Number of seconds until the API key expires. + - type: 'null' + type: object + required: [] + description: The service account API key create request payload. + ServiceAccountApiKeyBody: + properties: object: type: string - description: | - The object of the event. Always `event`. enum: - - event + - organization.project.service_account.api_key + description: The object type, which is always `organization.project.service_account.api_key` + default: organization.project.service_account.api_key x-stainless-const: true - type: + value: type: string - description: | - The type of the event. Always `response.completed`. - enum: - - response.completed - x-stainless-const: true - x-oaiMeta: - name: response.completed - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "response.completed", - "created_at": 1719168000, - "data": { - "id": "resp_abc123" - } - } - WebhookResponseFailed: + description: The unredacted API key value. + name: + type: string + description: The name of the API key. + created_at: + type: integer + format: unixtime + description: The Unix timestamp (in seconds) when the API key was created. + expires_at: + anyOf: + - type: integer + format: unixtime + description: The Unix timestamp (in seconds) when the API key expires, or null if it does not expire. + - type: 'null' + id: + type: string + description: The identifier of the API key. type: object - title: response.failed - description: | - Sent when a background response has failed. required: + - object + - value + - name - created_at - id - - data - - type + CreateContentProvenanceBody: properties: - created_at: - type: integer - format: unixtime - description: | - The Unix timestamp (in seconds) of when the model response failed. - id: + file: type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the model response. - object: + format: binary + description: The image or audio file to check for supported OpenAI provenance signals. + type: object + required: + - file + ProvenanceCheckObject: + type: string + enum: + - content_provenance_check + ProvenanceDetectionResultApi: + type: string + enum: + - detected + - not_detected + C2PAValidationStateApi: + type: string + enum: + - trusted + - valid + - invalid + - not_present + C2PAProvenanceResult: + properties: + type: type: string - description: | - The object of the event. Always `event`. enum: - - event + - c2pa + description: The provenance signal type. Always `c2pa`. + default: c2pa x-stainless-const: true + outcome: + $ref: '#/components/schemas/ProvenanceDetectionResultApi' + description: |- + Whether a supported OpenAI C2PA provenance signal was detected. + If `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect. + validation_state: + $ref: '#/components/schemas/C2PAValidationStateApi' + description: The validation status of the C2PA manifest in the uploaded image. + issuer: + anyOf: + - type: string + description: The C2PA manifest issuer, when available. + - type: 'null' + model: + anyOf: + - type: string + description: The OpenAI model recorded by the provenance signal, when available. + - type: 'null' + generated_at: + anyOf: + - type: string + description: The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset was generated, when available. + - type: 'null' + type: object + required: + - type + - outcome + - validation_state + - issuer + - model + - generated_at + SynthIDProvenanceResult: + properties: type: type: string - description: | - The type of the event. Always `response.failed`. enum: - - response.failed + - synthid + description: The provenance signal type. Always `synthid`. + default: synthid x-stainless-const: true - x-oaiMeta: - name: response.failed - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "response.failed", - "created_at": 1719168000, - "data": { - "id": "resp_abc123" - } - } - WebhookResponseIncomplete: + outcome: + $ref: '#/components/schemas/ProvenanceDetectionResultApi' + description: |- + Whether a supported OpenAI SynthID watermark was detected. + If `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect. + model: + anyOf: + - type: string + description: The OpenAI model recorded by the provenance signal, when available. + - type: 'null' + generated_at: + anyOf: + - type: string + description: The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset was generated, when available. + - type: 'null' type: object - title: response.incomplete - description: | - Sent when a background response has been interrupted. required: - - created_at - - id - - data - type + - outcome + - model + - generated_at + ProvenanceResource: properties: + object: + $ref: '#/components/schemas/ProvenanceCheckObject' + description: The object type. Always `content_provenance_check` for this endpoint. created_at: type: integer format: unixtime - description: | - The Unix timestamp (in seconds) of when the model response was interrupted. - id: - type: string - description: | - The unique ID of the event. - data: - type: object - description: | - Event data payload. - required: - - id - properties: - id: - type: string - description: | - The unique ID of the model response. - object: + description: The Unix timestamp, in seconds, when the provenance check was created. + results: + items: + discriminator: + propertyName: type + anyOf: + - $ref: '#/components/schemas/C2PAProvenanceResult' + - $ref: '#/components/schemas/SynthIDProvenanceResult' + type: array + description: The provenance results that apply to the uploaded file. Image results include C2PA and SynthID; audio results include SynthID. + type: object + required: + - object + - created_at + - results + OrderEnum: + type: string + enum: + - asc + - desc + VideoModel: + anyOf: + - type: string + - type: string + enum: + - sora-2 + - sora-2-pro + - sora-2-2025-10-06 + - sora-2-pro-2025-10-06 + - sora-2-2025-12-08 + VideoStatus: + type: string + enum: + - queued + - in_progress + - completed + - failed + VideoSize: + type: string + enum: + - 720x1280 + - 1280x720 + - 1024x1792 + - 1792x1024 + Error-2: + properties: + code: type: string - description: | - The object of the event. Always `event`. - enum: - - event - x-stainless-const: true - type: + description: A machine-readable error code that was returned. + message: type: string - description: | - The type of the event. Always `response.incomplete`. - enum: - - response.incomplete - x-stainless-const: true - x-oaiMeta: - name: response.incomplete - group: webhook-events - example: | - { - "id": "evt_abc123", - "type": "response.incomplete", - "created_at": 1719168000, - "data": { - "id": "resp_abc123" - } - } - WebhookSafetyAlertCreated: + description: A human-readable description of the error that was returned. + misalignment: + $ref: '#/components/schemas/MisalignmentErrorDetailsResource' type: object - title: safety.alert.created - description: Sent when an approved safety alert is available for an API project. required: - - id - - object - - created_at - - type - - data + - code + - message + title: Error + description: An error that occurred while generating the response. + VideoResource: properties: id: type: string - description: The unique ID of the webhook event. + description: Unique identifier for the video job. object: type: string enum: - - event + - video + description: The object type, which is always `video`. + default: video x-stainless-const: true - description: Always `event`. + model: + $ref: '#/components/schemas/VideoModel' + description: The video generation model that produced the job. + status: + $ref: '#/components/schemas/VideoStatus' + description: Current lifecycle status of the video job. + progress: + type: integer + description: Approximate completion percentage for the generation task. created_at: type: integer format: unixtime - description: The Unix timestamp in seconds when the event was created. - type: - type: string - enum: - - safety.alert.created - x-stainless-const: true - description: Always `safety.alert.created`. - data: - type: object - additionalProperties: false - required: - - id - properties: - id: - type: string - pattern: ^alert_[0-9a-f]{32}$ - description: The safety alert ID to pass to `GET /v1/safety/alerts/{id}`. - x-oaiMeta: - name: safety.alert.created - group: webhook-events - example: | - { - "id": "evt_123", - "object": "event", - "created_at": 1787659200, - "type": "safety.alert.created", - "data": {"id": "alert_0123456789abcdef0123456789abcdef"} - } - WebhookSafetyOrgAlertCreated: + description: Unix timestamp (seconds) for when the job was created. + completed_at: + anyOf: + - type: integer + format: unixtime + description: Unix timestamp (seconds) for when the job completed, if finished. + - type: 'null' + expires_at: + anyOf: + - type: integer + format: unixtime + description: Unix timestamp (seconds) for when the downloadable assets expire, if set. + - type: 'null' + prompt: + anyOf: + - type: string + description: The prompt that was used to generate the video. + - type: 'null' + size: + $ref: '#/components/schemas/VideoSize' + description: The resolution of the generated video. + seconds: + anyOf: + - type: string + - $ref: '#/components/schemas/VideoSeconds' + description: Duration of the generated clip in seconds. For extensions, this is the stitched total duration. + remixed_from_video_id: + anyOf: + - type: string + description: Identifier of the source video if this video is a remix. + - type: 'null' + error: + anyOf: + - $ref: '#/components/schemas/Error-2' + description: Error payload that explains why generation failed, if applicable. + - type: 'null' type: object - title: safety.org_alert.created - description: Sent when an approved safety alert is available for an enterprise workspace. required: - id - object + - model + - status + - progress - created_at - - type - - data + - completed_at + - expires_at + - prompt + - size + - seconds + - remixed_from_video_id + - error + title: Video job + description: Structured information describing a generated video job. + VideoListResource: properties: - id: - type: string - description: The unique ID of the webhook event. object: - type: string - enum: - - event - x-stainless-const: true - description: Always `event`. - created_at: - type: integer - format: unixtime - description: The Unix timestamp in seconds when the event was created. - type: - type: string - enum: - - safety.org_alert.created x-stainless-const: true - description: Always `safety.org_alert.created`. + default: list + description: The type of object returned, must be `list`. + const: list data: - type: object - additionalProperties: false - required: - - id - properties: - id: - type: string - pattern: ^alert_[0-9a-f]{32}$ - description: The safety alert ID to pass to `GET /v1/safety/alerts/{id}`. - x-oaiMeta: - name: safety.org_alert.created - group: webhook-events - example: | - { - "id": "evt_123", - "object": "event", - "created_at": 1787659200, - "type": "safety.org_alert.created", - "data": {"id": "alert_0123456789abcdef0123456789abcdef"} - } - ModerationInputType: - type: string - enum: - - text - - image - ModerationResultBody: + items: + $ref: '#/components/schemas/VideoResource' + type: array + description: A list of items + first_id: + anyOf: + - type: string + description: The ID of the first item in the list. + - type: 'null' + last_id: + anyOf: + - type: string + description: The ID of the last item in the list. + - type: 'null' + has_more: + type: boolean + description: Whether there are more items available. + type: object + required: + - object + - data + - first_id + - last_id + - has_more + ImageRefParam-2: properties: - type: + image_url: type: string - enum: - - moderation_result - description: The object type, which was always `moderation_result` for successful moderation results. - default: moderation_result - x-stainless-const: true - model: + maxLength: 20971520 + format: uri + description: A fully qualified URL or base64-encoded data URL. + file_id: type: string - description: The moderation model that produced this result. - flagged: - type: boolean - description: A boolean indicating whether the content was flagged by any category. - categories: - additionalProperties: - type: boolean - type: object - description: A dictionary of moderation categories to booleans, True if the input is flagged under this category. - x-oaiTypeLabel: map - category_scores: - additionalProperties: - type: number - type: object - description: A dictionary of moderation categories to scores. - x-oaiTypeLabel: map - category_applied_input_types: - additionalProperties: - items: - $ref: '#/components/schemas/ModerationInputType' - type: array - type: object - description: Which modalities of input are reflected by the score for each category. - x-oaiTypeLabel: map + example: file-123 type: object - required: - - type - - model - - flagged - - categories - - category_scores - - category_applied_input_types - title: Moderation result - description: A moderation result produced for the response input or output. - PromptCacheTTLEnum: - type: string - enum: - - 30m - PromptCacheModeEnum: + required: [] + VideoSeconds: type: string enum: - - implicit - - explicit - PromptCacheOptionsParam: + - '4' + - '8' + - '12' + CreateVideoMultipartBody: properties: - ttl: - $ref: '#/components/schemas/PromptCacheTTLEnum' - description: The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer. - mode: - $ref: '#/components/schemas/PromptCacheModeEnum' - description: Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching. + model: + $ref: '#/components/schemas/VideoModel' + description: 'The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`.' + prompt: + type: string + maxLength: 32000 + minLength: 1 + description: Text prompt that describes the video to generate. + input_reference: + anyOf: + - type: string + format: binary + description: Optional reference asset upload or reference object that guides generation. + - $ref: '#/components/schemas/ImageRefParam-2' + description: Optional reference asset upload or reference object that guides generation. Provide exactly one of `image_url` or `file_id` when using an object. + seconds: + $ref: '#/components/schemas/VideoSeconds' + description: 'Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.' + size: + $ref: '#/components/schemas/VideoSize' + description: 'Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.' type: object - required: [] - title: Prompt cache options - description: Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details. - PromptCacheBreakpointParam: + required: + - prompt + title: Create video multipart request + description: Multipart parameters for creating a new video generation job. + CreateVideoJsonBody: properties: - mode: + model: + $ref: '#/components/schemas/VideoModel' + description: 'The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`.' + prompt: type: string - enum: - - explicit - description: The breakpoint mode. Always `explicit`. - default: explicit - x-stainless-const: true + maxLength: 32000 + minLength: 1 + description: Text prompt that describes the video to generate. + input_reference: + $ref: '#/components/schemas/ImageRefParam-2' + description: Optional reference object that guides generation. Provide exactly one of `image_url` or `file_id`. + seconds: + $ref: '#/components/schemas/VideoSeconds' + description: 'Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.' + size: + $ref: '#/components/schemas/VideoSize' + description: 'Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.' type: object required: - - mode - title: Prompt cache breakpoint - description: Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block. - ModerationMode: - type: string - enum: - - score - - block - ModerationConfigParam: + - prompt + title: Create video JSON request + description: JSON parameters for creating a new video generation job. + CreateVideoCharacterBody: properties: - mode: - $ref: '#/components/schemas/ModerationMode' + video: + type: string + format: binary + description: Video file used to create a character. + name: + type: string + maxLength: 80 + minLength: 1 + description: Display name for this API character. type: object required: - - mode - description: The moderation policy for the response input. - ModerationPolicyParam: + - video + - name + title: Create character request + description: Parameters for creating a character from an uploaded video. + VideoCharacterResource: properties: - input: - anyOf: - - $ref: '#/components/schemas/ModerationConfigParam' - description: The moderation policy for the response input. - - type: 'null' - output: + id: anyOf: - - $ref: '#/components/schemas/ModerationConfigParam' - description: The moderation policy for the response output. + - type: string + description: Identifier for the character creation cameo. - type: 'null' - type: object - required: [] - description: The policy to apply to moderated response input and output. - ModerationParam: - properties: - model: - type: string - description: The moderation model to use for moderated completions, e.g. 'omni-moderation-latest'. - policy: + name: anyOf: - - $ref: '#/components/schemas/ModerationPolicyParam' - description: The policy to apply to moderated response input and output. + - type: string + description: Display name for the character. - type: 'null' + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) when the character was created. type: object required: - - model - description: Configuration for running moderation on the input and output of this response. - SkillReferenceParam: + - id + - name + - created_at + VideoReferenceInputParam: properties: - type: - type: string - enum: - - skill_reference - description: References a skill created with the /v1/skills endpoint. - default: skill_reference - x-stainless-const: true - skill_id: - type: string - maxLength: 64 - minLength: 1 - description: The ID of the referenced skill. - version: + id: type: string - description: Optional skill version. Use a positive integer or 'latest'. Omit for default. + description: The identifier of the completed video. + example: video_123 type: object required: - - type - - skill_id - InlineSkillSourceParam: + - id + description: Reference to the completed video. + CreateVideoEditMultipartBody: properties: - type: - type: string - enum: - - base64 - description: The type of the inline skill source. Must be `base64`. - default: base64 - x-stainless-const: true - media_type: - type: string - enum: - - application/zip - description: The media type of the inline skill payload. Must be `application/zip`. - default: application/zip - x-stainless-const: true - data: + video: + anyOf: + - type: string + format: binary + description: Reference to the completed video to edit. + - $ref: '#/components/schemas/VideoReferenceInputParam' + description: Reference to the completed video to edit. + prompt: type: string - maxLength: 70254592 + maxLength: 32000 minLength: 1 - description: Base64-encoded skill zip bundle. + description: Text prompt that describes how to edit the source video. type: object required: - - type - - media_type - - data - description: Inline skill payload - InlineSkillParam: + - video + - prompt + title: Create video edit multipart request + description: Parameters for editing an existing generated video. + CreateVideoEditJsonBody: properties: - type: - type: string - enum: - - inline - description: Defines an inline skill for this request. - default: inline - x-stainless-const: true - name: - type: string - description: The name of the skill. - description: + video: + $ref: '#/components/schemas/VideoReferenceInputParam' + description: Reference to the completed video to edit. + prompt: type: string - description: The description of the skill. - source: - $ref: '#/components/schemas/InlineSkillSourceParam' - description: Inline skill payload + maxLength: 32000 + minLength: 1 + description: Text prompt that describes how to edit the source video. type: object required: - - type - - name - - description - - source - ContainerNetworkPolicyDisabledParam: + - video + - prompt + title: Create video edit JSON request + description: JSON parameters for editing an existing generated video. + CreateVideoExtendMultipartBody: properties: - type: + video: + oneOf: + - type: string + format: binary + description: Reference to the completed video to extend. + - $ref: '#/components/schemas/VideoReferenceInputParam' + description: Reference to the completed video to extend. + prompt: type: string - enum: - - disabled - description: Disable outbound network access. Always `disabled`. - default: disabled - x-stainless-const: true + maxLength: 32000 + minLength: 1 + description: Updated text prompt that directs the extension generation. + seconds: + $ref: '#/components/schemas/VideoSeconds' + description: 'Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20).' type: object required: - - type - ContainerNetworkPolicyDomainSecretParam: + - video + - prompt + - seconds + title: Create video extension multipart request + description: Multipart parameters for extending an existing generated video. + CreateVideoExtendJsonBody: properties: - domain: - type: string - minLength: 1 - description: The domain associated with the secret. - name: - type: string - minLength: 1 - description: The name of the secret to inject for the domain. - value: + video: + $ref: '#/components/schemas/VideoReferenceInputParam' + description: Reference to the completed video to extend. + prompt: type: string - maxLength: 10485760 + maxLength: 32000 minLength: 1 - description: The secret value to inject for the domain. + description: Updated text prompt that directs the extension generation. + seconds: + $ref: '#/components/schemas/VideoSeconds' + description: 'Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20).' type: object required: - - domain - - name - - value - ContainerNetworkPolicyAllowlistParam: + - video + - prompt + - seconds + title: Create video extension JSON request + description: JSON parameters for extending an existing generated video. + DeletedVideoResource: properties: - type: + object: type: string enum: - - allowlist - description: Allow outbound network access only to specified domains. Always `allowlist`. - default: allowlist + - video.deleted + description: The object type that signals the deletion response. + default: video.deleted x-stainless-const: true - allowed_domains: - items: - type: string - type: array - minItems: 1 - description: A list of allowed domains when type is `allowlist`. - domain_secrets: - items: - $ref: '#/components/schemas/ContainerNetworkPolicyDomainSecretParam' - type: array - minItems: 1 - description: Optional domain-scoped secrets for allowlisted domains. + deleted: + type: boolean + description: Indicates that the video resource was deleted. + id: + type: string + description: Identifier of the deleted video. type: object required: - - type - - allowed_domains - IncludeEnum: - type: string - enum: - - file_search_call.results - - web_search_call.results - - web_search_call.action.sources - - message.input_image.image_url - - computer_call_output.output.image_url - - code_interpreter_call.outputs - - reasoning.encrypted_content - - message.output_text.logprobs - description: |- - Specify additional output data to include in the model response. Currently supported values are: - - `web_search_call.results`: Include the search results of the web search tool call. - - `web_search_call.action.sources`: Include the sources of the web search tool call. - - `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items. - - `computer_call_output.output.image_url`: Include image urls from the computer call output. - - `file_search_call.results`: Include the search results of the file search tool call. - - `message.input_image.image_url`: Include image urls from the input message. - - `message.output_text.logprobs`: Include logprobs with assistant messages. - - `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program). - MessageStatus: - type: string - enum: - - in_progress - - completed - - incomplete - MessageRole: + - object + - deleted + - id + title: Deleted video response + description: Confirmation payload returned after deleting a video. + VideoContentVariant: type: string enum: - - unknown - - user - - assistant - - system - - critic - - discriminator - - developer - - tool - PromptCacheBreakpointConfig: + - video + - thumbnail + - spritesheet + CreateVideoRemixBody: properties: - mode: + prompt: type: string - enum: - - explicit - description: The breakpoint mode. Always `explicit`. - default: explicit - x-stainless-const: true + maxLength: 32000 + minLength: 1 + description: Updated text prompt that directs the remix generation. type: object required: - - mode - title: Prompt cache breakpoint - description: Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block. - InputTextContent: + - prompt + title: Create video remix request + description: Parameters for remixing an existing generated video. + TruncationEnum: + type: string + enum: + - auto + - disabled + PersonalityEnum: + anyOf: + - type: string + - type: string + enum: + - friendly + - pragmatic + TokenCountsBody: properties: - type: - type: string - enum: - - input_text - description: The type of the input item. Always `input_text`. - default: input_text - x-stainless-const: true + model: + anyOf: + - type: string + description: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) to browse and compare available models. + - type: 'null' + input: + anyOf: + - description: Text, image, or file inputs to the model, used to generate a response + anyOf: + - type: string + maxLength: 10485760 + description: A text input to the model, equivalent to a text input with the `user` role. + - items: + $ref: '#/components/schemas/InputItem' + type: array + maxItems: 131072 + description: A list of one or many input items to the model, containing different content types. + - type: 'null' + previous_response_id: + anyOf: + - type: string + description: The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`. + example: resp_123 + - type: 'null' + tools: + anyOf: + - items: + $ref: '#/components/schemas/Tool' + type: array + description: An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter. + - type: 'null' text: - type: string - description: The text input to the model. - prompt_cache_breakpoint: - $ref: '#/components/schemas/PromptCacheBreakpointConfig' + anyOf: + - $ref: '#/components/schemas/ResponseTextParam' + - type: 'null' + reasoning: + anyOf: + - $ref: '#/components/schemas/Reasoning' + description: '**gpt-5 and o-series models only** Configuration options for [reasoning models](https://developers.openai.com/api/docs/guides/reasoning).' + - type: 'null' + truncation: + $ref: '#/components/schemas/TruncationEnum' + description: 'The truncation strategy to use for the model response. - `auto`: If the input to this Response exceeds the model''s context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.' + deprecated: true + instructions: + anyOf: + - type: string + description: |- + A system (or developer) message inserted into the model's context. + When used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses. + - type: 'null' + personality: + $ref: '#/components/schemas/PersonalityEnum' + description: A model-owned style preset to apply to this request. Omit this parameter to use the model's default style. Supported values may expand over time. Values must be at most 64 characters. + conversation: + anyOf: + - $ref: '#/components/schemas/ConversationParam' + - type: 'null' + tool_choice: + anyOf: + - $ref: '#/components/schemas/ToolChoiceParam' + description: Controls which tool the model should use, if any. + - type: 'null' + parallel_tool_calls: + anyOf: + - type: boolean + description: Whether to allow the model to run tool calls in parallel. + - type: 'null' type: object - required: - - type - - text - title: Input text - description: A text input to the model. - FileCitationBody: + required: [] + TokenCountsResource: properties: - type: + object: type: string enum: - - file_citation - description: The type of the file citation. Always `file_citation`. - default: file_citation + - response.input_tokens + default: response.input_tokens x-stainless-const: true - file_id: - type: string - description: The ID of the file. - index: + input_tokens: type: integer - description: The index of the file in the list of files. - filename: - type: string - description: The filename of the file cited. type: object required: - - type - - file_id - - index - - filename - title: File citation - description: A citation to a file. - UrlCitationBody: + - object + - input_tokens + title: Token counts + example: + object: response.input_tokens + input_tokens: 123 + PromptCacheRetentionEnum: + type: string + enum: + - in_memory + - 24h + ServiceTierEnum: + type: string + enum: + - auto + - default + - fast + - flex + - priority + CompactResponseMethodPublicBody: properties: - type: + model: + $ref: '#/components/schemas/ModelIdsCompaction' + input: + anyOf: + - description: Text, image, or file inputs to the model, used to generate a response + anyOf: + - type: string + maxLength: 10485760 + description: A text input to the model, equivalent to a text input with the `user` role. + - items: + $ref: '#/components/schemas/InputItem' + type: array + maxItems: 131072 + description: A list of one or many input items to the model, containing different content types. + - type: 'null' + previous_response_id: + anyOf: + - type: string + description: The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`. + example: resp_123 + - type: 'null' + instructions: + anyOf: + - type: string + description: |- + A system (or developer) message inserted into the model's context. + When used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses. + - type: 'null' + prompt_cache_key: + anyOf: + - type: string + maxLength: 64 + description: A key to use when reading from or writing to the prompt cache. + - type: 'null' + prompt_cache_retention: + anyOf: + - $ref: '#/components/schemas/PromptCacheRetentionEnum' + description: How long to retain a prompt cache entry created by this request. + deprecated: true + - type: 'null' + prompt_cache_options: + anyOf: + - $ref: '#/components/schemas/PromptCacheOptionsParam' + - type: 'null' + service_tier: + anyOf: + - $ref: '#/components/schemas/ServiceTierEnum' + description: |- + Specifies the processing type used for serving the request. - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model. - If set to '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier. - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. For models with a dedicated Fast tier, either value resolves to `service_tier=fast`; for other models, either value resolves to `service_tier=priority`. - When not set, the default behavior is 'auto'. + When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. + - type: 'null' + type: object + required: + - model + ItemField: + discriminator: + propertyName: type + description: An item representing a message, tool call, tool output, reasoning, or other response element. + anyOf: + - $ref: '#/components/schemas/Message' + - $ref: '#/components/schemas/Program' + - $ref: '#/components/schemas/ProgramOutput' + - $ref: '#/components/schemas/FunctionToolCall' + - $ref: '#/components/schemas/ToolSearchCall' + - $ref: '#/components/schemas/ToolSearchOutput' + - $ref: '#/components/schemas/AdditionalTools' + - $ref: '#/components/schemas/FunctionToolCallOutput' + - $ref: '#/components/schemas/FileSearchToolCall' + - $ref: '#/components/schemas/WebSearchToolCall' + - $ref: '#/components/schemas/ImageGenToolCall' + - $ref: '#/components/schemas/ComputerToolCall' + - $ref: '#/components/schemas/ComputerToolCallOutputResource' + - $ref: '#/components/schemas/ReasoningItem' + - $ref: '#/components/schemas/CompactionBody' + - $ref: '#/components/schemas/CodeInterpreterToolCall' + - $ref: '#/components/schemas/LocalShellToolCall' + deprecated: true + - $ref: '#/components/schemas/LocalShellToolCallOutput' + deprecated: true + - $ref: '#/components/schemas/FunctionShellCall' + - $ref: '#/components/schemas/FunctionShellCallOutput' + - $ref: '#/components/schemas/ApplyPatchToolCall' + - $ref: '#/components/schemas/ApplyPatchToolCallOutput' + - $ref: '#/components/schemas/MCPListTools' + - $ref: '#/components/schemas/MCPApprovalRequest' + - $ref: '#/components/schemas/MCPApprovalResponseResource' + - $ref: '#/components/schemas/MCPToolCall' + - $ref: '#/components/schemas/CustomToolCall' + - $ref: '#/components/schemas/CustomToolCallOutput' + CompactResource: + properties: + id: + type: string + description: The unique identifier for the compacted response. + object: type: string enum: - - url_citation - description: The type of the URL citation. Always `url_citation`. - default: url_citation + - response.compaction + description: The object type. Always `response.compaction`. + default: response.compaction x-stainless-const: true - url: - type: string - format: uri - description: The URL of the web resource. - start_index: - type: integer - description: The index of the first character of the URL citation in the message. - end_index: + output: + type: array + description: The compacted list of output items. This is a list of all user messages, followed by a single compaction item. + items: + $ref: '#/components/schemas/OutputItem' + created_at: type: integer - description: The index of the last character of the URL citation in the message. - title: - type: string - description: The title of the web resource. + format: unixtime + description: Unix timestamp (in seconds) when the compacted conversation was created. + usage: + $ref: '#/components/schemas/ResponseUsage' + description: Token accounting for the compaction pass, including cached, reasoning, and total tokens. type: object required: - - type - - url - - start_index - - end_index - - title - title: URL citation - description: A citation for a web resource used to generate a model response. - ContainerFileCitationBody: + - id + - object + - output + - created_at + - usage + title: The compacted response object + SkillResource: properties: - type: + id: + type: string + description: Unique identifier for the skill. + object: type: string enum: - - container_file_citation - description: The type of the container file citation. Always `container_file_citation`. - default: container_file_citation + - skill + description: The object type, which is `skill`. + default: skill x-stainless-const: true - container_id: + name: type: string - description: The ID of the container file. - file_id: + description: Name of the skill. + description: type: string - description: The ID of the file. - start_index: - type: integer - description: The index of the first character of the container file citation in the message. - end_index: + description: Description of the skill. + created_at: type: integer - description: The index of the last character of the container file citation in the message. - filename: + format: unixtime + description: Unix timestamp (seconds) for when the skill was created. + default_version: type: string - description: The filename of the container file cited. + description: Default version for the skill. + latest_version: + type: string + description: Latest version for the skill. type: object required: - - type - - container_id - - file_id - - start_index - - end_index - - filename - title: Container file citation - description: A citation for a container file used to generate a model response. - Annotation: - discriminator: - propertyName: type - description: An annotation that applies to a span of output text. - anyOf: - - $ref: '#/components/schemas/FileCitationBody' - - $ref: '#/components/schemas/UrlCitationBody' - - $ref: '#/components/schemas/ContainerFileCitationBody' - - $ref: '#/components/schemas/FilePath' - TopLogProb: + - id + - object + - name + - description + - created_at + - default_version + - latest_version + SkillListResource: properties: - token: - type: string - logprob: - type: number - bytes: + object: + x-stainless-const: true + default: list + description: The type of object returned, must be `list`. + const: list + data: items: - type: integer + $ref: '#/components/schemas/SkillResource' type: array + description: A list of items + first_id: + anyOf: + - type: string + description: The ID of the first item in the list. + - type: 'null' + last_id: + anyOf: + - type: string + description: The ID of the last item in the list. + - type: 'null' + has_more: + type: boolean + description: Whether there are more items available. + type: object + required: + - object + - data + - first_id + - last_id + - has_more + CreateSkillBody: + properties: + files: + anyOf: + - items: + type: string + format: binary + type: array + maxItems: 500 + description: Skill files to upload (directory upload) or a single zip file. + - type: string + format: binary + description: Skill zip file to upload. type: object - required: - - token - - logprob - - bytes - title: Top log probability - description: The top log probability of a token. - LogProb: + description: Uploads a skill either as a directory (multipart `files[]`) or as a single zip file. + title: Create skill request + SetDefaultSkillVersionBody: properties: - token: + default_version: type: string - logprob: - type: number - bytes: - items: - type: integer - type: array - top_logprobs: - items: - $ref: '#/components/schemas/TopLogProb' - type: array + description: The skill version number to set as default. type: object required: - - token - - logprob - - bytes - - top_logprobs - title: Log probability - description: The log probability of a token. - OutputTextContent: + - default_version + title: Update skill request + description: Updates the default version pointer for a skill. + DeletedSkillResource: properties: - type: + object: type: string enum: - - output_text - description: The type of the output text. Always `output_text`. - default: output_text + - skill.deleted + default: skill.deleted x-stainless-const: true - text: + deleted: + type: boolean + id: type: string - description: The text output from the model. - annotations: - items: - $ref: '#/components/schemas/Annotation' - type: array - description: The annotations of the text output. - logprobs: - items: - $ref: '#/components/schemas/LogProb' - type: array type: object required: - - type - - text - - annotations - title: Output text - description: A text output from the model. - TextContent: + - object + - deleted + - id + SkillVersionResource: properties: - type: + object: type: string enum: - - text - default: text + - skill.version + description: The object type, which is `skill.version`. + default: skill.version x-stainless-const: true - text: + id: + type: string + description: Unique identifier for the skill version. + skill_id: + type: string + description: Identifier of the skill for this version. + version: + type: string + description: Version number for this skill. + created_at: + type: integer + format: unixtime + description: Unix timestamp (seconds) for when the version was created. + name: + type: string + description: Name of the skill version. + description: type: string + description: Description of the skill version. type: object required: - - type - - text - title: Text Content - description: A text content. - SummaryTextContent: + - object + - id + - skill_id + - version + - created_at + - name + - description + SkillVersionListResource: properties: - type: - type: string - enum: - - summary_text - description: The type of the object. Always `summary_text`. - default: summary_text + object: x-stainless-const: true - text: - type: string - description: A summary of the reasoning output from the model so far. + default: list + description: The type of object returned, must be `list`. + const: list + data: + items: + $ref: '#/components/schemas/SkillVersionResource' + type: array + description: A list of items + first_id: + anyOf: + - type: string + description: The ID of the first item in the list. + - type: 'null' + last_id: + anyOf: + - type: string + description: The ID of the last item in the list. + - type: 'null' + has_more: + type: boolean + description: Whether there are more items available. type: object required: - - type - - text - title: Summary text - description: A summary text from the model. - ReasoningTextContent: + - object + - data + - first_id + - last_id + - has_more + CreateSkillVersionBody: properties: - type: + files: + anyOf: + - items: + type: string + format: binary + type: array + maxItems: 500 + description: Skill files to upload (directory upload) or a single zip file. + - type: string + format: binary + description: Skill zip file to upload. + default: + type: boolean + description: Whether to set this version as the default. + type: object + description: Uploads a new immutable version of a skill. + title: Create skill version request + DeletedSkillVersionResource: + properties: + object: type: string enum: - - reasoning_text - description: The type of the reasoning text. Always `reasoning_text`. - default: reasoning_text + - skill.version.deleted + default: skill.version.deleted x-stainless-const: true - text: + deleted: + type: boolean + id: type: string - description: The reasoning text from the model. + version: + type: string + description: The deleted skill version. type: object required: - - type - - text - title: ReasoningTextContent - description: Reasoning text from the model. - RefusalContent: + - object + - deleted + - id + - version + ChatkitWorkflowTracing: properties: - type: - type: string - enum: - - refusal - description: The type of the refusal. Always `refusal`. - default: refusal - x-stainless-const: true - refusal: - type: string - description: The refusal explanation from the model. + enabled: + type: boolean + description: Indicates whether tracing is enabled. type: object required: - - type - - refusal - title: Refusal - description: A refusal from the model. - ImageDetail: - type: string - enum: - - low - - high - - auto - - original - InputImageContent: + - enabled + title: Tracing Configuration + description: Controls diagnostic tracing during the session. + ChatkitWorkflow: properties: - type: + id: type: string - enum: - - input_image - description: The type of the input item. Always `input_image`. - default: input_image - x-stainless-const: true - image_url: + description: Identifier of the workflow backing the session. + version: anyOf: - type: string - format: uri - description: The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL. + description: Specific workflow version used for the session. Defaults to null when using the latest deployment. - type: 'null' - file_id: + state_variables: anyOf: - - type: string - description: The ID of the file to be sent to the model. + - additionalProperties: + anyOf: + - type: string + - type: integer + - type: boolean + - type: number + type: object + description: State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided. + x-oaiTypeLabel: map - type: 'null' - detail: - $ref: '#/components/schemas/ImageDetail' - description: The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`. - prompt_cache_breakpoint: - $ref: '#/components/schemas/PromptCacheBreakpointConfig' + tracing: + $ref: '#/components/schemas/ChatkitWorkflowTracing' + description: Tracing settings applied to the workflow. type: object required: - - type - - detail - title: Input image - description: An image input to the model. Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision). - ComputerScreenshotContent: + - id + - version + - state_variables + - tracing + title: Workflow + description: Workflow metadata and state returned for the session. + ChatSessionRateLimits: properties: - type: - type: string - enum: - - computer_screenshot - description: Specifies the event type. For a computer screenshot, this property is always set to `computer_screenshot`. - default: computer_screenshot - x-stainless-const: true - image_url: + max_requests_per_1_minute: + type: integer + description: Maximum allowed requests per one-minute window. + type: object + required: + - max_requests_per_1_minute + title: Rate limits + description: Active per-minute request limit for the session. + ChatSessionStatus: + type: string + enum: + - active + - expired + - cancelled + ChatSessionAutomaticThreadTitling: + properties: + enabled: + type: boolean + description: Whether automatic thread titling is enabled. + type: object + required: + - enabled + title: Automatic thread titling + description: Automatic thread title preferences for the session. + ChatSessionFileUpload: + properties: + enabled: + type: boolean + description: Indicates if uploads are enabled for the session. + max_file_size: anyOf: - - type: string - format: uri - description: The URL of the screenshot image. + - type: integer + description: Maximum upload size in megabytes. - type: 'null' - file_id: + max_files: anyOf: - - type: string - description: The identifier of an uploaded file that contains the screenshot. + - type: integer + description: Maximum number of uploads allowed during the session. - type: 'null' - detail: - $ref: '#/components/schemas/ImageDetail' - description: The detail level of the screenshot image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`. - prompt_cache_breakpoint: - $ref: '#/components/schemas/PromptCacheBreakpointConfig' type: object required: - - type - - image_url - - file_id - - detail - title: Computer screenshot - description: A screenshot of a computer. - FileInputDetail: - type: string - enum: - - auto - - low - - high - InputFileContent: + - enabled + - max_file_size + - max_files + title: File upload settings + description: Upload permissions and limits applied to the session. + ChatSessionHistory: properties: - type: - type: string - enum: - - input_file - description: The type of the input item. Always `input_file`. - default: input_file - x-stainless-const: true - file_id: + enabled: + type: boolean + description: Indicates if chat history is persisted for the session. + recent_threads: anyOf: - - type: string - description: The ID of the file to be sent to the model. + - type: integer + description: Number of prior threads surfaced in history views. Defaults to null when all history is retained. - type: 'null' - filename: - type: string - description: The name of the file to be sent to the model. - file_data: - type: string - description: | - The content of the file to be sent to the model. - prompt_cache_breakpoint: - $ref: '#/components/schemas/PromptCacheBreakpointConfig' - file_url: - type: string - format: uri - description: The URL of the file to be sent to the model. - detail: - $ref: '#/components/schemas/FileInputDetail' - description: The detail level of the file to be sent to the model. Use `auto` to let the system select the detail level; for GPT-5.6 and later models, `auto` uses high-quality rendering, which may increase input token usage. Use `low` for lower-cost rendering, or `high` to render the file at higher quality. Defaults to `auto`. type: object required: - - type - title: Input file - description: A file input to the model. - MessagePhase-2: - type: string - enum: - - commentary - - final_answer - Message: + - enabled + - recent_threads + title: History settings + description: History retention preferences returned for the session. + ChatSessionChatkitConfiguration: properties: - type: + automatic_thread_titling: + $ref: '#/components/schemas/ChatSessionAutomaticThreadTitling' + description: Automatic thread titling preferences. + file_upload: + $ref: '#/components/schemas/ChatSessionFileUpload' + description: Upload settings for the session. + history: + $ref: '#/components/schemas/ChatSessionHistory' + description: History retention configuration. + type: object + required: + - automatic_thread_titling + - file_upload + - history + title: ChatKit configuration + description: ChatKit configuration for the session. + ChatSessionResource: + properties: + id: + type: string + description: Identifier for the ChatKit session. + object: type: string enum: - - message - description: The type of the message. Always set to `message`. - default: message + - chatkit.session + description: Type discriminator that is always `chatkit.session`. + default: chatkit.session x-stainless-const: true - id: + expires_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the session expires. + client_secret: type: string - description: The unique ID of the message. + description: Ephemeral client secret that authenticates session requests. + workflow: + $ref: '#/components/schemas/ChatkitWorkflow' + description: Workflow metadata for the session. + user: + type: string + description: User identifier associated with the session. + rate_limits: + $ref: '#/components/schemas/ChatSessionRateLimits' + description: Resolved rate limit values. + max_requests_per_1_minute: + type: integer + description: Convenience copy of the per-minute request limit. status: - $ref: '#/components/schemas/MessageStatus' - description: The status of item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API. - role: - $ref: '#/components/schemas/MessageRole' - description: The role of the message. One of `unknown`, `user`, `assistant`, `system`, `critic`, `discriminator`, `developer`, or `tool`. - content: - items: - discriminator: - propertyName: type - description: A content part that makes up an input or output item. + $ref: '#/components/schemas/ChatSessionStatus' + description: Current lifecycle state of the session. + chatkit_configuration: + $ref: '#/components/schemas/ChatSessionChatkitConfiguration' + description: Resolved ChatKit feature configuration for the session. + type: object + required: + - id + - object + - expires_at + - client_secret + - workflow + - user + - rate_limits + - max_requests_per_1_minute + - status + - chatkit_configuration + title: The chat session object + description: Represents a ChatKit session and its resolved configuration. + WorkflowTracingParam: + properties: + enabled: + type: boolean + description: Whether tracing is enabled during the session. Defaults to true. + type: object + required: [] + title: Tracing Configuration + description: Controls diagnostic tracing during the session. + WorkflowParam: + properties: + id: + type: string + description: Identifier for the workflow invoked by the session. + version: + type: string + description: Specific workflow version to run. Defaults to the latest deployed version. + state_variables: + additionalProperties: anyOf: - - $ref: '#/components/schemas/InputTextContent' - - $ref: '#/components/schemas/OutputTextContent' - - $ref: '#/components/schemas/TextContent' - - $ref: '#/components/schemas/SummaryTextContent' - - $ref: '#/components/schemas/ReasoningTextContent' - - $ref: '#/components/schemas/RefusalContent' - - $ref: '#/components/schemas/InputImageContent' - - $ref: '#/components/schemas/ComputerScreenshotContent' - - $ref: '#/components/schemas/InputFileContent' - type: array - description: The content of the message - phase: - anyOf: - - $ref: '#/components/schemas/MessagePhase-2' - description: Labels an `assistant` message as intermediate commentary (`commentary`) or the final answer (`final_answer`). For models like `gpt-5.3-codex` and beyond, when sending follow-up requests, preserve and resend phase on all assistant messages — dropping it can degrade performance. Not used for user messages. - - type: 'null' + - type: string + maxLength: 10485760 + - type: integer + - type: boolean + - type: number + type: object + maxProperties: 64 + description: State variables forwarded to the workflow. Keys may be up to 64 characters, values must be primitive types, and the map defaults to an empty object. + x-oaiTypeLabel: map + tracing: + $ref: '#/components/schemas/WorkflowTracingParam' + description: Optional tracing overrides for the workflow invocation. When omitted, tracing is enabled by default. type: object required: - - type - id - - status - - role - - content - title: Message - description: A message to or from the model. - DirectToolCallCaller: + title: Workflow settings + description: Workflow reference and overrides applied to the chat session. + ExpiresAfterParam: properties: - type: + anchor: type: string enum: - - direct - default: direct + - created_at + description: Base timestamp used to calculate expiration. Currently fixed to `created_at`. + default: created_at x-stainless-const: true + seconds: + type: integer + maximum: 600 + minimum: 1 + format: int64 + description: Number of seconds after the anchor when the session expires. type: object required: - - type - ProgramToolCallCaller: + - anchor + - seconds + title: Expiration overrides + description: Controls when the session expires relative to an anchor timestamp. + RateLimitsParam: properties: - type: - type: string - enum: - - program - default: program - x-stainless-const: true - caller_id: + max_requests_per_1_minute: + type: integer + minimum: 1 + description: Maximum number of requests allowed per minute for the session. Defaults to 10. + type: object + required: [] + title: Rate limit overrides + description: Controls request rate limits for the session. + AutomaticThreadTitlingParam: + properties: + enabled: + type: boolean + description: Enable automatic thread title generation. Defaults to true. + type: object + required: [] + title: Automatic thread titling configuration + description: Controls whether ChatKit automatically generates thread titles. + FileUploadParam: + properties: + enabled: + type: boolean + description: Enable uploads for this session. Defaults to false. + max_file_size: + type: integer + maximum: 512 + minimum: 1 + description: Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is the maximum allowable size. + max_files: + type: integer + minimum: 1 + description: Maximum number of files that can be uploaded to the session. Defaults to 10. + type: object + required: [] + title: File upload configuration + description: Controls whether users can upload files. + HistoryParam: + properties: + enabled: + type: boolean + description: Enables chat users to access previous ChatKit threads. Defaults to true. + recent_threads: + type: integer + minimum: 1 + description: Number of recent ChatKit threads users have access to. Defaults to unlimited when unset. + type: object + required: [] + title: Chat history configuration + description: Controls how much historical context is retained for the session. + ChatkitConfigurationParam: + properties: + automatic_thread_titling: + $ref: '#/components/schemas/AutomaticThreadTitlingParam' + description: Configuration for automatic thread titling. When omitted, automatic thread titling is enabled by default. + file_upload: + $ref: '#/components/schemas/FileUploadParam' + description: Configuration for upload enablement and limits. When omitted, uploads are disabled by default (max_files 10, max_file_size 512 MB). + history: + $ref: '#/components/schemas/HistoryParam' + description: Configuration for chat history retention. When omitted, history is enabled by default with no limit on recent_threads (null). + type: object + required: [] + title: ChatKit configuration overrides + description: Optional per-session configuration settings for ChatKit behavior. + CreateChatSessionBody: + properties: + workflow: + $ref: '#/components/schemas/WorkflowParam' + description: Workflow that powers the session. + user: type: string - description: The call ID of the program item that produced this tool call. + minLength: 1 + description: A free-form string that identifies your end user; ensures this Session can access other objects that have the same `user` scope. + expires_after: + $ref: '#/components/schemas/ExpiresAfterParam' + description: Optional override for session expiration timing in seconds from creation. Defaults to 10 minutes. + rate_limits: + $ref: '#/components/schemas/RateLimitsParam' + description: Optional override for per-minute request limits. When omitted, defaults to 10. + chatkit_configuration: + $ref: '#/components/schemas/ChatkitConfigurationParam' + description: Optional overrides for ChatKit runtime configuration features type: object required: - - type - - caller_id - ToolCallCaller: - discriminator: - propertyName: type - description: The execution context that produced this tool call. - anyOf: - - $ref: '#/components/schemas/DirectToolCallCaller' - - $ref: '#/components/schemas/ProgramToolCallCaller' - FunctionCallStatus: - type: string - enum: - - in_progress - - completed - - incomplete - DirectToolCallCallerParam: + - workflow + - user + title: Create chat session request + description: Parameters for provisioning a new ChatKit session. + UserMessageInputText: properties: type: type: string enum: - - direct - description: The caller type. Always `direct`. - default: direct + - input_text + description: Type discriminator that is always `input_text`. + default: input_text x-stainless-const: true + text: + type: string + description: Plain-text content supplied by the user. type: object required: - type - ProgramToolCallCallerParam: + - text + title: User message input + description: Text block that a user contributed to the thread. + UserMessageQuotedText: properties: type: type: string enum: - - program - description: The caller type. Always `program`. - default: program + - quoted_text + description: Type discriminator that is always `quoted_text`. + default: quoted_text x-stainless-const: true - caller_id: + text: type: string - maxLength: 64 - minLength: 1 - description: The call ID of the program item that produced this tool call. + description: Quoted text content. type: object required: - type - - caller_id - ToolCallCallerParam: - discriminator: - propertyName: type - description: The execution context that produced this tool call. - anyOf: - - $ref: '#/components/schemas/DirectToolCallCallerParam' - - $ref: '#/components/schemas/ProgramToolCallCallerParam' - FunctionCallOutputStatusEnum: - type: string - enum: - - in_progress - - completed - - incomplete - WebSearchCallStatus: - type: string - enum: - - in_progress - - searching - - completed - - failed - - incomplete - ImageGenActionEnum: - type: string - enum: - - generate - - edit - - auto - ImageBackground: - type: string - enum: - - transparent - - opaque - - auto - ImageOutputFormat: + - text + title: User message quoted text + description: Quoted snippet that the user referenced in their message. + AttachmentType: type: string enum: - - png - - webp - - jpeg - ImageGenToolCall: + - image + - file + Attachment: properties: type: - type: string - enum: - - image_generation_call - description: The type of the image generation call. Always `image_generation_call`. - x-stainless-const: true + $ref: '#/components/schemas/AttachmentType' + description: Attachment discriminator. id: type: string - description: The unique ID of the image generation call. - status: + description: Identifier for the attachment. + name: type: string - enum: - - in_progress - - completed - - generating - - failed - description: The status of the image generation call. - result: - anyOf: - - type: string - description: The generated image encoded in base64. - - type: 'null' - size: - anyOf: - - anyOf: - - type: string - - type: string - enum: - - 1024x1024 - - 1024x1536 - - 1536x1024 - description: The image dimensions as a `WIDTHxHEIGHT` string, for example `1536x864`. - - type: 'null' - quality: - anyOf: - - type: string - enum: - - low - - medium - - high - - xhigh - - max - - auto - description: The quality of the image generated by the image generation tool call. One of `low`, `medium`, `high`, `xhigh`, `max`, or `auto`. - - type: 'null' - action: - anyOf: - - $ref: '#/components/schemas/ImageGenActionEnum' - description: The action used for image generation. - - type: 'null' - x-openai-go-optional-enum: true - background: - anyOf: - - $ref: '#/components/schemas/ImageBackground' - description: The background setting used for generation. - - type: 'null' - x-openai-go-optional-enum: true - output_format: - anyOf: - - $ref: '#/components/schemas/ImageOutputFormat' - description: The output format used for generation. - - type: 'null' - x-openai-go-optional-enum: true - revised_prompt: + description: Original display name for the attachment. + mime_type: + type: string + description: MIME type of the attachment. + preview_url: anyOf: - type: string - description: The prompt that was used after any model prompt rewriting. + format: uri + description: Preview URL for rendering the attachment inline. - type: 'null' type: object required: - type - id - - status - - result - title: Image generation call - description: An image generation request made by the model. - ClickButtonType: - type: string - enum: - - left - - right - - wheel - - back - - forward - ClickParam: + - name + - mime_type + - preview_url + title: Attachment + description: Attachment metadata included on thread items. + ToolChoice: properties: - type: + id: type: string - enum: - - click - description: Specifies the event type. For a click action, this property is always `click`. - default: click - x-stainless-const: true - button: - $ref: '#/components/schemas/ClickButtonType' - description: Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`. - x: - type: integer - description: The x-coordinate where the click occurred. - y: - type: integer - description: The y-coordinate where the click occurred. - keys: - anyOf: - - items: - type: string - type: array - description: The keys being held while clicking. - - type: 'null' + description: Identifier of the requested tool. type: object required: - - type - - button - - x - - y - title: Click - description: A click action. - DoubleClickAction: + - id + title: Tool choice + description: Tool selection that the assistant should honor when executing the item. + InferenceOptions: properties: - type: - type: string - enum: - - double_click - description: Specifies the event type. For a double click action, this property is always set to `double_click`. - default: double_click - x-stainless-const: true - x: - type: integer - description: The x-coordinate where the double click occurred. - y: - type: integer - description: The y-coordinate where the double click occurred. - keys: + tool_choice: anyOf: - - items: - type: string - type: array - description: The keys being held while double-clicking. + - $ref: '#/components/schemas/ToolChoice' + description: Preferred tool to invoke. Defaults to null when ChatKit should auto-select. + - type: 'null' + model: + anyOf: + - type: string + description: Model name that generated the response. Defaults to null when using the session default. - type: 'null' type: object required: - - type - - x - - y - - keys - title: DoubleClick - description: A double click action. - CoordParam: + - tool_choice + - model + title: Inference options + description: Model and tool overrides applied when generating the assistant response. + UserMessageItem: properties: - x: - type: integer - description: The x-coordinate. - y: + id: + type: string + description: Identifier of the thread item. + object: + type: string + enum: + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item + x-stainless-const: true + created_at: type: integer - description: The y-coordinate. - type: object - required: - - x - - y - title: Coordinate - description: 'An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.' - DragParam: - properties: + format: unixtime + description: Unix timestamp (in seconds) for when the item was created. + thread_id: + type: string + description: Identifier of the parent thread. type: type: string enum: - - drag - description: Specifies the event type. For a drag action, this property is always set to `drag`. - default: drag + - chatkit.user_message + default: chatkit.user_message x-stainless-const: true - path: + content: items: - $ref: '#/components/schemas/CoordParam' + discriminator: + propertyName: type + description: Content blocks that comprise a user message. + anyOf: + - $ref: '#/components/schemas/UserMessageInputText' + - $ref: '#/components/schemas/UserMessageQuotedText' type: array - description: |- - An array of coordinates representing the path of the drag action. Coordinates will appear as an array of objects, eg - ``` - [ - { x: 100, y: 200 }, - { x: 200, y: 300 } - ] - ``` - keys: + description: Ordered content elements supplied by the user. + attachments: + items: + $ref: '#/components/schemas/Attachment' + type: array + description: Attachments associated with the user message. Defaults to an empty list. + inference_options: anyOf: - - items: - type: string - type: array - description: The keys being held while dragging the mouse. + - $ref: '#/components/schemas/InferenceOptions' + description: Inference overrides applied to the message. Defaults to null when unset. - type: 'null' type: object required: + - id + - object + - created_at + - thread_id - type - - path - title: Drag - description: A drag action. - KeyPressAction: + - content + - attachments + - inference_options + title: User Message Item + description: User-authored messages within a thread. + FileAnnotationSource: properties: type: type: string enum: - - keypress - description: Specifies the event type. For a keypress action, this property is always set to `keypress`. - default: keypress + - file + description: Type discriminator that is always `file`. + default: file x-stainless-const: true - keys: - items: - type: string - description: One of the keys the model is requesting to be pressed. - type: array - description: The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key. + filename: + type: string + description: Filename referenced by the annotation. type: object required: - type - - keys - title: KeyPress - description: A collection of keypresses the model would like to perform. - MoveParam: + - filename + title: File annotation source + description: Attachment source referenced by an annotation. + FileAnnotation: properties: type: type: string enum: - - move - description: Specifies the event type. For a move action, this property is always set to `move`. - default: move + - file + description: Type discriminator that is always `file` for this annotation. + default: file x-stainless-const: true - x: - type: integer - description: The x-coordinate to move to. - y: - type: integer - description: The y-coordinate to move to. - keys: - anyOf: - - items: - type: string - type: array - description: The keys being held while moving the mouse. - - type: 'null' + source: + $ref: '#/components/schemas/FileAnnotationSource' + description: File attachment referenced by the annotation. type: object required: - type - - x - - y - title: Move - description: A mouse move action. - ScreenshotParam: + - source + title: File annotation + description: Annotation that references an uploaded file. + UrlAnnotationSource: properties: type: type: string enum: - - screenshot - description: Specifies the event type. For a screenshot action, this property is always set to `screenshot`. - default: screenshot + - url + description: Type discriminator that is always `url`. + default: url x-stainless-const: true + url: + type: string + format: uri + description: URL referenced by the annotation. type: object required: - type - title: Screenshot - description: A screenshot action. - ScrollParam: + - url + title: URL annotation source + description: URL backing an annotation entry. + UrlAnnotation: properties: type: type: string enum: - - scroll - description: Specifies the event type. For a scroll action, this property is always set to `scroll`. - default: scroll + - url + description: Type discriminator that is always `url` for this annotation. + default: url x-stainless-const: true - x: - type: integer - description: The x-coordinate where the scroll occurred. - y: - type: integer - description: The y-coordinate where the scroll occurred. - scroll_x: - type: integer - description: The horizontal scroll distance. - scroll_y: - type: integer - description: The vertical scroll distance. - keys: - anyOf: - - items: - type: string - type: array - description: The keys being held while scrolling. - - type: 'null' + source: + $ref: '#/components/schemas/UrlAnnotationSource' + description: URL referenced by the annotation. type: object required: - type - - x - - y - - scroll_x - - scroll_y - title: Scroll - description: A scroll action. - TypeParam: + - source + title: URL annotation + description: Annotation that references a URL. + ResponseOutputText: properties: type: type: string enum: - - type - description: Specifies the event type. For a type action, this property is always set to `type`. - default: type + - output_text + description: Type discriminator that is always `output_text`. + default: output_text x-stainless-const: true text: type: string - description: The text to type. + description: Assistant generated text. + annotations: + items: + discriminator: + propertyName: type + description: Annotation object describing a cited source. + anyOf: + - $ref: '#/components/schemas/FileAnnotation' + - $ref: '#/components/schemas/UrlAnnotation' + type: array + description: Ordered list of annotations attached to the response text. type: object required: - type - text - title: Type - description: An action to type in text. - WaitParam: + - annotations + title: Assistant message content + description: Assistant response text accompanied by optional annotations. + AssistantMessageItem: properties: + id: + type: string + description: Identifier of the thread item. + object: + type: string + enum: + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item + x-stainless-const: true + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the item was created. + thread_id: + type: string + description: Identifier of the parent thread. type: type: string enum: - - wait - description: Specifies the event type. For a wait action, this property is always set to `wait`. - default: wait + - chatkit.assistant_message + description: Type discriminator that is always `chatkit.assistant_message`. + default: chatkit.assistant_message x-stainless-const: true + content: + items: + $ref: '#/components/schemas/ResponseOutputText' + type: array + description: Ordered assistant response segments. type: object required: + - id + - object + - created_at + - thread_id - type - title: Wait - description: A wait action. - ComputerCallSafetyCheckParam: + - content + title: Assistant message + description: Assistant-authored message within a thread. + WidgetMessageItem: properties: id: type: string - description: The ID of the pending safety check. - code: - anyOf: - - type: string - description: The type of the pending safety check. - - type: 'null' - message: - anyOf: - - type: string - description: Details about the pending safety check. - - type: 'null' + description: Identifier of the thread item. + object: + type: string + enum: + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item + x-stainless-const: true + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the item was created. + thread_id: + type: string + description: Identifier of the parent thread. + type: + type: string + enum: + - chatkit.widget + description: Type discriminator that is always `chatkit.widget`. + default: chatkit.widget + x-stainless-const: true + widget: + type: string + description: Serialized widget payload rendered in the UI. type: object required: - id - description: A pending safety check for the computer call. - ComputerCallOutputStatus: + - object + - created_at + - thread_id + - type + - widget + title: Widget message + description: Thread item that renders a widget payload. + ClientToolCallStatus: type: string enum: + - in_progress - completed - - incomplete - - failed - ToolSearchExecutionType: - type: string - enum: - - server - - client - ToolSearchCall: + ClientToolCallItem: properties: - type: + id: + type: string + description: Identifier of the thread item. + object: type: string enum: - - tool_search_call - description: The type of the item. Always `tool_search_call`. - default: tool_search_call + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item x-stainless-const: true - id: + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the item was created. + thread_id: type: string - description: The unique ID of the tool search call item. + description: Identifier of the parent thread. + type: + type: string + enum: + - chatkit.client_tool_call + description: Type discriminator that is always `chatkit.client_tool_call`. + default: chatkit.client_tool_call + x-stainless-const: true + status: + $ref: '#/components/schemas/ClientToolCallStatus' + description: Execution status for the tool call. call_id: + type: string + description: Identifier for the client tool call. + name: + type: string + description: Tool name that was invoked. + arguments: + type: string + description: JSON-encoded arguments that were sent to the tool. + output: anyOf: - type: string - description: The unique ID of the tool search call generated by the model. + description: JSON-encoded output captured from the tool. Defaults to null while execution is in progress. - type: 'null' - execution: - $ref: '#/components/schemas/ToolSearchExecutionType' - description: Whether tool search was executed by the server or by the client. - arguments: - description: Arguments used for the tool search call. - status: - $ref: '#/components/schemas/FunctionCallStatus' - description: The status of the tool search call item that was recorded. - created_by: - type: string - description: The identifier of the actor that created the item. type: object required: - - type - id + - object + - created_at + - thread_id + - type + - status - call_id - - execution + - name - arguments - - status - CallableToolAllowedCaller: + - output + title: Client tool call + description: Record of a client side tool invocation initiated by the assistant. + TaskType: type: string enum: - - direct - - programmatic - FunctionTool: + - custom + - thought + TaskItem: properties: - type: + id: + type: string + description: Identifier of the thread item. + object: type: string enum: - - function - description: The type of the function tool. Always `function`. - default: function + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item x-stainless-const: true - name: + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the item was created. + thread_id: type: string - description: The name of the function to call. - async: - type: boolean - description: + description: Identifier of the parent thread. + type: + type: string + enum: + - chatkit.task + description: Type discriminator that is always `chatkit.task`. + default: chatkit.task + x-stainless-const: true + task_type: + $ref: '#/components/schemas/TaskType' + description: Subtype for the task. + heading: anyOf: - type: string - description: A description of the function. Used by the model to determine whether or not to call the function. - - type: 'null' - parameters: - anyOf: - - additionalProperties: {} - type: object - description: A JSON schema object describing the parameters of the function. - x-oaiTypeLabel: map - - type: 'null' - output_schema: - anyOf: - - additionalProperties: {} - type: object - description: A JSON schema object describing the JSON value encoded in string outputs for this function. - x-oaiTypeLabel: map - - type: 'null' - strict: - anyOf: - - type: boolean - description: Whether strict parameter validation is enforced for this function tool. + description: Optional heading for the task. Defaults to null when not provided. - type: 'null' - defer_loading: - type: boolean - description: Whether this function is deferred and loaded via tool search. - allowed_callers: + summary: anyOf: - - items: - $ref: '#/components/schemas/CallableToolAllowedCaller' - type: array - description: The tool invocation context(s). + - type: string + description: Optional summary that describes the task. Defaults to null when omitted. - type: 'null' type: object required: + - id + - object + - created_at + - thread_id - type - - name - - strict - - parameters - title: Function - description: Defines a function in your own code the model can choose to call. Learn more about [function calling](https://developers.openai.com/api/docs/guides/function-calling). - RankerVersionType: - type: string - enum: - - auto - - default-2024-11-15 - HybridSearchOptions: - properties: - embedding_weight: - type: number - description: The weight of the embedding in the reciprocal ranking fusion. - text_weight: - type: number - description: The weight of the text in the reciprocal ranking fusion. - type: object - required: - - embedding_weight - - text_weight - RankingOptions: - properties: - ranker: - $ref: '#/components/schemas/RankerVersionType' - description: The ranker to use for the file search. - score_threshold: - type: number - description: The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results. - hybrid_search: - $ref: '#/components/schemas/HybridSearchOptions' - description: Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled. - type: object - required: [] - Filters: - anyOf: - - $ref: '#/components/schemas/ComparisonFilter' - - $ref: '#/components/schemas/CompoundFilter' - FileSearchTool: + - task_type + - heading + - summary + title: Task item + description: Task emitted by the workflow to show progress and status updates. + TaskGroupTask: properties: type: - type: string - enum: - - file_search - description: The type of the file search tool. Always `file_search`. - default: file_search - x-stainless-const: true - vector_store_ids: - items: - type: string - type: array - description: The IDs of the vector stores to search. - max_num_results: - type: integer - description: The maximum number of results to return. This number should be between 1 and 50 inclusive. - ranking_options: - $ref: '#/components/schemas/RankingOptions' - description: Ranking options for search. - filters: + $ref: '#/components/schemas/TaskType' + description: Subtype for the grouped task. + heading: anyOf: - - $ref: '#/components/schemas/Filters' - description: A filter to apply. + - type: string + description: Optional heading for the grouped task. Defaults to null when not provided. + - type: 'null' + summary: + anyOf: + - type: string + description: Optional summary that describes the grouped task. Defaults to null when omitted. - type: 'null' type: object required: - type - - vector_store_ids - title: File search - description: A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://developers.openai.com/api/docs/guides/tools-file-search). - ComputerTool: + - heading + - summary + title: Task group task + description: Task entry that appears within a TaskGroup. + TaskGroupItem: properties: - type: + id: + type: string + description: Identifier of the thread item. + object: type: string enum: - - computer - description: The type of the computer tool. Always `computer`. - default: computer + - chatkit.thread_item + description: Type discriminator that is always `chatkit.thread_item`. + default: chatkit.thread_item x-stainless-const: true - type: object - required: - - type - title: Computer - description: A tool that controls a virtual computer. Learn more about the [computer tool](https://developers.openai.com/api/docs/guides/tools-computer-use). - ComputerEnvironment: - type: string - enum: - - windows - - mac - - linux - - ubuntu - - browser - ComputerUsePreviewTool: - properties: + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the item was created. + thread_id: + type: string + description: Identifier of the parent thread. type: type: string enum: - - computer_use_preview - description: The type of the computer use tool. Always `computer_use_preview`. - default: computer_use_preview + - chatkit.task_group + description: Type discriminator that is always `chatkit.task_group`. + default: chatkit.task_group x-stainless-const: true - environment: - $ref: '#/components/schemas/ComputerEnvironment' - description: The type of computer environment to control. - display_width: - type: integer - description: The width of the computer display. - display_height: - type: integer - description: The height of the computer display. + tasks: + items: + $ref: '#/components/schemas/TaskGroupTask' + type: array + description: Tasks included in the group. type: object required: + - id + - object + - created_at + - thread_id - type - - environment - - display_width - - display_height - title: Computer use preview - description: A tool that controls a virtual computer. Learn more about the [computer tool](https://developers.openai.com/api/docs/guides/tools-computer-use). - ContainerMemoryLimit: - type: string - enum: - - 1g - - 4g - - 16g - - 64g - RunStepDeltaObjectDelta: - description: The delta containing the fields that have changed on the run step. + - tasks + title: Task group + description: Collection of workflow tasks grouped together in the thread. + ThreadItem: + discriminator: + propertyName: type + title: The thread item + anyOf: + - $ref: '#/components/schemas/UserMessageItem' + - $ref: '#/components/schemas/AssistantMessageItem' + - $ref: '#/components/schemas/WidgetMessageItem' + - $ref: '#/components/schemas/ClientToolCallItem' + - $ref: '#/components/schemas/TaskItem' + - $ref: '#/components/schemas/TaskGroupItem' + ThreadItemListResource: + properties: + object: + x-stainless-const: true + default: list + description: The type of object returned, must be `list`. + const: list + data: + items: + $ref: '#/components/schemas/ThreadItem' + type: array + description: A list of items + first_id: + anyOf: + - type: string + description: The ID of the first item in the list. + - type: 'null' + last_id: + anyOf: + - type: string + description: The ID of the last item in the list. + - type: 'null' + has_more: + type: boolean + description: Whether there are more items available. type: object - properties: - step_details: - type: object - description: The details of the run step. - anyOf: - - $ref: '#/components/schemas/RunStepDeltaStepDetailsMessageCreationObject' - - $ref: '#/components/schemas/RunStepDeltaStepDetailsToolCallsObject' - discriminator: - propertyName: type - ProgrammaticToolCallingParam: + required: + - object + - data + - first_id + - last_id + - has_more + title: Thread Items + description: A paginated list of thread items rendered for the ChatKit API. + ActiveStatus: properties: type: type: string enum: - - programmatic_tool_calling - description: The type of the tool. Always `programmatic_tool_calling`. - default: programmatic_tool_calling + - active + description: Status discriminator that is always `active`. + default: active x-stainless-const: true type: object required: - type - InputFidelity: - type: string - enum: - - high - - low - description: Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`. - LocalShellToolParam: + title: Active thread status + description: Indicates that a thread is active. + LockedStatus: properties: type: type: string enum: - - local_shell - description: The type of the local shell tool. Always `local_shell`. - default: local_shell + - locked + description: Status discriminator that is always `locked`. + default: locked x-stainless-const: true + reason: + anyOf: + - type: string + description: Reason that the thread was locked. Defaults to null when no reason is recorded. + - type: 'null' type: object required: - type - title: Local shell tool - description: A tool that allows the model to execute shell commands in a local environment. - ContainerAutoParam: + - reason + title: Locked thread status + description: Indicates that a thread is locked and cannot accept new input. + ClosedStatus: properties: type: type: string enum: - - container_auto - description: Automatically creates a container for this request - default: container_auto + - closed + description: Status discriminator that is always `closed`. + default: closed x-stainless-const: true - file_ids: - items: - type: string - example: file-123 - type: array - maxItems: 50 - description: An optional list of uploaded files to make available to your code. - memory_limit: + reason: anyOf: - - $ref: '#/components/schemas/ContainerMemoryLimit' - description: The memory limit for the container. + - type: string + description: Reason that the thread was closed. Defaults to null when no reason is recorded. - type: 'null' - network_policy: - discriminator: - propertyName: type - description: Network access policy for the container. - anyOf: - - $ref: '#/components/schemas/ContainerNetworkPolicyDisabledParam' - - $ref: '#/components/schemas/ContainerNetworkPolicyAllowlistParam' - skills: - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/SkillReferenceParam' - - $ref: '#/components/schemas/InlineSkillParam' - type: array - maxItems: 200 - description: An optional list of skills referenced by id or inline data. type: object required: - type - LocalSkillParam: + - reason + title: Closed thread status + description: Indicates that a thread has been closed. + ThreadResource: properties: - name: + id: type: string - description: The name of the skill. - description: + description: Identifier of the thread. + object: type: string - description: The description of the skill. - path: + enum: + - chatkit.thread + description: Type discriminator that is always `chatkit.thread`. + default: chatkit.thread + x-stainless-const: true + created_at: + type: integer + format: unixtime + description: Unix timestamp (in seconds) for when the thread was created. + title: + anyOf: + - type: string + description: Optional human-readable title for the thread. Defaults to null when no title has been generated. + - type: 'null' + status: + discriminator: + propertyName: type + description: Current status for the thread. Defaults to `active` for newly created threads. + anyOf: + - $ref: '#/components/schemas/ActiveStatus' + - $ref: '#/components/schemas/LockedStatus' + - $ref: '#/components/schemas/ClosedStatus' + user: type: string - description: The path to the directory containing the skill. + description: Free-form string that identifies your end user who owns the thread. type: object required: - - name - - description - - path - LocalEnvironmentParam: + - id + - object + - created_at + - title + - status + - user + title: The thread object + description: Represents a ChatKit thread and its current status. + example: + id: cthr_def456 + object: chatkit.thread + created_at: 1712345600 + title: Demo feedback + status: + type: active + user: user_456 + DeletedThreadResource: properties: - type: + id: + type: string + description: Identifier of the deleted thread. + object: type: string enum: - - local - description: Use a local computer environment. - default: local + - chatkit.thread.deleted + description: Type discriminator that is always `chatkit.thread.deleted`. + default: chatkit.thread.deleted x-stainless-const: true - skills: + deleted: + type: boolean + description: Indicates that the thread has been deleted. + type: object + required: + - id + - object + - deleted + title: Deleted thread + description: Confirmation payload returned after deleting a thread. + ThreadListResource: + properties: + object: + x-stainless-const: true + default: list + description: The type of object returned, must be `list`. + const: list + data: items: - $ref: '#/components/schemas/LocalSkillParam' + $ref: '#/components/schemas/ThreadResource' type: array - maxItems: 200 - description: An optional list of skills. + description: A list of items + first_id: + anyOf: + - type: string + description: The ID of the first item in the list. + - type: 'null' + last_id: + anyOf: + - type: string + description: The ID of the last item in the list. + - type: 'null' + has_more: + type: boolean + description: Whether there are more items available. type: object required: - - type - ContainerReferenceParam: + - object + - data + - first_id + - last_id + - has_more + title: Threads + description: A paginated list of ChatKit threads. + EnvironmentTypeResource: + type: string + enum: + - openai_hosted + - self_hosted + description: The kind of execution environment. + EnvironmentStatusResource: + type: string + enum: + - pending + - connected + - disconnected + - expired + - failed + description: The public lifecycle status of an execution environment. + HostedEnvironmentFileResourceFileId: + type: object properties: type: type: string enum: - - container_reference - description: References a container created with the /v1/containers endpoint - default: container_reference + - file_id + default: file_id x-stainless-const: true - container_id: + description: The type of the object. Always `file_id`. + id: type: string - description: The ID of the referenced container. - example: cntr_123 - type: object + minLength: 0 + description: The session-scoped ID of the file in the execution environment. + file_id: + type: string + minLength: 0 + description: The ID of the uploaded file. + path: + type: string + minLength: 0 + description: The file's absolute path inside the environment. + size_bytes: + type: integer + format: int64 + minimum: 0 + description: The decoded file size in bytes. required: - type - - container_id - FunctionShellToolParam: + - id + - file_id + - path + - size_bytes + additionalProperties: false + description: A file copied from the OpenAI Files API. + HostedEnvironmentFileResourceInline: + type: object properties: type: type: string enum: - - shell - description: The type of the shell tool. Always `shell`. - default: shell + - inline + default: inline x-stainless-const: true - environment: - anyOf: - - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/ContainerAutoParam' - - $ref: '#/components/schemas/LocalEnvironmentParam' - - $ref: '#/components/schemas/ContainerReferenceParam' - - type: 'null' - allowed_callers: - anyOf: - - items: - $ref: '#/components/schemas/CallableToolAllowedCaller' - type: array - minItems: 1 - description: The tool invocation context(s). - - type: 'null' - type: object + description: The type of the object. Always `inline`. + id: + type: string + minLength: 0 + description: The session-scoped ID of the file in the execution environment. + path: + type: string + minLength: 0 + description: The file's absolute path inside the environment. + size_bytes: + type: integer + format: int64 + minimum: 0 + description: The decoded file size in bytes. required: - type - title: Shell tool - description: A tool that allows the model to execute shell commands. - CustomTextFormatParam: + - id + - path + - size_bytes + additionalProperties: false + description: A file supplied inline when the session was created. + HostedEnvironmentFileResource: + description: Metadata for a file materialized in an OpenAI-hosted execution environment. + discriminator: + propertyName: type + mapping: + file_id: '#/components/schemas/HostedEnvironmentFileResourceFileId' + inline: '#/components/schemas/HostedEnvironmentFileResourceInline' + x-oai-discriminator-values: + - file_id + - inline + anyOf: + - $ref: '#/components/schemas/HostedEnvironmentFileResourceFileId' + - $ref: '#/components/schemas/HostedEnvironmentFileResourceInline' + HostedSkillResourceSkillReference: + type: object properties: type: type: string enum: - - text - description: Unconstrained text format. Always `text`. - default: text + - skill_reference + default: skill_reference x-stainless-const: true - type: object + description: The type of the object. Always `skill_reference`. + skill_id: + type: string + minLength: 0 + description: The referenced skill ID. + version: + type: string + minLength: 0 + description: The concrete skill version installed for this session. + name: + type: string + minLength: 0 + description: The installed skill name. + description: + type: string + minLength: 0 + description: The installed skill description. required: - type - title: Text format - description: Unconstrained free-form text. - GrammarSyntax1: - type: string - enum: - - lark - - regex - CustomGrammarFormatParam: + - skill_id + - version + - name + - description + additionalProperties: false + description: A skill installed from the Skills API. + HostedSkillResourceInline: + type: object properties: type: type: string enum: - - grammar - description: Grammar format. Always `grammar`. - default: grammar + - inline + default: inline x-stainless-const: true - syntax: - $ref: '#/components/schemas/GrammarSyntax1' - description: The syntax of the grammar definition. One of `lark` or `regex`. - definition: + description: The type of the object. Always `inline`. + name: type: string - description: The grammar definition. - type: object + minLength: 0 + description: The installed skill name. + description: + type: string + minLength: 0 + description: The installed skill description. required: - type - - syntax - - definition - title: Grammar format - description: A grammar defined by the user. - CustomToolParam: + - name + - description + additionalProperties: false + description: A skill installed from an inline ZIP archive. + HostedSkillResource: + description: A skill installed in an OpenAI-hosted environment. + discriminator: + propertyName: type + mapping: + skill_reference: '#/components/schemas/HostedSkillResourceSkillReference' + inline: '#/components/schemas/HostedSkillResourceInline' + x-oai-discriminator-values: + - skill_reference + - inline + anyOf: + - $ref: '#/components/schemas/HostedSkillResourceSkillReference' + - $ref: '#/components/schemas/HostedSkillResourceInline' + HostedPluginResourceInline: + type: object properties: type: type: string enum: - - custom - description: The type of the custom tool. Always `custom`. - default: custom + - inline + default: inline x-stainless-const: true + description: The type of the object. Always `inline`. name: type: string - description: The name of the custom tool, used to identify it in tool calls. - async: - type: boolean - description: Whether the tool response can be returned asynchronously versus immediately returned on next response creation. + minLength: 0 + description: The installed plugin name. description: type: string - description: Optional description of the custom tool, used to provide more context. - format: - discriminator: - propertyName: type - description: The input format for the custom tool. Default is unconstrained text. - anyOf: - - $ref: '#/components/schemas/CustomTextFormatParam' - - $ref: '#/components/schemas/CustomGrammarFormatParam' - defer_loading: - type: boolean - description: Whether this tool should be deferred and discovered via tool search. - allowed_callers: - anyOf: - - items: - $ref: '#/components/schemas/CallableToolAllowedCaller' - type: array - minItems: 1 - description: The tool invocation context(s). - - type: 'null' - type: object + minLength: 0 + description: The installed plugin description. required: - type - name - title: Custom tool - description: A custom tool that processes input using a specified format. Learn more about [custom tools](https://developers.openai.com/api/docs/guides/function-calling#custom-tools) - EmptyModelParam: - properties: {} + - description + additionalProperties: false + description: A plugin installed from an inline ZIP archive. + HostedPluginResource: + description: A plugin installed in an OpenAI-hosted environment. + discriminator: + propertyName: type + mapping: + inline: '#/components/schemas/HostedPluginResourceInline' + x-oai-discriminator-values: + - inline + anyOf: + - $ref: '#/components/schemas/HostedPluginResourceInline' + PublicEnvironmentResource: type: object - required: [] - FunctionToolParam: properties: - name: + id: type: string - maxLength: 128 - minLength: 1 - pattern: ^[a-zA-Z0-9_-]+$ - description: - anyOf: - - type: string - - type: 'null' - parameters: - anyOf: - - $ref: '#/components/schemas/EmptyModelParam' - - type: 'null' - strict: - anyOf: - - type: boolean - description: Whether to enforce strict parameter validation. If omitted, Responses attempts to use strict validation when the schema is compatible, and falls back to non-strict validation otherwise. - - type: 'null' + minLength: 0 + description: The ID of the environment. + object: + type: string + enum: + - agent.environment + default: agent.environment + x-stainless-const: true + description: The object type. Always `agent.environment`. + type: + $ref: '#/components/schemas/EnvironmentTypeResource' + description: Whether the environment is hosted by OpenAI or by the application. + status: + $ref: '#/components/schemas/EnvironmentStatusResource' + description: The current environment connection status. + files: + type: array + items: + $ref: '#/components/schemas/HostedEnvironmentFileResource' + minItems: 0 + maxItems: 2000 + description: Files installed in the environment, without their contents. + skills: + type: array + items: + $ref: '#/components/schemas/HostedSkillResource' + minItems: 0 + maxItems: 2000 + description: Skills installed in the environment, without their archive contents. + plugins: + type: array + items: + $ref: '#/components/schemas/HostedPluginResource' + minItems: 0 + maxItems: 2000 + description: Plugins installed in the environment, without their archive contents. + required: + - id + - object + - type + - status + - files + - skills + - plugins + additionalProperties: false + description: Safe metadata for a first-class execution environment. + ErrorBodyResource: + type: object + properties: type: + type: string + minLength: 0 + description: The error type. + code: + type: string + minLength: 0 + description: A machine-readable error code. + message: + type: string + minLength: 0 + description: A human-readable error message. + param: + type: + - string + - 'null' + minLength: 0 + description: The request parameter that caused the error, or null for a request-wide error. + required: + - type + - code + - message + - param + additionalProperties: false + description: Details about an API error. + ErrorResponse-2: + type: object + properties: + error: + $ref: '#/components/schemas/ErrorBodyResource' + description: The error returned by the API. + required: + - error + additionalProperties: false + description: An API error response. + ListOrderParam: + type: string + enum: + - asc + - desc + x-enumDescriptions: + - Returns resources in ascending order. + - Returns resources in descending order. + description: The order in which paginated resources are returned. + EnvironmentFilePageObjectResource: + type: string + enum: + - page + default: page + x-stainless-const: true + description: The object type for a page of files in an execution environment. + EnvironmentFileResource: + type: object + properties: + object: type: string enum: - - function - default: function + - agent.environment.file + default: agent.environment.file x-stainless-const: true - async: - type: boolean - description: Whether the tool response can be returned asynchronously versus immediately returned on next response creation. - output_schema: - anyOf: - - additionalProperties: {} - type: object - description: A JSON Schema describing the JSON value encoded in string outputs for this function tool. This does not describe content-array outputs. - x-oaiTypeLabel: map - - type: 'null' - defer_loading: + description: The object type. Always `agent.environment.file`. + environment_id: + type: string + minLength: 0 + description: The ID of the environment containing this file. + path: + type: string + minLength: 0 + description: The absolute file path inside the environment's workspace. + size_bytes: + type: integer + format: int64 + minimum: 0 + description: The file size in bytes. + required: + - object + - environment_id + - path + - size_bytes + additionalProperties: false + description: A live file in an execution environment. + EnvironmentFileListResource: + type: object + properties: + object: + $ref: '#/components/schemas/EnvironmentFilePageObjectResource' + description: The object type. Always `page`. + data: + type: array + items: + $ref: '#/components/schemas/EnvironmentFileResource' + minItems: 0 + maxItems: 2000 + description: Files available on the current page. + next: + type: + - string + - 'null' + minLength: 0 + description: The opaque cursor to use when requesting the next page, if any. + has_more: type: boolean - description: Whether this function should be deferred and discovered via tool search. - allowed_callers: - anyOf: - - items: - $ref: '#/components/schemas/CallableToolAllowedCaller' - type: array - minItems: 1 - description: The tool invocation context(s). - - type: 'null' + description: Whether more files follow this page. + required: + - object + - data + - next + - has_more + additionalProperties: false + description: A paginated list of live execution environment files. + HostedEnvironmentFileParamFileId: + type: object + properties: + type: + type: string + enum: + - file_id + default: file_id + x-stainless-const: true + description: The type of the object. Always `file_id`. + file_id: + type: string + minLength: 1 + maxLength: 256 + description: The ID of the uploaded file. + path: + type: string + minLength: 1 + maxLength: 4096 + description: The absolute destination path inside `/workspace`. + required: + - type + - file_id + - path + additionalProperties: false + description: A file previously uploaded through the OpenAI Files API. + HostedEnvironmentFileParamInline: type: object - required: - - name - - type - NamespaceToolParam: properties: type: type: string enum: - - namespace - description: The type of the tool. Always `namespace`. - default: namespace + - inline + default: inline x-stainless-const: true - name: + description: The type of the object. Always `inline`. + data: type: string - minLength: 1 - description: The namespace name used in tool calls (for example, `crm`). - description: + minLength: 0 + maxLength: 6990508 + description: The standard-base64-encoded file contents. + path: type: string - description: A description of the namespace shown to the model. - tools: - items: - discriminator: - propertyName: type - description: A function or custom tool that belongs to a namespace. - anyOf: - - $ref: '#/components/schemas/FunctionToolParam' - - $ref: '#/components/schemas/CustomToolParam' - type: array - minItems: 1 - description: The function/custom tools available inside this namespace. - type: object + minLength: 1 + maxLength: 4096 + description: The absolute destination path inside `/workspace`. required: - type - - name - - description - - tools - title: Namespace - description: Groups function/custom tools under a shared namespace. - ToolSearchToolParam: + - data + - path + additionalProperties: false + description: A file supplied directly as standard-base64 data. + HostedEnvironmentFileParam: + description: A file materialized in an OpenAI-hosted execution environment. + discriminator: + propertyName: type + mapping: + file_id: '#/components/schemas/HostedEnvironmentFileParamFileId' + inline: '#/components/schemas/HostedEnvironmentFileParamInline' + x-oai-discriminator-values: + - file_id + - inline + anyOf: + - $ref: '#/components/schemas/HostedEnvironmentFileParamFileId' + - $ref: '#/components/schemas/HostedEnvironmentFileParamInline' + SubagentObjectResource: + type: string + enum: + - agent.session.subagent + default: agent.session.subagent + x-stainless-const: true + description: The object type for a subagent. + OutputTextResource: + type: object properties: type: type: string enum: - - tool_search - description: The type of the tool. Always `tool_search`. - default: tool_search + - output_text + default: output_text x-stainless-const: true - execution: - $ref: '#/components/schemas/ToolSearchExecutionType' - description: Whether tool search is executed by the server or by the client. - description: - anyOf: - - type: string - description: Description shown to the model for a client-executed tool search tool. - - type: 'null' - parameters: - anyOf: - - $ref: '#/components/schemas/EmptyModelParam' - description: Parameter schema for a client-executed tool search tool. - - type: 'null' - type: object + description: The content type. Always `output_text`. + text: + type: string + minLength: 0 + description: The text produced by the agent. required: - type - title: Tool search tool - description: Hosted or BYOT tool search configuration for deferred tools. - ApproximateLocation: + - text + additionalProperties: false + description: A text content part produced by the agent. + EncryptedContentResource: + type: object properties: type: type: string enum: - - approximate - description: The type of location approximation. Always `approximate`. - default: approximate + - encrypted_content + default: encrypted_content x-stainless-const: true - country: - anyOf: - - type: string - description: The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`. - - type: 'null' - region: - anyOf: - - type: string - description: Free text input for the region of the user, e.g. `California`. - - type: 'null' - city: - anyOf: - - type: string - description: Free text input for the city of the user, e.g. `San Francisco`. - - type: 'null' - timezone: - anyOf: - - type: string - description: The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`. - - type: 'null' - type: object + description: The content type. Always `encrypted_content`. + encrypted_content: + type: string + minLength: 0 + description: The encrypted content payload. required: - type - SearchContextSize: + - encrypted_content + additionalProperties: false + description: Encrypted content exchanged between agents. + AgentContentResource: + description: A plaintext or encrypted content part exchanged between agents. + discriminator: + propertyName: type + mapping: + output_text: '#/components/schemas/OutputTextResource' + encrypted_content: '#/components/schemas/EncryptedContentResource' + x-oai-discriminator-values: + - output_text + - encrypted_content + anyOf: + - $ref: '#/components/schemas/OutputTextResource' + - $ref: '#/components/schemas/EncryptedContentResource' + SubagentStatusResource: type: string enum: - - low - - medium - - high - SearchContentType: + - active + - closed + x-enumDescriptions: + - The subagent remains available, including while idle between turns. + - The subagent is closed. + description: The current status of a subagent. + SubagentResource: + type: object + properties: + id: + type: string + minLength: 0 + description: The ID of the subagent. + object: + $ref: '#/components/schemas/SubagentObjectResource' + description: The object type. Always `agent.session.subagent`. + session_id: + type: string + minLength: 0 + description: The ID of the session that owns the subagent. + name: + type: + - string + - 'null' + minLength: 0 + description: The runner-assigned nickname, or null when unavailable. + instructions: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/AgentContentResource' + minItems: 0 + maxItems: 2000 + description: Initial task content, or null when unavailable. Text may contain placeholders for images or audio when only a preview is available. + parent_agent_id: + type: string + minLength: 0 + description: The ID of the agent that created this subagent. + status: + $ref: '#/components/schemas/SubagentStatusResource' + description: The current status of the subagent. + opened_at: + type: integer + format: int64 + description: The Unix timestamp, in seconds, when the subagent was first opened. Resuming does not change it. + closed_at: + type: + - integer + - 'null' + format: int64 + description: The Unix timestamp, in seconds, when the subagent was closed. Null while active, including after resume. + required: + - id + - object + - session_id + - name + - instructions + - parent_agent_id + - status + - opened_at + - closed_at + additionalProperties: false + description: A subagent created within a session. + SessionMessageRoleResource: type: string enum: - - text - - image - WebSearchPreviewTool: + - user + - assistant + description: The author of a session message. + MessageContentResourceInputText: + type: object properties: type: type: string enum: - - web_search_preview - - web_search_preview_2025_03_11 - description: The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`. - default: web_search_preview + - input_text + default: input_text x-stainless-const: true - user_location: - anyOf: - - $ref: '#/components/schemas/ApproximateLocation' - description: The user's location. - - type: 'null' - search_context_size: - $ref: '#/components/schemas/SearchContextSize' - description: High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default. - search_content_types: - items: - $ref: '#/components/schemas/SearchContentType' - type: array - type: object + description: The type of the object. Always `input_text`. + text: + type: string + minLength: 0 + description: The text supplied by the user. required: - type - title: Web search preview - description: This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://developers.openai.com/api/docs/guides/tools-web-search). - ApplyPatchToolParam: + - text + additionalProperties: false + description: Text supplied by the user. + MessageContentResourceInputImage: + type: object properties: type: type: string enum: - - apply_patch - description: The type of the tool. Always `apply_patch`. - default: apply_patch + - input_image + default: input_image x-stainless-const: true - allowed_callers: - anyOf: - - items: - $ref: '#/components/schemas/CallableToolAllowedCaller' - type: array - minItems: 1 - description: The tool invocation context(s). - - type: 'null' - type: object + description: The type of the object. Always `input_image`. + image_url: + type: string + minLength: 0 + description: The URL of the image supplied by the user, which may be a base64-encoded data URL. required: - type - title: Apply patch tool - description: Allows the assistant to create, delete, or update files using unified diffs. - ToolSearchOutput: + - image_url + additionalProperties: false + description: An image supplied by the user. + MessageContentResourceOutputText: + type: object properties: type: type: string enum: - - tool_search_output - description: The type of the item. Always `tool_search_output`. - default: tool_search_output + - output_text + default: output_text x-stainless-const: true - id: - type: string - description: The unique ID of the tool search output item. - call_id: - anyOf: - - type: string - description: The unique ID of the tool search call generated by the model. - - type: 'null' - execution: - $ref: '#/components/schemas/ToolSearchExecutionType' - description: Whether tool search was executed by the server or by the client. - tools: - items: - $ref: '#/components/schemas/Tool' - type: array - description: The loaded tool definitions returned by tool search. - status: - $ref: '#/components/schemas/FunctionCallOutputStatusEnum' - description: The status of the tool search output item that was recorded. - created_by: + description: The type of the object. Always `output_text`. + text: type: string - description: The identifier of the actor that created the item. - type: object + minLength: 0 + description: The text produced by the assistant. required: - type - - id - - call_id - - execution - - tools - - status - AdditionalTools: + - text + additionalProperties: false + description: Text produced by the assistant. + MessageContentResource: + description: A content part in a session message. + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/MessageContentResourceInputText' + input_image: '#/components/schemas/MessageContentResourceInputImage' + output_text: '#/components/schemas/MessageContentResourceOutputText' + x-oai-discriminator-values: + - input_text + - input_image + - output_text + anyOf: + - $ref: '#/components/schemas/MessageContentResourceInputText' + - $ref: '#/components/schemas/MessageContentResourceInputImage' + - $ref: '#/components/schemas/MessageContentResourceOutputText' + OutputItemStatusResource: + type: string + enum: + - in_progress + - completed + - incomplete + x-enumDescriptions: + - The item is in progress. + - The item is complete. + - The item stopped before completing. + description: The status of an agent output item. + MessagePhaseResource: + type: string + enum: + - commentary + - final_answer + x-enumDescriptions: + - Commentary produced while the agent works. + - The agent's final answer. + description: The phase of an assistant message. + MessageItemResource: + type: object properties: type: type: string enum: - - additional_tools - description: The type of the item. Always `additional_tools`. - default: additional_tools + - message + default: message x-stainless-const: true + description: The item type. Always `message`. id: - type: string - description: The unique ID of the additional tools item. + type: + - string + - 'null' + minLength: 0 + description: The ID of this item, or null for legacy user messages whose ID was not recorded. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. role: - $ref: '#/components/schemas/MessageRole' - description: The role that provided the additional tools. - tools: - items: - $ref: '#/components/schemas/Tool' + $ref: '#/components/schemas/SessionMessageRoleResource' + description: The role of the message author. + content: type: array - description: The additional tool definitions made available at this item. - type: object + items: + $ref: '#/components/schemas/MessageContentResource' + minItems: 0 + maxItems: 2000 + description: The content of the message. User messages contain input text or images; assistant messages contain output text. + status: + $ref: '#/components/schemas/OutputItemStatusResource' + description: The status of the message. User messages are always `completed`. + phase: + anyOf: + - $ref: '#/components/schemas/MessagePhaseResource' + - type: 'null' + description: The phase of an assistant message. Null for user messages. required: - type - id + - turn_id - role - - tools - Program: + - content + - status + - phase + additionalProperties: false + description: A user or assistant message recorded in a session. + SummaryTextResource: + type: object properties: type: type: string enum: - - program - description: The type of the item. Always `program`. - default: program + - summary_text + default: summary_text x-stainless-const: true - id: + description: The content type. Always `summary_text`. + text: type: string - description: The unique ID of the program item. - call_id: + minLength: 0 + description: The reasoning summary text. + required: + - type + - text + additionalProperties: false + description: A reasoning summary content part. + ReasoningItemResource: + type: object + properties: + type: type: string - description: The stable call ID of the program item. - code: + enum: + - reasoning + default: reasoning + x-stainless-const: true + description: The item type. Always `reasoning`. + id: type: string - description: The JavaScript source executed by programmatic tool calling. - fingerprint: + minLength: 0 + description: The ID of the reasoning item. + turn_id: type: string - description: Opaque program replay fingerprint that must be round-tripped. - type: object + minLength: 0 + description: The ID of the turn that contains this item. + summary: + type: array + items: + $ref: '#/components/schemas/SummaryTextResource' + minItems: 0 + maxItems: 2000 + description: The reasoning summaries produced by the agent. + status: + anyOf: + - $ref: '#/components/schemas/OutputItemStatusResource' + - type: 'null' + description: The status of the reasoning item. required: - type - id - - call_id - - code - - fingerprint - ProgramOutputStatus: + - turn_id + - summary + - status + additionalProperties: false + description: A reasoning item produced by the agent. + FunctionCallStatusResource: type: string enum: + - in_progress - completed + - failed - incomplete - ProgramOutput: + x-enumDescriptions: + - The call is in progress. + - The call completed successfully. + - The call failed. + - The call stopped before completing. + description: The status of a tool call. + FunctionCallItemResource: + type: object properties: type: type: string enum: - - program_output - description: The type of the item. Always `program_output`. - default: program_output + - function_call + default: function_call x-stainless-const: true + description: The item type. Always `function_call`. id: type: string - description: The unique ID of the program output item. + minLength: 0 + description: The ID of the function call item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. call_id: type: string - description: The call ID of the program item. - result: + minLength: 0 + description: The ID used to submit the function result. + name: type: string - description: The result produced by the program item. + minLength: 0 + description: The name of the function to call. + arguments: + description: The arguments to pass to the function. status: - $ref: '#/components/schemas/ProgramOutputStatus' - description: The terminal status of the program output item. - type: object + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the function call. required: - type - id + - turn_id - call_id - - result + - name + - arguments - status - CompactionBody: + additionalProperties: false + description: A function call produced by the agent. + InputContentResourceInputText: + type: object properties: type: type: string enum: - - compaction - description: The type of the item. Always `compaction`. - default: compaction + - input_text + default: input_text x-stainless-const: true - id: - type: string - description: The unique ID of the compaction item. - encrypted_content: - type: string - description: The encrypted content that was produced by compaction. - created_by: + description: The type of the object. Always `input_text`. + text: type: string - description: The identifier of the actor that created the item. - type: object + minLength: 0 + description: The text supplied to the agent. required: - type - - id - - encrypted_content - title: Compaction item - description: A compaction item generated by the [`v1/responses/compact` API](https://developers.openai.com/api/reference/resources/responses/methods/compact). - CodeInterpreterOutputLogs: + - text + additionalProperties: false + description: Text input recorded in a session item. + InputContentResourceInputImage: + type: object properties: type: type: string enum: - - logs - description: The type of the output. Always `logs`. - default: logs + - input_image + default: input_image x-stainless-const: true - logs: + description: The type of the object. Always `input_image`. + image_url: type: string - description: The logs output from the code interpreter. - type: object + minLength: 0 + description: The URL of the image supplied to the agent, which may be a base64-encoded data URL. required: - type - - logs - title: Code interpreter output logs - description: The logs output from the code interpreter. - CodeInterpreterOutputImage: + - image_url + additionalProperties: false + description: Image input recorded in a session item. + InputContentResource: + description: User-provided content recorded in a session item. + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/InputContentResourceInputText' + input_image: '#/components/schemas/InputContentResourceInputImage' + x-oai-discriminator-values: + - input_text + - input_image + anyOf: + - $ref: '#/components/schemas/InputContentResourceInputText' + - $ref: '#/components/schemas/InputContentResourceInputImage' + FunctionCallOutputResource: + description: The text or model-input content supplied as a function result. + anyOf: + - type: string + minLength: 0 + - type: array + items: + $ref: '#/components/schemas/InputContentResource' + minItems: 0 + maxItems: 2000 + FunctionCallOutputItemResource: + type: object properties: + id: + type: string + minLength: 0 + description: The ID of the function call output item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. type: type: string enum: - - image - description: The type of the output. Always `image`. - default: image + - function_call_output + default: function_call_output x-stainless-const: true - url: + description: The item type. Always `function_call_output`. + call_id: type: string - format: uri - description: The URL of the image output from the code interpreter. - type: object + minLength: 0 + description: The ID of the function call that produced this output. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the function call. + output: + anyOf: + - $ref: '#/components/schemas/FunctionCallOutputResource' + - type: 'null' + description: The function result, if the call succeeded. + error: + type: + - string + - 'null' + minLength: 0 + description: The error message, if the call failed. required: + - id + - turn_id - type - - url - title: Code interpreter output image - description: The image output from the code interpreter. - LocalShellExecAction: + - call_id + - status + - output + - error + additionalProperties: false + description: The result supplied for a function call. + AgentMessageItemResource: + type: object properties: + id: + type: string + minLength: 0 + description: The ID of the message. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. type: type: string enum: - - exec - description: The type of the local shell action. Always `exec`. - default: exec + - agent_message + default: agent_message x-stainless-const: true - command: - items: - type: string + description: The item type. Always `agent_message`. + sender_agent_id: + type: string + minLength: 0 + description: The ID or name of the sending agent. + recipient_agent_id: + type: string + minLength: 0 + description: The ID or name of the receiving agent. + content: type: array - description: The command to run. - timeout_ms: - anyOf: - - type: integer - description: Optional timeout in milliseconds for the command. - - type: 'null' - working_directory: - anyOf: - - type: string - description: Optional working directory to run the command in. - - type: 'null' - env: - additionalProperties: - type: string - type: object - description: Environment variables to set for the command. - x-oaiTypeLabel: map - user: - anyOf: - - type: string - description: Optional user to run the command as. - - type: 'null' - type: object + items: + $ref: '#/components/schemas/AgentContentResource' + minItems: 0 + maxItems: 2000 + description: The content exchanged between the agents. required: + - id + - turn_id - type - - command - - env - title: Local shell exec action - description: Execute a shell command on the server. - FunctionShellAction: + - sender_agent_id + - recipient_agent_id + - content + additionalProperties: false + description: A message exchanged between agent threads. + McpCallItemResource: + type: object properties: - commands: - items: - type: string - description: A list of commands to run. - type: array - timeout_ms: + type: + type: string + enum: + - mcp_call + default: mcp_call + x-stainless-const: true + description: The item type. Always `mcp_call`. + id: + type: string + minLength: 0 + description: The ID of the MCP call item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + server_label: + type: string + minLength: 0 + description: The label of the MCP server. + name: + type: string + minLength: 0 + description: The name of the MCP tool. + arguments: + description: The arguments passed to the MCP tool. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the MCP tool call. + output: anyOf: - - type: integer - description: Optional timeout in milliseconds for the commands. + - {} - type: 'null' - max_output_length: + description: The output returned by the MCP tool, if any. + error: anyOf: - - type: integer - description: Optional maximum number of characters to return from each command. + - {} - type: 'null' - type: object + description: The error returned by the MCP tool, if any. required: - - commands - - timeout_ms - - max_output_length - title: Shell exec action - description: Execute a shell command. - FunctionShellCallStatus: - type: string - enum: - - in_progress - - completed - - incomplete - LocalEnvironmentResource: + - type + - id + - turn_id + - server_label + - name + - arguments + - status + - output + - error + additionalProperties: false + description: A call to a tool on an MCP server. + WebSearchActionResourceSearch: + type: object properties: type: type: string enum: - - local - description: The environment type. Always `local`. - default: local + - search + default: search x-stainless-const: true - type: object + description: The type of the object. Always `search`. + query: + type: + - string + - 'null' + minLength: 0 + description: The search query, when a single query was used. + queries: + type: + - array + - 'null' + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: The search queries, when multiple queries were used. required: - type - title: Local Environment - description: Represents the use of a local environment to perform shell actions. - ContainerReferenceResource: + - query + - queries + additionalProperties: false + description: A search query or group of search queries. + WebSearchActionResourceOpenPage: + type: object properties: type: type: string enum: - - container_reference - description: The environment type. Always `container_reference`. - default: container_reference + - open_page + default: open_page x-stainless-const: true - container_id: + description: The type of the object. Always `open_page`. + url: + type: + - string + - 'null' + minLength: 0 + description: The URL of the page that was opened. + required: + - type + - url + additionalProperties: false + description: Opens a web page. + WebSearchActionResourceFindInPage: + type: object + properties: + type: type: string + enum: + - find_in_page + default: find_in_page + x-stainless-const: true + description: The type of the object. Always `find_in_page`. + url: + type: + - string + - 'null' + minLength: 0 + description: The URL of the page that was searched. + pattern: + type: + - string + - 'null' + minLength: 0 + description: The text pattern that was searched for. + required: + - type + - url + - pattern + additionalProperties: false + description: Finds text within a web page. + WebSearchActionResourceOther: type: object + properties: + type: + type: string + enum: + - other + default: other + x-stainless-const: true + description: The type of the object. Always `other`. required: - type - - container_id - title: Container Reference - description: Represents a container created with /v1/containers. - FunctionShellCall: + additionalProperties: false + description: Another web search action. + WebSearchActionResource: + description: An action performed by the web search tool. + discriminator: + propertyName: type + mapping: + search: '#/components/schemas/WebSearchActionResourceSearch' + open_page: '#/components/schemas/WebSearchActionResourceOpenPage' + find_in_page: '#/components/schemas/WebSearchActionResourceFindInPage' + other: '#/components/schemas/WebSearchActionResourceOther' + x-oai-discriminator-values: + - search + - open_page + - find_in_page + - other + anyOf: + - $ref: '#/components/schemas/WebSearchActionResourceSearch' + - $ref: '#/components/schemas/WebSearchActionResourceOpenPage' + - $ref: '#/components/schemas/WebSearchActionResourceFindInPage' + - $ref: '#/components/schemas/WebSearchActionResourceOther' + WebSearchCallItemResource: + type: object properties: type: type: string enum: - - shell_call - description: The type of the item. Always `shell_call`. - default: shell_call + - web_search_call + default: web_search_call x-stainless-const: true + description: The item type. Always `web_search_call`. id: type: string - description: The unique ID of the shell tool call. Populated when this item is returned via API. - call_id: + minLength: 0 + description: The ID of the web search call. + turn_id: type: string - description: The unique ID of the shell tool call generated by the model. - caller: - anyOf: - - $ref: '#/components/schemas/ToolCallCaller' - description: The execution context that produced this tool call. - - type: 'null' - action: - $ref: '#/components/schemas/FunctionShellAction' - description: The shell commands and limits that describe how to run the tool call. + minLength: 0 + description: The ID of the turn that contains this item. status: - $ref: '#/components/schemas/FunctionShellCallStatus' - description: The status of the shell call. One of `in_progress`, `completed`, or `incomplete`. - environment: + $ref: '#/components/schemas/OutputItemStatusResource' + description: The status of the web search call. + action: anyOf: - - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LocalEnvironmentResource' - - $ref: '#/components/schemas/ContainerReferenceResource' + - $ref: '#/components/schemas/WebSearchActionResource' - type: 'null' - created_by: - type: string - description: The ID of the entity that created this tool call. - type: object + description: The action performed by the web search tool. required: - type - id - - call_id - - action + - turn_id - status - - environment - title: Shell tool call - description: A tool call that executes one or more shell commands in a managed environment. - FunctionShellCallOutputStatusEnum: - type: string - enum: - - in_progress - - completed - - incomplete - FunctionShellCallOutputTimeoutOutcome: + - action + additionalProperties: false + description: A web search call produced by the agent. + CommandExecutionItemResource: + type: object properties: type: type: string enum: - - timeout - description: The outcome type. Always `timeout`. - default: timeout + - command_execution + default: command_execution x-stainless-const: true - type: object + description: The item type. Always `command_execution`. + id: + type: string + minLength: 0 + description: The ID of the command execution item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + command: + type: string + minLength: 0 + description: The command that was executed. + cwd: + type: + - string + - 'null' + minLength: 0 + description: The working directory used to execute the command. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the command execution. + output: + type: + - string + - 'null' + minLength: 0 + description: The command output, if available. + exit_code: + type: + - integer + - 'null' + format: int64 + description: The process exit code, if the command completed. + duration_ms: + type: + - integer + - 'null' + format: int64 + description: The command duration in milliseconds. required: - type - title: Shell call timeout outcome - description: Indicates that the shell call exceeded its configured time limit. - FunctionShellCallOutputExitOutcome: + - id + - turn_id + - command + - cwd + - status + - output + - exit_code + - duration_ms + additionalProperties: false + description: A command execution produced by the agent. + InterruptSubagentCallItemResource: + type: object properties: type: type: string enum: - - exit - description: The outcome type. Always `exit`. - default: exit + - interrupt_subagent_call + default: interrupt_subagent_call x-stainless-const: true - exit_code: - type: integer - description: Exit code from the shell process. - type: object - required: - - type - - exit_code - title: Shell call exit outcome - description: Indicates that the shell commands finished and returned an exit code. - FunctionShellCallOutputContent: - properties: - stdout: + x-enumDescriptions: + - The current public item type. + description: The item type. Always `interrupt_subagent_call`. + id: type: string - description: The standard output that was captured. - stderr: + minLength: 0 + description: The ID of the tool call item. + turn_id: type: string - description: The standard error output that was captured. - outcome: - discriminator: - propertyName: type - title: Shell call outcome - description: Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk. - anyOf: - - $ref: '#/components/schemas/FunctionShellCallOutputTimeoutOutcome' - - $ref: '#/components/schemas/FunctionShellCallOutputExitOutcome' - created_by: + minLength: 0 + description: The ID of the turn that contains this item. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the tool call. + sender_agent_id: type: string - description: The identifier of the actor that created the item. - type: object + minLength: 0 + description: The ID of the agent requesting the interrupt. + recipient_agent_id: + type: string + minLength: 0 + description: The ID of the agent to interrupt. required: - - stdout - - stderr - - outcome - title: Shell call output content - description: The content of a shell tool call output that was emitted. - FunctionShellCallOutput: + - type + - id + - turn_id + - status + - sender_agent_id + - recipient_agent_id + additionalProperties: false + description: A request to interrupt a subagent's current turn. The subagent remains available. + CreateSubagentCallItemResource: + type: object properties: type: type: string enum: - - shell_call_output - description: The type of the shell call output. Always `shell_call_output`. - default: shell_call_output + - create_subagent_call + default: create_subagent_call x-stainless-const: true + x-enumDescriptions: + - The current public item type. + description: The item type. Always `create_subagent_call`. id: type: string - description: The unique ID of the shell call output. Populated when this item is returned via API. - call_id: + minLength: 0 + description: The ID of the tool call item. + turn_id: type: string - description: The unique ID of the shell tool call generated by the model. - caller: - anyOf: - - $ref: '#/components/schemas/ToolCallCaller' - description: The execution context that produced this tool call. - - type: 'null' + minLength: 0 + description: The ID of the turn that contains this item. status: - $ref: '#/components/schemas/FunctionShellCallOutputStatusEnum' - description: The status of the shell call output. One of `in_progress`, `completed`, or `incomplete`. - output: - items: - $ref: '#/components/schemas/FunctionShellCallOutputContent' - type: array - description: An array of shell call output contents - max_output_length: - anyOf: - - type: integer - description: The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output. - - type: 'null' - created_by: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the tool call. + agent_id: type: string - description: The identifier of the actor that created the item. - type: object + minLength: 0 + description: The ID of the agent that requested the subagent. + content: + type: array + items: + $ref: '#/components/schemas/AgentContentResource' + minItems: 0 + maxItems: 2000 + description: The task given to the spawned agent. + model: + type: + - string + - 'null' + minLength: 0 + description: The model requested for the spawned agent. + reasoning_effort: + type: + - string + - 'null' + minLength: 0 + description: The reasoning effort requested for the spawned agent. required: - type - id - - call_id + - turn_id - status - - output - - max_output_length - title: Shell call output - description: The output of a shell tool call that was emitted. - ApplyPatchCallStatus: - type: string - enum: - - in_progress - - completed - ApplyPatchCreateFileOperation: + - agent_id + - content + - model + - reasoning_effort + additionalProperties: false + description: A request to spawn a subagent. + SendSubagentInputCallItemResource: + type: object properties: type: type: string enum: - - create_file - description: Create a new file with the provided diff. - default: create_file + - send_subagent_input_call + default: send_subagent_input_call x-stainless-const: true - path: + x-enumDescriptions: + - The current public item type. + description: The item type. Always `send_subagent_input_call`. + id: type: string - description: Path of the file to create. - diff: + minLength: 0 + description: The ID of the tool call item. + turn_id: type: string - description: Diff to apply. - type: object + minLength: 0 + description: The ID of the turn that contains this item. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the tool call. + sender_agent_id: + type: string + minLength: 0 + description: The ID of the agent sending the input. + recipient_agent_id: + type: string + minLength: 0 + description: The ID of the agent receiving the input. + content: + type: array + items: + $ref: '#/components/schemas/AgentContentResource' + minItems: 0 + maxItems: 2000 + description: The input sent to the receiving agent. required: - type - - path - - diff - title: Apply patch create file operation - description: Instruction describing how to create a file via the apply_patch tool. - ApplyPatchDeleteFileOperation: + - id + - turn_id + - status + - sender_agent_id + - recipient_agent_id + - content + additionalProperties: false + description: A request to send input to another agent. + ResumeSubagentCallItemResource: + type: object properties: type: type: string enum: - - delete_file - description: Delete the specified file. - default: delete_file + - resume_subagent_call + default: resume_subagent_call x-stainless-const: true - path: + x-enumDescriptions: + - The current public item type. + description: The item type. Always `resume_subagent_call`. + id: type: string - description: Path of the file to delete. - type: object + minLength: 0 + description: The ID of the tool call item. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the tool call. + sender_agent_id: + type: string + minLength: 0 + description: The ID of the agent requesting the resume. + recipient_agent_id: + type: string + minLength: 0 + description: The ID of the agent to resume. required: - type - - path - title: Apply patch delete file operation - description: Instruction describing how to delete a file via the apply_patch tool. - ApplyPatchUpdateFileOperation: + - id + - turn_id + - status + - sender_agent_id + - recipient_agent_id + additionalProperties: false + description: A request to resume a subagent. + WaitForSubagentsCallItemResource: + type: object properties: type: type: string enum: - - update_file - description: Update an existing file with the provided diff. - default: update_file + - wait_for_subagents_call + default: wait_for_subagents_call x-stainless-const: true - path: + x-enumDescriptions: + - The current public item type. + description: The item type. Always `wait_for_subagents_call`. + id: type: string - description: Path of the file to update. - diff: + minLength: 0 + description: The ID of the tool call item. + turn_id: type: string - description: Diff to apply. - type: object + minLength: 0 + description: The ID of the turn that contains this item. + status: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the tool call. + sender_agent_id: + type: string + minLength: 0 + description: The ID of the agent waiting for results. + recipient_agent_ids: + type: array + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: The IDs of the agents to wait for. required: - type - - path - - diff - title: Apply patch update file operation - description: Instruction describing how to update a file via the apply_patch tool. - ApplyPatchToolCall: + - id + - turn_id + - status + - sender_agent_id + - recipient_agent_ids + additionalProperties: false + description: A request to wait for one or more subagents. + CloseSubagentCallItemResource: + type: object properties: type: type: string enum: - - apply_patch_call - description: The type of the item. Always `apply_patch_call`. - default: apply_patch_call + - close_subagent_call + default: close_subagent_call x-stainless-const: true + x-enumDescriptions: + - The current public item type. + description: The item type. Always `close_subagent_call`. id: type: string - description: The unique ID of the apply patch tool call. Populated when this item is returned via API. - call_id: + minLength: 0 + description: The ID of the tool call item. + turn_id: type: string - description: The unique ID of the apply patch tool call generated by the model. - caller: - anyOf: - - $ref: '#/components/schemas/ToolCallCaller' - description: The execution context that produced this tool call. - - type: 'null' + minLength: 0 + description: The ID of the turn that contains this item. status: - $ref: '#/components/schemas/ApplyPatchCallStatus' - description: The status of the apply patch tool call. One of `in_progress` or `completed`. - operation: - discriminator: - propertyName: type - title: Apply patch operation - description: One of the create_file, delete_file, or update_file operations applied via apply_patch. - anyOf: - - $ref: '#/components/schemas/ApplyPatchCreateFileOperation' - - $ref: '#/components/schemas/ApplyPatchDeleteFileOperation' - - $ref: '#/components/schemas/ApplyPatchUpdateFileOperation' - created_by: + $ref: '#/components/schemas/FunctionCallStatusResource' + description: The status of the tool call. + sender_agent_id: type: string - description: The ID of the entity that created this tool call. - type: object + minLength: 0 + description: The ID of the agent requesting the close. + recipient_agent_id: + type: string + minLength: 0 + description: The ID of the agent to close. required: - type - id - - call_id + - turn_id - status - - operation - title: Apply patch tool call - description: A tool call that applies file diffs by creating, deleting, or updating files. - ApplyPatchCallOutputStatus: + - sender_agent_id + - recipient_agent_id + additionalProperties: false + description: A request to close a subagent. + SessionTurnItemResource: + description: An item associated with a session turn. + discriminator: + propertyName: type + mapping: + message: '#/components/schemas/MessageItemResource' + reasoning: '#/components/schemas/ReasoningItemResource' + function_call: '#/components/schemas/FunctionCallItemResource' + function_call_output: '#/components/schemas/FunctionCallOutputItemResource' + agent_message: '#/components/schemas/AgentMessageItemResource' + mcp_call: '#/components/schemas/McpCallItemResource' + web_search_call: '#/components/schemas/WebSearchCallItemResource' + command_execution: '#/components/schemas/CommandExecutionItemResource' + interrupt_subagent_call: '#/components/schemas/InterruptSubagentCallItemResource' + create_subagent_call: '#/components/schemas/CreateSubagentCallItemResource' + send_subagent_input_call: '#/components/schemas/SendSubagentInputCallItemResource' + resume_subagent_call: '#/components/schemas/ResumeSubagentCallItemResource' + wait_for_subagents_call: '#/components/schemas/WaitForSubagentsCallItemResource' + close_subagent_call: '#/components/schemas/CloseSubagentCallItemResource' + x-oai-discriminator-values: + - message + - reasoning + - function_call + - function_call_output + - agent_message + - mcp_call + - web_search_call + - command_execution + - create_subagent_call + - send_subagent_input_call + - resume_subagent_call + - wait_for_subagents_call + - interrupt_subagent_call + - close_subagent_call + anyOf: + - $ref: '#/components/schemas/MessageItemResource' + - $ref: '#/components/schemas/ReasoningItemResource' + - $ref: '#/components/schemas/FunctionCallItemResource' + - $ref: '#/components/schemas/FunctionCallOutputItemResource' + - $ref: '#/components/schemas/AgentMessageItemResource' + - $ref: '#/components/schemas/McpCallItemResource' + - $ref: '#/components/schemas/WebSearchCallItemResource' + - $ref: '#/components/schemas/CommandExecutionItemResource' + - $ref: '#/components/schemas/CreateSubagentCallItemResource' + - $ref: '#/components/schemas/SendSubagentInputCallItemResource' + - $ref: '#/components/schemas/ResumeSubagentCallItemResource' + - $ref: '#/components/schemas/WaitForSubagentsCallItemResource' + - $ref: '#/components/schemas/InterruptSubagentCallItemResource' + - $ref: '#/components/schemas/CloseSubagentCallItemResource' + SessionItemListResource: + type: object + properties: + object: + type: string + enum: + - list + default: list + x-stainless-const: true + description: The object type, which is always `list`. + data: + type: array + items: + $ref: '#/components/schemas/SessionTurnItemResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. + required: + - object + - data + - first_id + - last_id + - has_more + additionalProperties: false + description: A page of messages, reasoning, and tool calls from a session's item history. + TurnObjectResource: + type: string + enum: + - agent.session.turn + default: agent.session.turn + x-stainless-const: true + description: The object type for a turn. + TurnStatusResource: type: string enum: + - queued + - in_progress + - waiting - completed - failed - ApplyPatchToolCallOutput: + - cancelled + x-enumDescriptions: + - The turn is waiting to start. + - The turn is in progress. + - The turn is waiting for external input. + - The turn completed successfully. + - The turn failed. + - The turn was cancelled. + description: The current status of a turn. + SessionTurnErrorCodeResource: + type: string + enum: + - context_length_exceeded + - session_budget_exceeded + - usage_limit_exceeded + - rate_limit_exceeded + - server_overloaded + - cyber_policy + - connection_failed + - server_error + - authentication_error + - invalid_request + - resource_not_found + - sandbox_error + - executor_version_incompatible + - active_turn_not_steerable + - request_timeout + - internal_error + x-enumDescriptions: + - The request exceeds the model's context window. + - The session has reached its usage budget. + - The organization has reached a usage, plan, or billing limit. + - The request exceeds the available rate limit. + - The model service is temporarily overloaded. + - The request was rejected by a safety policy. + - The request could not connect to the model service. + - The model service encountered an unexpected error. + - The API credentials are invalid or lack the required access. + - The request contains invalid input or configuration. + - The requested model or resource is unavailable. + - The request could not complete in its execution environment. + - The executor must be upgraded before it can run this turn. + - The session cannot accept additional input while a request is running. + - The request timed out before the model service responded. + - An unexpected internal error prevented the session request from completing. + description: Stable public categories for session request failures. + SessionTurnErrorResource: + type: object properties: - type: + code: + $ref: '#/components/schemas/SessionTurnErrorCodeResource' + description: A stable, machine-readable failure category. + message: type: string - enum: - - apply_patch_call_output - description: The type of the item. Always `apply_patch_call_output`. - default: apply_patch_call_output - x-stainless-const: true + minLength: 0 + description: A customer-safe explanation of the failure. + required: + - code + - message + additionalProperties: false + description: A customer-safe error describing why a session request failed. + InputTokensDetailsResource: + type: object + properties: + cached_tokens: + type: integer + format: int64 + description: The number of input tokens retrieved from the prompt cache. + required: + - cached_tokens + additionalProperties: false + description: A breakdown of input token usage for a session or turn. + OutputTokensDetailsResource: + type: object + properties: + reasoning_tokens: + type: integer + format: int64 + description: The number of output tokens used for reasoning. + required: + - reasoning_tokens + additionalProperties: false + description: A breakdown of output token usage for a session or turn. + TokenUsageResource: + type: object + properties: + input_tokens: + type: integer + format: int64 + description: The number of input tokens used by the agent. + input_tokens_details: + $ref: '#/components/schemas/InputTokensDetailsResource' + description: A breakdown of the agent's input token usage. + output_tokens: + type: integer + format: int64 + description: The number of output tokens generated by the agent. + output_tokens_details: + $ref: '#/components/schemas/OutputTokensDetailsResource' + description: A breakdown of the agent's output token usage. + total_tokens: + type: integer + format: int64 + description: The total number of input and output tokens used by the agent. + required: + - input_tokens + - input_tokens_details + - output_tokens + - output_tokens_details + - total_tokens + additionalProperties: false + description: Recorded token usage for a session or turn. Usage is best effort and may change. + TurnResource: + type: object + properties: id: type: string - description: The unique ID of the apply patch tool call output. Populated when this item is returned via API. - call_id: + minLength: 0 + description: The ID of the turn. + object: + $ref: '#/components/schemas/TurnObjectResource' + description: The object type. Always `agent.session.turn`. + session_id: type: string - description: The unique ID of the apply patch tool call generated by the model. - caller: + minLength: 0 + description: The ID of the session that owns the turn. + agent_id: + type: string + minLength: 0 + description: The ID of the agent that ran the turn. + subagent_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the subagent that ran the turn, if applicable. + status: + $ref: '#/components/schemas/TurnStatusResource' + description: The current status of the turn. + created_at: + type: integer + format: int64 + description: The Unix timestamp, in seconds, used to order the turn by creation time. Subagent turns use their start time, falling back to completion time or the subagent opening time when the preceding timestamps are unavailable. + started_at: + type: + - integer + - 'null' + format: int64 + description: The Unix timestamp, in seconds, when the turn started. + completed_at: + type: + - integer + - 'null' + format: int64 + description: The Unix timestamp, in seconds, when the turn reached a terminal state. + error: anyOf: - - $ref: '#/components/schemas/ToolCallCaller' - description: The execution context that produced this tool call. + - $ref: '#/components/schemas/SessionTurnErrorResource' - type: 'null' - status: - $ref: '#/components/schemas/ApplyPatchCallOutputStatus' - description: The status of the apply patch tool call output. One of `completed` or `failed`. - output: + description: A customer-safe error. Non-null only for a failed turn. + usage: anyOf: - - type: string - description: Optional textual output returned by the apply patch tool. + - $ref: '#/components/schemas/TokenUsageResource' - type: 'null' - created_by: - type: string - description: The ID of the entity that created this tool call output. - type: object + description: Best-effort token usage for the turn, or null if unknown. Recorded usage may change. required: - - type - id - - call_id + - object + - session_id + - agent_id + - subagent_id - status - title: Apply patch tool call output - description: The output emitted by an apply patch tool call. - MCPProtocolError: + - created_at + - started_at + - completed_at + - error + - usage + additionalProperties: false + description: The canonical public representation of a session turn. + SessionTurnListResource: + type: object properties: - type: + object: type: string enum: - - mcp_protocol_error - default: mcp_protocol_error + - list + default: list x-stainless-const: true - code: - type: integer - message: - type: string + description: The object type, which is always `list`. + data: + type: array + items: + $ref: '#/components/schemas/TurnResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. + required: + - object + - data + - first_id + - last_id + - has_more + additionalProperties: false + description: A page of Agents API resources, with IDs for retrieving additional pages. + ReasoningEffortResource: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + - max + description: The amount of reasoning effort used by an agent. + ReasoningSummaryResource: + type: string + enum: + - concise + - detailed + - auto + x-enumDescriptions: + - Returns a concise reasoning summary when supported. + - Returns a detailed reasoning summary when supported. + - Automatically selects the most detailed summary supported by the model. + description: The reasoning summary format requested from an agent. + ReasoningResource: type: object + properties: + effort: + anyOf: + - $ref: '#/components/schemas/ReasoningEffortResource' + - type: 'null' + description: The requested reasoning effort, or `null` when the model selects its own default. + summary: + anyOf: + - $ref: '#/components/schemas/ReasoningSummaryResource' + - type: 'null' + description: The requested reasoning summary format, or `null` when summaries are disabled. required: - - type - - code - - message - MCPToolExecutionError: + - effort + - summary + additionalProperties: false + description: The reasoning configuration used by an agent. + TextFormatResourceText: + type: object properties: type: type: string enum: - - mcp_tool_execution_error - default: mcp_tool_execution_error + - text + default: text x-stainless-const: true - content: {} - type: object + description: The type of the object. Always `text`. required: - type - - content - HTTPError: + additionalProperties: false + description: Generates ordinary text without a structured-output constraint. + TextFormatResourceJsonSchema: + type: object properties: type: type: string enum: - - http_error - default: http_error + - json_schema + default: json_schema x-stainless-const: true - code: - type: integer - message: - type: string - type: object + description: The type of the object. Always `json_schema`. + schema: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: The JSON Schema that generated text must match. required: - type - - code - - message - MCPToolCallStatus: - type: string - enum: - - in_progress - - completed - - incomplete - - calling - - failed - DetailEnum: + - schema + additionalProperties: false + description: Constrains generated text to a JSON Schema. + TextFormatResource: + description: The effective output format for generated text. + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/TextFormatResourceText' + json_schema: '#/components/schemas/TextFormatResourceJsonSchema' + x-oai-discriminator-values: + - text + - json_schema + anyOf: + - $ref: '#/components/schemas/TextFormatResourceText' + - $ref: '#/components/schemas/TextFormatResourceJsonSchema' + VerbosityResource: type: string enum: - low + - medium - high - - auto - - original - FunctionCallItemStatus: + description: The amount of text produced by an agent. + TextResource: + type: object + properties: + format: + $ref: '#/components/schemas/TextFormatResource' + description: The effective output format. Defaults to ordinary text. + verbosity: + $ref: '#/components/schemas/VerbosityResource' + description: The amount of text produced by the agent. Defaults to `medium`. + required: + - format + - verbosity + additionalProperties: false + description: The text configuration used by an agent. + ServiceTierResource: type: string enum: - - in_progress - - completed - - incomplete - ComputerCallOutputItemParam: + - auto + - default + - flex + - priority + - fast + description: The service-tier policy configured for an agent. + PersistedAgentToolResourceFunction: + type: object properties: - id: - anyOf: - - type: string - description: The ID of the computer tool call output. - example: cuo_123 - - type: 'null' - call_id: - type: string - maxLength: 64 - minLength: 1 - description: The ID of the computer tool call that produced the output. type: type: string enum: - - computer_call_output - description: The type of the computer tool call output. Always `computer_call_output`. - default: computer_call_output + - function + default: function x-stainless-const: true - output: - $ref: '#/components/schemas/ComputerScreenshotImage' - acknowledged_safety_checks: - anyOf: - - items: - $ref: '#/components/schemas/ComputerCallSafetyCheckParam' - type: array - description: The safety checks reported by the API that have been acknowledged by the developer. - - type: 'null' - status: - anyOf: - - $ref: '#/components/schemas/FunctionCallItemStatus' - description: The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API. - - type: 'null' - type: object + description: The type of the object. Always `function`. + name: + type: string + minLength: 0 + description: The name of the function. + description: + type: string + minLength: 0 + description: A description of what the function does. + parameters: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: A JSON Schema object describing the function's arguments. + defer_loading: + type: boolean + description: Whether the function is deferred and discovered through tool search. required: - - call_id - type - - output - title: Computer tool call output - description: The output of a computer tool call. - InputTextContentParam: + - name + - description + - parameters + - defer_loading + additionalProperties: false + description: A function defined by the application. + PersistedAgentToolResourceToolSearch: + type: object properties: type: type: string enum: - - input_text - description: The type of the input item. Always `input_text`. - default: input_text + - tool_search + default: tool_search x-stainless-const: true - text: - type: string - maxLength: 10485760 - description: The text input to the model. - prompt_cache_breakpoint: - anyOf: - - $ref: '#/components/schemas/PromptCacheBreakpointParam' - - type: 'null' - type: object + description: The type of the object. Always `tool_search`. required: - type - - text - title: Input text - description: A text input to the model. - InputImageContentParamAutoParam: + additionalProperties: false + description: Discovers deferred function tools and loads them into the model context. + PersistedAgentToolResourceProgrammaticToolCalling: + type: object properties: type: type: string enum: - - input_image - description: The type of the input item. Always `input_image`. - default: input_image + - programmatic_tool_calling + default: programmatic_tool_calling x-stainless-const: true - image_url: - anyOf: - - type: string - maxLength: 20971520 - format: uri - description: The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL. - - type: 'null' - file_id: - anyOf: - - type: string - description: The ID of the file to be sent to the model. - example: file-123 - - type: 'null' - detail: - anyOf: - - $ref: '#/components/schemas/DetailEnum' - description: The detail level of the image to be sent to the model. One of `high`, `low`, `auto`, or `original`. Defaults to `auto`. - - type: 'null' - prompt_cache_breakpoint: - anyOf: - - $ref: '#/components/schemas/PromptCacheBreakpointParam' - - type: 'null' - type: object + description: The type of the object. Always `programmatic_tool_calling`. + enabled: + type: boolean + description: Whether tools can be called from model-generated code. required: - type - title: Input image - description: An image input to the model. Learn about [image inputs](https://developers.openai.com/api/docs/guides/images-vision) - FileDetailEnum: - type: string - enum: - - auto - - low - - high - InputFileContentParam: + - enabled + additionalProperties: false + description: Enables calling tools from model-generated code. + PersistedMcpTransportResourceHttp: + type: object properties: type: type: string enum: - - input_file - description: The type of the input item. Always `input_file`. - default: input_file + - http + default: http x-stainless-const: true - file_id: - anyOf: - - type: string - description: The ID of the file to be sent to the model. - example: file-123 - - type: 'null' - filename: - anyOf: - - type: string - description: The name of the file to be sent to the model. - - type: 'null' - file_data: - anyOf: - - type: string - maxLength: 73400320 - description: The base64-encoded data of the file to be sent to the model. - - type: 'null' - file_url: - anyOf: - - type: string - format: uri - description: The URL of the file to be sent to the model. - - type: 'null' - detail: - $ref: '#/components/schemas/FileDetailEnum' - description: The detail level of the file to be sent to the model. Use `auto` to let the system select the detail level; for GPT-5.6 and later models, `auto` uses high-quality rendering, which may increase input token usage. Use `low` for lower-cost rendering, or `high` to render the file at higher quality. Defaults to `auto`. - prompt_cache_breakpoint: - anyOf: - - $ref: '#/components/schemas/PromptCacheBreakpointParam' - - type: 'null' - type: object + description: The type of the object. Always `http`. + server_url: + type: string + minLength: 0 + description: The URL of the MCP server. + headers: + type: object + additionalProperties: + type: string + minLength: 0 + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: Non-secret HTTP headers sent to the MCP server. required: - type - title: Input file - description: A file input to the model. - FunctionCallOutputItemParam: + - server_url + - headers + additionalProperties: false + description: Connects to an MCP server over HTTP. + PersistedMcpTransportResourceStdio: + type: object properties: - id: - anyOf: - - type: string - description: The unique ID of the function tool call output. Populated when this item is returned via API. - example: fc_123 - - type: 'null' - call_id: - anyOf: - - type: string - maxLength: 64 - minLength: 1 - description: The unique ID of the function tool call generated by the model. - - type: 'null' type: type: string enum: - - function_call_output - description: The type of the function tool call output. Always `function_call_output`. - default: function_call_output + - stdio + default: stdio x-stainless-const: true - output: - description: Text, image, or file output of the function tool call. - anyOf: - - type: string - maxLength: 10485760 - description: A JSON string of the output of the function tool call. - - items: - discriminator: - propertyName: type - description: A piece of message content, such as text, an image, or a file. - anyOf: - - $ref: '#/components/schemas/InputTextContentParam' - - $ref: '#/components/schemas/InputImageContentParamAutoParam' - - $ref: '#/components/schemas/InputFileContentParam' - type: array - description: An array of content outputs (text, image, file) for the function tool call. - name: - anyOf: - - type: string - maxLength: 128 - minLength: 1 - description: The name of the tool that produced the output. - - type: 'null' - namespace: - anyOf: - - type: string - maxLength: 64 - minLength: 1 - pattern: ^[a-zA-Z0-9_-]+$ - description: The namespace of the tool that produced the output. - - type: 'null' - caller: - anyOf: - - $ref: '#/components/schemas/ToolCallCallerParam' - description: The execution context that produced this tool call. - - type: 'null' - status: - anyOf: - - $ref: '#/components/schemas/FunctionCallItemStatus' - description: The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API. - - type: 'null' - type: object + description: The type of the object. Always `stdio`. + command: + type: string + minLength: 0 + description: The command used to start the MCP server. + args: + type: array + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Arguments passed to the MCP server command. + cwd: + type: string + minLength: 0 + description: The working directory used to start the MCP server. + env_vars: + type: array + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Environment variable names inherited from the execution environment. required: - type - - output - title: Function tool call output - description: The output of a function tool call. - FileCitationParam: + - command + - args + - cwd + - env_vars + additionalProperties: false + description: Starts an MCP server as a local process. + PersistedMcpTransportResource: + description: A credential-free transport used to connect to an MCP server. + discriminator: + propertyName: type + mapping: + http: '#/components/schemas/PersistedMcpTransportResourceHttp' + stdio: '#/components/schemas/PersistedMcpTransportResourceStdio' + x-oai-discriminator-values: + - http + - stdio + anyOf: + - $ref: '#/components/schemas/PersistedMcpTransportResourceHttp' + - $ref: '#/components/schemas/PersistedMcpTransportResourceStdio' + McpConnectionOriginResource: + type: string + enum: + - service + - environment + description: Where outbound MCP HTTP connections originate. + PersistedAgentToolResourceMcp: + type: object properties: type: type: string enum: - - file_citation - description: The citation type. Always `file_citation`. - default: file_citation + - mcp + default: mcp x-stainless-const: true - index: - type: integer - minimum: 0 - description: The index of the file in the list of files. - file_id: - type: string - description: The ID of the file. - example: file-123 - filename: + description: The type of the object. Always `mcp`. + server_label: type: string - description: The filename of the file cited. - type: object + minLength: 0 + description: A label used to identify the MCP server in tool calls. + credential_id: + type: + - string + - 'null' + minLength: 0 + description: The vault credential selected for this MCP server, if any. + transport: + $ref: '#/components/schemas/PersistedMcpTransportResource' + description: The credential-free transport used to connect to the MCP server. + request_metadata: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: Metadata included with requests to this MCP server. + allowed_tools: + type: + - array + - 'null' + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: The MCP tools the agent may call, or null when all server tools are allowed. + required: + type: boolean + description: Whether this MCP server must initialize before the first turn. + connection_origin: + $ref: '#/components/schemas/McpConnectionOriginResource' + description: Where outbound MCP HTTP connections originate. required: - type - - index - - file_id - - filename - UrlCitationParam: + - server_label + - credential_id + - transport + - request_metadata + - allowed_tools + - required + - connection_origin + additionalProperties: false + description: Tools provided by a remote MCP server without stored credentials. + WebSearchModeResource: + type: string + enum: + - disabled + - cached + - live + description: The source used for web search results. + WebSearchContextSizeResource: + type: string + enum: + - low + - medium + - high + description: The amount of web search context made available to the model. + WebSearchLocationResource: + type: object + properties: + country: + type: + - string + - 'null' + minLength: 0 + description: The two-letter ISO country code, such as `US`. + region: + type: + - string + - 'null' + minLength: 0 + description: The region or state name. + city: + type: + - string + - 'null' + minLength: 0 + description: The city name. + timezone: + type: + - string + - 'null' + minLength: 0 + description: The IANA timezone, such as `America/Los_Angeles`. + required: + - country + - region + - city + - timezone + additionalProperties: false + description: Approximate user location used to localize web search results. + PersistedAgentToolResourceWebSearch: + type: object properties: type: type: string enum: - - url_citation - description: The citation type. Always `url_citation`. - default: url_citation + - web_search + default: web_search x-stainless-const: true - start_index: - type: integer - minimum: 0 - description: The index of the first character of the citation in the message. - end_index: - type: integer - minimum: 0 - description: The index of the last character of the citation in the message. - url: - type: string - format: uri - description: The URL of the cited resource. - title: - type: string - description: The title of the cited resource. - type: object + description: The type of the object. Always `web_search`. + mode: + $ref: '#/components/schemas/WebSearchModeResource' + description: The source used for web search results. + context_size: + $ref: '#/components/schemas/WebSearchContextSizeResource' + description: The amount of search context made available to the model. Defaults to `medium`. + allowed_domains: + type: + - array + - 'null' + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Allowed search domains, or `null` when the search is unrestricted. + location: + anyOf: + - $ref: '#/components/schemas/WebSearchLocationResource' + - type: 'null' + description: Approximate location used to localize search results, if provided. required: - type - - start_index - - end_index - - url - - title - ContainerFileCitationParam: + - mode + - context_size + - allowed_domains + - location + additionalProperties: false + description: Web search. + PersistedAgentToolResource: + description: A credential-free tool available to a reusable agent. + discriminator: + propertyName: type + mapping: + function: '#/components/schemas/PersistedAgentToolResourceFunction' + tool_search: '#/components/schemas/PersistedAgentToolResourceToolSearch' + programmatic_tool_calling: '#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling' + mcp: '#/components/schemas/PersistedAgentToolResourceMcp' + web_search: '#/components/schemas/PersistedAgentToolResourceWebSearch' + x-oai-discriminator-values: + - function + - tool_search + - programmatic_tool_calling + - mcp + - web_search + anyOf: + - $ref: '#/components/schemas/PersistedAgentToolResourceFunction' + - $ref: '#/components/schemas/PersistedAgentToolResourceToolSearch' + - $ref: '#/components/schemas/PersistedAgentToolResourceProgrammaticToolCalling' + - $ref: '#/components/schemas/PersistedAgentToolResourceMcp' + - $ref: '#/components/schemas/PersistedAgentToolResourceWebSearch' + MultiAgentConfigResource: + type: object properties: - type: + enabled: + type: boolean + description: Whether subagent tools are enabled. Defaults to false. + max_concurrent_subagents: + type: + - integer + - 'null' + format: int64 + minimum: 1 + maximum: 4294967295 + description: Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled. + required: + - enabled + - max_concurrent_subagents + additionalProperties: false + description: The resolved configuration for creating and coordinating subagents. + AgentResource: + type: object + properties: + id: + type: string + minLength: 0 + description: The ID of the reusable agent. + object: type: string enum: - - container_file_citation - description: The citation type. Always `container_file_citation`. - default: container_file_citation + - agent + default: agent x-stainless-const: true - start_index: + description: The object type. Always `agent`. + created_at: type: integer - minimum: 0 - description: The index of the first character of the citation in the message. - end_index: + format: int64 + description: The Unix timestamp, in seconds, when the agent was created. + updated_at: type: integer - minimum: 0 - description: The index of the last character of the citation in the message. - container_id: - type: string - description: The ID of the container. - example: cntr_123 - file_id: - type: string - description: The ID of the container file. - example: cfile_123 - filename: + format: int64 + description: The Unix timestamp, in seconds, when the agent was last updated. + name: + type: + - string + - 'null' + minLength: 0 + description: A human-readable name for the agent, or null if it is unnamed. + metadata: + type: object + additionalProperties: + type: string + minLength: 0 + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: Custom string key-value pairs attached to the agent. + model: type: string - description: The filename of the container file cited. + minLength: 0 + description: The requested model name used for inference. + reasoning: + $ref: '#/components/schemas/ReasoningResource' + description: The resolved reasoning configuration, including the model default for an omitted effort. + text: + $ref: '#/components/schemas/TextResource' + description: The resolved configuration for text generated by the agent. + service_tier: + $ref: '#/components/schemas/ServiceTierResource' + description: The resolved service-tier policy used for model requests. + instructions: + type: + - string + - 'null' + minLength: 0 + description: Custom instructions appended to the agent's default base instructions. + tools: + type: array + items: + $ref: '#/components/schemas/PersistedAgentToolResource' + minItems: 0 + maxItems: 2000 + description: Tools available to the agent. + multi_agent: + $ref: '#/components/schemas/MultiAgentConfigResource' + description: The resolved configuration for creating and coordinating subagents. + required: + - id + - object + - created_at + - updated_at + - name + - metadata + - model + - reasoning + - text + - service_tier + - instructions + - tools + - multi_agent + additionalProperties: false + description: A reusable agent scoped to the caller's project. + AgentListResource: type: object + properties: + object: + type: string + enum: + - list + default: list + x-stainless-const: true + description: The object type, which is always `list`. + data: + type: array + items: + $ref: '#/components/schemas/AgentResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. required: - - type - - start_index - - end_index - - container_id - - file_id - - filename - ToolSearchCallItemParam: + - object + - data + - first_id + - last_id + - has_more + additionalProperties: false + description: A page of Agents API resources, with IDs for retrieving additional pages. + ReasoningEffortParam: + type: string + enum: + - none + - minimal + - low + - medium + - high + - xhigh + - max + description: The amount of reasoning effort the model should use. + ReasoningSummaryParam: + type: string + enum: + - concise + - detailed + - auto + x-enumDescriptions: + - Returns a concise reasoning summary when supported. + - Returns a detailed reasoning summary when supported. + - Automatically selects the most detailed summary supported by the model. + description: The reasoning summary format requested from the model. + ReasoningParam: + type: object properties: - id: + effort: anyOf: - - type: string - description: The unique ID of this tool search call. - example: tsc_123 + - $ref: '#/components/schemas/ReasoningEffortParam' - type: 'null' - call_id: + description: The amount of reasoning effort the model should use. Omission lets the model select it. + summary: anyOf: - - type: string - maxLength: 64 - minLength: 1 - description: The unique ID of the tool search call generated by the model. + - $ref: '#/components/schemas/ReasoningSummaryParam' - type: 'null' + description: Controls whether the response includes a reasoning summary. + additionalProperties: false + description: Reasoning configuration for the agent. + TextFormatParamText: + type: object + properties: type: type: string enum: - - tool_search_call - description: The item type. Always `tool_search_call`. - default: tool_search_call + - text + default: text x-stainless-const: true - execution: - $ref: '#/components/schemas/ToolSearchExecutionType' - description: Whether tool search was executed by the server or by the client. - arguments: - $ref: '#/components/schemas/EmptyModelParam' - description: The arguments supplied to the tool search call. - status: - anyOf: - - $ref: '#/components/schemas/FunctionCallItemStatus' - description: The status of the tool search call. - - type: 'null' - type: object + description: The type of the object. Always `text`. required: - type - - arguments - ToolSearchOutputItemParam: + additionalProperties: false + description: Generates ordinary text without a structured-output constraint. + TextFormatParamJsonSchema: + type: object properties: - id: - anyOf: - - type: string - description: The unique ID of this tool search output. - example: tso_123 - - type: 'null' - call_id: - anyOf: - - type: string - maxLength: 64 - minLength: 1 - description: The unique ID of the tool search call generated by the model. - - type: 'null' type: type: string enum: - - tool_search_output - description: The item type. Always `tool_search_output`. - default: tool_search_output + - json_schema + default: json_schema x-stainless-const: true - execution: - $ref: '#/components/schemas/ToolSearchExecutionType' - description: Whether tool search was executed by the server or by the client. - tools: - items: - $ref: '#/components/schemas/Tool' - type: array - description: The loaded tool definitions returned by the tool search output. - status: - anyOf: - - $ref: '#/components/schemas/FunctionCallItemStatus' - description: The status of the tool search output. - - type: 'null' - type: object + description: The type of the object. Always `json_schema`. + schema: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: The JSON Schema that generated text must match. required: - type - - tools - AdditionalToolsItemParam: + - schema + additionalProperties: false + description: Constrains generated text to a JSON Schema. + TextFormatParam: + description: The output format for generated text. + discriminator: + propertyName: type + mapping: + text: '#/components/schemas/TextFormatParamText' + json_schema: '#/components/schemas/TextFormatParamJsonSchema' + x-oai-discriminator-values: + - text + - json_schema + anyOf: + - $ref: '#/components/schemas/TextFormatParamText' + - $ref: '#/components/schemas/TextFormatParamJsonSchema' + VerbosityParam: + type: string + enum: + - low + - medium + - high + x-enumDescriptions: + - Produces less text. + - Uses the default amount of text. + - Produces more text. + description: The amount of text the model should produce. + TextParam: + type: object properties: - id: + format: anyOf: - - type: string - description: The unique ID of this additional tools item. - example: at_123 + - $ref: '#/components/schemas/TextFormatParam' + - type: 'null' + description: 'The output format. Omission uses ordinary text (`{"type": "text"}`).' + verbosity: + anyOf: + - $ref: '#/components/schemas/VerbosityParam' - type: 'null' + description: The amount of text the model should produce. Defaults to `medium`, matching Responses. + additionalProperties: false + description: Configuration for text generated by the agent. + ServiceTierParam: + type: string + enum: + - auto + - default + - flex + - priority + - fast + x-enumDescriptions: + - Selects the service tier automatically. + - Uses the default service tier. + - Uses the flex service tier. + - Uses the priority service tier. + - Uses the fast service tier. + description: The service tier used for model requests. + PersistedAgentToolConfigParamFunction: + type: object + properties: type: type: string enum: - - additional_tools - description: The item type. Always `additional_tools`. - default: additional_tools + - function + default: function x-stainless-const: true - role: + description: The type of the object. Always `function`. + name: type: string - enum: - - developer - description: The role that provided the additional tools. Only `developer` is supported. - default: developer - x-stainless-const: true - tools: - items: - $ref: '#/components/schemas/Tool' - type: array - description: A list of additional tools made available at this item. - type: object + minLength: 0 + maxLength: 1048576 + description: The name of the function. + description: + type: string + minLength: 0 + maxLength: 1048576 + description: A description of what the function does. + parameters: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: A JSON Schema object describing the function's arguments. + defer_loading: + type: boolean + default: false + description: Whether this function is deferred and discovered through tool search. Defaults to `false`. required: - type - - role - - tools - CompactionSummaryItemParam: + - name + - description + - parameters + additionalProperties: false + description: A function defined by the application. + PersistedAgentToolConfigParamToolSearch: + type: object properties: - id: - anyOf: - - type: string - description: The ID of the compaction item. - example: cmp_123 - - type: 'null' type: type: string enum: - - compaction - description: The type of the item. Always `compaction`. - default: compaction + - tool_search + default: tool_search x-stainless-const: true - encrypted_content: - type: string - maxLength: 20971520 - description: The encrypted content of the compaction summary. - type: object + description: The type of the object. Always `tool_search`. required: - type - - encrypted_content - title: Compaction item - description: A compaction item generated by the [`v1/responses/compact` API](https://developers.openai.com/api/reference/resources/responses/methods/compact). - FunctionShellActionParam: - properties: - commands: - items: - type: string - type: array - description: Ordered shell commands for the execution environment to run. - timeout_ms: - anyOf: - - type: integer - description: Maximum wall-clock time in milliseconds to allow the shell commands to run. - - type: 'null' - max_output_length: - anyOf: - - type: integer - description: Maximum number of UTF-8 characters to capture from combined stdout and stderr output. - - type: 'null' + additionalProperties: false + description: Discovers deferred function tools and loads them into the model context. + PersistedAgentToolConfigParamProgrammaticToolCalling: type: object - required: - - commands - title: Shell action - description: Commands and limits describing how to run the shell tool call. - FunctionShellCallItemStatus: - type: string - enum: - - in_progress - - completed - - incomplete - title: Shell call status - description: Status values reported for shell tool calls. - FunctionShellCallItemParam: properties: - id: - anyOf: - - type: string - description: The unique ID of the shell tool call. Populated when this item is returned via API. - example: sh_123 - - type: 'null' - call_id: - type: string - maxLength: 64 - minLength: 1 - description: The unique ID of the shell tool call generated by the model. - caller: - anyOf: - - $ref: '#/components/schemas/ToolCallCallerParam' - description: The execution context that produced this tool call. - - type: 'null' type: type: string enum: - - shell_call - description: The type of the item. Always `shell_call`. - default: shell_call + - programmatic_tool_calling + default: programmatic_tool_calling x-stainless-const: true - action: - $ref: '#/components/schemas/FunctionShellActionParam' - description: The shell commands and limits that describe how to run the tool call. - status: - anyOf: - - $ref: '#/components/schemas/FunctionShellCallItemStatus' - description: The status of the shell call. One of `in_progress`, `completed`, or `incomplete`. - - type: 'null' - environment: - anyOf: - - discriminator: - propertyName: type - description: The environment to execute the shell commands in. - anyOf: - - $ref: '#/components/schemas/LocalEnvironmentParam' - - $ref: '#/components/schemas/ContainerReferenceParam' - - type: 'null' - type: object + description: The type of the object. Always `programmatic_tool_calling`. + enabled: + type: boolean + default: true + description: Whether tools can be called from model-generated code. Defaults to `true`. required: - - call_id - type - - action - title: Shell tool call - description: A tool representing a request to execute one or more shell commands. - FunctionShellCallOutputTimeoutOutcomeParam: + additionalProperties: false + description: Enables calling tools from model-generated code. + PersistedMcpTransportConfigParamHttp: + type: object properties: type: type: string enum: - - timeout - description: The outcome type. Always `timeout`. - default: timeout + - http + default: http x-stainless-const: true - type: object + description: The type of the object. Always `http`. + server_url: + type: string + minLength: 0 + maxLength: 1048576 + description: The URL of the MCP server. + headers: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 1048576 + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Non-secret HTTP headers sent to the MCP server. required: - type - title: Shell call timeout outcome - description: Indicates that the shell call exceeded its configured time limit. - FunctionShellCallOutputExitOutcomeParam: + - server_url + additionalProperties: false + description: Connects to an MCP server over HTTP. + PersistedMcpTransportConfigParamStdio: + type: object properties: type: type: string enum: - - exit - description: The outcome type. Always `exit`. - default: exit + - stdio + default: stdio x-stainless-const: true - exit_code: - type: integer - description: The exit code returned by the shell process. - type: object + description: The type of the object. Always `stdio`. + command: + type: string + minLength: 0 + maxLength: 1048576 + description: The command used to start the MCP server. + args: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Arguments passed to the MCP server command. + cwd: + type: string + minLength: 0 + maxLength: 1048576 + description: The working directory used to start the MCP server. + env_vars: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Environment variable names to inherit from the selected execution environment. required: - type - - exit_code - title: Shell call exit outcome - description: Indicates that the shell commands finished and returned an exit code. - FunctionShellCallOutputOutcomeParam: + - command + - cwd + additionalProperties: false + description: Starts an MCP server as a local process. + PersistedMcpTransportConfigParam: + description: A credential-free transport used to connect to an MCP server. discriminator: propertyName: type - title: Shell call outcome - description: The exit or timeout outcome associated with this shell call. + mapping: + http: '#/components/schemas/PersistedMcpTransportConfigParamHttp' + stdio: '#/components/schemas/PersistedMcpTransportConfigParamStdio' + x-oai-discriminator-values: + - http + - stdio anyOf: - - $ref: '#/components/schemas/FunctionShellCallOutputTimeoutOutcomeParam' - - $ref: '#/components/schemas/FunctionShellCallOutputExitOutcomeParam' - FunctionShellCallOutputContentParam: - properties: - stdout: - type: string - maxLength: 10485760 - description: Captured stdout output for the shell call. - stderr: - type: string - maxLength: 10485760 - description: Captured stderr output for the shell call. - outcome: - $ref: '#/components/schemas/FunctionShellCallOutputOutcomeParam' - description: The exit or timeout outcome associated with this shell call. + - $ref: '#/components/schemas/PersistedMcpTransportConfigParamHttp' + - $ref: '#/components/schemas/PersistedMcpTransportConfigParamStdio' + McpConnectionOriginParam: + type: string + enum: + - service + - environment + x-enumDescriptions: + - Uses the Managed Agents service network. + - Uses the session's execution environment. + description: Where outbound MCP HTTP connections originate. + PersistedAgentToolConfigParamMcp: type: object - required: - - stdout - - stderr - - outcome - title: Shell output content - description: Captured stdout and stderr for a portion of a shell tool call output. - FunctionShellCallOutputItemParam: properties: - id: - anyOf: - - type: string - description: The unique ID of the shell tool call output. Populated when this item is returned via API. - example: sho_123 - - type: 'null' - call_id: - type: string - maxLength: 64 - minLength: 1 - description: The unique ID of the shell tool call generated by the model. - caller: - anyOf: - - $ref: '#/components/schemas/ToolCallCallerParam' - description: The execution context that produced this tool call. - - type: 'null' type: type: string enum: - - shell_call_output - description: The type of the item. Always `shell_call_output`. - default: shell_call_output + - mcp + default: mcp x-stainless-const: true - output: + description: The type of the object. Always `mcp`. + server_label: + type: string + minLength: 0 + maxLength: 1048576 + description: A label used to identify the MCP server in tool calls. + credential_id: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The vault credential selected for this MCP server. Optional when exactly one attached credential matches the server URL. + transport: + $ref: '#/components/schemas/PersistedMcpTransportConfigParam' + description: The credential-free transport used to connect to the MCP server. + request_metadata: + type: + - object + - 'null' + additionalProperties: {} + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Metadata included with requests to this MCP server. + allowed_tools: + type: + - array + - 'null' items: - $ref: '#/components/schemas/FunctionShellCallOutputContentParam' - type: array - description: Captured chunks of stdout and stderr output, along with their associated outcomes. - status: - anyOf: - - $ref: '#/components/schemas/FunctionShellCallItemStatus' - description: The status of the shell call output. - - type: 'null' - max_output_length: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: The MCP tools the agent may call. All server tools are allowed when omitted. + required: + type: boolean + default: false + description: Whether this MCP server must initialize before the first turn. Defaults to `false`. + connection_origin: anyOf: - - type: integer - description: The maximum number of UTF-8 characters captured for this shell call's combined output. + - $ref: '#/components/schemas/McpConnectionOriginParam' - type: 'null' - type: object + description: Selects where outbound MCP HTTP connections originate. required: - - call_id - type - - output - title: Shell tool call output - description: The streamed output items emitted by a shell tool call. - ApplyPatchCallStatusParam: + - server_label + - transport + additionalProperties: false + description: Tools provided by a remote MCP server without stored credentials. + WebSearchModeParam: type: string enum: - - in_progress - - completed - title: Apply patch call status - description: Status values reported for apply_patch tool calls. - ApplyPatchCreateFileOperationParam: + - disabled + - cached + - live + x-enumDescriptions: + - Disables web search. + - Uses cached search results. + - Searches the live web. + description: The source used for web search results. + WebSearchContextSizeParam: + type: string + enum: + - low + - medium + - high + description: The amount of web search context made available to the model. + WebSearchLocationParam: + type: object properties: - type: - type: string - enum: - - create_file - description: The operation type. Always `create_file`. - default: create_file - x-stainless-const: true - path: - type: string - minLength: 1 - description: Path of the file to create relative to the workspace root. - diff: - type: string - maxLength: 10485760 - description: Unified diff content to apply when creating the file. + country: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The two-letter ISO country code, such as `US`. + region: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The region or state name. + city: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The city name. + timezone: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The IANA timezone, such as `America/Los_Angeles`. + additionalProperties: false + description: Approximate user location used to localize web search results. + PersistedAgentToolConfigParamWebSearch: type: object - required: - - type - - path - - diff - title: Apply patch create file operation - description: Instruction for creating a new file via the apply_patch tool. - ApplyPatchDeleteFileOperationParam: properties: type: type: string enum: - - delete_file - description: The operation type. Always `delete_file`. - default: delete_file + - web_search + default: web_search x-stainless-const: true - path: - type: string - minLength: 1 - description: Path of the file to delete relative to the workspace root. - type: object + description: The type of the object. Always `web_search`. + mode: + anyOf: + - $ref: '#/components/schemas/WebSearchModeParam' + - type: 'null' + description: The source used for web search results. Defaults to `live`. + context_size: + anyOf: + - $ref: '#/components/schemas/WebSearchContextSizeParam' + - type: 'null' + description: The amount of search context made available to the model. Defaults to `medium`. + allowed_domains: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Domains the search may include. + location: + anyOf: + - $ref: '#/components/schemas/WebSearchLocationParam' + - type: 'null' + description: Approximate location used to localize search results. required: - type - - path - title: Apply patch delete file operation - description: Instruction for deleting an existing file via the apply_patch tool. - ApplyPatchUpdateFileOperationParam: + additionalProperties: false + description: Web search. + PersistedAgentToolConfigParam: + description: A tool that can be stored on a reusable agent without session credentials. + discriminator: + propertyName: type + mapping: + function: '#/components/schemas/PersistedAgentToolConfigParamFunction' + tool_search: '#/components/schemas/PersistedAgentToolConfigParamToolSearch' + programmatic_tool_calling: '#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling' + mcp: '#/components/schemas/PersistedAgentToolConfigParamMcp' + web_search: '#/components/schemas/PersistedAgentToolConfigParamWebSearch' + x-oai-discriminator-values: + - function + - tool_search + - programmatic_tool_calling + - mcp + - web_search + anyOf: + - $ref: '#/components/schemas/PersistedAgentToolConfigParamFunction' + - $ref: '#/components/schemas/PersistedAgentToolConfigParamToolSearch' + - $ref: '#/components/schemas/PersistedAgentToolConfigParamProgrammaticToolCalling' + - $ref: '#/components/schemas/PersistedAgentToolConfigParamMcp' + - $ref: '#/components/schemas/PersistedAgentToolConfigParamWebSearch' + MultiAgentConfigCurrentParam: + type: object properties: - type: - type: string - enum: - - update_file - description: The operation type. Always `update_file`. - default: update_file - x-stainless-const: true - path: - type: string - minLength: 1 - description: Path of the file to update relative to the workspace root. - diff: + enabled: + type: boolean + description: Whether subagent tools are enabled. + max_concurrent_subagents: + type: integer + format: int64 + minimum: 1 + maximum: 4294967295 + description: Maximum number of subagents that may run concurrently. Defaults to 6. + required: + - enabled + additionalProperties: false + description: Explicit configuration for creating and coordinating subagents. + CreateAgentParams: + type: object + properties: + metadata: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 512 + propertyNames: + type: string + minLength: 1 + maxLength: 64 + minProperties: 0 + maxProperties: 16 + description: Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map. + name: + type: + - string + - 'null' + minLength: 0 + maxLength: 128 + description: A human-readable name for the agent. Omission or null leaves the agent unnamed. + model: type: string - maxLength: 10485760 - description: Unified diff content to apply to the existing file. + minLength: 0 + maxLength: 1048576 + description: The model to use for the agent. The requested model name is preserved. + reasoning: + anyOf: + - $ref: '#/components/schemas/ReasoningParam' + - type: 'null' + description: Configuration for model reasoning. Omission uses the model's default effort. + text: + anyOf: + - $ref: '#/components/schemas/TextParam' + - type: 'null' + description: Configuration for generated text. Defaults to the `text` format and medium verbosity. + service_tier: + anyOf: + - $ref: '#/components/schemas/ServiceTierParam' + - type: 'null' + description: The service tier used for model requests. Defaults to `auto`. + instructions: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: Additional instructions appended to the agent's default base instructions. Omit or set to null to add no custom instructions. + tools: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/PersistedAgentToolConfigParam' + minItems: 0 + maxItems: 2000 + description: Tools available to the agent. Defaults to an empty list. + multi_agent: + anyOf: + - $ref: '#/components/schemas/MultiAgentConfigCurrentParam' + - type: 'null' + description: Configuration for creating and coordinating subagents. Subagent tools are disabled by default. + required: + - model + additionalProperties: false + description: Parameters for creating a reusable agent. + UpdateAgentParams: type: object - required: - - type - - path - - diff - title: Apply patch update file operation - description: Instruction for updating an existing file via the apply_patch tool. - ApplyPatchOperationParam: - discriminator: - propertyName: type - title: Apply patch operation - description: One of the create_file, delete_file, or update_file operations supplied to the apply_patch tool. - anyOf: - - $ref: '#/components/schemas/ApplyPatchCreateFileOperationParam' - - $ref: '#/components/schemas/ApplyPatchDeleteFileOperationParam' - - $ref: '#/components/schemas/ApplyPatchUpdateFileOperationParam' - ApplyPatchToolCallItemParam: properties: - type: + model: type: string - enum: - - apply_patch_call - description: The type of the item. Always `apply_patch_call`. - default: apply_patch_call - x-stainless-const: true - id: + minLength: 0 + maxLength: 1048576 + description: The model to use for the agent. The requested model name is preserved. + reasoning: anyOf: - - type: string - description: The unique ID of the apply patch tool call. Populated when this item is returned via API. - example: apc_123 + - $ref: '#/components/schemas/ReasoningParam' - type: 'null' - call_id: - type: string - maxLength: 64 - minLength: 1 - description: The unique ID of the apply patch tool call generated by the model. - caller: + description: Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort. + text: anyOf: - - $ref: '#/components/schemas/ToolCallCallerParam' - description: The execution context that produced this tool call. + - $ref: '#/components/schemas/TextParam' - type: 'null' - status: - $ref: '#/components/schemas/ApplyPatchCallStatusParam' - description: The status of the apply patch tool call. One of `in_progress` or `completed`. - operation: - $ref: '#/components/schemas/ApplyPatchOperationParam' - description: The specific create, delete, or update instruction for the apply_patch tool call. + description: Configuration for text generated by the agent. + service_tier: + anyOf: + - $ref: '#/components/schemas/ServiceTierParam' + - type: 'null' + description: The service tier used for model requests. + instructions: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: Additional instructions appended to the agent's default base instructions. Omit to leave unchanged. + multi_agent: + anyOf: + - $ref: '#/components/schemas/MultiAgentConfigCurrentParam' + - type: 'null' + description: Configuration for creating and coordinating subagents. + metadata: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 512 + propertyNames: + type: string + minLength: 1 + maxLength: 64 + minProperties: 0 + maxProperties: 16 + description: Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. + name: + type: + - string + - 'null' + minLength: 0 + maxLength: 128 + description: A replacement name. Omit to leave unchanged, or pass null to clear it. + tools: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/PersistedAgentToolConfigParam' + minItems: 0 + maxItems: 2000 + description: Tools available to the agent. + additionalProperties: false + description: Fields to replace on an existing reusable agent. + DeletedAgentResource: type: object + properties: + id: + type: string + minLength: 0 + description: The ID of the deleted agent. + object: + type: string + enum: + - agent.deleted + default: agent.deleted + x-stainless-const: true + description: The object type. Always `agent.deleted`. + deleted: + type: boolean + description: Whether the agent was deleted. Always `true`. required: - - type - - call_id - - status - - operation - title: Apply patch tool call - description: A tool call representing a request to create, delete, or update files using diff patches. - ApplyPatchCallOutputStatusParam: + - id + - object + - deleted + additionalProperties: false + description: A deleted reusable agent. + EnvironmentPackagesResource: + type: object + properties: + python: + type: array + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Python packages installed in the environment. + system: + type: array + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: System packages installed in the environment. + npm: + type: array + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: npm packages installed globally in the environment. + required: + - python + - system + - npm + additionalProperties: false + description: Packages installed in an OpenAI-hosted environment. + NetworkAccessResource: type: string enum: - - completed - - failed - title: Apply patch call output status - description: Outcome values reported for apply_patch tool call outputs. - ApplyPatchToolCallOutputItemParam: + - enabled + - disabled + - restricted + x-enumDescriptions: + - Allows unrestricted network access. + - Disables network access. + - Allows access only to configured domains. + description: The network access mode for an OpenAI-hosted environment. + NetworkPolicyResource: + type: object + properties: + access: + $ref: '#/components/schemas/NetworkAccessResource' + description: The environment's network access mode. + allowed_domains: + type: array + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Domains the environment may access when network access is restricted. + required: + - access + - allowed_domains + additionalProperties: false + description: Network access for an OpenAI-hosted environment. + HostedTemplateSkillResourceSkillReference: + type: object properties: type: type: string enum: - - apply_patch_call_output - description: The type of the item. Always `apply_patch_call_output`. - default: apply_patch_call_output + - skill_reference + default: skill_reference x-stainless-const: true - id: - anyOf: - - type: string - description: The unique ID of the apply patch tool call output. Populated when this item is returned via API. - example: apco_123 - - type: 'null' - call_id: + description: The type of the object. Always `skill_reference`. + skill_id: type: string - maxLength: 64 - minLength: 1 - description: The unique ID of the apply patch tool call generated by the model. - caller: - anyOf: - - $ref: '#/components/schemas/ToolCallCallerParam' - description: The execution context that produced this tool call. - - type: 'null' - status: - $ref: '#/components/schemas/ApplyPatchCallOutputStatusParam' - description: The status of the apply patch tool call output. One of `completed` or `failed`. - output: - anyOf: - - type: string - maxLength: 10485760 - description: Optional human-readable log text from the apply patch tool (e.g., patch results or errors). - - type: 'null' - type: object + minLength: 0 + description: The referenced skill ID. + version: + type: + - string + - 'null' + minLength: 0 + description: The requested version selector, including `latest`. required: - type - - call_id - - status - title: Apply patch tool call output - description: The streamed output emitted by an apply patch tool call. - CompactionTriggerItemParam: + - skill_id + - version + additionalProperties: false + description: A skill resolved afresh from the Skills API whenever a session starts. + HostedTemplateSkillResourceInline: + type: object properties: type: type: string enum: - - compaction_trigger - description: The type of the item. Always `compaction_trigger`. - default: compaction_trigger + - inline + default: inline x-stainless-const: true - type: object + description: The type of the object. Always `inline`. + name: + type: string + minLength: 0 + description: The skill name declared in `SKILL.md`. + description: + type: string + minLength: 0 + description: The skill description declared in `SKILL.md`. required: - type - title: Compaction trigger - description: Compacts the current context. Must be the final input item. - ItemReferenceParam: - properties: - type: - anyOf: - - type: string - enum: - - item_reference - description: The type of item to reference. Always `item_reference`. - default: item_reference - x-stainless-const: true - - type: 'null' - id: - type: string - description: The ID of the item to reference. + - name + - description + additionalProperties: false + description: Safe metadata for an inline skill archive. + HostedTemplateSkillResource: + description: Safe metadata for a skill configured by an environment template. + discriminator: + propertyName: type + mapping: + skill_reference: '#/components/schemas/HostedTemplateSkillResourceSkillReference' + inline: '#/components/schemas/HostedTemplateSkillResourceInline' + x-oai-discriminator-values: + - skill_reference + - inline + anyOf: + - $ref: '#/components/schemas/HostedTemplateSkillResourceSkillReference' + - $ref: '#/components/schemas/HostedTemplateSkillResourceInline' + HostedTemplateFileResourceFileId: type: object - required: - - id - title: Item reference - description: An internal identifier for an item to reference. - ProgramItemParam: properties: - id: - type: string - description: The unique ID of this program item. - example: cm_123 type: type: string enum: - - program - description: The item type. Always `program`. - default: program + - file_id + default: file_id x-stainless-const: true - call_id: - type: string - maxLength: 64 - minLength: 1 - description: The stable call ID of the program item. - code: + description: The type of the object. Always `file_id`. + file_id: type: string - maxLength: 10485760 - description: The JavaScript source executed by programmatic tool calling. - fingerprint: + minLength: 0 + description: The ID of the uploaded file. + path: type: string - maxLength: 10485760 - description: Opaque program replay fingerprint that must be round-tripped. - type: object + minLength: 0 + description: The file's absolute path inside the environment. required: - - id - type - - call_id - - code - - fingerprint - ProgramOutputItemStatus: - type: string - enum: - - completed - - incomplete - ProgramOutputItemParam: + - file_id + - path + additionalProperties: false + description: A project-scoped Files API reference resolved separately for each session. + HostedTemplateFileResourceInline: + type: object properties: - id: - type: string - description: The unique ID of this program output item. - example: cmo_123 type: type: string enum: - - program_output - description: The item type. Always `program_output`. - default: program_output + - inline + default: inline x-stainless-const: true - call_id: - type: string - maxLength: 64 - minLength: 1 - description: The call ID of the program item. - result: + description: The type of the object. Always `inline`. + path: type: string - maxLength: 10485760 - description: The result produced by the program item. - status: - $ref: '#/components/schemas/ProgramOutputItemStatus' - description: The terminal status of the program output. - type: object + minLength: 0 + description: The file's absolute path inside the environment. + size_bytes: + type: integer + format: int64 + minimum: 0 + description: The decoded size of the inline file in bytes. required: - - id - type - - call_id - - result - - status - ConversationResource: + - path + - size_bytes + additionalProperties: false + description: Metadata for confidential inline file contents. + HostedTemplateFileResource: + description: Safe metadata for a file configured by an environment template. + discriminator: + propertyName: type + mapping: + file_id: '#/components/schemas/HostedTemplateFileResourceFileId' + inline: '#/components/schemas/HostedTemplateFileResourceInline' + x-oai-discriminator-values: + - file_id + - inline + anyOf: + - $ref: '#/components/schemas/HostedTemplateFileResourceFileId' + - $ref: '#/components/schemas/HostedTemplateFileResourceInline' + EnvironmentTemplateResource: + type: object properties: id: type: string - description: The unique ID of the conversation. + minLength: 0 + description: The ID of the reusable environment template. + name: + type: + - string + - 'null' + minLength: 0 + description: An optional human-readable display name for the template. object: type: string enum: - - conversation - description: The object type, which is always `conversation`. - default: conversation + - agent.environment.template + default: agent.environment.template x-stainless-const: true - metadata: - description: |- - Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. - Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. + description: The object type. Always `agent.environment.template`. created_at: type: integer - format: unixtime - description: The time at which the conversation was created, measured in seconds since the Unix epoch. - type: object + format: int64 + description: The Unix timestamp, in seconds, when the template was created. + updated_at: + type: integer + format: int64 + description: The Unix timestamp, in seconds, when the template was last updated. + packages: + $ref: '#/components/schemas/EnvironmentPackagesResource' + description: Packages installed in each fresh OpenAI-hosted environment. + network: + $ref: '#/components/schemas/NetworkPolicyResource' + description: Runtime network access for each OpenAI-hosted environment. + capability_directories: + type: array + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Directories that expose capabilities to the agent. + skills: + type: array + items: + $ref: '#/components/schemas/HostedTemplateSkillResource' + minItems: 0 + maxItems: 200 + description: Safe skill metadata, preserving unresolved version selectors. + plugins: + type: array + items: + $ref: '#/components/schemas/HostedPluginResource' + minItems: 0 + maxItems: 32 + description: Safe plugin metadata, excluding inline archive contents. + files: + type: array + items: + $ref: '#/components/schemas/HostedTemplateFileResource' + minItems: 0 + maxItems: 50 + description: Safe file metadata, excluding contents and session-scoped file IDs. required: - id + - name - object - - metadata - created_at - _MisalignmentErrorType: - anyOf: - - type: string - - type: string - enum: - - potentially_unintended_data_transfer - - potentially_unintended_data_access - - potentially_unintended_destructive_activity - - other - _MisalignmentSteer: - properties: - message: - type: string - description: The public continuation instruction. - type: object - required: - - message - MisalignmentErrorDetailsResource: - properties: - error_type: - $ref: '#/components/schemas/_MisalignmentErrorType' - description: An optional classification; clients must accept additional values. - detailed_explanation: - type: string - description: The public explanation for this block. - steer: - $ref: '#/components/schemas/_MisalignmentSteer' - description: An optional public continuation instruction. - type: object - required: [] - ImageGenOutputTokensDetails: - properties: - image_tokens: - type: integer - description: The number of image output tokens generated by the model. - text_tokens: - type: integer - description: The number of text output tokens generated by the model. - type: object - required: - - image_tokens - - text_tokens - title: Image generation output token details - description: The output token details for the image generation. - ImageGenInputUsageDetails: - properties: - text_tokens: - type: integer - description: The number of text tokens in the input prompt. - image_tokens: - type: integer - description: The number of image tokens in the input prompt. - type: object - required: - - text_tokens - - image_tokens - title: Input usage details - description: The input tokens detailed information for the image generation. - ImageGenUsage: - properties: - input_tokens: - type: integer - description: The number of tokens (images and text) in the input prompt. - total_tokens: - type: integer - description: The total number of tokens (images and text) used for the image generation. - output_tokens: - type: integer - description: The number of output tokens generated by the model. - output_tokens_details: - $ref: '#/components/schemas/ImageGenOutputTokensDetails' - input_tokens_details: - $ref: '#/components/schemas/ImageGenInputUsageDetails' - type: object - required: - - input_tokens - - total_tokens - - output_tokens - - input_tokens_details - title: Image generation usage - description: For `gpt-image-1` only, the token usage information for the image generation. - instructions: - anyOf: - - description: Frontend instructions for voice, conversation, interruptions, and when to delegate. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); put business rules and tool workflows in a separate [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). Limited to 16,384 client-supplied tokens. Omitted or blank instructions use server defaults. Immutable after startup. - type: string - - type: 'null' - LiveCustomVoiceParam: - type: object - properties: - id: - type: string - minLength: 1 - maxLength: 128 - required: - - id - LiveInitialSessionAudioOutputParam: - description: Settings for speech generated by the Live model. Choose the voice before starting the session. - type: object - properties: - voice: - description: The voice used for Live speech, as a built-in voice name or a custom voice object containing its ID. Defaults to `marin` and cannot change after startup. - anyOf: - - anyOf: - - type: string - - $ref: '#/components/schemas/LiveBuiltInVoice' - - $ref: '#/components/schemas/LiveCustomVoiceParam' - required: [] - LiveClientDelegationParam: - description: Delegate tasks to your application. The Live session emits delegation events that your backend handles. + - updated_at + - packages + - network + - capability_directories + - skills + - plugins + - files + additionalProperties: false + description: Reusable configuration that provisions a fresh OpenAI-hosted environment for each session. + EnvironmentTemplateListResource: type: object properties: - type: - description: The delegation owner. Always `client` for tasks handled by your application. - default: client - x-stainless-const: true + object: type: string enum: - - client + - list + default: list + x-stainless-const: true + description: The object type, which is always `list`. + data: + type: array + items: + $ref: '#/components/schemas/EnvironmentTemplateResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. required: - - type - LiveResponsesServiceTier: - type: string - enum: - - auto - - default - - fast_tier_temp_pilot - - flex - - priority - - ultrafast - LiveReasoningEffort: - type: string - enum: - - none - - minimal - - low - - medium - - high - - xhigh - LiveReasoningSummary: - type: string - enum: - - concise - - detailed - - auto - LiveDelegationReasoningInputParam: - description: Reasoning options for Responses requests made on behalf of the Live session. + - object + - data + - first_id + - last_id + - has_more + additionalProperties: false + description: A page of Agents API resources, with IDs for retrieving additional pages. + EnvironmentPackagesParam: type: object properties: - effort: - anyOf: - - description: How much reasoning effort the delegated Responses model should use. Supported values depend on the backend model. - $ref: '#/components/schemas/LiveReasoningEffort' - - type: 'null' - summary: - anyOf: - - description: The reasoning summary to request from the delegated Responses model, when supported. - $ref: '#/components/schemas/LiveReasoningSummary' - - type: 'null' - required: [] - LiveTextVerbosity: - type: string - enum: - - low - - medium - - high - LiveDelegationTextInputParam: - description: Text generation options for the Live session’s Responses backend. + python: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Python packages to install. Defaults to an empty list. + system: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: System packages to install. Defaults to an empty list. + npm: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: npm packages to install globally. Defaults to an empty list. + additionalProperties: false + description: Packages to install in an OpenAI-hosted environment. + SetupCommandParam: type: object properties: - verbosity: - anyOf: - - description: The amount of detail in text generated by the Responses backend. This does not configure the Live model’s spoken delivery. - $ref: '#/components/schemas/LiveTextVerbosity' - - type: 'null' - required: [] - LiveFunctionToolInputParam: - description: A function tool available to the Responses backend when the Live model delegates a task. + command: + type: string + minLength: 0 + maxLength: 65536 + description: The shell command to execute. + cwd: + type: + - string + - 'null' + minLength: 0 + maxLength: 4096 + description: The absolute working directory. Defaults to `/workspace`. + required: + - command + additionalProperties: false + description: A confidential setup command executed before the hosted agent starts. + NetworkAccessParam: + type: string + enum: + - enabled + - disabled + - restricted + x-enumDescriptions: + - Allows unrestricted network access, matching an omitted network policy. + - Disables network access. + - Allows access only to configured domains. + description: The network access mode for an OpenAI-hosted environment. + NetworkPolicyParam: + type: object + properties: + access: + $ref: '#/components/schemas/NetworkAccessParam' + description: The environment's network access mode. + allowed_domains: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Domains the environment may access when network access is restricted. + required: + - access + additionalProperties: false + description: Network access for an OpenAI-hosted environment. + HostedSkillParamSkillReference: type: object properties: type: - description: The tool type. Always `function`. - default: function - x-stainless-const: true type: string enum: - - function - name: - description: The name the delegated Responses model uses when calling this function. + - skill_reference + default: skill_reference + x-stainless-const: true + description: The type of the object. Always `skill_reference`. + skill_id: type: string - description: - anyOf: - - description: What the function does and when the delegated Responses model should call it. - type: string - - type: 'null' - parameters: - anyOf: - - description: A JSON Schema object describing the arguments accepted by the function. - type: object - additionalProperties: {} - - type: 'null' - strict: - anyOf: - - description: Whether the delegated Responses model must follow the function’s parameter schema exactly. - type: boolean - - type: 'null' + minLength: 1 + maxLength: 64 + description: The ID of the skill created through `/v1/skills`. + version: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The skill version, a positive integer or `latest`; omission selects the default. required: - type - - name - LiveWebSearchToolInputParam: - description: A web search tool available to the Live session’s Responses backend. + - skill_id + additionalProperties: false + description: References a skill uploaded through the Skills API. + InlineCapabilitySourceParamBase64: type: object properties: type: - description: The tool type. Always `web_search`. - default: web_search + type: string + enum: + - base64 + default: base64 x-stainless-const: true + description: The type of the object. Always `base64`. + media_type: type: string enum: - - web_search + - application/zip + default: application/zip + x-stainless-const: true + x-enumDescriptions: + - A ZIP archive. + description: The archive media type, always `application/zip`. + data: + type: string + minLength: 1 + maxLength: 70254592 + description: Standard-base64 encoded ZIP archive bytes. required: - type - LiveToolChoiceEnum: - type: string - enum: - - auto - - none - - required - LiveFunctionToolChoiceParam: + - media_type + - data + additionalProperties: false + description: Provides ZIP bytes encoded with standard base64. + InlineCapabilitySourceParam: + description: The encoded ZIP archive for an inline skill or plugin. + discriminator: + propertyName: type + mapping: + base64: '#/components/schemas/InlineCapabilitySourceParamBase64' + x-oai-discriminator-values: + - base64 + anyOf: + - $ref: '#/components/schemas/InlineCapabilitySourceParamBase64' + HostedSkillParamInline: type: object properties: type: - default: function - x-stainless-const: true type: string enum: - - function + - inline + default: inline + x-stainless-const: true + description: The type of the object. Always `inline`. name: type: string minLength: 1 maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ + description: The skill name declared in `SKILL.md`. + description: + type: string + minLength: 0 + maxLength: 1048576 + description: The skill description declared in `SKILL.md`. + source: + $ref: '#/components/schemas/InlineCapabilitySourceParam' + description: The inline ZIP archive. required: - type - name - LiveMCPToolChoiceParam: + - description + - source + additionalProperties: false + description: Supplies a skill ZIP directly in the session request. + HostedSkillParam: + description: A skill installed in an OpenAI-hosted environment. + discriminator: + propertyName: type + mapping: + skill_reference: '#/components/schemas/HostedSkillParamSkillReference' + inline: '#/components/schemas/HostedSkillParamInline' + x-oai-discriminator-values: + - skill_reference + - inline + anyOf: + - $ref: '#/components/schemas/HostedSkillParamSkillReference' + - $ref: '#/components/schemas/HostedSkillParamInline' + HostedPluginParamInline: type: object properties: type: - default: mcp - x-stainless-const: true type: string enum: - - mcp - server_label: - type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ + - inline + default: inline + x-stainless-const: true + description: The type of the object. Always `inline`. name: type: string minLength: 1 maxLength: 64 - pattern: ^[a-zA-Z0-9_-]+$ + description: The plugin name declared in `.codex-plugin/plugin.json`. + description: + type: string + minLength: 0 + maxLength: 1048576 + description: The plugin description declared in `.codex-plugin/plugin.json`. + source: + $ref: '#/components/schemas/InlineCapabilitySourceParam' + description: The inline ZIP archive. required: - type - - server_label - name - LiveResponsesDelegationSettingsInputParam: - description: Model, prompt, and tool settings for tasks delegated by the Live session to a Responses backend. + - description + - source + additionalProperties: false + description: Supplies a plugin ZIP directly in the session request. + HostedPluginParam: + description: A plugin installed in an OpenAI-hosted environment. + discriminator: + propertyName: type + mapping: + inline: '#/components/schemas/HostedPluginParamInline' + x-oai-discriminator-values: + - inline + anyOf: + - $ref: '#/components/schemas/HostedPluginParamInline' + CreateEnvironmentTemplateParams: type: object properties: - model: - description: The model used for server-owned Responses delegations. - type: string - instructions: - anyOf: - - description: Instructions for the delegated Responses model, separate from Live instructions. See [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). - type: string - - type: 'null' - max_output_tokens: - anyOf: - - description: Maximum number of output tokens for each delegated response. - type: integer - minimum: 16 - - type: 'null' - service_tier: + packages: anyOf: - - description: Service tier for delegated Responses requests. - $ref: '#/components/schemas/LiveResponsesServiceTier' + - $ref: '#/components/schemas/EnvironmentPackagesParam' - type: 'null' - reasoning: + description: Packages to install in the environment. Defaults to empty package lists. + setup_commands: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/SetupCommandParam' + minItems: 0 + maxItems: 16 + description: Ordered, confidential setup commands. Command bodies are never returned. + network: anyOf: - - description: Reasoning settings passed to each delegated Responses request. - $ref: '#/components/schemas/LiveDelegationReasoningInputParam' + - $ref: '#/components/schemas/NetworkPolicyParam' - type: 'null' - text: + description: Network access policy for the environment. Defaults to enabled. + env: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 1048576 + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Environment variables made available to the agent. + capability_directories: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Directories that contain capabilities exposed to the agent. Defaults to an empty list. + skills: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedSkillParam' + minItems: 0 + maxItems: 200 + description: Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list. + plugins: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedPluginParam' + minItems: 0 + maxItems: 32 + description: Plugins provided as inline ZIP archives. Defaults to an empty list. + files: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedEnvironmentFileParam' + minItems: 0 + maxItems: 50 + description: Files available before the agent starts. Defaults to an empty list. + name: + type: + - string + - 'null' + minLength: 1 + maxLength: 256 + description: An optional human-readable display name for the template. + additionalProperties: false + description: Parameters for creating a reusable, project-scoped OpenAI-hosted environment template. + UpdateEnvironmentTemplateParams: + type: object + properties: + name: + type: + - string + - 'null' + minLength: 1 + maxLength: 256 + description: A replacement human-readable display name, or `null` to clear the name. + packages: anyOf: - - description: Text generation settings passed to each delegated Responses request. - $ref: '#/components/schemas/LiveDelegationTextInputParam' + - $ref: '#/components/schemas/EnvironmentPackagesParam' - type: 'null' - tools: - description: Tools available to the Responses backend while it handles tasks delegated by the Live model. - type: array + description: Packages installed before the runtime network policy applies. + setup_commands: + type: + - array + - 'null' items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveFunctionToolInputParam' - - $ref: '#/components/schemas/LiveWebSearchToolInputParam' - tool_choice: - description: Controls which tool the Responses backend uses when handling a task delegated by the Live model. - anyOf: - - $ref: '#/components/schemas/LiveToolChoiceEnum' - - $ref: '#/components/schemas/LiveFunctionToolChoiceParam' - - $ref: '#/components/schemas/LiveMCPToolChoiceParam' - parallel_tool_calls: + $ref: '#/components/schemas/SetupCommandParam' + minItems: 0 + maxItems: 16 + description: Replacement confidential setup commands, never included in returned resources. + network: anyOf: - - description: Whether the delegated Responses model may request multiple tool calls in a single response. - type: boolean + - $ref: '#/components/schemas/NetworkPolicyParam' - type: 'null' + description: Network access available after setup completes. + env: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 1048576 + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Replacement confidential environment values. + capability_directories: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Directories that expose capabilities to the agent. + skills: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedSkillParam' + minItems: 0 + maxItems: 200 + description: Replacement skill configuration installed for each new session. + plugins: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedPluginParam' + minItems: 0 + maxItems: 32 + description: Replacement plugin configuration installed for each new session. + files: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedEnvironmentFileParam' + minItems: 0 + maxItems: 50 + description: Replacement file configuration materialized for each new session. + additionalProperties: false + description: Fields to replace on an existing reusable OpenAI-hosted environment template. + DeletedEnvironmentTemplateResource: + type: object + properties: + id: + type: string + minLength: 0 + description: The ID of the deleted environment template. + object: + type: string + enum: + - agent.environment.template.deleted + default: agent.environment.template.deleted + x-stainless-const: true + description: The object type. Always `agent.environment.template.deleted`. + deleted: + type: boolean + description: Whether the environment template was deleted. Always `true`. required: - - model - LiveResponsesDelegationParam: - description: Delegate tasks to a Responses model managed by the Live session. + - id + - object + - deleted + additionalProperties: false + description: A deleted reusable environment template. + SessionStatusResource: + type: string + enum: + - idle + - in_progress + - requires_action + - failed + x-enumDescriptions: + - The session has no turn in progress and is ready for input. A hosted environment may still be provisioning. + - The session is processing a turn. + - The session is waiting for one or more required actions. + - The session failed. + description: The current status of a session. + SessionRequiredActionResourceFunctionCall: type: object properties: type: - description: The delegation owner. Always `responses` for tasks handled by the Responses API. - default: responses + type: string + enum: + - function_call + default: function_call x-stainless-const: true + description: The type of the object. Always `function_call`. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that requested the function call. + call_id: + type: string + minLength: 0 + description: The ID to include when submitting the function result. + name: + type: string + minLength: 0 + description: The function name. + arguments: + description: The arguments supplied by the model. + required: + - type + - turn_id + - call_id + - name + - arguments + additionalProperties: false + description: Run a function tool and submit its result. + SessionRequiredActionResourceEnvironmentConnection: + type: object + properties: + type: type: string enum: - - responses - responses: - description: Backend model, prompt, and tools used when the Live session delegates a task to Responses. - $ref: '#/components/schemas/LiveResponsesDelegationSettingsInputParam' + - environment_connection + default: environment_connection + x-stainless-const: true + description: The type of the object. Always `environment_connection`. + environment_id: + type: string + minLength: 0 + description: The ID of the environment to reconnect. required: - type - - responses - delegation: + - environment_id + additionalProperties: false + description: Reconnect a session environment. + SessionRequiredActionResource: + description: An action that must be completed before a session can continue. + discriminator: + propertyName: type + mapping: + function_call: '#/components/schemas/SessionRequiredActionResourceFunctionCall' + environment_connection: '#/components/schemas/SessionRequiredActionResourceEnvironmentConnection' + x-oai-discriminator-values: + - function_call + - environment_connection anyOf: - - description: Who handles tasks delegated by the Live model. Omitted or null selects your application; use `responses` to let the API manage a Responses backend. - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveClientDelegationParam' - - $ref: '#/components/schemas/LiveResponsesDelegationParam' - - type: 'null' - store: - description: Whether to store the session for later forking and recording download. Defaults to false for new sessions. - type: boolean - LiveInitialMessageStatus: - type: string - enum: - - incomplete - - completed - LiveInitialInputTextContentPartParam: - description: Text supplied in a developer or user message when starting a Live session. + - $ref: '#/components/schemas/SessionRequiredActionResourceFunctionCall' + - $ref: '#/components/schemas/SessionRequiredActionResourceEnvironmentConnection' + AgentToolResourceFunction: type: object properties: type: - description: The text content type. Always `input_text`. - default: input_text - x-stainless-const: true type: string enum: - - input_text - text: - description: The message text to include in the Live session’s initial conversation history. + - function + default: function + x-stainless-const: true + description: The type of the object. Always `function`. + name: + type: string + minLength: 0 + description: The name of the function. + description: type: string + minLength: 0 + description: A description of what the function does. + parameters: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: A JSON Schema object describing the function's arguments. + defer_loading: + type: boolean + description: Whether the function is deferred and discovered through tool search. required: - - text - LiveInitialDeveloperMessageItemParam: - description: A developer message included in the initial text history of a Live session. + - type + - name + - description + - parameters + - defer_loading + additionalProperties: false + description: A function defined by the application. + AgentToolResourceProgrammaticToolCalling: type: object properties: - id: - anyOf: - - description: An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation. - type: string - - type: 'null' type: - description: The history item type. Always `message`. - default: message + type: string + enum: + - programmatic_tool_calling + default: programmatic_tool_calling x-stainless-const: true + description: The type of the object. Always `programmatic_tool_calling`. + enabled: + type: boolean + description: Whether tools can be called from model-generated code. + required: + - type + - enabled + additionalProperties: false + description: Enables calling tools from model-generated code. + McpTransportResourceHttp: + type: object + properties: + type: type: string enum: - - message - status: - anyOf: - - description: The supplied message’s status. Live uses its text as history and does not resume an incomplete message. - $ref: '#/components/schemas/LiveInitialMessageStatus' - - type: 'null' - role: - description: The author of this history message. Always `developer`. - default: developer + - http + default: http x-stainless-const: true + description: The type of the object. Always `http`. + server_url: + type: string + minLength: 0 + description: The URL of the MCP server. + required: + - type + - server_url + additionalProperties: false + description: Connects to an MCP server over HTTP. + McpTransportResourceStdio: + type: object + properties: + type: type: string enum: - - developer - content: - description: The message content. Supply exactly one text part for the initial Live conversation history. + - stdio + default: stdio + x-stainless-const: true + description: The type of the object. Always `stdio`. + command: + type: string + minLength: 0 + description: The command used to start the MCP server. + args: type: array items: - $ref: '#/components/schemas/LiveInitialInputTextContentPartParam' - minItems: 1 - maxItems: 1 + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Arguments passed to the MCP server command. + cwd: + type: string + minLength: 0 + description: The working directory used to start the MCP server. + env_vars: + type: array + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Environment variable names inherited from the execution environment. required: - - role - - content - LiveInitialUserMessageItemParam: - description: A user message included in the initial text history of a Live session. + - type + - command + - args + - cwd + - env_vars + additionalProperties: false + description: Starts an MCP server as a local process. + McpTransportResource: + description: The transport used to connect to an MCP server. + discriminator: + propertyName: type + mapping: + http: '#/components/schemas/McpTransportResourceHttp' + stdio: '#/components/schemas/McpTransportResourceStdio' + x-oai-discriminator-values: + - http + - stdio + anyOf: + - $ref: '#/components/schemas/McpTransportResourceHttp' + - $ref: '#/components/schemas/McpTransportResourceStdio' + AgentToolResourceMcp: type: object properties: - id: - anyOf: - - description: An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation. - type: string - - type: 'null' type: - description: The history item type. Always `message`. - default: message - x-stainless-const: true type: string enum: - - message - status: - anyOf: - - description: The supplied message’s status. Live uses its text as history and does not resume an incomplete message. - $ref: '#/components/schemas/LiveInitialMessageStatus' - - type: 'null' - role: - description: The author of this history message. Always `user`. - default: user + - mcp + default: mcp x-stainless-const: true + description: The type of the object. Always `mcp`. + server_label: type: string - enum: - - user - content: - description: The message content. Supply exactly one text part for the initial Live conversation history. - type: array + minLength: 0 + description: A label used to identify the MCP server in tool calls. + credential_id: + type: + - string + - 'null' + minLength: 0 + description: The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL. + transport: + $ref: '#/components/schemas/McpTransportResource' + description: The transport used to connect to the MCP server. + request_metadata: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: Metadata included with requests to this MCP server. + allowed_tools: + type: + - array + - 'null' items: - $ref: '#/components/schemas/LiveInitialInputTextContentPartParam' - minItems: 1 - maxItems: 1 + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: The MCP tools the agent may call. + required: + type: boolean + description: Whether this MCP server must initialize before the first turn. + connection_origin: + $ref: '#/components/schemas/McpConnectionOriginResource' + description: Where outbound MCP HTTP connections originate. required: - - role - - content - LiveInitialTextContentPartParam: - description: Assistant text supplied as conversation history when starting a Live session. + - type + - server_label + - credential_id + - transport + - request_metadata + - allowed_tools + - required + - connection_origin + additionalProperties: false + description: Tools provided by a remote MCP server. + AgentToolResourceWebSearch: type: object properties: type: - description: The text content type. Always `text`. - default: text - x-stainless-const: true type: string enum: - - text - text: - description: The message text to include in the Live session’s initial conversation history. + - web_search + default: web_search + x-stainless-const: true + description: The type of the object. Always `web_search`. + mode: + $ref: '#/components/schemas/WebSearchModeResource' + description: The source used for web search results. + context_size: + $ref: '#/components/schemas/WebSearchContextSizeResource' + description: The amount of search context made available to the model. Defaults to `medium`. + allowed_domains: + type: + - array + - 'null' + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Allowed search domains, or `null` when the search is unrestricted. + location: + anyOf: + - $ref: '#/components/schemas/WebSearchLocationResource' + - type: 'null' + description: Approximate location used to localize search results, if provided. + required: + - type + - mode + - context_size + - allowed_domains + - location + additionalProperties: false + description: Web search. + AgentToolResource: + description: A tool available to the agent. + discriminator: + propertyName: type + mapping: + function: '#/components/schemas/AgentToolResourceFunction' + programmatic_tool_calling: '#/components/schemas/AgentToolResourceProgrammaticToolCalling' + mcp: '#/components/schemas/AgentToolResourceMcp' + web_search: '#/components/schemas/AgentToolResourceWebSearch' + x-oai-discriminator-values: + - function + - programmatic_tool_calling + - mcp + - web_search + anyOf: + - $ref: '#/components/schemas/AgentToolResourceFunction' + - $ref: '#/components/schemas/AgentToolResourceProgrammaticToolCalling' + - $ref: '#/components/schemas/AgentToolResourceMcp' + - $ref: '#/components/schemas/AgentToolResourceWebSearch' + SessionAgentResource: + type: object + properties: + id: + type: string + minLength: 0 + description: The ID of the agent. + name: + type: + - string + - 'null' + minLength: 0 + description: The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value. + model: type: string + minLength: 0 + description: The model used by the agent. + reasoning: + $ref: '#/components/schemas/ReasoningResource' + description: The agent's reasoning configuration. + text: + $ref: '#/components/schemas/TextResource' + description: Configuration for text generated by the agent. + service_tier: + $ref: '#/components/schemas/ServiceTierResource' + description: The effective service-tier policy for model requests. Defaults to `auto`. + instructions: + type: + - string + - 'null' + minLength: 0 + description: Custom instructions appended to the agent's default base instructions. + tools: + type: array + items: + $ref: '#/components/schemas/AgentToolResource' + minItems: 0 + maxItems: 2000 + description: Tools available to the agent. + multi_agent: + $ref: '#/components/schemas/MultiAgentConfigResource' + description: Configuration for creating and coordinating subagents. required: + - id + - name + - model + - reasoning - text - LiveInitialOutputTextContentPartParam: - description: Assistant output text supplied as conversation history when starting a Live session. + - service_tier + - instructions + - tools + - multi_agent + additionalProperties: false + description: The effective agent configuration for a session. + EnvironmentResourceNone: type: object properties: type: - description: The text content type. Always `output_text`. - default: output_text - x-stainless-const: true type: string enum: - - output_text - text: - description: The message text to include in the Live session’s initial conversation history. - type: string + - none + default: none + x-stainless-const: true + description: The type of the object. Always `none`. required: - type - - text - LiveInitialAssistantMessageItemParam: - description: An assistant message included in the initial text history of a Live session. + additionalProperties: false + description: The session talks to CCA without selecting or provisioning an execution environment. + EnvironmentResourceOpenaiHosted: type: object properties: - id: - anyOf: - - description: An optional identifier for the supplied history message. Live uses the message’s role and text to initialize the conversation. - type: string - - type: 'null' type: - description: The history item type. Always `message`. - default: message - x-stainless-const: true type: string enum: - - message - status: - anyOf: - - description: The supplied message’s status. Live uses its text as history and does not resume an incomplete message. - $ref: '#/components/schemas/LiveInitialMessageStatus' - - type: 'null' - role: - description: The author of this history message. Always `assistant`. - default: assistant + - openai_hosted + default: openai_hosted x-stainless-const: true + description: The type of the object. Always `openai_hosted`. + id: type: string - enum: - - assistant - content: - description: The message content. Supply exactly one text part for the initial Live conversation history. + minLength: 0 + description: The public ID of the environment. + packages: + $ref: '#/components/schemas/EnvironmentPackagesResource' + description: Packages installed in the environment. + network: + $ref: '#/components/schemas/NetworkPolicyResource' + description: The effective network access policy for the environment. + capability_directories: type: array items: - discriminator: - propertyName: type - x-oai-default-discriminator-value: text - anyOf: - - $ref: '#/components/schemas/LiveInitialTextContentPartParam' - - $ref: '#/components/schemas/LiveInitialOutputTextContentPartParam' - minItems: 1 - maxItems: 1 + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Directories that contain capabilities exposed to the agent. + skills: + type: array + items: + $ref: '#/components/schemas/HostedSkillResource' + minItems: 0 + maxItems: 2000 + description: Skills installed in the environment, excluding their archive contents. + plugins: + type: array + items: + $ref: '#/components/schemas/HostedPluginResource' + minItems: 0 + maxItems: 2000 + description: Plugins installed in the environment, excluding their archive contents. + files: + type: array + items: + $ref: '#/components/schemas/HostedEnvironmentFileResource' + minItems: 0 + maxItems: 50 + description: Files available in the environment, excluding their contents. required: - - role - - content - LiveInitialItem: - description: A developer, user, or assistant message supplied as text history before the Live session starts. - discriminator: - propertyName: role - anyOf: - - $ref: '#/components/schemas/LiveInitialDeveloperMessageItemParam' - - $ref: '#/components/schemas/LiveInitialUserMessageItemParam' - - $ref: '#/components/schemas/LiveInitialAssistantMessageItemParam' - input: - description: Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and 8,192 rendered tokens in total. - type: array - items: - $ref: '#/components/schemas/LiveInitialItem' - maxItems: 128 - LiveAllowedServerEventParam: - description: A Live server event selector for the WebRTC frontend data channel. - example: - type: session.started + - type + - id + - packages + - network + - capability_directories + - skills + - plugins + - files + additionalProperties: false + description: An environment hosted by OpenAI. + EnvironmentResourceSelfHosted: type: object properties: type: - description: The outer Live server event type. Use 'response.event' for Responses events. type: string - minLength: 1 - maxLength: 256 - response_event: - description: The nested Responses event type. Required when type is 'response.event'; forbidden for other event types. + enum: + - self_hosted + default: self_hosted + x-stainless-const: true + description: The type of the object. Always `self_hosted`. + remote_url: type: string - minLength: 1 - maxLength: 256 + minLength: 0 + description: Pass this URL unchanged to `codex exec-server --remote` when connecting this environment. + id: + type: string + minLength: 0 + description: The public ID of the environment. + workspace_directory: + type: string + minLength: 0 + description: The absolute project directory inside the environment. Defaults to `/workspace`. + capability_directories: + type: array + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: Directories that contain capabilities exposed to the agent. required: - type + - remote_url + - id + - workspace_directory + - capability_directories additionalProperties: false - x-oaiMeta: - example: - type: session.started - LiveDataChannelConfigParam: - description: Control which Live events an untrusted WebRTC frontend can send and receive over its data channel. These restrictions do not apply to trusted sideband connections. + description: An environment hosted by the application. + EnvironmentResource: + description: The execution environment for a session. + discriminator: + propertyName: type + mapping: + none: '#/components/schemas/EnvironmentResourceNone' + openai_hosted: '#/components/schemas/EnvironmentResourceOpenaiHosted' + self_hosted: '#/components/schemas/EnvironmentResourceSelfHosted' + x-oai-discriminator-values: + - none + - openai_hosted + - self_hosted + anyOf: + - $ref: '#/components/schemas/EnvironmentResourceNone' + - $ref: '#/components/schemas/EnvironmentResourceOpenaiHosted' + - $ref: '#/components/schemas/EnvironmentResourceSelfHosted' + SessionResource: type: object properties: - allowed_client_events: - description: Client event types that the frontend data channel may send. Use 'all' to allow every client event; an empty array allows none. Omission preserves the existing allow-all behavior. - anyOf: - - default: all - x-stainless-const: true + metadata: + type: object + additionalProperties: type: string - enum: - - all - - type: array - items: - description: A Live client event type allowed on the frontend data channel, such as `session.input_audio.mute`. - type: string - minLength: 1 - maxLength: 256 - pattern: ^(?:error|info|[a-z][a-z0-9_-]*(?:\.[a-z0-9_-]+)+)$ - maxItems: 256 - allowed_server_events: - description: Server events that may be sent to the frontend data channel. Use 'all' to allow every server event; an empty array allows none. Omission preserves the existing allow-all behavior. Responses events use an object with type 'response.event' and a response_event selector. - anyOf: - - default: all - x-stainless-const: true + minLength: 0 + propertyNames: type: string - enum: - - all - - type: array - items: - $ref: '#/components/schemas/LiveAllowedServerEventParam' - maxItems: 256 - x-stainless-variantName: event_selectors - required: [] - LiveClientConfigParam: - description: Startup-only capabilities for an untrusted frontend attached to a unified WebRTC session. Trusted sideband connections are unaffected. - type: object - properties: - data_channel: - description: Client and server event permissions for the WebRTC frontend data channel. - $ref: '#/components/schemas/LiveDataChannelConfigParam' - required: - - data_channel - properties-store: - description: Whether to store the forked session. Omission inherits the stored session's setting. - type: boolean - LiveResponsesDelegationSettingsUpdateInputParam: - description: Updates to the Responses backend of an existing Live session. Omitted settings retain their current values. - type: object - properties: - model: - description: The Responses backend model to use for subsequent delegated requests. Omit to keep the current backend model. + minLength: 0 + minProperties: 0 + description: Custom string key-value pairs attached to the session. + id: type: string - instructions: - anyOf: - - description: Instructions for the delegated Responses model, separate from Live instructions. See [backend prompting](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). - type: string - - type: 'null' - max_output_tokens: - anyOf: - - description: Maximum number of output tokens for each delegated response. - type: integer - minimum: 16 - - type: 'null' - service_tier: - anyOf: - - description: Service tier for delegated Responses requests. - $ref: '#/components/schemas/LiveResponsesServiceTier' - - type: 'null' - reasoning: - anyOf: - - description: Reasoning settings passed to each delegated Responses request. - $ref: '#/components/schemas/LiveDelegationReasoningInputParam' - - type: 'null' - text: - anyOf: - - description: Text generation settings passed to each delegated Responses request. - $ref: '#/components/schemas/LiveDelegationTextInputParam' - - type: 'null' - tools: - description: Tools available to the Responses backend while it handles tasks delegated by the Live model. + minLength: 0 + description: The ID of the session. + object: + type: string + enum: + - agent.session + default: agent.session + x-stainless-const: true + description: The object type. Always `agent.session`. + created_at: + type: integer + format: int64 + description: The Unix timestamp, in seconds, when the session was created. + last_active_at: + type: integer + format: int64 + description: The Unix timestamp, in seconds, when the session was last active. + status: + $ref: '#/components/schemas/SessionStatusResource' + description: The current status of the session. + required_actions: type: array items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/LiveFunctionToolInputParam' - - $ref: '#/components/schemas/LiveWebSearchToolInputParam' - tool_choice: - description: Controls which tool the Responses backend uses when handling a task delegated by the Live model. - anyOf: - - $ref: '#/components/schemas/LiveToolChoiceEnum' - - $ref: '#/components/schemas/LiveFunctionToolChoiceParam' - - $ref: '#/components/schemas/LiveMCPToolChoiceParam' - parallel_tool_calls: + $ref: '#/components/schemas/SessionRequiredActionResource' + minItems: 0 + maxItems: 2000 + description: Actions that must be completed before the session can continue. + error: + type: + - string + - 'null' + minLength: 0 + description: The error that caused the session to fail, if any. + agent: + $ref: '#/components/schemas/SessionAgentResource' + description: The agent running in the session. + environment: + $ref: '#/components/schemas/EnvironmentResource' + description: The execution environment for the session. + vault_ids: + type: array + items: + type: string + minLength: 0 + minItems: 0 + maxItems: 2000 + description: The IDs of vaults made available to the session. + usage: anyOf: - - description: Whether the delegated Responses model may request multiple tool calls in a single response. - type: boolean + - $ref: '#/components/schemas/TokenUsageResource' - type: 'null' - required: [] - LiveResponsesDelegationUpdateParam: - description: Update the Responses backend for an existing Live session without changing delegation ownership. + description: Best-effort token usage for the session, or null if unknown. Recorded usage may change. + required: + - metadata + - id + - object + - created_at + - last_active_at + - status + - required_actions + - error + - agent + - environment + - vault_ids + - usage + additionalProperties: false + description: A Managed Agents session. + SessionListResource: type: object properties: - type: - description: The delegation owner. Always `responses` for tasks handled by the Responses API. - default: responses - x-stainless-const: true + object: type: string enum: - - responses - responses: - description: Responses backend settings to update. Omitted settings keep their existing values. - $ref: '#/components/schemas/LiveResponsesDelegationSettingsUpdateInputParam' + - list + default: list + x-stainless-const: true + description: The object type, which is always `list`. + data: + type: array + items: + $ref: '#/components/schemas/SessionResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. required: - - type - target_uri: - type: string - description: |- - URI that should appear in the SIP Refer-To header. Supports values like - `tel:+14155550123` or `sip:agent@example.com`. - example: tel:+14155550123 - PublicProjectResidency: - type: string - enum: - - GLOBAL - - US_STORAGE_PROCESSING - - EU_STORAGE_PROCESSING - - JP_STORAGE - - KR_STORAGE - - CA_STORAGE - - SG_STORAGE - - IN_STORAGE - - AU_STORAGE - - GB_STORAGE - - AE_STORAGE - - AE_STORAGE_PROCESSING - SpecificProgrammaticToolCallingParam: + - object + - data + - first_id + - last_id + - has_more + additionalProperties: false + description: A page of Agents API resources, with IDs for retrieving additional pages. + AgentToolConfigParamFunction: + type: object properties: type: type: string enum: - - programmatic_tool_calling - description: The tool to call. Always `programmatic_tool_calling`. - default: programmatic_tool_calling + - function + default: function x-stainless-const: true - type: object + description: The type of the object. Always `function`. + name: + type: string + minLength: 0 + maxLength: 1048576 + description: The name of the function. + description: + type: string + minLength: 0 + maxLength: 1048576 + description: A description of what the function does. + parameters: + type: object + additionalProperties: {} + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: A JSON Schema object describing the function's arguments. + defer_loading: + type: boolean + default: false + description: Whether this function is deferred and discovered through tool search. Defaults to `false`. required: - type - SpecificApplyPatchParam: + - name + - description + - parameters + additionalProperties: false + description: A function defined by the application. + AgentToolConfigParamToolSearch: + type: object properties: type: type: string enum: - - apply_patch - description: The tool to call. Always `apply_patch`. - default: apply_patch + - tool_search + default: tool_search x-stainless-const: true - type: object + description: The type of the object. Always `tool_search`. required: - type - title: Specific apply patch tool choice - description: Forces the model to call the apply_patch tool when executing a tool call. - SpecificFunctionShellParam: + additionalProperties: false + description: Discovers deferred function tools and loads them into the model context. + AgentToolConfigParamProgrammaticToolCalling: + type: object properties: type: type: string enum: - - shell - description: The tool to call. Always `shell`. - default: shell + - programmatic_tool_calling + default: programmatic_tool_calling x-stainless-const: true - type: object + description: The type of the object. Always `programmatic_tool_calling`. + enabled: + type: boolean + default: true + description: Whether tools can be called from model-generated code. Defaults to `true`. required: - type - title: Specific shell tool choice - description: Forces the model to call the shell tool when a tool call is required. - ResponsePromptCacheOptionsParam: - properties: - ttl: - $ref: '#/components/schemas/PromptCacheTTLEnum' - description: The minimum lifetime applied to every implicit and explicit cache breakpoint written by the request. Defaults to `30m`, which is currently the only supported value. The backend may retain cache entries for longer. - mode: - $ref: '#/components/schemas/PromptCacheModeEnum' - description: Controls whether OpenAI automatically creates an implicit cache breakpoint. Defaults to `implicit`. With `implicit`, OpenAI creates one implicit breakpoint and writes up to the latest three explicit breakpoints in the request. With `explicit`, OpenAI does not create an implicit breakpoint and writes up to the latest four explicit breakpoints. If there are no explicit breakpoints, the request does not use prompt caching. - comparison_response_id: - anyOf: - - type: string - description: The ID of a response to compare when diagnosing prompt cache reuse. Supplying this field requests prompt cache diagnostics when the feature is enabled. - example: resp_123 - - type: 'null' - type: object - required: [] - title: Prompt cache options - description: Options for prompt caching. Supported for `gpt-5.6` and later models. By default, OpenAI automatically chooses one implicit cache breakpoint. You can add explicit breakpoints to content blocks with `prompt_cache_breakpoint`. Each request can write up to four breakpoints. For cache matching, OpenAI considers up to the latest 80 breakpoints in the conversation, without a content-block lookback limit. Set `mode` to `explicit` to disable the implicit breakpoint. The `ttl` defaults to `30m`, which is currently the only supported value. See the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching) for current details. - ReasoningModeEnum: - anyOf: - - type: string - - type: string - enum: - - standard - - pro - ConversationParam-2: - properties: - id: - type: string - description: The unique ID of the conversation. - example: conv_123 + additionalProperties: false + description: Enables calling tools from model-generated code. + McpTransportConfigParamHttp: type: object - required: - - id - title: Conversation object - description: The conversation that this response belongs to. - ContextManagementParam: properties: type: type: string - description: The context management entry type. Currently only 'compaction' is supported. - compact_threshold: - anyOf: - - type: integer - minimum: 1000 - description: Token threshold at which compaction should be triggered for this entry. - - type: 'null' - type: object + enum: + - http + default: http + x-stainless-const: true + description: The type of the object. Always `http`. + server_url: + type: string + minLength: 0 + maxLength: 1048576 + description: The URL of the MCP server. + authorization: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The authorization value sent to the MCP server, if any. + headers: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 1048576 + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Additional HTTP headers sent to the MCP server. required: - type - PromptCacheOptions: - properties: - ttl: - $ref: '#/components/schemas/PromptCacheTTLEnum' - description: The minimum lifetime applied to each cache breakpoint. - mode: - $ref: '#/components/schemas/PromptCacheModeEnum' - description: Whether implicit prompt-cache breakpoints were enabled. - comparison_response_id: - anyOf: - - type: string - description: The response ID supplied as the prompt cache diagnostics comparison. - - type: 'null' + - server_url + additionalProperties: false + description: Connects to an MCP server over HTTP. + McpTransportConfigParamStdio: type: object - required: - - ttl - - mode - title: Prompt cache options - description: The prompt-caching options that were applied to the response. Supported for `gpt-5.6` and later models. - CacheMissReasonTypeEnum: - type: string - enum: - - model_changed - - prompt_cache_key_changed - - tools_changed - - text_format_changed - - reasoning_effort_changed - - verbosity_changed - - context_compacted - - input_changed - - service_tier_changed - PromptCacheMissDiagnosticsBody: properties: type: type: string enum: - - cache_miss - default: cache_miss + - stdio + default: stdio x-stainless-const: true - reason: - $ref: '#/components/schemas/CacheMissReasonTypeEnum' - description: The reason prompt cache reuse did not occur. - cache_missed_tokens: - type: integer - description: The estimated number of input tokens affected after the first detected divergence. - comparison_reusable_tokens: - type: integer - description: The raw token count of the reusable prefix in the compared response. - type: object + description: The type of the object. Always `stdio`. + command: + type: string + minLength: 0 + maxLength: 1048576 + description: The command used to start the MCP server. + args: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Arguments passed to the MCP server command. + cwd: + type: string + minLength: 0 + maxLength: 1048576 + description: The working directory used to start the MCP server. + env: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 1048576 + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Environment variables set for the MCP server process. + env_vars: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Environment variable names to inherit from the selected execution environment. required: - type - - reason - - cache_missed_tokens - PromptCacheHitDiagnosticsBody: + - command + - cwd + additionalProperties: false + description: Starts an MCP server as a local process. + McpTransportConfigParam: + description: The transport used to connect to an MCP server. + discriminator: + propertyName: type + mapping: + http: '#/components/schemas/McpTransportConfigParamHttp' + stdio: '#/components/schemas/McpTransportConfigParamStdio' + x-oai-discriminator-values: + - http + - stdio + anyOf: + - $ref: '#/components/schemas/McpTransportConfigParamHttp' + - $ref: '#/components/schemas/McpTransportConfigParamStdio' + AgentToolConfigParamMcp: + type: object properties: type: type: string enum: - - cache_hit - default: cache_hit + - mcp + default: mcp x-stainless-const: true - type: object + description: The type of the object. Always `mcp`. + server_label: + type: string + minLength: 0 + maxLength: 1048576 + description: A label used to identify the MCP server in tool calls. + credential_id: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL. + transport: + $ref: '#/components/schemas/McpTransportConfigParam' + description: The transport used to connect to the MCP server. + request_metadata: + type: + - object + - 'null' + additionalProperties: {} + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Metadata included with requests to this MCP server. + allowed_tools: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: The MCP tools the agent may call. All server tools are allowed when omitted. + required: + type: boolean + default: false + description: Whether this MCP server must initialize before the first turn. Defaults to `false`. + connection_origin: + anyOf: + - $ref: '#/components/schemas/McpConnectionOriginParam' + - type: 'null' + description: Selects where outbound MCP HTTP connections originate. Omitted or `service` uses the Managed Agents service network; `environment` uses the session's selected environment. required: - type - PromptCacheComparisonResponseNotFoundDiagnosticsBody: + - server_label + - transport + additionalProperties: false + description: Tools provided by a remote MCP server. + AgentToolConfigParamWebSearch: + type: object properties: type: type: string enum: - - comparison_response_not_found - default: comparison_response_not_found + - web_search + default: web_search x-stainless-const: true - type: object + description: The type of the object. Always `web_search`. + mode: + anyOf: + - $ref: '#/components/schemas/WebSearchModeParam' + - type: 'null' + description: The source used for web search results. Defaults to `live`. + context_size: + anyOf: + - $ref: '#/components/schemas/WebSearchContextSizeParam' + - type: 'null' + description: The amount of search context made available to the model. Defaults to `medium`. + allowed_domains: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Domains the search may include. + location: + anyOf: + - $ref: '#/components/schemas/WebSearchLocationParam' + - type: 'null' + description: Approximate location used to localize search results. required: - type - PromptCacheUnavailableDiagnosticsBody: + additionalProperties: false + description: Web search. + AgentToolConfigParam: + description: A tool available to the agent. + discriminator: + propertyName: type + mapping: + function: '#/components/schemas/AgentToolConfigParamFunction' + tool_search: '#/components/schemas/AgentToolConfigParamToolSearch' + programmatic_tool_calling: '#/components/schemas/AgentToolConfigParamProgrammaticToolCalling' + mcp: '#/components/schemas/AgentToolConfigParamMcp' + web_search: '#/components/schemas/AgentToolConfigParamWebSearch' + x-oai-discriminator-values: + - function + - tool_search + - programmatic_tool_calling + - mcp + - web_search + anyOf: + - $ref: '#/components/schemas/AgentToolConfigParamFunction' + - $ref: '#/components/schemas/AgentToolConfigParamToolSearch' + - $ref: '#/components/schemas/AgentToolConfigParamProgrammaticToolCalling' + - $ref: '#/components/schemas/AgentToolConfigParamMcp' + - $ref: '#/components/schemas/AgentToolConfigParamWebSearch' + SessionAgentConfigParam: + type: object + properties: + model: + type: string + minLength: 0 + maxLength: 1048576 + description: The model to use for the agent. The requested model name is preserved. + reasoning: + anyOf: + - $ref: '#/components/schemas/ReasoningParam' + - type: 'null' + description: Configuration for model reasoning. Omit to keep the current settings; pass `null` to reset to the model's default effort. + text: + anyOf: + - $ref: '#/components/schemas/TextParam' + - type: 'null' + description: Configuration for text generated by the agent. + service_tier: + anyOf: + - $ref: '#/components/schemas/ServiceTierParam' + - type: 'null' + description: The service tier used for model requests. + instructions: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: Additional instructions appended to the agent's default base instructions. Omit to leave unchanged. + multi_agent: + anyOf: + - $ref: '#/components/schemas/MultiAgentConfigCurrentParam' + - type: 'null' + description: Configuration for creating and coordinating subagents. + tools: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/AgentToolConfigParam' + minItems: 0 + maxItems: 16384 + description: Tools available to the agent. Omit to inherit, or pass null to clear them. + additionalProperties: false + description: Agent configuration for a session. Omitted fields inherit from `agent_id` when supplied. Supplied objects and arrays replace the whole field; null resets nullable fields. + EnvironmentParamNone: + type: object properties: type: type: string enum: - - unavailable - default: unavailable + - none + default: none x-stainless-const: true - type: object + description: The type of the object. Always `none`. required: - type - PromptCacheDiagnostics: - discriminator: - propertyName: type - description: Prompt cache diagnostics requested for this response. - anyOf: - - $ref: '#/components/schemas/PromptCacheMissDiagnosticsBody' - - $ref: '#/components/schemas/PromptCacheHitDiagnosticsBody' - - $ref: '#/components/schemas/PromptCacheComparisonResponseNotFoundDiagnosticsBody' - - $ref: '#/components/schemas/PromptCacheUnavailableDiagnosticsBody' - ModerationErrorBody: + additionalProperties: false + description: Runs the agent without an execution environment. + EnvironmentParamOpenaiHosted: + type: object properties: type: type: string enum: - - error - description: The object type, which was always `error` for moderation failures. - default: error + - openai_hosted + default: openai_hosted x-stainless-const: true - code: - type: string - description: The error code. - message: - type: string - description: The error message. - type: object - required: - - type - - code - - message - title: Moderation error - description: An error produced while attempting moderation for the response input or output. - Moderation: - properties: - input: - discriminator: - propertyName: type - description: Moderation for the response input. + description: The type of the object. Always `openai_hosted`. + packages: anyOf: - - $ref: '#/components/schemas/ModerationResultBody' - - $ref: '#/components/schemas/ModerationErrorBody' - output: - discriminator: - propertyName: type - description: Moderation for the response output. + - $ref: '#/components/schemas/EnvironmentPackagesParam' + - type: 'null' + description: Packages to install in the environment. Defaults to empty package lists. + setup_commands: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/SetupCommandParam' + minItems: 0 + maxItems: 16 + description: Ordered, confidential setup commands. Command bodies are never returned. + network: anyOf: - - $ref: '#/components/schemas/ModerationResultBody' - - $ref: '#/components/schemas/ModerationErrorBody' - type: object - required: - - input - - output - title: Moderation - description: Moderation results or errors for the response input and output. - ResponseConversation: - properties: - id: + - $ref: '#/components/schemas/NetworkPolicyParam' + - type: 'null' + description: Network access policy for the environment. Defaults to enabled. + env: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 1048576 + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Environment variables made available to the agent. + capability_directories: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Directories that contain capabilities exposed to the agent. Defaults to an empty list. + skills: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedSkillParam' + minItems: 0 + maxItems: 200 + description: Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list. + plugins: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedPluginParam' + minItems: 0 + maxItems: 32 + description: Plugins provided as inline ZIP archives. Defaults to an empty list. + files: + type: + - array + - 'null' + items: + $ref: '#/components/schemas/HostedEnvironmentFileParam' + minItems: 0 + maxItems: 50 + description: Files available before the agent starts. Defaults to an empty list. + environment_template_id: type: string - description: The unique ID of the conversation that this response was associated with. - type: object + minLength: 0 + maxLength: 64 + description: A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy. required: - - id - title: Conversation - description: The conversation that this response belonged to. Input items and output items from this response were automatically added to this conversation. - ResponseShellCallCommandAddedStreamingEvent: + - type + additionalProperties: false + description: An OpenAI-hosted environment, optionally based on a reusable template. + EnvironmentParamSelfHosted: + type: object properties: type: type: string enum: - - response.shell_call_command.added - description: The type of the event, always `response.shell_call_command.added`. - default: response.shell_call_command.added + - self_hosted + default: self_hosted x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of the event that was emitted. - output_index: - type: integer - description: The index of the output item that was updated. - command_index: - type: integer - description: The index of the shell command that was added. - command: + description: The type of the object. Always `self_hosted`. + workspace_directory: type: string - description: The shell command that was added. - type: object + minLength: 0 + maxLength: 1048576 + description: Absolute project directory inside the self-hosted environment. + capability_directories: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: Directories that contain capabilities exposed to the agent. Defaults to an empty list. required: - type - - sequence_number - - output_index - - command_index - - command - title: Response shell command added event - description: A streaming event that indicated a shell command was added to a tool call. - ResponseShellCallCommandDeltaStreamingEvent: + - workspace_directory + additionalProperties: false + description: An application-hosted environment configured inline. + EnvironmentParam: + description: The execution environment and optional reusable template for a session. + discriminator: + propertyName: type + mapping: + none: '#/components/schemas/EnvironmentParamNone' + openai_hosted: '#/components/schemas/EnvironmentParamOpenaiHosted' + self_hosted: '#/components/schemas/EnvironmentParamSelfHosted' + x-oai-discriminator-values: + - none + - openai_hosted + - self_hosted + anyOf: + - $ref: '#/components/schemas/EnvironmentParamNone' + - $ref: '#/components/schemas/EnvironmentParamOpenaiHosted' + - $ref: '#/components/schemas/EnvironmentParamSelfHosted' + InputContentParamInputText: + type: object properties: type: type: string enum: - - response.shell_call_command.delta - description: The type of the event, always `response.shell_call_command.delta`. - default: response.shell_call_command.delta + - input_text + default: input_text x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of the event that was emitted. - output_index: - type: integer - description: The index of the output item that was updated. - command_index: - type: integer - description: The index of the shell command that was updated. - delta: - type: string - description: The shell command delta that was appended. - obfuscation: + description: The type of the object. Always `input_text`. + text: type: string - description: An obfuscation string that was added to pad the event payload. - type: object + minLength: 0 + maxLength: 1048576 + description: The text sent to the model. required: - type - - sequence_number - - output_index - - command_index - - delta - title: Response shell command delta event - description: A streaming event that indicated a shell command was incrementally updated. - ResponseShellCallCommandDoneStreamingEvent: + - text + additionalProperties: false + description: Text input to the model. + InputContentParamInputImage: + type: object properties: type: type: string enum: - - response.shell_call_command.done - description: The type of the event, always `response.shell_call_command.done`. - default: response.shell_call_command.done + - input_image + default: input_image x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of the event that was emitted. - output_index: - type: integer - description: The index of the output item that was updated. - command_index: - type: integer - description: The index of the shell command that was completed. - command: + description: The type of the object. Always `input_image`. + image_url: type: string - description: The final shell command that was emitted. - type: object + minLength: 0 + maxLength: 1048576 + description: The URL of the image sent to the model. required: - type - - sequence_number - - output_index - - command_index - - command - title: Response shell command done event - description: A streaming event that indicated a shell command was completed. - ShellCallOutputDelta: - properties: - stdout: - type: string - description: The stdout delta that was emitted. - stderr: - type: string - description: The stderr delta that was emitted. + - image_url + additionalProperties: false + description: Image input to the model. + InputContentParam: + description: Content included in an input message. + discriminator: + propertyName: type + mapping: + input_text: '#/components/schemas/InputContentParamInputText' + input_image: '#/components/schemas/InputContentParamInputImage' + x-oai-discriminator-values: + - input_text + - input_image + anyOf: + - $ref: '#/components/schemas/InputContentParamInputText' + - $ref: '#/components/schemas/InputContentParamInputImage' + InputMessageParam: type: object - required: [] - title: Shell call output delta - description: A delta of stdout/stderr emitted while a shell call was running. - ResponseShellCallOutputContentDeltaStreamingEvent: properties: type: type: string enum: - - response.shell_call_output_content.delta - description: The type of the event, always `response.shell_call_output_content.delta`. - default: response.shell_call_output_content.delta + - message + default: message x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of the event that was emitted. - item_id: - type: string - description: The ID of the output item that was updated. - output_index: - type: integer - description: The index of the output item that was updated. - command_index: - type: integer - description: The index of the shell command that produced output. - delta: - $ref: '#/components/schemas/ShellCallOutputDelta' - description: The stdout/stderr delta that was emitted. - type: object - required: - - type - - sequence_number - - item_id - - output_index - - command_index - - delta - title: Response shell call output content delta event - description: A streaming event that indicated shell call output was incrementally added. - ResponseShellCallOutputContentDoneStreamingEvent: - properties: - type: + description: The type of the input item. Always `message`. + role: type: string enum: - - response.shell_call_output_content.done - description: The type of the event, always `response.shell_call_output_content.done`. - default: response.shell_call_output_content.done + - user + default: user x-stainless-const: true - sequence_number: - type: integer - description: The sequence number of the event that was emitted. - item_id: - type: string - description: The ID of the output item that was updated. - output_index: - type: integer - description: The index of the output item that was updated. - command_index: - type: integer - description: The index of the shell command that produced output. - output: - items: - $ref: '#/components/schemas/FunctionShellCallOutputContent' + description: The role of the message author. Always `user`. + content: type: array - description: The output contents emitted for the shell command. - type: object + items: + $ref: '#/components/schemas/InputContentParam' + minItems: 0 + maxItems: 16384 + description: The content of the message. required: - - type - - sequence_number - - item_id - - output_index - - command_index - - output - title: Response shell call output content done event - description: A streaming event that indicated shell call output was completed. - CreateConversationBody: + - role + - content + additionalProperties: false + description: A user message submitted to a session. + CreateSessionInputParam: + description: Initial input submitted when creating a session. + anyOf: + - type: string + minLength: 1 + maxLength: 1048576 + - type: array + items: + $ref: '#/components/schemas/InputMessageParam' + minItems: 0 + maxItems: 16384 + CreateAgentSessionParams: + type: object properties: metadata: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 512 + propertyNames: + type: string + minLength: 1 + maxLength: 64 + minProperties: 0 + maxProperties: 16 + description: Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map. + agent: + $ref: '#/components/schemas/SessionAgentConfigParam' + description: Agent configuration. With `agent_id`, supplied fields override the saved agent for this session. Without `agent_id`, `model` is required. + agent_id: + type: string + minLength: 0 + maxLength: 64 + description: The ID of a saved reusable agent. Omit `agent` to use its configuration unchanged. + environment: + $ref: '#/components/schemas/EnvironmentParam' + description: An inline execution environment or a reference to an environment template. + vault_ids: + type: + - array + - 'null' + items: + type: string + minLength: 0 + maxLength: 1048576 + minItems: 0 + maxItems: 16384 + description: The IDs of vaults made available to the session. + input: anyOf: - - $ref: '#/components/schemas/Metadata' - description: |- - Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. - Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. - - type: 'null' - items: - anyOf: - - items: - $ref: '#/components/schemas/InputItem' - type: array - maxItems: 20 - description: Initial items to include in the conversation context. You may add up to 20 items at a time. + - $ref: '#/components/schemas/CreateSessionInputParam' - type: 'null' + description: Initial input to submit when the session is created. A string is shorthand for a single user message. Required when `environment.type` is `none`, or when `stream` is `true` for an environment that is not `self_hosted`; optional for self-hosted and non-streaming execution environments. + stream: + type: boolean + default: false + description: Whether to stream session events as server-sent events. Defaults to `false`. + required: + - environment + additionalProperties: false + description: Parameters for creating a Managed Agents session. + SessionErrorResource: type: object - required: [] - UpdateConversationBody: properties: - metadata: - $ref: '#/components/schemas/Metadata' - description: |- - Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. - Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. - type: object + type: + type: string + minLength: 0 + description: The error type. + code: + type: + - string + - 'null' + minLength: 0 + description: The machine-readable error code, if any. + message: + type: string + minLength: 0 + description: A customer-safe explanation of the error. + param: + type: + - string + - 'null' + minLength: 0 + description: The request parameter associated with the error, if any. required: - - metadata - DeletedConversationResource: + - type + - code + - message + - param + additionalProperties: false + description: An error payload with the same public fields as Responses API streaming errors. + SessionEventError: + type: object properties: - object: + type: type: string enum: - - conversation.deleted - default: conversation.deleted + - error + default: error x-stainless-const: true - deleted: - type: boolean - id: + description: The type of the object. Always `error`. + event_id: type: string - type: object + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + error: + $ref: '#/components/schemas/SessionErrorResource' + description: The error that occurred. required: - - object - - deleted - - id - SafetyAlertErrorType: + - type + - event_id + - session_id + - error + additionalProperties: false + description: Emitted when a turn or session fails. + x-oaiMeta: + example: + type: error + event_id: event_123 + session_id: sess_123 + error: + type: server_error + code: null + message: The session failed due to an internal server error. + param: null + SessionEnvironmentStatusResource: type: string enum: - - potentially_unintended_data_transfer - - potentially_unintended_data_access - - potentially_unintended_destructive_activity - - other - SafetyAlertResource: + - pending + - ready + - connected + - disconnected + - failed + x-enumDescriptions: + - The environment is being prepared. + - The environment is ready to connect. + - The environment is connected. + - The environment is disconnected. + - The environment failed to connect. + description: The connection status of a session environment. + SessionEnvironmentErrorResource: + type: object properties: - id: + type: type: string - object: + minLength: 0 + description: The error type. + code: type: string - enum: - - safety.alert - default: safety.alert - x-stainless-const: true - created_at: - type: integer - format: unixtime - request_id: + minLength: 0 + description: A machine-readable error code. + message: type: string - response_id: + minLength: 0 + description: A human-readable error message. + required: + - type + - code + - message + additionalProperties: false + description: An error reported while preparing a session environment. + SessionEnvironmentStateResource: + type: object + properties: + id: type: string - model: + minLength: 0 + description: The public ID of the environment. + type: type: string - request_paused: - type: boolean - description: Whether block registration succeeded for this request. This does not confirm that response execution stopped. - error_type: - $ref: '#/components/schemas/SafetyAlertErrorType' - reason: + minLength: 0 + description: The environment type. + status: + $ref: '#/components/schemas/SessionEnvironmentStatusResource' + description: The environment's connection status. + error: anyOf: - - type: string - description: A customer-safe description derived from error_type, or null for zero data retention requests. + - $ref: '#/components/schemas/SessionEnvironmentErrorResource' - type: 'null' - type: object + description: The error reported while preparing the environment, if any. required: - id - - object - - created_at - - request_id - - response_id - - model - - request_paused - - error_type - - reason - SpendLimitCurrency: - anyOf: - - type: string - - type: string - enum: - - USD - SpendLimitInterval: - anyOf: - - type: string - - type: string - enum: - - month - SpendLimitEnforcementStatus: - anyOf: - - type: string - - type: string - enum: - - inactive - - enforcing - SpendLimitEnforcement: - properties: - status: - $ref: '#/components/schemas/SpendLimitEnforcementStatus' - description: Whether the hard spend limit is currently enforcing. - type: object - required: + - type - status - description: The current enforcement state of a hard spend limit. - OrganizationSpendLimitResource: - properties: - object: - type: string - enum: - - organization.spend_limit - description: The object type, which is always `organization.spend_limit`. - default: organization.spend_limit - x-stainless-const: true - threshold_amount: - type: integer - description: The hard spend limit amount, in cents. - currency: - $ref: '#/components/schemas/SpendLimitCurrency' - description: The currency for the threshold amount. Currently, only `USD` is supported. - interval: - $ref: '#/components/schemas/SpendLimitInterval' - description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. - enforcement: - $ref: '#/components/schemas/SpendLimitEnforcement' - description: The current enforcement state of the hard spend limit. + - error + additionalProperties: false + description: The current state of a session environment. + SessionEventAgentSessionEnvironmentReady: type: object - required: - - object - - threshold_amount - - currency - - interval - - enforcement - description: Represents a hard spend limit configured at the organization level. - UpdateOrganizationSpendLimitBody: properties: - threshold_amount: - type: integer - minimum: 1 - description: The hard spend limit amount, in cents. - currency: + type: type: string enum: - - USD - description: The currency for the threshold amount. Currently, only `USD` is supported. - interval: + - agent.session.environment.ready + default: agent.session.environment.ready + x-stainless-const: true + description: The type of the object. Always `agent.session.environment.ready`. + event_id: type: string - enum: - - month - description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. - type: object - required: - - threshold_amount - - currency - - interval - description: Parameters for the hard spend limit you want to create or replace. - OrganizationSpendLimitDeletedResource: - properties: - object: + minLength: 0 + description: The unique ID of the event. + session_id: type: string - enum: - - organization.spend_limit.deleted - description: The object type, which is always `organization.spend_limit.deleted`. - default: organization.spend_limit.deleted - x-stainless-const: true - deleted: - type: boolean - description: Whether the hard spend limit was deleted. - type: object + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + environment: + $ref: '#/components/schemas/SessionEnvironmentStateResource' + description: The current environment state. required: - - object - - deleted - description: Confirmation payload returned after deleting an organization hard spend limit. - ProjectSpendLimitResource: + - type + - event_id + - session_id + - turn_id + - environment + additionalProperties: false + description: Emitted when a hosted session environment is ready to connect. + SessionEventAgentOutputCommandExecutionOutputDelta: + type: object properties: - object: + type: type: string enum: - - project.spend_limit - description: The object type, which is always `project.spend_limit`. - default: project.spend_limit + - agent.output.command_execution_output.delta + default: agent.output.command_execution_output.delta x-stainless-const: true - threshold_amount: + description: The type of the object. Always `agent.output.command_execution_output.delta`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + item_id: + type: string + minLength: 0 + description: The ID of the command execution item. + output_index: type: integer - description: The hard spend limit amount, in cents. - currency: - $ref: '#/components/schemas/SpendLimitCurrency' - description: The currency for the threshold amount. Currently, only `USD` is supported. - interval: - $ref: '#/components/schemas/SpendLimitInterval' - description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. - enforcement: - $ref: '#/components/schemas/SpendLimitEnforcement' - description: The current enforcement state of the hard spend limit. - type: object + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the item in the turn output. + delta: + type: string + minLength: 0 + description: The output text that was appended. required: - - object - - threshold_amount - - currency - - interval - - enforcement - description: Represents a hard spend limit configured at the project level. - UpdateProjectSpendLimitBody: + - type + - event_id + - session_id + - turn_id + - item_id + - output_index + - delta + additionalProperties: false + description: Emitted when command execution produces an output delta. + SessionEventAgentSessionCreated: + type: object properties: - threshold_amount: - type: integer - minimum: 1 - description: The hard spend limit amount, in cents. - currency: + type: type: string enum: - - USD - description: The currency for the threshold amount. Currently, only `USD` is supported. - interval: + - agent.session.created + default: agent.session.created + x-stainless-const: true + description: The type of the object. Always `agent.session.created`. + event_id: type: string - enum: - - month - description: The time interval for evaluating spend against the threshold. Currently, only `month` is supported. - type: object + minLength: 0 + description: The unique ID of the event. + session: + $ref: '#/components/schemas/SessionResource' + description: The session that was created. required: - - threshold_amount - - currency - - interval - description: Parameters for the hard spend limit you want to create or replace. - ProjectSpendLimitDeletedResource: + - type + - event_id + - session + additionalProperties: false + description: Emitted when a session is created. + SessionEventAgentSessionTurnCreated: + type: object properties: - object: + type: type: string enum: - - project.spend_limit.deleted - description: The object type, which is always `project.spend_limit.deleted`. - default: project.spend_limit.deleted + - agent.session.turn.created + default: agent.session.turn.created x-stainless-const: true - deleted: - type: boolean - description: Whether the hard spend limit was deleted. - type: object - required: - - object - - deleted - description: Confirmation payload returned after deleting a project hard spend limit. - CreateProjectServiceAccountApiKeyBody: - properties: - name: + description: The type of the object. Always `agent.session.turn.created`. + event_id: type: string - description: API key name. - scopes: - items: - type: string - description: API key scope. - type: array - description: API key scopes. - expires_in_seconds: - anyOf: - - type: integer - maximum: 31536000 - minimum: 1 - description: Number of seconds until the API key expires. - - type: 'null' + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: string + minLength: 0 + description: The ID of the turn associated with the event. + turn: + $ref: '#/components/schemas/TurnResource' + description: The turn at the time it was created. + required: + - type + - event_id + - session_id + - turn_id + - turn + additionalProperties: false + description: Emitted when a turn is created. + SessionEventAgentSessionTurnInProgress: type: object - required: [] - description: The service account API key create request payload. - ServiceAccountApiKeyBody: properties: - object: + type: type: string enum: - - organization.project.service_account.api_key - description: The object type, which is always `organization.project.service_account.api_key` - default: organization.project.service_account.api_key + - agent.session.turn.in_progress + default: agent.session.turn.in_progress x-stainless-const: true - value: + description: The type of the object. Always `agent.session.turn.in_progress`. + event_id: type: string - description: The unredacted API key value. - name: + minLength: 0 + description: The unique ID of the event. + session_id: type: string - description: The name of the API key. - created_at: - type: integer - format: unixtime - description: The Unix timestamp (in seconds) when the API key was created. - expires_at: - anyOf: - - type: integer - format: unixtime - description: The Unix timestamp (in seconds) when the API key expires, or null if it does not expire. - - type: 'null' - id: + minLength: 0 + description: The ID of the session associated with the event. + turn_id: type: string - description: The identifier of the API key. - type: object + minLength: 0 + description: The ID of the turn associated with the event. + turn: + $ref: '#/components/schemas/TurnResource' + description: The turn at the time it started running. required: - - object - - value - - name - - created_at - - id - CreateContentProvenanceBody: - properties: - file: - type: string - format: binary - description: The image or audio file to check for supported OpenAI provenance signals. + - type + - event_id + - session_id + - turn_id + - turn + additionalProperties: false + description: Emitted when a turn starts running. + SessionEventAgentSessionTurnCompleted: type: object - required: - - file - ProvenanceCheckObject: - type: string - enum: - - content_provenance_check - ProvenanceDetectionResultApi: - type: string - enum: - - detected - - not_detected - C2PAValidationStateApi: - type: string - enum: - - trusted - - valid - - invalid - - not_present - C2PAProvenanceResult: properties: type: type: string enum: - - c2pa - description: The provenance signal type. Always `c2pa`. - default: c2pa + - agent.session.turn.completed + default: agent.session.turn.completed x-stainless-const: true - outcome: - $ref: '#/components/schemas/ProvenanceDetectionResultApi' - description: |- - Whether a supported OpenAI C2PA provenance signal was detected. - If `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect. - validation_state: - $ref: '#/components/schemas/C2PAValidationStateApi' - description: The validation status of the C2PA manifest in the uploaded image. - issuer: - anyOf: - - type: string - description: The C2PA manifest issuer, when available. - - type: 'null' - model: - anyOf: - - type: string - description: The OpenAI model recorded by the provenance signal, when available. - - type: 'null' - generated_at: + description: The type of the object. Always `agent.session.turn.completed`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: string + minLength: 0 + description: The ID of the turn associated with the event. + turn: + $ref: '#/components/schemas/TurnResource' + description: The completed turn. + usage: anyOf: - - type: string - description: The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset was generated, when available. + - $ref: '#/components/schemas/TokenUsageResource' - type: 'null' - type: object + description: Token usage by the root agent during the turn, when available. required: - type - - outcome - - validation_state - - issuer - - model - - generated_at - SynthIDProvenanceResult: + - event_id + - session_id + - turn_id + - turn + - usage + additionalProperties: false + description: Emitted when a turn completes. + SessionEventAgentSessionTurnFailed: + type: object properties: type: type: string enum: - - synthid - description: The provenance signal type. Always `synthid`. - default: synthid + - agent.session.turn.failed + default: agent.session.turn.failed x-stainless-const: true - outcome: - $ref: '#/components/schemas/ProvenanceDetectionResultApi' - description: |- - Whether a supported OpenAI SynthID watermark was detected. - If `not_detected`, it means the tool did not find supported signals in the uploaded file. The content could still have been generated by OpenAI if the metadata was stripped or has evidence of tampering, the watermark was degraded, it comes from a legacy generation model, or it was created before provenance signals were available. Content could also still be AI-generated by another company's model, which the tool currently does not detect. - model: - anyOf: - - type: string - description: The OpenAI model recorded by the provenance signal, when available. - - type: 'null' - generated_at: + description: The type of the object. Always `agent.session.turn.failed`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: string + minLength: 0 + description: The ID of the turn associated with the event. + turn: + $ref: '#/components/schemas/TurnResource' + description: The failed turn. + usage: anyOf: - - type: string - description: The UTC RFC 3339 timestamp recorded by the provenance signal for when the asset was generated, when available. + - $ref: '#/components/schemas/TokenUsageResource' - type: 'null' - type: object + description: Token usage by the root agent during the turn, when available. required: - type - - outcome - - model - - generated_at - ProvenanceResource: - properties: - object: - $ref: '#/components/schemas/ProvenanceCheckObject' - description: The object type. Always `content_provenance_check` for this endpoint. - created_at: - type: integer - format: unixtime - description: The Unix timestamp, in seconds, when the provenance check was created. - results: - items: - discriminator: - propertyName: type - anyOf: - - $ref: '#/components/schemas/C2PAProvenanceResult' - - $ref: '#/components/schemas/SynthIDProvenanceResult' - type: array - description: The provenance results that apply to the uploaded file. Image results include C2PA and SynthID; audio results include SynthID. + - event_id + - session_id + - turn_id + - turn + - usage + additionalProperties: false + description: Emitted when a turn fails. + SessionEventAgentSessionTurnCancelled: type: object - required: - - object - - created_at - - results - OrderEnum: - type: string - enum: - - asc - - desc - VideoModel: - anyOf: - - type: string - - type: string - enum: - - sora-2 - - sora-2-pro - - sora-2-2025-10-06 - - sora-2-pro-2025-10-06 - - sora-2-2025-12-08 - VideoStatus: - type: string - enum: - - queued - - in_progress - - completed - - failed - VideoSize: - type: string - enum: - - 720x1280 - - 1280x720 - - 1024x1792 - - 1792x1024 - Error-2: properties: - code: + type: type: string - description: A machine-readable error code that was returned. - message: + enum: + - agent.session.turn.cancelled + default: agent.session.turn.cancelled + x-stainless-const: true + description: The type of the object. Always `agent.session.turn.cancelled`. + event_id: type: string - description: A human-readable description of the error that was returned. - misalignment: - $ref: '#/components/schemas/MisalignmentErrorDetailsResource' - type: object - required: - - code - - message - title: Error - description: An error that occurred while generating the response. - VideoResource: - properties: - id: + minLength: 0 + description: The unique ID of the event. + session_id: type: string - description: Unique identifier for the video job. - object: + minLength: 0 + description: The ID of the session associated with the event. + turn_id: type: string - enum: - - video - description: The object type, which is always `video`. - default: video - x-stainless-const: true - model: - $ref: '#/components/schemas/VideoModel' - description: The video generation model that produced the job. - status: - $ref: '#/components/schemas/VideoStatus' - description: Current lifecycle status of the video job. - progress: - type: integer - description: Approximate completion percentage for the generation task. - created_at: - type: integer - format: unixtime - description: Unix timestamp (seconds) for when the job was created. - completed_at: - anyOf: - - type: integer - format: unixtime - description: Unix timestamp (seconds) for when the job completed, if finished. - - type: 'null' - expires_at: - anyOf: - - type: integer - format: unixtime - description: Unix timestamp (seconds) for when the downloadable assets expire, if set. - - type: 'null' - prompt: - anyOf: - - type: string - description: The prompt that was used to generate the video. - - type: 'null' - size: - $ref: '#/components/schemas/VideoSize' - description: The resolution of the generated video. - seconds: - anyOf: - - type: string - - $ref: '#/components/schemas/VideoSeconds' - description: Duration of the generated clip in seconds. For extensions, this is the stitched total duration. - remixed_from_video_id: - anyOf: - - type: string - description: Identifier of the source video if this video is a remix. - - type: 'null' - error: + minLength: 0 + description: The ID of the turn associated with the event. + turn: + $ref: '#/components/schemas/TurnResource' + description: The cancelled turn. + usage: anyOf: - - $ref: '#/components/schemas/Error-2' - description: Error payload that explains why generation failed, if applicable. + - $ref: '#/components/schemas/TokenUsageResource' - type: 'null' - type: object + description: Token usage by the root agent during the turn, when available. required: - - id - - object - - model - - status - - progress - - created_at - - completed_at - - expires_at - - prompt - - size - - seconds - - remixed_from_video_id - - error - title: Video job - description: Structured information describing a generated video job. - VideoListResource: - properties: - object: - x-stainless-const: true - default: list - description: The type of object returned, must be `list`. - const: list - data: - items: - $ref: '#/components/schemas/VideoResource' - type: array - description: A list of items - first_id: - anyOf: - - type: string - description: The ID of the first item in the list. - - type: 'null' - last_id: - anyOf: - - type: string - description: The ID of the last item in the list. - - type: 'null' - has_more: - type: boolean - description: Whether there are more items available. + - type + - event_id + - session_id + - turn_id + - turn + - usage + additionalProperties: false + description: Emitted when a turn is cancelled. + SessionEventAgentSessionTurnItemAdded: type: object - required: - - object - - data - - first_id - - last_id - - has_more - ImageRefParam-2: properties: - image_url: + type: type: string - maxLength: 20971520 - format: uri - description: A fully qualified URL or base64-encoded data URL. - file_id: + enum: + - agent.session.turn.item.added + default: agent.session.turn.item.added + x-stainless-const: true + description: The type of the object. Always `agent.session.turn.item.added`. + event_id: type: string - example: file-123 - type: object - required: [] - VideoSeconds: - type: string - enum: - - '4' - - '8' - - '12' - CreateVideoMultipartBody: - properties: - model: - $ref: '#/components/schemas/VideoModel' - description: 'The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`.' - prompt: + minLength: 0 + description: The unique ID of the event. + session_id: type: string - maxLength: 32000 - minLength: 1 - description: Text prompt that describes the video to generate. - input_reference: - anyOf: - - type: string - format: binary - description: Optional reference asset upload or reference object that guides generation. - - $ref: '#/components/schemas/ImageRefParam-2' - description: Optional reference asset upload or reference object that guides generation. Provide exactly one of `image_url` or `file_id` when using an object. - seconds: - $ref: '#/components/schemas/VideoSeconds' - description: 'Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.' - size: - $ref: '#/components/schemas/VideoSize' - description: 'Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.' - type: object + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + output_index: + type: + - integer + - 'null' + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the item in the turn output, when the item is agent output. + item: + $ref: '#/components/schemas/SessionTurnItemResource' + description: The item that was added. required: - - prompt - title: Create video multipart request - description: Multipart parameters for creating a new video generation job. - CreateVideoJsonBody: + - type + - event_id + - session_id + - turn_id + - output_index + - item + additionalProperties: false + description: Emitted when an item is added to a turn. + SessionEventAgentSessionIdle: + type: object properties: - model: - $ref: '#/components/schemas/VideoModel' - description: 'The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`.' - prompt: + type: type: string - maxLength: 32000 - minLength: 1 - description: Text prompt that describes the video to generate. - input_reference: - $ref: '#/components/schemas/ImageRefParam-2' - description: Optional reference object that guides generation. Provide exactly one of `image_url` or `file_id`. - seconds: - $ref: '#/components/schemas/VideoSeconds' - description: 'Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.' - size: - $ref: '#/components/schemas/VideoSize' - description: 'Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.' - type: object + enum: + - agent.session.idle + default: agent.session.idle + x-stainless-const: true + description: The type of the object. Always `agent.session.idle`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session: + $ref: '#/components/schemas/SessionResource' + description: The session that became idle. required: - - prompt - title: Create video JSON request - description: JSON parameters for creating a new video generation job. - CreateVideoCharacterBody: + - type + - event_id + - session + additionalProperties: false + description: Emitted when a session becomes idle. + SessionEventAgentSessionInProgress: + type: object properties: - video: + type: type: string - format: binary - description: Video file used to create a character. - name: + enum: + - agent.session.in_progress + default: agent.session.in_progress + x-stainless-const: true + description: The type of the object. Always `agent.session.in_progress`. + event_id: type: string - maxLength: 80 - minLength: 1 - description: Display name for this API character. - type: object + minLength: 0 + description: The unique ID of the event. + session: + $ref: '#/components/schemas/SessionResource' + description: The session that started processing. required: - - video - - name - title: Create character request - description: Parameters for creating a character from an uploaded video. - VideoCharacterResource: - properties: - id: - anyOf: - - type: string - description: Identifier for the character creation cameo. - - type: 'null' - name: - anyOf: - - type: string - description: Display name for the character. - - type: 'null' - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) when the character was created. + - type + - event_id + - session + additionalProperties: false + description: Emitted when a session starts processing a turn. + SessionEventAgentSessionRequiresAction: type: object - required: - - id - - name - - created_at - VideoReferenceInputParam: properties: - id: + type: type: string - description: The identifier of the completed video. - example: video_123 - type: object + enum: + - agent.session.requires_action + default: agent.session.requires_action + x-stainless-const: true + description: The type of the object. Always `agent.session.requires_action`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session: + $ref: '#/components/schemas/SessionResource' + description: The session and its current required actions. required: - - id - description: Reference to the completed video. - CreateVideoEditMultipartBody: + - type + - event_id + - session + additionalProperties: false + description: Emitted when a session is waiting for one or more required actions. + SessionEventAgentSessionFailed: + type: object properties: - video: - anyOf: - - type: string - format: binary - description: Reference to the completed video to edit. - - $ref: '#/components/schemas/VideoReferenceInputParam' - description: Reference to the completed video to edit. - prompt: + type: type: string - maxLength: 32000 - minLength: 1 - description: Text prompt that describes how to edit the source video. - type: object + enum: + - agent.session.failed + default: agent.session.failed + x-stainless-const: true + description: The type of the object. Always `agent.session.failed`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session: + $ref: '#/components/schemas/SessionResource' + description: The failed session. required: - - video - - prompt - title: Create video edit multipart request - description: Parameters for editing an existing generated video. - CreateVideoEditJsonBody: + - type + - event_id + - session + additionalProperties: false + description: Emitted when a session fails. + SessionEventAgentSessionEnvironmentPending: + type: object properties: - video: - $ref: '#/components/schemas/VideoReferenceInputParam' - description: Reference to the completed video to edit. - prompt: + type: type: string - maxLength: 32000 - minLength: 1 - description: Text prompt that describes how to edit the source video. - type: object + enum: + - agent.session.environment.pending + default: agent.session.environment.pending + x-stainless-const: true + description: The type of the object. Always `agent.session.environment.pending`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + environment: + $ref: '#/components/schemas/SessionEnvironmentStateResource' + description: The current environment state. required: - - video - - prompt - title: Create video edit JSON request - description: JSON parameters for editing an existing generated video. - CreateVideoExtendMultipartBody: + - type + - event_id + - session_id + - turn_id + - environment + additionalProperties: false + description: Emitted while a session environment is being prepared. + SessionEventAgentSessionEnvironmentConnected: + type: object properties: - video: - oneOf: - - type: string - format: binary - description: Reference to the completed video to extend. - - $ref: '#/components/schemas/VideoReferenceInputParam' - description: Reference to the completed video to extend. - prompt: + type: type: string - maxLength: 32000 - minLength: 1 - description: Updated text prompt that directs the extension generation. - seconds: - $ref: '#/components/schemas/VideoSeconds' - description: 'Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20).' - type: object + enum: + - agent.session.environment.connected + default: agent.session.environment.connected + x-stainless-const: true + description: The type of the object. Always `agent.session.environment.connected`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + environment: + $ref: '#/components/schemas/SessionEnvironmentStateResource' + description: The current environment state. required: - - video - - prompt - - seconds - title: Create video extension multipart request - description: Multipart parameters for extending an existing generated video. - CreateVideoExtendJsonBody: + - type + - event_id + - session_id + - turn_id + - environment + additionalProperties: false + description: Emitted when a session environment connects. + SessionEventAgentSessionEnvironmentDisconnected: + type: object properties: - video: - $ref: '#/components/schemas/VideoReferenceInputParam' - description: Reference to the completed video to extend. - prompt: + type: type: string - maxLength: 32000 - minLength: 1 - description: Updated text prompt that directs the extension generation. - seconds: - $ref: '#/components/schemas/VideoSeconds' - description: 'Length of the newly generated extension segment in seconds (allowed values: 4, 8, 12, 16, 20).' - type: object + enum: + - agent.session.environment.disconnected + default: agent.session.environment.disconnected + x-stainless-const: true + description: The type of the object. Always `agent.session.environment.disconnected`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + environment: + $ref: '#/components/schemas/SessionEnvironmentStateResource' + description: The current environment state. required: - - video - - prompt - - seconds - title: Create video extension JSON request - description: JSON parameters for extending an existing generated video. - DeletedVideoResource: + - type + - event_id + - session_id + - turn_id + - environment + additionalProperties: false + description: Emitted when a session environment disconnects. + SessionEventAgentSessionEnvironmentFailed: + type: object properties: - object: + type: type: string enum: - - video.deleted - description: The object type that signals the deletion response. - default: video.deleted + - agent.session.environment.failed + default: agent.session.environment.failed x-stainless-const: true - deleted: - type: boolean - description: Indicates that the video resource was deleted. - id: + description: The type of the object. Always `agent.session.environment.failed`. + event_id: type: string - description: Identifier of the deleted video. - type: object + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + environment: + $ref: '#/components/schemas/SessionEnvironmentStateResource' + description: The current environment state. required: - - object - - deleted - - id - title: Deleted video response - description: Confirmation payload returned after deleting a video. - VideoContentVariant: - type: string - enum: - - video - - thumbnail - - spritesheet - CreateVideoRemixBody: + - type + - event_id + - session_id + - turn_id + - environment + additionalProperties: false + description: Emitted when a session environment fails. + SessionEventAgentSessionSubagentCreated: + type: object properties: - prompt: + type: type: string - maxLength: 32000 - minLength: 1 - description: Updated text prompt that directs the remix generation. - type: object + enum: + - agent.session.subagent.created + default: agent.session.subagent.created + x-stainless-const: true + description: The type of the object. Always `agent.session.subagent.created`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + subagent: + $ref: '#/components/schemas/SubagentResource' + description: The subagent that was created. required: - - prompt - title: Create video remix request - description: Parameters for remixing an existing generated video. - TruncationEnum: - type: string - enum: - - auto - - disabled - PersonalityEnum: - anyOf: - - type: string - - type: string - enum: - - friendly - - pragmatic - TokenCountsBody: - properties: - model: - anyOf: - - type: string - description: Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](https://developers.openai.com/api/docs/models) to browse and compare available models. - - type: 'null' - input: - anyOf: - - description: Text, image, or file inputs to the model, used to generate a response - anyOf: - - type: string - maxLength: 10485760 - description: A text input to the model, equivalent to a text input with the `user` role. - - items: - $ref: '#/components/schemas/InputItem' - type: array - maxItems: 131072 - description: A list of one or many input items to the model, containing different content types. - - type: 'null' - previous_response_id: - anyOf: - - type: string - description: The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`. - example: resp_123 - - type: 'null' - tools: - anyOf: - - items: - $ref: '#/components/schemas/Tool' - type: array - description: An array of tools the model may call while generating a response. You can specify which tool to use by setting the `tool_choice` parameter. - - type: 'null' - text: - anyOf: - - $ref: '#/components/schemas/ResponseTextParam' - - type: 'null' - reasoning: - anyOf: - - $ref: '#/components/schemas/Reasoning' - description: '**gpt-5 and o-series models only** Configuration options for [reasoning models](https://developers.openai.com/api/docs/guides/reasoning).' - - type: 'null' - truncation: - $ref: '#/components/schemas/TruncationEnum' - description: 'The truncation strategy to use for the model response. - `auto`: If the input to this Response exceeds the model''s context window size, the model will truncate the response to fit the context window by dropping items from the beginning of the conversation. - `disabled` (default): If the input size will exceed the context window size for a model, the request will fail with a 400 error.' - deprecated: true - instructions: - anyOf: - - type: string - description: |- - A system (or developer) message inserted into the model's context. - When used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses. - - type: 'null' - personality: - $ref: '#/components/schemas/PersonalityEnum' - description: A model-owned style preset to apply to this request. Omit this parameter to use the model's default style. Supported values may expand over time. Values must be at most 64 characters. - conversation: - anyOf: - - $ref: '#/components/schemas/ConversationParam' - - type: 'null' - tool_choice: - anyOf: - - $ref: '#/components/schemas/ToolChoiceParam' - description: Controls which tool the model should use, if any. - - type: 'null' - parallel_tool_calls: - anyOf: - - type: boolean - description: Whether to allow the model to run tool calls in parallel. - - type: 'null' + - type + - event_id + - subagent + additionalProperties: false + description: Emitted when a subagent is created. + SessionEventAgentSessionSubagentActive: type: object - required: [] - TokenCountsResource: properties: - object: + type: type: string enum: - - response.input_tokens - default: response.input_tokens + - agent.session.subagent.active + default: agent.session.subagent.active x-stainless-const: true - input_tokens: - type: integer + description: The type of the object. Always `agent.session.subagent.active`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + subagent: + $ref: '#/components/schemas/SubagentResource' + description: The subagent that resumed. + required: + - type + - event_id + - subagent + additionalProperties: false + description: Emitted when a closed subagent successfully resumes. + SessionEventAgentSessionSubagentClosed: type: object + properties: + type: + type: string + enum: + - agent.session.subagent.closed + default: agent.session.subagent.closed + x-stainless-const: true + description: The type of the object. Always `agent.session.subagent.closed`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + subagent: + $ref: '#/components/schemas/SubagentResource' + description: The subagent that was closed. required: - - object - - input_tokens - title: Token counts - example: - object: response.input_tokens - input_tokens: 123 - PromptCacheRetentionEnum: - type: string - enum: - - in_memory - - 24h - ServiceTierEnum: - type: string - enum: - - auto - - default - - fast - - flex - - priority - CompactResponseMethodPublicBody: + - type + - event_id + - subagent + additionalProperties: false + description: Emitted when a subagent is closed. + AssistantMessageItemResource: + type: object properties: - model: - $ref: '#/components/schemas/ModelIdsCompaction' - input: - anyOf: - - description: Text, image, or file inputs to the model, used to generate a response - anyOf: - - type: string - maxLength: 10485760 - description: A text input to the model, equivalent to a text input with the `user` role. - - items: - $ref: '#/components/schemas/InputItem' - type: array - maxItems: 131072 - description: A list of one or many input items to the model, containing different content types. - - type: 'null' - previous_response_id: - anyOf: - - type: string - description: The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about [conversation state](https://developers.openai.com/api/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`. - example: resp_123 - - type: 'null' - instructions: - anyOf: - - type: string - description: |- - A system (or developer) message inserted into the model's context. - When used along with `previous_response_id`, the instructions from a previous response will not be carried over to the next response. This makes it simple to swap out system (or developer) messages in new responses. - - type: 'null' - prompt_cache_key: - anyOf: - - type: string - maxLength: 64 - description: A key to use when reading from or writing to the prompt cache. - - type: 'null' - prompt_cache_retention: - anyOf: - - $ref: '#/components/schemas/PromptCacheRetentionEnum' - description: How long to retain a prompt cache entry created by this request. - deprecated: true - - type: 'null' - prompt_cache_options: - anyOf: - - $ref: '#/components/schemas/PromptCacheOptionsParam' - - type: 'null' - service_tier: + type: + type: string + enum: + - message + default: message + x-stainless-const: true + description: The item type. Always `message`. + id: + type: string + minLength: 0 + description: The ID of the message. + turn_id: + type: string + minLength: 0 + description: The ID of the turn that contains this item. + role: + type: string + enum: + - assistant + default: assistant + x-stainless-const: true + description: The role of the message author. Always `assistant`. + status: + $ref: '#/components/schemas/OutputItemStatusResource' + description: The status of the message. + content: + type: array + items: + $ref: '#/components/schemas/OutputTextResource' + minItems: 0 + maxItems: 2000 + description: The content of the message. + phase: anyOf: - - $ref: '#/components/schemas/ServiceTierEnum' - description: |- - Specifies the processing type used for serving the request. - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model. - If set to '[flex](https://developers.openai.com/api/docs/guides/flex-processing)', then the request will be processed with the Flex Processing service tier. - To opt-in to [Fast mode](https://developers.openai.com/api/docs/guides/fast-mode) at the request level, include the `service_tier=fast` or `service_tier=priority` parameter for Responses or Chat Completions. For models with a dedicated Fast tier, either value resolves to `service_tier=fast`; for other models, either value resolves to `service_tier=priority`. - When not set, the default behavior is 'auto'. - When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. + - $ref: '#/components/schemas/MessagePhaseResource' - type: 'null' - type: object + description: The phase of the assistant message. required: - - model - ItemField: + - type + - id + - turn_id + - role + - status + - content + - phase + additionalProperties: false + description: An assistant message produced by the agent. + AgentOutputItemResource: + description: An output item produced by an agent. discriminator: propertyName: type - description: An item representing a message, tool call, tool output, reasoning, or other response element. + mapping: + message: '#/components/schemas/AssistantMessageItemResource' + reasoning: '#/components/schemas/ReasoningItemResource' + function_call: '#/components/schemas/FunctionCallItemResource' + mcp_call: '#/components/schemas/McpCallItemResource' + web_search_call: '#/components/schemas/WebSearchCallItemResource' + command_execution: '#/components/schemas/CommandExecutionItemResource' + interrupt_subagent_call: '#/components/schemas/InterruptSubagentCallItemResource' + create_subagent_call: '#/components/schemas/CreateSubagentCallItemResource' + send_subagent_input_call: '#/components/schemas/SendSubagentInputCallItemResource' + resume_subagent_call: '#/components/schemas/ResumeSubagentCallItemResource' + wait_for_subagents_call: '#/components/schemas/WaitForSubagentsCallItemResource' + close_subagent_call: '#/components/schemas/CloseSubagentCallItemResource' + x-oai-discriminator-values: + - message + - reasoning + - function_call + - mcp_call + - web_search_call + - command_execution + - create_subagent_call + - send_subagent_input_call + - resume_subagent_call + - wait_for_subagents_call + - interrupt_subagent_call + - close_subagent_call anyOf: - - $ref: '#/components/schemas/Message' - - $ref: '#/components/schemas/Program' - - $ref: '#/components/schemas/ProgramOutput' - - $ref: '#/components/schemas/FunctionToolCall' - - $ref: '#/components/schemas/ToolSearchCall' - - $ref: '#/components/schemas/ToolSearchOutput' - - $ref: '#/components/schemas/AdditionalTools' - - $ref: '#/components/schemas/FunctionToolCallOutput' - - $ref: '#/components/schemas/FileSearchToolCall' - - $ref: '#/components/schemas/WebSearchToolCall' - - $ref: '#/components/schemas/ImageGenToolCall' - - $ref: '#/components/schemas/ComputerToolCall' - - $ref: '#/components/schemas/ComputerToolCallOutputResource' - - $ref: '#/components/schemas/ReasoningItem' - - $ref: '#/components/schemas/CompactionBody' - - $ref: '#/components/schemas/CodeInterpreterToolCall' - - $ref: '#/components/schemas/LocalShellToolCall' - deprecated: true - - $ref: '#/components/schemas/LocalShellToolCallOutput' - deprecated: true - - $ref: '#/components/schemas/FunctionShellCall' - - $ref: '#/components/schemas/FunctionShellCallOutput' - - $ref: '#/components/schemas/ApplyPatchToolCall' - - $ref: '#/components/schemas/ApplyPatchToolCallOutput' - - $ref: '#/components/schemas/MCPListTools' - - $ref: '#/components/schemas/MCPApprovalRequest' - - $ref: '#/components/schemas/MCPApprovalResponseResource' - - $ref: '#/components/schemas/MCPToolCall' - - $ref: '#/components/schemas/CustomToolCall' - - $ref: '#/components/schemas/CustomToolCallOutput' - CompactResource: + - $ref: '#/components/schemas/AssistantMessageItemResource' + - $ref: '#/components/schemas/ReasoningItemResource' + - $ref: '#/components/schemas/FunctionCallItemResource' + - $ref: '#/components/schemas/McpCallItemResource' + - $ref: '#/components/schemas/WebSearchCallItemResource' + - $ref: '#/components/schemas/CommandExecutionItemResource' + - $ref: '#/components/schemas/CreateSubagentCallItemResource' + - $ref: '#/components/schemas/SendSubagentInputCallItemResource' + - $ref: '#/components/schemas/ResumeSubagentCallItemResource' + - $ref: '#/components/schemas/WaitForSubagentsCallItemResource' + - $ref: '#/components/schemas/InterruptSubagentCallItemResource' + - $ref: '#/components/schemas/CloseSubagentCallItemResource' + SessionEventAgentSessionTurnItemDone: + type: object properties: - id: - type: string - description: The unique identifier for the compacted response. - object: + type: type: string enum: - - response.compaction - description: The object type. Always `response.compaction`. - default: response.compaction + - agent.session.turn.item.done + default: agent.session.turn.item.done x-stainless-const: true - output: - type: array - description: The compacted list of output items. This is a list of all user messages, followed by a single compaction item. - items: - $ref: '#/components/schemas/OutputItem' - created_at: + description: The type of the object. Always `agent.session.turn.item.done`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + output_index: type: integer - format: unixtime - description: Unix timestamp (in seconds) when the compacted conversation was created. - usage: - $ref: '#/components/schemas/ResponseUsage' - description: Token accounting for the compaction pass, including cached, reasoning, and total tokens. + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the output item in the turn output. + item: + $ref: '#/components/schemas/AgentOutputItemResource' + description: The completed output item. + required: + - type + - event_id + - session_id + - turn_id + - output_index + - item + additionalProperties: false + description: Emitted when an output item is complete. + SessionEventAgentSessionTurnContentPartAdded: type: object - required: - - id - - object - - output - - created_at - - usage - title: The compacted response object - SkillResource: properties: - id: - type: string - description: Unique identifier for the skill. - object: + type: type: string enum: - - skill - description: The object type, which is `skill`. - default: skill + - agent.session.turn.content_part.added + default: agent.session.turn.content_part.added x-stainless-const: true - name: - type: string - description: Name of the skill. - description: + description: The type of the object. Always `agent.session.turn.content_part.added`. + event_id: type: string - description: Description of the skill. - created_at: - type: integer - format: unixtime - description: Unix timestamp (seconds) for when the skill was created. - default_version: + minLength: 0 + description: The unique ID of the event. + session_id: type: string - description: Default version for the skill. - latest_version: + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + item_id: type: string - description: Latest version for the skill. - type: object - required: - - id - - object - - name - - description - - created_at - - default_version - - latest_version - SkillListResource: - properties: - object: - x-stainless-const: true - default: list - description: The type of object returned, must be `list`. - const: list - data: - items: - $ref: '#/components/schemas/SkillResource' - type: array - description: A list of items - first_id: - anyOf: - - type: string - description: The ID of the first item in the list. - - type: 'null' - last_id: - anyOf: - - type: string - description: The ID of the last item in the list. - - type: 'null' - has_more: - type: boolean - description: Whether there are more items available. - type: object + minLength: 0 + description: The ID of the message item. + output_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the item in the turn output. + content_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the content part in the message. + part: + $ref: '#/components/schemas/OutputTextResource' + description: The initial content part. required: - - object - - data - - first_id - - last_id - - has_more - CreateSkillBody: - properties: - files: - anyOf: - - items: - type: string - format: binary - type: array - maxItems: 500 - description: Skill files to upload (directory upload) or a single zip file. - - type: string - format: binary - description: Skill zip file to upload. + - type + - event_id + - session_id + - turn_id + - item_id + - output_index + - content_index + - part + additionalProperties: false + description: Emitted when an output text content part is added. + SessionEventAgentSessionTurnContentPartDone: type: object - description: Uploads a skill either as a directory (multipart `files[]`) or as a single zip file. - title: Create skill request - SetDefaultSkillVersionBody: properties: - default_version: + type: type: string - description: The skill version number to set as default. - type: object + enum: + - agent.session.turn.content_part.done + default: agent.session.turn.content_part.done + x-stainless-const: true + description: The type of the object. Always `agent.session.turn.content_part.done`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + item_id: + type: string + minLength: 0 + description: The ID of the message item. + output_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the item in the turn output. + content_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the content part in the message. + part: + $ref: '#/components/schemas/OutputTextResource' + description: The completed content part. required: - - default_version - title: Update skill request - description: Updates the default version pointer for a skill. - DeletedSkillResource: + - type + - event_id + - session_id + - turn_id + - item_id + - output_index + - content_index + - part + additionalProperties: false + description: Emitted when an output content part is complete. + SessionEventAgentSessionTurnOutputTextDelta: + type: object properties: - object: + type: type: string enum: - - skill.deleted - default: skill.deleted + - agent.session.turn.output_text.delta + default: agent.session.turn.output_text.delta x-stainless-const: true - deleted: - type: boolean - id: + description: The type of the object. Always `agent.session.turn.output_text.delta`. + event_id: type: string - type: object + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + item_id: + type: string + minLength: 0 + description: The ID of the message item. + output_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the item in the turn output. + content_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the content part in the message. + delta: + type: string + minLength: 0 + description: The text that was appended. required: - - object - - deleted - - id - SkillVersionResource: + - type + - event_id + - session_id + - turn_id + - item_id + - output_index + - content_index + - delta + additionalProperties: false + description: Emitted when text is appended to an output text content part. + SessionEventAgentSessionTurnOutputTextDone: + type: object properties: - object: + type: type: string enum: - - skill.version - description: The object type, which is `skill.version`. - default: skill.version + - agent.session.turn.output_text.done + default: agent.session.turn.output_text.done x-stainless-const: true - id: + description: The type of the object. Always `agent.session.turn.output_text.done`. + event_id: type: string - description: Unique identifier for the skill version. - skill_id: + minLength: 0 + description: The unique ID of the event. + session_id: type: string - description: Identifier of the skill for this version. - version: + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + item_id: type: string - description: Version number for this skill. - created_at: + minLength: 0 + description: The ID of the message item. + output_index: type: integer - format: unixtime - description: Unix timestamp (seconds) for when the version was created. - name: - type: string - description: Name of the skill version. - description: + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the item in the turn output. + content_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the content part in the message. + text: type: string - description: Description of the skill version. - type: object + minLength: 0 + description: The complete output text. required: - - object - - id - - skill_id - - version - - created_at - - name - - description - SkillVersionListResource: + - type + - event_id + - session_id + - turn_id + - item_id + - output_index + - content_index + - text + additionalProperties: false + description: Emitted when an output text content part is complete. + SessionEventAgentSessionTurnReasoningSummaryPartAdded: + type: object properties: - object: + type: + type: string + enum: + - agent.session.turn.reasoning_summary_part.added + default: agent.session.turn.reasoning_summary_part.added x-stainless-const: true - default: list - description: The type of object returned, must be `list`. - const: list - data: - items: - $ref: '#/components/schemas/SkillVersionResource' - type: array - description: A list of items - first_id: - anyOf: - - type: string - description: The ID of the first item in the list. - - type: 'null' - last_id: - anyOf: - - type: string - description: The ID of the last item in the list. - - type: 'null' - has_more: - type: boolean - description: Whether there are more items available. - type: object + description: The type of the object. Always `agent.session.turn.reasoning_summary_part.added`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + item_id: + type: string + minLength: 0 + description: The ID of the reasoning item. + output_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the item in the turn output. + summary_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the summary content part. + part: + $ref: '#/components/schemas/SummaryTextResource' + description: The initial summary part. required: - - object - - data - - first_id - - last_id - - has_more - CreateSkillVersionBody: - properties: - files: - anyOf: - - items: - type: string - format: binary - type: array - maxItems: 500 - description: Skill files to upload (directory upload) or a single zip file. - - type: string - format: binary - description: Skill zip file to upload. - default: - type: boolean - description: Whether to set this version as the default. + - type + - event_id + - session_id + - turn_id + - item_id + - output_index + - summary_index + - part + additionalProperties: false + description: Emitted when a reasoning summary content part is added. + SessionEventAgentSessionTurnReasoningSummaryPartDone: type: object - description: Uploads a new immutable version of a skill. - title: Create skill version request - DeletedSkillVersionResource: properties: - object: + type: type: string enum: - - skill.version.deleted - default: skill.version.deleted + - agent.session.turn.reasoning_summary_part.done + default: agent.session.turn.reasoning_summary_part.done x-stainless-const: true - deleted: - type: boolean - id: + description: The type of the object. Always `agent.session.turn.reasoning_summary_part.done`. + event_id: type: string - version: + minLength: 0 + description: The unique ID of the event. + session_id: type: string - description: The deleted skill version. - type: object + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + item_id: + type: string + minLength: 0 + description: The ID of the reasoning item. + output_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the item in the turn output. + summary_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the summary part. + part: + $ref: '#/components/schemas/SummaryTextResource' + description: The completed summary part. + status: + type: + - string + - 'null' + enum: + - incomplete + - null + description: Present as `incomplete` when summary generation was interrupted. + x-stainless-const: true required: - - object - - deleted - - id - - version - ChatkitWorkflowTracing: - properties: - enabled: - type: boolean - description: Indicates whether tracing is enabled. + - type + - event_id + - session_id + - turn_id + - item_id + - output_index + - summary_index + - part + - status + additionalProperties: false + description: Emitted when a reasoning summary part is complete. + SessionEventAgentSessionTurnReasoningSummaryTextDelta: type: object - required: - - enabled - title: Tracing Configuration - description: Controls diagnostic tracing during the session. - ChatkitWorkflow: properties: - id: + type: type: string - description: Identifier of the workflow backing the session. - version: - anyOf: - - type: string - description: Specific workflow version used for the session. Defaults to null when using the latest deployment. - - type: 'null' - state_variables: - anyOf: - - additionalProperties: - anyOf: - - type: string - - type: integer - - type: boolean - - type: number - type: object - description: State variable key-value pairs applied when invoking the workflow. Defaults to null when no overrides were provided. - x-oaiTypeLabel: map - - type: 'null' - tracing: - $ref: '#/components/schemas/ChatkitWorkflowTracing' - description: Tracing settings applied to the workflow. - type: object - required: - - id - - version - - state_variables - - tracing - title: Workflow - description: Workflow metadata and state returned for the session. - ChatSessionRateLimits: - properties: - max_requests_per_1_minute: + enum: + - agent.session.turn.reasoning_summary_text.delta + default: agent.session.turn.reasoning_summary_text.delta + x-stainless-const: true + description: The type of the object. Always `agent.session.turn.reasoning_summary_text.delta`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + item_id: + type: string + minLength: 0 + description: The ID of the reasoning item. + output_index: type: integer - description: Maximum allowed requests per one-minute window. - type: object - required: - - max_requests_per_1_minute - title: Rate limits - description: Active per-minute request limit for the session. - ChatSessionStatus: - type: string - enum: - - active - - expired - - cancelled - ChatSessionAutomaticThreadTitling: - properties: - enabled: - type: boolean - description: Whether automatic thread titling is enabled. - type: object + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the item in the turn output. + summary_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the summary content part. + delta: + type: string + minLength: 0 + description: The summary text that was appended. required: - - enabled - title: Automatic thread titling - description: Automatic thread title preferences for the session. - ChatSessionFileUpload: - properties: - enabled: - type: boolean - description: Indicates if uploads are enabled for the session. - max_file_size: - anyOf: - - type: integer - description: Maximum upload size in megabytes. - - type: 'null' - max_files: - anyOf: - - type: integer - description: Maximum number of uploads allowed during the session. - - type: 'null' + - type + - event_id + - session_id + - turn_id + - item_id + - output_index + - summary_index + - delta + additionalProperties: false + description: Emitted when text is appended to a reasoning summary. + SessionEventAgentSessionTurnReasoningSummaryTextDone: type: object - required: - - enabled - - max_file_size - - max_files - title: File upload settings - description: Upload permissions and limits applied to the session. - ChatSessionHistory: properties: - enabled: - type: boolean - description: Indicates if chat history is persisted for the session. - recent_threads: - anyOf: - - type: integer - description: Number of prior threads surfaced in history views. Defaults to null when all history is retained. - - type: 'null' - type: object + type: + type: string + enum: + - agent.session.turn.reasoning_summary_text.done + default: agent.session.turn.reasoning_summary_text.done + x-stainless-const: true + description: The type of the object. Always `agent.session.turn.reasoning_summary_text.done`. + event_id: + type: string + minLength: 0 + description: The unique ID of the event. + session_id: + type: string + minLength: 0 + description: The ID of the session associated with the event. + turn_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the turn associated with the event, when applicable. + item_id: + type: string + minLength: 0 + description: The ID of the reasoning item. + output_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the item in the turn output. + summary_index: + type: integer + format: int64 + minimum: 0 + maximum: 4294967295 + description: The index of the summary content part. + text: + type: string + minLength: 0 + description: The complete reasoning summary text. required: - - enabled - - recent_threads - title: History settings - description: History retention preferences returned for the session. - ChatSessionChatkitConfiguration: - properties: - automatic_thread_titling: - $ref: '#/components/schemas/ChatSessionAutomaticThreadTitling' - description: Automatic thread titling preferences. - file_upload: - $ref: '#/components/schemas/ChatSessionFileUpload' - description: Upload settings for the session. - history: - $ref: '#/components/schemas/ChatSessionHistory' - description: History retention configuration. + - type + - event_id + - session_id + - turn_id + - item_id + - output_index + - summary_index + - text + additionalProperties: false + description: Emitted when a reasoning summary content part is complete. + SessionEvent: + description: An event emitted by a Managed Agents session. + discriminator: + propertyName: type + mapping: + error: '#/components/schemas/SessionEventError' + agent.session.environment.ready: '#/components/schemas/SessionEventAgentSessionEnvironmentReady' + agent.output.command_execution_output.delta: '#/components/schemas/SessionEventAgentOutputCommandExecutionOutputDelta' + agent.session.created: '#/components/schemas/SessionEventAgentSessionCreated' + agent.session.turn.created: '#/components/schemas/SessionEventAgentSessionTurnCreated' + agent.session.turn.in_progress: '#/components/schemas/SessionEventAgentSessionTurnInProgress' + agent.session.turn.completed: '#/components/schemas/SessionEventAgentSessionTurnCompleted' + agent.session.turn.failed: '#/components/schemas/SessionEventAgentSessionTurnFailed' + agent.session.turn.cancelled: '#/components/schemas/SessionEventAgentSessionTurnCancelled' + agent.session.turn.item.added: '#/components/schemas/SessionEventAgentSessionTurnItemAdded' + agent.session.idle: '#/components/schemas/SessionEventAgentSessionIdle' + agent.session.in_progress: '#/components/schemas/SessionEventAgentSessionInProgress' + agent.session.requires_action: '#/components/schemas/SessionEventAgentSessionRequiresAction' + agent.session.failed: '#/components/schemas/SessionEventAgentSessionFailed' + agent.session.environment.pending: '#/components/schemas/SessionEventAgentSessionEnvironmentPending' + agent.session.environment.connected: '#/components/schemas/SessionEventAgentSessionEnvironmentConnected' + agent.session.environment.disconnected: '#/components/schemas/SessionEventAgentSessionEnvironmentDisconnected' + agent.session.environment.failed: '#/components/schemas/SessionEventAgentSessionEnvironmentFailed' + agent.session.subagent.created: '#/components/schemas/SessionEventAgentSessionSubagentCreated' + agent.session.subagent.active: '#/components/schemas/SessionEventAgentSessionSubagentActive' + agent.session.subagent.closed: '#/components/schemas/SessionEventAgentSessionSubagentClosed' + agent.session.turn.item.done: '#/components/schemas/SessionEventAgentSessionTurnItemDone' + agent.session.turn.content_part.added: '#/components/schemas/SessionEventAgentSessionTurnContentPartAdded' + agent.session.turn.content_part.done: '#/components/schemas/SessionEventAgentSessionTurnContentPartDone' + agent.session.turn.output_text.delta: '#/components/schemas/SessionEventAgentSessionTurnOutputTextDelta' + agent.session.turn.output_text.done: '#/components/schemas/SessionEventAgentSessionTurnOutputTextDone' + agent.session.turn.reasoning_summary_part.added: '#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartAdded' + agent.session.turn.reasoning_summary_part.done: '#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartDone' + agent.session.turn.reasoning_summary_text.delta: '#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDelta' + agent.session.turn.reasoning_summary_text.done: '#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDone' + x-oai-discriminator-values: + - error + - agent.session.environment.ready + - agent.output.command_execution_output.delta + - agent.session.created + - agent.session.turn.created + - agent.session.turn.in_progress + - agent.session.turn.completed + - agent.session.turn.failed + - agent.session.turn.cancelled + - agent.session.turn.item.added + - agent.session.idle + - agent.session.in_progress + - agent.session.requires_action + - agent.session.failed + - agent.session.environment.pending + - agent.session.environment.connected + - agent.session.environment.disconnected + - agent.session.environment.failed + - agent.session.subagent.created + - agent.session.subagent.active + - agent.session.subagent.closed + - agent.session.turn.item.done + - agent.session.turn.content_part.added + - agent.session.turn.content_part.done + - agent.session.turn.output_text.delta + - agent.session.turn.output_text.done + - agent.session.turn.reasoning_summary_part.added + - agent.session.turn.reasoning_summary_part.done + - agent.session.turn.reasoning_summary_text.delta + - agent.session.turn.reasoning_summary_text.done + anyOf: + - $ref: '#/components/schemas/SessionEventError' + - $ref: '#/components/schemas/SessionEventAgentSessionEnvironmentReady' + - $ref: '#/components/schemas/SessionEventAgentOutputCommandExecutionOutputDelta' + - $ref: '#/components/schemas/SessionEventAgentSessionCreated' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnCreated' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnInProgress' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnCompleted' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnFailed' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnCancelled' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnItemAdded' + - $ref: '#/components/schemas/SessionEventAgentSessionIdle' + - $ref: '#/components/schemas/SessionEventAgentSessionInProgress' + - $ref: '#/components/schemas/SessionEventAgentSessionRequiresAction' + - $ref: '#/components/schemas/SessionEventAgentSessionFailed' + - $ref: '#/components/schemas/SessionEventAgentSessionEnvironmentPending' + - $ref: '#/components/schemas/SessionEventAgentSessionEnvironmentConnected' + - $ref: '#/components/schemas/SessionEventAgentSessionEnvironmentDisconnected' + - $ref: '#/components/schemas/SessionEventAgentSessionEnvironmentFailed' + - $ref: '#/components/schemas/SessionEventAgentSessionSubagentCreated' + - $ref: '#/components/schemas/SessionEventAgentSessionSubagentActive' + - $ref: '#/components/schemas/SessionEventAgentSessionSubagentClosed' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnItemDone' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnContentPartAdded' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnContentPartDone' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnOutputTextDelta' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnOutputTextDone' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartAdded' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryPartDone' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDelta' + - $ref: '#/components/schemas/SessionEventAgentSessionTurnReasoningSummaryTextDone' + UpdateAgentSessionParams: + type: object + properties: + metadata: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 512 + propertyNames: + type: string + minLength: 1 + maxLength: 64 + minProperties: 0 + maxProperties: 16 + description: Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. + additionalProperties: false + description: Fields to update on an existing session. + DeletedSessionResource: type: object - required: - - automatic_thread_titling - - file_upload - - history - title: ChatKit configuration - description: ChatKit configuration for the session. - ChatSessionResource: properties: id: type: string - description: Identifier for the ChatKit session. + minLength: 0 + description: The ID of the deleted session. object: type: string enum: - - chatkit.session - description: Type discriminator that is always `chatkit.session`. - default: chatkit.session + - agent.session.deleted + default: agent.session.deleted x-stainless-const: true - expires_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the session expires. - client_secret: - type: string - description: Ephemeral client secret that authenticates session requests. - workflow: - $ref: '#/components/schemas/ChatkitWorkflow' - description: Workflow metadata for the session. - user: - type: string - description: User identifier associated with the session. - rate_limits: - $ref: '#/components/schemas/ChatSessionRateLimits' - description: Resolved rate limit values. - max_requests_per_1_minute: - type: integer - description: Convenience copy of the per-minute request limit. - status: - $ref: '#/components/schemas/ChatSessionStatus' - description: Current lifecycle state of the session. - chatkit_configuration: - $ref: '#/components/schemas/ChatSessionChatkitConfiguration' - description: Resolved ChatKit feature configuration for the session. - type: object + description: The object type. Always `agent.session.deleted`. + deleted: + type: boolean + description: Whether the session has been removed from the public API. Always `true`. Physical cleanup may still be in progress. required: - id - object - - expires_at - - client_secret - - workflow - - user - - rate_limits - - max_requests_per_1_minute - - status - - chatkit_configuration - title: The chat session object - description: Represents a ChatKit session and its resolved configuration. - WorkflowTracingParam: - properties: - enabled: - type: boolean - description: Whether tracing is enabled during the session. Defaults to true. + - deleted + additionalProperties: false + description: A Managed Agents session removed from the public API. Physical cleanup may continue asynchronously. + SessionArtifactResource: type: object - required: [] - title: Tracing Configuration - description: Controls diagnostic tracing during the session. - WorkflowParam: properties: id: type: string - description: Identifier for the workflow invoked by the session. - version: - type: string - description: Specific workflow version to run. Defaults to the latest deployed version. - state_variables: - additionalProperties: - anyOf: - - type: string - maxLength: 10485760 - - type: integer - - type: boolean - - type: number - type: object - maxProperties: 64 - description: State variables forwarded to the workflow. Keys may be up to 64 characters, values must be primitive types, and the map defaults to an empty object. - x-oaiTypeLabel: map - tracing: - $ref: '#/components/schemas/WorkflowTracingParam' - description: Optional tracing overrides for the workflow invocation. When omitted, tracing is enabled by default. - type: object - required: - - id - title: Workflow settings - description: Workflow reference and overrides applied to the chat session. - ExpiresAfterParam: - properties: - anchor: + minLength: 0 + description: The immutable artifact ID. + object: type: string enum: - - created_at - description: Base timestamp used to calculate expiration. Currently fixed to `created_at`. - default: created_at + - agent.session.artifact + default: agent.session.artifact x-stainless-const: true - seconds: + description: The object type. Always `agent.session.artifact`. + session_id: + type: string + minLength: 0 + description: The ID of the session that owns the artifact. + environment_id: + type: string + minLength: 0 + description: The ID of the environment that produced the artifact. + turn_id: + type: string + minLength: 0 + description: The ID of the completed turn that published the artifact. + path: + type: string + minLength: 0 + description: The original absolute file path in the execution environment. + size_bytes: type: integer - maximum: 600 - minimum: 1 format: int64 - description: Number of seconds after the anchor when the session expires. - type: object - required: - - anchor - - seconds - title: Expiration overrides - description: Controls when the session expires relative to an anchor timestamp. - RateLimitsParam: - properties: - max_requests_per_1_minute: - type: integer - minimum: 1 - description: Maximum number of requests allowed per minute for the session. Defaults to 10. - type: object - required: [] - title: Rate limit overrides - description: Controls request rate limits for the session. - AutomaticThreadTitlingParam: - properties: - enabled: - type: boolean - description: Enable automatic thread title generation. Defaults to true. - type: object - required: [] - title: Automatic thread titling configuration - description: Controls whether ChatKit automatically generates thread titles. - FileUploadParam: - properties: - enabled: - type: boolean - description: Enable uploads for this session. Defaults to false. - max_file_size: - type: integer - maximum: 512 - minimum: 1 - description: Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is the maximum allowable size. - max_files: + minimum: 0 + description: The immutable artifact size in bytes. + created_at: type: integer - minimum: 1 - description: Maximum number of files that can be uploaded to the session. Defaults to 10. + format: int64 + description: The Unix timestamp, in seconds, when the artifact was published. + required: + - id + - object + - session_id + - environment_id + - turn_id + - path + - size_bytes + - created_at + additionalProperties: false + description: An immutable file published by a completed hosted session turn. + SessionArtifactListResource: type: object - required: [] - title: File upload configuration - description: Controls whether users can upload files. - HistoryParam: properties: - enabled: + object: + type: string + enum: + - list + default: list + x-stainless-const: true + description: The object type, which is always `list`. + data: + type: array + items: + $ref: '#/components/schemas/SessionArtifactResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: type: boolean - description: Enables chat users to access previous ChatKit threads. Defaults to true. - recent_threads: - type: integer - minimum: 1 - description: Number of recent ChatKit threads users have access to. Defaults to unlimited when unset. - type: object - required: [] - title: Chat history configuration - description: Controls how much historical context is retained for the session. - ChatkitConfigurationParam: - properties: - automatic_thread_titling: - $ref: '#/components/schemas/AutomaticThreadTitlingParam' - description: Configuration for automatic thread titling. When omitted, automatic thread titling is enabled by default. - file_upload: - $ref: '#/components/schemas/FileUploadParam' - description: Configuration for upload enablement and limits. When omitted, uploads are disabled by default (max_files 10, max_file_size 512 MB). - history: - $ref: '#/components/schemas/HistoryParam' - description: Configuration for chat history retention. When omitted, history is enabled by default with no limit on recent_threads (null). + description: Whether there are more resources to retrieve after this page. + required: + - object + - data + - first_id + - last_id + - has_more + additionalProperties: false + description: A page of Agents API resources, with IDs for retrieving additional pages. + DeletedSessionArtifactResource: type: object - required: [] - title: ChatKit configuration overrides - description: Optional per-session configuration settings for ChatKit behavior. - CreateChatSessionBody: properties: - workflow: - $ref: '#/components/schemas/WorkflowParam' - description: Workflow that powers the session. - user: + id: type: string - minLength: 1 - description: A free-form string that identifies your end user; ensures this Session can access other objects that have the same `user` scope. - expires_after: - $ref: '#/components/schemas/ExpiresAfterParam' - description: Optional override for session expiration timing in seconds from creation. Defaults to 10 minutes. - rate_limits: - $ref: '#/components/schemas/RateLimitsParam' - description: Optional override for per-minute request limits. When omitted, defaults to 10. - chatkit_configuration: - $ref: '#/components/schemas/ChatkitConfigurationParam' - description: Optional overrides for ChatKit runtime configuration features - type: object + minLength: 0 + description: The ID of the deleted session artifact. + object: + type: string + enum: + - agent.session.artifact.deleted + default: agent.session.artifact.deleted + x-stainless-const: true + description: The object type. Always `agent.session.artifact.deleted`. + deleted: + type: boolean + description: Whether the session artifact was deleted. Always `true`. required: - - workflow - - user - title: Create chat session request - description: Parameters for provisioning a new ChatKit session. - UserMessageInputText: + - id + - object + - deleted + additionalProperties: false + description: Confirmation that an immutable session artifact was deleted. + SessionInputParamAgentSessionInputMessage: + type: object properties: type: type: string enum: - - input_text - description: Type discriminator that is always `input_text`. - default: input_text + - agent.session.input.message + default: agent.session.input.message x-stainless-const: true - text: - type: string - description: Plain-text content supplied by the user. - type: object + description: The type of the object. Always `agent.session.input.message`. + input: + type: array + items: + $ref: '#/components/schemas/InputMessageParam' + minItems: 0 + maxItems: 16384 + description: The user messages to add to the session. required: - type - - text - title: User message input - description: Text block that a user contributed to the thread. - UserMessageQuotedText: + - input + additionalProperties: false + description: Adds one or more user messages and starts a turn. + SessionInputParamAgentSessionInputCancel: + type: object properties: type: type: string enum: - - quoted_text - description: Type discriminator that is always `quoted_text`. - default: quoted_text + - agent.session.input.cancel + default: agent.session.input.cancel x-stainless-const: true - text: - type: string - description: Quoted text content. - type: object + description: The type of the object. Always `agent.session.input.cancel`. required: - type - - text - title: User message quoted text - description: Quoted snippet that the user referenced in their message. - AttachmentType: - type: string - enum: - - image - - file - Attachment: + additionalProperties: false + description: Cancels the session's active turn. + FunctionCallOutputParam: + description: A function result represented as text or supported model-input content. + anyOf: + - type: string + minLength: 0 + maxLength: 1048576 + - type: array + items: + $ref: '#/components/schemas/InputContentParam' + minItems: 0 + maxItems: 16384 + SessionInputParamAgentSessionInputToolResult: + type: object properties: type: - $ref: '#/components/schemas/AttachmentType' - description: Attachment discriminator. - id: type: string - description: Identifier for the attachment. - name: + enum: + - agent.session.input.tool_result + default: agent.session.input.tool_result + x-stainless-const: true + description: The type of the object. Always `agent.session.input.tool_result`. + turn_id: type: string - description: Original display name for the attachment. - mime_type: + minLength: 0 + maxLength: 1048576 + description: The ID of the turn that requested the function call. + call_id: type: string - description: MIME type of the attachment. - preview_url: + minLength: 0 + maxLength: 1048576 + description: The ID of the function call. + success: + type: boolean + description: Whether the function call succeeded. + output: anyOf: - - type: string - format: uri - description: Preview URL for rendering the attachment inline. + - $ref: '#/components/schemas/FunctionCallOutputParam' - type: 'null' - type: object + description: The function result when the call succeeded. + error: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The error message when the call failed. required: - type - - id - - name - - mime_type - - preview_url - title: Attachment - description: Attachment metadata included on thread items. - ToolChoice: - properties: - id: - type: string - description: Identifier of the requested tool. + - turn_id + - call_id + - success + additionalProperties: false + description: Submits the result of a function call. + SessionInputParam: + description: Input submitted to an existing session. + discriminator: + propertyName: type + mapping: + agent.session.input.message: '#/components/schemas/SessionInputParamAgentSessionInputMessage' + agent.session.input.cancel: '#/components/schemas/SessionInputParamAgentSessionInputCancel' + agent.session.input.tool_result: '#/components/schemas/SessionInputParamAgentSessionInputToolResult' + x-oai-discriminator-values: + - agent.session.input.message + - agent.session.input.cancel + - agent.session.input.tool_result + anyOf: + - $ref: '#/components/schemas/SessionInputParamAgentSessionInputMessage' + - $ref: '#/components/schemas/SessionInputParamAgentSessionInputCancel' + - $ref: '#/components/schemas/SessionInputParamAgentSessionInputToolResult' + CreateSessionEventsParams: type: object - required: - - id - title: Tool choice - description: Tool selection that the assistant should honor when executing the item. - InferenceOptions: properties: - tool_choice: - anyOf: - - $ref: '#/components/schemas/ToolChoice' - description: Preferred tool to invoke. Defaults to null when ChatKit should auto-select. - - type: 'null' - model: - anyOf: - - type: string - description: Model name that generated the response. Defaults to null when using the session default. - - type: 'null' - type: object + events: + type: array + items: + $ref: '#/components/schemas/SessionInputParam' + minItems: 0 + maxItems: 16384 + description: The input events to submit to the session. required: - - tool_choice - - model - title: Inference options - description: Model and tool overrides applied when generating the assistant response. - UserMessageItem: + - events + additionalProperties: false + description: Input events submitted to an existing session. + VaultStatusParam: + type: string + enum: + - active + - archived + description: Whether a vault or credential is active or archived. + VaultStatusFilterParam: + description: One or more lifecycle statuses to include when listing vaults or credentials. + anyOf: + - $ref: '#/components/schemas/VaultStatusParam' + - type: array + items: + $ref: '#/components/schemas/VaultStatusParam' + minItems: 0 + maxItems: 16384 + VaultResource: + type: object properties: id: type: string - description: Identifier of the thread item. + minLength: 0 + description: The ID of the vault. object: type: string enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item + - vault + default: vault x-stainless-const: true + description: The object type. Always `vault`. + name: + type: + - string + - 'null' + minLength: 0 + description: The human-readable name of the vault, if set. + metadata: + type: object + additionalProperties: + type: string + minLength: 0 + propertyNames: + type: string + minLength: 0 + minProperties: 0 + description: Key-value pairs associated with the vault, such as an application or team identifier. created_at: type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: - type: string - description: Identifier of the parent thread. - type: + format: int64 + description: The Unix timestamp, in seconds, when the vault was created. + required: + - id + - object + - name + - metadata + - created_at + additionalProperties: false + description: A collection of credentials that agent tools can use to authenticate to MCP servers. + VaultListResource: + type: object + properties: + object: type: string enum: - - chatkit.user_message - default: chatkit.user_message + - list + default: list x-stainless-const: true - content: - items: - discriminator: - propertyName: type - description: Content blocks that comprise a user message. - anyOf: - - $ref: '#/components/schemas/UserMessageInputText' - - $ref: '#/components/schemas/UserMessageQuotedText' + description: The object type, which is always `list`. + data: type: array - description: Ordered content elements supplied by the user. - attachments: items: - $ref: '#/components/schemas/Attachment' - type: array - description: Attachments associated with the user message. Defaults to an empty list. - inference_options: - anyOf: - - $ref: '#/components/schemas/InferenceOptions' - description: Inference overrides applied to the message. Defaults to null when unset. - - type: 'null' + $ref: '#/components/schemas/VaultResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. + required: + - object + - data + - first_id + - last_id + - has_more + additionalProperties: false + description: A page of Agents API resources, with IDs for retrieving additional pages. + CreateVaultParams: + type: object + properties: + name: + type: string + minLength: 1 + maxLength: 1048576 + description: The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming. + metadata: + type: + - object + - 'null' + additionalProperties: + type: string + minLength: 0 + maxLength: 1048576 + propertyNames: + type: string + minLength: 1 + maxLength: 256 + minProperties: 0 + maxProperties: 1024 + description: Key-value pairs to associate with the vault, such as an application or team identifier. + additionalProperties: false + description: Parameters for creating a vault to store credentials used by agent tools. + DeletedVaultResource: type: object + properties: + id: + type: string + minLength: 0 + description: The ID of the deleted vault. + object: + type: string + enum: + - vault.deleted + default: vault.deleted + x-stainless-const: true + description: The object type. Always `vault.deleted`. + deleted: + type: boolean + description: Whether the resource was deleted. Always `true`. required: - id - object - - created_at - - thread_id - - type - - content - - attachments - - inference_options - title: User Message Item - description: User-authored messages within a thread. - FileAnnotationSource: + - deleted + additionalProperties: false + description: Confirmation that a vault was deleted. + McpOauthTokenEndpointAuthResourceNone: + type: object properties: type: type: string enum: - - file - description: Type discriminator that is always `file`. - default: file + - none + default: none x-stainless-const: true - filename: - type: string - description: Filename referenced by the annotation. - type: object + description: The type of the object. Always `none`. required: - type - - filename - title: File annotation source - description: Attachment source referenced by an annotation. - FileAnnotation: + additionalProperties: false + description: Sends the client ID without a client secret. + McpOauthTokenEndpointAuthResourceClientSecretBasic: + type: object properties: type: type: string enum: - - file - description: Type discriminator that is always `file` for this annotation. - default: file + - client_secret_basic + default: client_secret_basic x-stainless-const: true - source: - $ref: '#/components/schemas/FileAnnotationSource' - description: File attachment referenced by the annotation. - type: object + description: The type of the object. Always `client_secret_basic`. required: - type - - source - title: File annotation - description: Annotation that references an uploaded file. - UrlAnnotationSource: + additionalProperties: false + description: Sends the client ID and secret using HTTP Basic authentication. + McpOauthTokenEndpointAuthResourceClientSecretPost: + type: object properties: type: type: string enum: - - url - description: Type discriminator that is always `url`. - default: url + - client_secret_post + default: client_secret_post x-stainless-const: true - url: - type: string - format: uri - description: URL referenced by the annotation. - type: object + description: The type of the object. Always `client_secret_post`. required: - type - - url - title: URL annotation source - description: URL backing an annotation entry. - UrlAnnotation: + additionalProperties: false + description: Sends the client ID and secret in the token request body. + McpOauthTokenEndpointAuthResource: + description: The client authentication method used for OAuth token refresh. + discriminator: + propertyName: type + mapping: + none: '#/components/schemas/McpOauthTokenEndpointAuthResourceNone' + client_secret_basic: '#/components/schemas/McpOauthTokenEndpointAuthResourceClientSecretBasic' + client_secret_post: '#/components/schemas/McpOauthTokenEndpointAuthResourceClientSecretPost' + x-oai-discriminator-values: + - none + - client_secret_basic + - client_secret_post + anyOf: + - $ref: '#/components/schemas/McpOauthTokenEndpointAuthResourceNone' + - $ref: '#/components/schemas/McpOauthTokenEndpointAuthResourceClientSecretBasic' + - $ref: '#/components/schemas/McpOauthTokenEndpointAuthResourceClientSecretPost' + McpOauthRefreshResource: + type: object + properties: + token_endpoint: + type: string + minLength: 0 + description: The HTTPS OAuth token endpoint used for refresh. + client_id: + type: string + minLength: 0 + description: The OAuth client ID used when requesting a new access token. + resource: + type: + - string + - 'null' + minLength: 0 + description: The resource URI sent to the OAuth token endpoint during refresh, if configured. + scope: + type: + - string + - 'null' + minLength: 0 + description: Space-separated OAuth scopes requested during refresh, if configured. + token_endpoint_auth: + $ref: '#/components/schemas/McpOauthTokenEndpointAuthResource' + description: How the OAuth client authenticates to the token endpoint, excluding its client secret. + required: + - token_endpoint + - client_id + - resource + - scope + - token_endpoint_auth + additionalProperties: false + description: Configuration used to refresh an MCP OAuth access token, excluding secret values. + VaultCredentialAuthResourceMcpOauth: + type: object properties: type: type: string enum: - - url - description: Type discriminator that is always `url` for this annotation. - default: url + - mcp_oauth + default: mcp_oauth x-stainless-const: true - source: - $ref: '#/components/schemas/UrlAnnotationSource' - description: URL referenced by the annotation. - type: object + description: The type of the object. Always `mcp_oauth`. + mcp_server_url: + type: string + minLength: 0 + description: The HTTPS MCP server URL authorized by this credential. + expires_at: + type: + - string + - 'null' + minLength: 0 + description: When the OAuth access token expires, as an RFC 3339 timestamp, if known. + refresh: + anyOf: + - $ref: '#/components/schemas/McpOauthRefreshResource' + - type: 'null' + description: Public refresh metadata without refresh tokens or OAuth client secrets. required: - type - - source - title: URL annotation - description: Annotation that references a URL. - ResponseOutputText: + - mcp_server_url + - expires_at + - refresh + additionalProperties: false + description: Public metadata for an OAuth credential; tokens and client secrets are never returned. + VaultCredentialAuthResourceStaticBearer: + type: object properties: type: type: string enum: - - output_text - description: Type discriminator that is always `output_text`. - default: output_text + - static_bearer + default: static_bearer x-stainless-const: true - text: + description: The type of the object. Always `static_bearer`. + mcp_server_url: type: string - description: Assistant generated text. - annotations: - items: - discriminator: - propertyName: type - description: Annotation object describing a cited source. - anyOf: - - $ref: '#/components/schemas/FileAnnotation' - - $ref: '#/components/schemas/UrlAnnotation' - type: array - description: Ordered list of annotations attached to the response text. - type: object + minLength: 0 + description: The HTTPS MCP server URL authorized by this credential. required: - type - - text - - annotations - title: Assistant message content - description: Assistant response text accompanied by optional annotations. - AssistantMessageItem: + - mcp_server_url + additionalProperties: false + description: Metadata for a bearer-token credential, without automatic OAuth refresh. + VaultCredentialAuthResource: + description: The MCP server and authentication configuration of a vault credential, excluding secrets. + discriminator: + propertyName: type + mapping: + mcp_oauth: '#/components/schemas/VaultCredentialAuthResourceMcpOauth' + static_bearer: '#/components/schemas/VaultCredentialAuthResourceStaticBearer' + x-oai-discriminator-values: + - mcp_oauth + - static_bearer + anyOf: + - $ref: '#/components/schemas/VaultCredentialAuthResourceMcpOauth' + - $ref: '#/components/schemas/VaultCredentialAuthResourceStaticBearer' + VaultCredentialResource: + type: object properties: id: type: string - description: Identifier of the thread item. + minLength: 0 + description: The ID of the credential. object: type: string enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item + - vault.credential + default: vault.credential x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: + description: The object type. Always `vault.credential`. + vault_id: type: string - description: Identifier of the parent thread. - type: + minLength: 0 + description: The ID of the vault containing this credential. + name: type: string - enum: - - chatkit.assistant_message - description: Type discriminator that is always `chatkit.assistant_message`. - default: chatkit.assistant_message - x-stainless-const: true - content: - items: - $ref: '#/components/schemas/ResponseOutputText' - type: array - description: Ordered assistant response segments. - type: object + minLength: 0 + description: The human-readable name of the credential. + auth: + $ref: '#/components/schemas/VaultCredentialAuthResource' + description: The authentication method and non-secret configuration for the MCP server. + created_at: + type: integer + format: int64 + description: The Unix timestamp, in seconds, when the credential was created. + updated_at: + type: integer + format: int64 + description: The Unix timestamp, in seconds, when the credential was last updated. required: - id - object + - vault_id + - name + - auth - created_at - - thread_id - - type - - content - title: Assistant message - description: Assistant-authored message within a thread. - WidgetMessageItem: + - updated_at + additionalProperties: false + description: Metadata for a stored MCP server credential. Secret values are never returned. + VaultCredentialListResource: + type: object properties: - id: - type: string - description: Identifier of the thread item. object: type: string enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item + - list + default: list x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: - type: string - description: Identifier of the parent thread. + description: The object type, which is always `list`. + data: + type: array + items: + $ref: '#/components/schemas/VaultCredentialResource' + minItems: 0 + maxItems: 2000 + description: The resources returned in this page, in the requested sort order. + first_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the first resource in `data`, or `null` if the page is empty. + last_id: + type: + - string + - 'null' + minLength: 0 + description: The ID of the last resource in `data`, or `null` if the page is empty. Pass this as `after` with the same order and filters. + has_more: + type: boolean + description: Whether there are more resources to retrieve after this page. + required: + - object + - data + - first_id + - last_id + - has_more + additionalProperties: false + description: A page of Agents API resources, with IDs for retrieving additional pages. + CreateMcpOauthTokenEndpointAuthParamNone: + type: object + properties: type: type: string enum: - - chatkit.widget - description: Type discriminator that is always `chatkit.widget`. - default: chatkit.widget + - none + default: none x-stainless-const: true - widget: - type: string - description: Serialized widget payload rendered in the UI. - type: object + description: The type of the object. Always `none`. required: - - id - - object - - created_at - - thread_id - type - - widget - title: Widget message - description: Thread item that renders a widget payload. - ClientToolCallStatus: - type: string - enum: - - in_progress - - completed - ClientToolCallItem: + additionalProperties: false + description: Sends the client ID without a client secret. + CreateMcpOauthTokenEndpointAuthParamClientSecretBasic: + type: object properties: - id: - type: string - description: Identifier of the thread item. - object: + type: type: string enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item + - client_secret_basic + default: client_secret_basic x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: + description: The type of the object. Always `client_secret_basic`. + client_secret: type: string - description: Identifier of the parent thread. + minLength: 0 + maxLength: 1048576 + description: The OAuth client secret to store. Never returned in credential resources. + required: + - type + - client_secret + additionalProperties: false + description: Sends the client ID and secret using HTTP Basic authentication. + CreateMcpOauthTokenEndpointAuthParamClientSecretPost: + type: object + properties: type: type: string enum: - - chatkit.client_tool_call - description: Type discriminator that is always `chatkit.client_tool_call`. - default: chatkit.client_tool_call + - client_secret_post + default: client_secret_post x-stainless-const: true - status: - $ref: '#/components/schemas/ClientToolCallStatus' - description: Execution status for the tool call. - call_id: - type: string - description: Identifier for the client tool call. - name: - type: string - description: Tool name that was invoked. - arguments: + description: The type of the object. Always `client_secret_post`. + client_secret: type: string - description: JSON-encoded arguments that were sent to the tool. - output: - anyOf: - - type: string - description: JSON-encoded output captured from the tool. Defaults to null while execution is in progress. - - type: 'null' - type: object + minLength: 0 + maxLength: 1048576 + description: The OAuth client secret to store. Never returned in credential resources. required: - - id - - object - - created_at - - thread_id - type - - status - - call_id - - name - - arguments - - output - title: Client tool call - description: Record of a client side tool invocation initiated by the assistant. - TaskType: - type: string - enum: - - custom - - thought - TaskItem: + - client_secret + additionalProperties: false + description: Sends the client ID and secret in the token request body. + CreateMcpOauthTokenEndpointAuthParam: + description: Client authentication credentials for OAuth token refresh. + discriminator: + propertyName: type + mapping: + none: '#/components/schemas/CreateMcpOauthTokenEndpointAuthParamNone' + client_secret_basic: '#/components/schemas/CreateMcpOauthTokenEndpointAuthParamClientSecretBasic' + client_secret_post: '#/components/schemas/CreateMcpOauthTokenEndpointAuthParamClientSecretPost' + x-oai-discriminator-values: + - none + - client_secret_basic + - client_secret_post + anyOf: + - $ref: '#/components/schemas/CreateMcpOauthTokenEndpointAuthParamNone' + - $ref: '#/components/schemas/CreateMcpOauthTokenEndpointAuthParamClientSecretBasic' + - $ref: '#/components/schemas/CreateMcpOauthTokenEndpointAuthParamClientSecretPost' + CreateMcpOauthRefreshParam: + type: object properties: - id: + token_endpoint: type: string - description: Identifier of the thread item. - object: - type: string - enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item - x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: + minLength: 0 + maxLength: 1048576 + description: The HTTPS OAuth token endpoint used to exchange the refresh token for a new access token. + client_id: type: string - description: Identifier of the parent thread. + minLength: 0 + maxLength: 1048576 + description: The OAuth client ID used when requesting a new access token. + resource: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The resource URI to send to the OAuth token endpoint during refresh, if required. + scope: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: Space-separated OAuth scopes to request during refresh, if required. + refresh_token: + type: string + minLength: 0 + maxLength: 1048576 + description: The refresh token to store. This secret is never returned in credential resources. + token_endpoint_auth: + $ref: '#/components/schemas/CreateMcpOauthTokenEndpointAuthParam' + description: How the OAuth client authenticates to the token endpoint. + required: + - token_endpoint + - client_id + - refresh_token + - token_endpoint_auth + additionalProperties: false + description: Configuration for refreshing the access token of an MCP OAuth credential. + CreateVaultCredentialAuthParamMcpOauth: + type: object + properties: type: type: string enum: - - chatkit.task - description: Type discriminator that is always `chatkit.task`. - default: chatkit.task + - mcp_oauth + default: mcp_oauth x-stainless-const: true - task_type: - $ref: '#/components/schemas/TaskType' - description: Subtype for the task. - heading: - anyOf: - - type: string - description: Optional heading for the task. Defaults to null when not provided. - - type: 'null' - summary: + description: The type of the object. Always `mcp_oauth`. + mcp_server_url: + type: string + minLength: 0 + maxLength: 1048576 + description: The HTTPS MCP server URL authorized by this credential. + access_token: + type: string + minLength: 0 + maxLength: 1048576 + description: A write-only OAuth access token; never returned by credential resources. + expires_at: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: When the OAuth access token expires, as an RFC 3339 timestamp, if known. + refresh: anyOf: - - type: string - description: Optional summary that describes the task. Defaults to null when omitted. + - $ref: '#/components/schemas/CreateMcpOauthRefreshParam' - type: 'null' - type: object + description: Optional refresh configuration for an HTTPS OAuth token endpoint. required: - - id - - object - - created_at - - thread_id - type - - task_type - - heading - - summary - title: Task item - description: Task emitted by the workflow to show progress and status updates. - TaskGroupTask: - properties: - type: - $ref: '#/components/schemas/TaskType' - description: Subtype for the grouped task. - heading: - anyOf: - - type: string - description: Optional heading for the grouped task. Defaults to null when not provided. - - type: 'null' - summary: - anyOf: - - type: string - description: Optional summary that describes the grouped task. Defaults to null when omitted. - - type: 'null' + - mcp_server_url + - access_token + additionalProperties: false + description: An OAuth credential for an HTTPS MCP destination. + CreateVaultCredentialAuthParamStaticBearer: type: object - required: - - type - - heading - - summary - title: Task group task - description: Task entry that appears within a TaskGroup. - TaskGroupItem: properties: - id: - type: string - description: Identifier of the thread item. - object: + type: type: string enum: - - chatkit.thread_item - description: Type discriminator that is always `chatkit.thread_item`. - default: chatkit.thread_item + - static_bearer + default: static_bearer x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the item was created. - thread_id: + description: The type of the object. Always `static_bearer`. + mcp_server_url: type: string - description: Identifier of the parent thread. - type: + minLength: 0 + maxLength: 1048576 + description: The HTTPS MCP server URL authorized by this credential. + token: type: string - enum: - - chatkit.task_group - description: Type discriminator that is always `chatkit.task_group`. - default: chatkit.task_group - x-stainless-const: true - tasks: - items: - $ref: '#/components/schemas/TaskGroupTask' - type: array - description: Tasks included in the group. - type: object + minLength: 0 + maxLength: 1048576 + description: The bearer token to store. This secret is never returned in credential resources. required: - - id - - object - - created_at - - thread_id - type - - tasks - title: Task group - description: Collection of workflow tasks grouped together in the thread. - ThreadItem: + - mcp_server_url + - token + additionalProperties: false + description: A bearer token for an MCP server, without automatic OAuth refresh. + CreateVaultCredentialAuthParam: + description: Authentication credentials for an MCP server used by agent tools. discriminator: propertyName: type - title: The thread item + mapping: + mcp_oauth: '#/components/schemas/CreateVaultCredentialAuthParamMcpOauth' + static_bearer: '#/components/schemas/CreateVaultCredentialAuthParamStaticBearer' + x-oai-discriminator-values: + - mcp_oauth + - static_bearer anyOf: - - $ref: '#/components/schemas/UserMessageItem' - - $ref: '#/components/schemas/AssistantMessageItem' - - $ref: '#/components/schemas/WidgetMessageItem' - - $ref: '#/components/schemas/ClientToolCallItem' - - $ref: '#/components/schemas/TaskItem' - - $ref: '#/components/schemas/TaskGroupItem' - ThreadItemListResource: - properties: - object: - x-stainless-const: true - default: list - description: The type of object returned, must be `list`. - const: list - data: - items: - $ref: '#/components/schemas/ThreadItem' - type: array - description: A list of items - first_id: - anyOf: - - type: string - description: The ID of the first item in the list. - - type: 'null' - last_id: - anyOf: - - type: string - description: The ID of the last item in the list. - - type: 'null' - has_more: - type: boolean - description: Whether there are more items available. + - $ref: '#/components/schemas/CreateVaultCredentialAuthParamMcpOauth' + - $ref: '#/components/schemas/CreateVaultCredentialAuthParamStaticBearer' + CreateVaultCredentialParams: type: object + properties: + name: + type: string + minLength: 1 + maxLength: 1048576 + description: The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after trimming. + auth: + $ref: '#/components/schemas/CreateVaultCredentialAuthParam' + description: The authentication method and secret values to store for the MCP server. required: - - object - - data - - first_id - - last_id - - has_more - title: Thread Items - description: A paginated list of thread items rendered for the ChatKit API. - ActiveStatus: + - auth + - name + additionalProperties: false + description: Parameters for storing a credential that authorizes access to an MCP server. + RotateMcpOauthTokenEndpointAuthParamClientSecretBasic: + type: object properties: type: type: string enum: - - active - description: Status discriminator that is always `active`. - default: active + - client_secret_basic + default: client_secret_basic x-stainless-const: true - type: object + description: The type of the object. Always `client_secret_basic`. + client_secret: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources. required: - type - title: Active thread status - description: Indicates that a thread is active. - LockedStatus: + additionalProperties: false + description: Updates credentials sent using HTTP Basic authentication. + RotateMcpOauthTokenEndpointAuthParamClientSecretPost: + type: object properties: type: type: string enum: - - locked - description: Status discriminator that is always `locked`. - default: locked + - client_secret_post + default: client_secret_post x-stainless-const: true - reason: + description: The type of the object. Always `client_secret_post`. + client_secret: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The replacement OAuth client secret. Omit or pass `null` to keep the stored secret. This secret is never returned in resources. + required: + - type + additionalProperties: false + description: Updates credentials sent in the token request body. + RotateMcpOauthTokenEndpointAuthParam: + description: Client-secret updates that preserve the credential's OAuth authentication method. + discriminator: + propertyName: type + mapping: + client_secret_basic: '#/components/schemas/RotateMcpOauthTokenEndpointAuthParamClientSecretBasic' + client_secret_post: '#/components/schemas/RotateMcpOauthTokenEndpointAuthParamClientSecretPost' + x-oai-discriminator-values: + - client_secret_basic + - client_secret_post + anyOf: + - $ref: '#/components/schemas/RotateMcpOauthTokenEndpointAuthParamClientSecretBasic' + - $ref: '#/components/schemas/RotateMcpOauthTokenEndpointAuthParamClientSecretPost' + RotateMcpOauthRefreshParam: + type: object + properties: + refresh_token: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The replacement refresh token. Omit or pass `null` to keep the stored token. This secret is never returned in resources. + scope: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: Replacement space-separated OAuth scopes for refresh requests. Omit to keep the scopes, or pass `null` to stop sending a scope parameter. + token_endpoint_auth: anyOf: - - type: string - description: Reason that the thread was locked. Defaults to null when no reason is recorded. + - $ref: '#/components/schemas/RotateMcpOauthTokenEndpointAuthParam' - type: 'null' + description: Client-secret updates for the existing token endpoint authentication method. + additionalProperties: false + description: Updates to an MCP credential's existing OAuth refresh configuration. + RotateVaultCredentialAuthParamMcpOauth: type: object - required: - - type - - reason - title: Locked thread status - description: Indicates that a thread is locked and cannot accept new input. - ClosedStatus: properties: type: type: string enum: - - closed - description: Status discriminator that is always `closed`. - default: closed + - mcp_oauth + default: mcp_oauth x-stainless-const: true - reason: + description: The type of the object. Always `mcp_oauth`. + access_token: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: A write-only replacement OAuth access token. + expires_at: + type: + - string + - 'null' + minLength: 0 + maxLength: 1048576 + description: The replacement expiry as an RFC 3339 timestamp, or `null` to clear it. Omitting this field preserves the expiry unless a new access token is supplied, in which case the expiry is cleared. + refresh: anyOf: - - type: string - description: Reason that the thread was closed. Defaults to null when no reason is recorded. + - $ref: '#/components/schemas/RotateMcpOauthRefreshParam' - type: 'null' - type: object + description: Optional write-only refresh-token and client-secret updates. required: - type - - reason - title: Closed thread status - description: Indicates that a thread has been closed. - ThreadResource: + additionalProperties: false + description: Rotate an OAuth credential for an HTTPS MCP destination. + RotateVaultCredentialAuthParamStaticBearer: + type: object properties: - id: - type: string - description: Identifier of the thread. - object: + type: type: string enum: - - chatkit.thread - description: Type discriminator that is always `chatkit.thread`. - default: chatkit.thread + - static_bearer + default: static_bearer x-stainless-const: true - created_at: - type: integer - format: unixtime - description: Unix timestamp (in seconds) for when the thread was created. - title: - anyOf: - - type: string - description: Optional human-readable title for the thread. Defaults to null when no title has been generated. - - type: 'null' - status: - discriminator: - propertyName: type - description: Current status for the thread. Defaults to `active` for newly created threads. - anyOf: - - $ref: '#/components/schemas/ActiveStatus' - - $ref: '#/components/schemas/LockedStatus' - - $ref: '#/components/schemas/ClosedStatus' - user: + description: The type of the object. Always `static_bearer`. + token: type: string - description: Free-form string that identifies your end user who owns the thread. + minLength: 0 + maxLength: 1048576 + description: The replacement bearer token. This secret is never returned in credential resources. + required: + - type + - token + additionalProperties: false + description: Replace the bearer token for the credential's MCP server. + RotateVaultCredentialAuthParam: + description: Updates to a vault credential without changing its authentication method or MCP server. + discriminator: + propertyName: type + mapping: + mcp_oauth: '#/components/schemas/RotateVaultCredentialAuthParamMcpOauth' + static_bearer: '#/components/schemas/RotateVaultCredentialAuthParamStaticBearer' + x-oai-discriminator-values: + - mcp_oauth + - static_bearer + anyOf: + - $ref: '#/components/schemas/RotateVaultCredentialAuthParamMcpOauth' + - $ref: '#/components/schemas/RotateVaultCredentialAuthParamStaticBearer' + RotateVaultCredentialParams: type: object + properties: + auth: + $ref: '#/components/schemas/RotateVaultCredentialAuthParam' + description: Replacement values for the credential's existing authentication method. required: - - id - - object - - created_at - - title - - status - - user - title: The thread object - description: Represents a ChatKit thread and its current status. - example: - id: cthr_def456 - object: chatkit.thread - created_at: 1712345600 - title: Demo feedback - status: - type: active - user: user_456 - DeletedThreadResource: + - auth + additionalProperties: false + description: Secret, expiry, and OAuth refresh scope updates for an existing vault credential. + DeletedVaultCredentialResource: + type: object properties: id: type: string - description: Identifier of the deleted thread. + minLength: 0 + description: The ID of the deleted credential. object: type: string enum: - - chatkit.thread.deleted - description: Type discriminator that is always `chatkit.thread.deleted`. - default: chatkit.thread.deleted + - vault.credential.deleted + default: vault.credential.deleted x-stainless-const: true + description: The object type. Always `vault.credential.deleted`. deleted: type: boolean - description: Indicates that the thread has been deleted. - type: object + description: Whether the resource was deleted. Always `true`. required: - id - object - deleted - title: Deleted thread - description: Confirmation payload returned after deleting a thread. - ThreadListResource: - properties: - object: - x-stainless-const: true - default: list - description: The type of object returned, must be `list`. - const: list - data: - items: - $ref: '#/components/schemas/ThreadResource' - type: array - description: A list of items - first_id: - anyOf: - - type: string - description: The ID of the first item in the list. - - type: 'null' - last_id: - anyOf: - - type: string - description: The ID of the last item in the list. - - type: 'null' - has_more: - type: boolean - description: Whether there are more items available. - type: object - required: - - object - - data - - first_id - - last_id - - has_more - title: Threads - description: A paginated list of ChatKit threads. + additionalProperties: false + description: Confirmation that a vault credential was deleted. DragPoint: properties: x: diff --git a/docs/agents-helpers.md b/docs/agents-helpers.md new file mode 100644 index 000000000..70c3ef07e --- /dev/null +++ b/docs/agents-helpers.md @@ -0,0 +1,45 @@ +# Agents session helpers + +Use `client.beta.agents.sessions.stream` to submit input to an idle session and +iterate through one turn. The helper opens the event connection before submitting +input. During iteration, this caller must be the session's only input writer. +Use the block form to close the connection even if iteration is abandoned: + +```ruby +client.beta.agents.sessions.stream("session_id", input: "Summarize the results") do |stream| + stream.each do |event| + if event.type == :"agent.session.turn.output_text.delta" + print event.delta + end + end +end +``` + +Input accepts a string or an array of input messages. The stream yields the +original typed events, including turn failures and cancellations. Protocol errors +with an `error` payload retain the raw event stream's API-exception behavior and +close the connection. Initial idle events +and subagent completions do not end iteration. The stream ends after the selected +coordinator turn completes, fails, or is cancelled and the session becomes idle, +or when the session fails. An unexpected connection end raises `RuntimeError`. +Closing the stream never cancels the backend turn. Without a block, close it in +an `ensure` clause when abandoning iteration. + +Pass `tool_handlers: {"lookup" => ->(arguments) { ... }}` to dispatch registered +function calls sequentially after their events are yielded. Each callback receives +a copied JSON object with string keys and may return a string, JSON object, +input-content array, or `nil`. Invalid arguments, callback errors, and invalid +outputs submit a generic failure without exception text. Unregistered tools stay +available for manual handling through the raw events API. + +Input and tool-result submissions use separate idempotency keys, stable across +retries. `idempotency_key:` applies only to input; a case-insensitive +`Idempotency-Key` in `request_options[:extra_headers]` overrides it. Request +options such as timeout and maximum retries apply to each HTTP request. +`stream.until_done` consumes the stream without processing events in caller code. +For an active session or an unrestricted event feed, use the existing +`client.beta.agents.sessions.events.stream_streaming` method. + +`message.output_text` joins all output-text blocks in an `AgentSessionMessage`. +It returns an empty string when there are none, includes every message phase, +and neither fetches data nor changes the message's serialization. diff --git a/lib/openai.rb b/lib/openai.rb index e0e0f8359..a03ab7d2c 100644 --- a/lib/openai.rb +++ b/lib/openai.rb @@ -78,6 +78,7 @@ require_relative "openai/internal/cursor_page" require_relative "openai/internal/next_cursor_page" require_relative "openai/internal/page" +require_relative "openai/internal/token_page" require_relative "openai/models/admin/organization/admin_api_key" require_relative "openai/helpers/structured_output/json_schema_converter" require_relative "openai/helpers/structured_output/boolean" @@ -159,6 +160,7 @@ require_relative "openai/models/graders/python_grader" require_relative "openai/models/graders/text_similarity_grader" require_relative "openai/models/fine_tuning/fine_tuning_job_wandb_integration_object" +require_relative "openai/models/beta/hosted_environment_file_param" require_relative "openai/models/realtime/realtime_session_create_request" require_relative "openai/models/responses/response_custom_tool_call" require_relative "openai/models/responses/response_custom_tool_call_output" @@ -450,6 +452,132 @@ require_relative "openai/models/batch_request_counts" require_relative "openai/models/batch_retrieve_params" require_relative "openai/models/batch_usage" +require_relative "openai/models/beta/agent" +require_relative "openai/models/beta/agent_close_subagent_call_item" +require_relative "openai/models/beta/agent_command_execution_item" +require_relative "openai/models/beta/agent_content" +require_relative "openai/models/beta/agent_create_params" +require_relative "openai/models/beta/agent_create_subagent_call_item" +require_relative "openai/models/beta/agent_deleted" +require_relative "openai/models/beta/agent_delete_params" +require_relative "openai/models/beta/agent_function_call_item" +require_relative "openai/models/beta/agent_function_call_output" +require_relative "openai/models/beta/agent_function_call_output_param" +require_relative "openai/models/beta/agent_function_call_status" +require_relative "openai/models/beta/agent_interrupt_subagent_call_item" +require_relative "openai/models/beta/agent_list_params" +require_relative "openai/models/beta/agent_mcp_call_item" +require_relative "openai/models/beta/agent_output_command_execution_output_delta_event" +require_relative "openai/models/beta/agent_output_item" +require_relative "openai/models/beta/agent_output_item_status" +require_relative "openai/models/beta/agent_reasoning" +require_relative "openai/models/beta/agent_reasoning_item" +require_relative "openai/models/beta/agent_reasoning_param" +require_relative "openai/models/beta/agent_resume_subagent_call_item" +require_relative "openai/models/beta/agent_retrieve_params" +require_relative "openai/models/beta/agents/environment_info" +require_relative "openai/models/beta/agents/environment_retrieve_params" +require_relative "openai/models/beta/agents/environments/environment_file" +require_relative "openai/models/beta/agents/environments/environment_template" +require_relative "openai/models/beta/agents/environments/environment_template_deleted" +require_relative "openai/models/beta/agents/environments/file_create_params" +require_relative "openai/models/beta/agents/environments/file_list_params" +require_relative "openai/models/beta/agents/environments/template_create_params" +require_relative "openai/models/beta/agents/environments/template_delete_params" +require_relative "openai/models/beta/agents/environments/template_list_params" +require_relative "openai/models/beta/agents/environments/template_retrieve_params" +require_relative "openai/models/beta/agents/environments/template_update_params" +require_relative "openai/models/beta/agents/session_create_params" +require_relative "openai/models/beta/agents/session_delete_params" +require_relative "openai/models/beta/agents/session_list_params" +require_relative "openai/models/beta/agents/session_retrieve_params" +require_relative "openai/models/beta/agents/sessions/artifact_content_params" +require_relative "openai/models/beta/agents/sessions/artifact_delete_params" +require_relative "openai/models/beta/agents/sessions/artifact_list_params" +require_relative "openai/models/beta/agents/sessions/artifact_retrieve_params" +require_relative "openai/models/beta/agents/sessions/event_create_params" +require_relative "openai/models/beta/agents/sessions/event_stream_params" +require_relative "openai/models/beta/agents/sessions/item_list_params" +require_relative "openai/models/beta/agents/sessions/session_artifact" +require_relative "openai/models/beta/agents/sessions/session_artifact_deleted" +require_relative "openai/models/beta/agents/sessions/subagent_list_params" +require_relative "openai/models/beta/agents/sessions/subagent_retrieve_params" +require_relative "openai/models/beta/agents/sessions/subagents/item_list_params" +require_relative "openai/models/beta/agents/sessions/subagents/turn_list_params" +require_relative "openai/models/beta/agents/sessions/subagents/turn_retrieve_params" +require_relative "openai/models/beta/agents/sessions/subagents/turns/item_list_params" +require_relative "openai/models/beta/agents/sessions/turn" +require_relative "openai/models/beta/agents/sessions/turn_list_params" +require_relative "openai/models/beta/agents/sessions/turn_retrieve_params" +require_relative "openai/models/beta/agents/session_update_params" +require_relative "openai/models/beta/agents/vault" +require_relative "openai/models/beta/agents/vault_create_params" +require_relative "openai/models/beta/agents/vault_deleted" +require_relative "openai/models/beta/agents/vault_delete_params" +require_relative "openai/models/beta/agents/vault_list_params" +require_relative "openai/models/beta/agents/vault_retrieve_params" +require_relative "openai/models/beta/agents/vaults/credential" +require_relative "openai/models/beta/agents/vaults/credential_auth" +require_relative "openai/models/beta/agents/vaults/credential_auth_create_param" +require_relative "openai/models/beta/agents/vaults/credential_auth_rotate_param" +require_relative "openai/models/beta/agents/vaults/credential_create_params" +require_relative "openai/models/beta/agents/vaults/credential_deleted" +require_relative "openai/models/beta/agents/vaults/credential_delete_params" +require_relative "openai/models/beta/agents/vaults/credential_list_params" +require_relative "openai/models/beta/agents/vaults/credential_retrieve_params" +require_relative "openai/models/beta/agents/vaults/credential_update_params" +require_relative "openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth" +require_relative "openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_create_param" +require_relative "openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_rotate_param" +require_relative "openai/models/beta/agents/vault_status" +require_relative "openai/models/beta/agents/vault_status_filter" +require_relative "openai/models/beta/agent_send_subagent_input_call_item" +require_relative "openai/models/beta/agent_session" +require_relative "openai/models/beta/agent_session_assistant_message" +require_relative "openai/models/beta/agent_session_created_event" +require_relative "openai/models/beta/agent_session_deleted" +require_relative "openai/models/beta/agent_session_environment_connected_event" +require_relative "openai/models/beta/agent_session_environment_disconnected_event" +require_relative "openai/models/beta/agent_session_environment_failed_event" +require_relative "openai/models/beta/agent_session_environment_pending_event" +require_relative "openai/models/beta/agent_session_environment_ready_event" +require_relative "openai/models/beta/agent_session_environment_state" +require_relative "openai/models/beta/agent_session_error_event" +require_relative "openai/models/beta/agent_session_event" +require_relative "openai/models/beta/agent_session_failed_event" +require_relative "openai/models/beta/agent_session_idle_event" +require_relative "openai/models/beta/agent_session_in_progress_event" +require_relative "openai/models/beta/agent_session_input_message_param" +require_relative "openai/models/beta/agent_session_input_param" +require_relative "openai/models/beta/agent_session_item" +require_relative "openai/models/beta/agent_session_message" +require_relative "openai/models/beta/agent_session_message_content" +require_relative "openai/models/beta/agent_session_requires_action_event" +require_relative "openai/models/beta/agent_session_subagent_active_event" +require_relative "openai/models/beta/agent_session_subagent_closed_event" +require_relative "openai/models/beta/agent_session_subagent_created_event" +require_relative "openai/models/beta/agent_session_turn_cancelled_event" +require_relative "openai/models/beta/agent_session_turn_completed_event" +require_relative "openai/models/beta/agent_session_turn_content_part_added_event" +require_relative "openai/models/beta/agent_session_turn_content_part_done_event" +require_relative "openai/models/beta/agent_session_turn_created_event" +require_relative "openai/models/beta/agent_session_turn_failed_event" +require_relative "openai/models/beta/agent_session_turn_in_progress_event" +require_relative "openai/models/beta/agent_session_turn_item_added_event" +require_relative "openai/models/beta/agent_session_turn_item_done_event" +require_relative "openai/models/beta/agent_session_turn_output_text_delta_event" +require_relative "openai/models/beta/agent_session_turn_output_text_done_event" +require_relative "openai/models/beta/agent_session_turn_reasoning_summary_part_added_event" +require_relative "openai/models/beta/agent_session_turn_reasoning_summary_part_done_event" +require_relative "openai/models/beta/agent_session_turn_reasoning_summary_text_delta_event" +require_relative "openai/models/beta/agent_session_turn_reasoning_summary_text_done_event" +require_relative "openai/models/beta/agent_text" +require_relative "openai/models/beta/agent_text_param" +require_relative "openai/models/beta/agent_tool" +require_relative "openai/models/beta/agent_tool_param" +require_relative "openai/models/beta/agent_update_params" +require_relative "openai/models/beta/agent_wait_for_subagents_call_item" +require_relative "openai/models/beta/agent_web_search_call_item" require_relative "openai/models/beta/assistant" require_relative "openai/models/beta/assistant_create_params" require_relative "openai/models/beta/assistant_deleted" @@ -597,9 +725,30 @@ require_relative "openai/models/beta/chatkit/thread_retrieve_params" require_relative "openai/models/beta/chatkit_workflow" require_relative "openai/models/beta/code_interpreter_tool" +require_relative "openai/models/beta/environment" +require_relative "openai/models/beta/environment_param" require_relative "openai/models/beta/file_search_tool" require_relative "openai/models/beta/function_tool" +require_relative "openai/models/beta/hosted_environment_file" +require_relative "openai/models/beta/hosted_environment_file_id" +require_relative "openai/models/beta/hosted_plugin" +require_relative "openai/models/beta/hosted_plugin_param" +require_relative "openai/models/beta/hosted_skill" +require_relative "openai/models/beta/hosted_skill_param" +require_relative "openai/models/beta/hosted_skill_reference" +require_relative "openai/models/beta/inline_capability_source_param" +require_relative "openai/models/beta/input_content" +require_relative "openai/models/beta/input_content_param" +require_relative "openai/models/beta/mcp_transport" +require_relative "openai/models/beta/mcp_transport_param" require_relative "openai/models/beta/message_stream_event" +require_relative "openai/models/beta/multi_agent_config" +require_relative "openai/models/beta/multi_agent_config_param" +require_relative "openai/models/beta/output_text" +require_relative "openai/models/beta/persisted_agent_tool" +require_relative "openai/models/beta/persisted_agent_tool_param" +require_relative "openai/models/beta/persisted_mcp_transport" +require_relative "openai/models/beta/persisted_mcp_transport_param" require_relative "openai/models/beta/response_cancel_params" require_relative "openai/models/beta/response_compact_params" require_relative "openai/models/beta/response_create_params" @@ -611,6 +760,13 @@ require_relative "openai/models/beta/responses/input_token_count_response" require_relative "openai/models/beta/run_step_stream_event" require_relative "openai/models/beta/run_stream_event" +require_relative "openai/models/beta/session_error" +require_relative "openai/models/beta/session_turn_error" +require_relative "openai/models/beta/setup_command_param" +require_relative "openai/models/beta/subagent" +require_relative "openai/models/beta/summary_text" +require_relative "openai/models/beta/text_format" +require_relative "openai/models/beta/text_format_param" require_relative "openai/models/beta/thread" require_relative "openai/models/beta/thread_create_and_run_params" require_relative "openai/models/beta/thread_create_params" @@ -681,6 +837,8 @@ require_relative "openai/models/beta/threads/text_delta_block" require_relative "openai/models/beta/thread_stream_event" require_relative "openai/models/beta/thread_update_params" +require_relative "openai/models/beta/token_usage" +require_relative "openai/models/beta/web_search_action" require_relative "openai/models/chat/chat_completion" require_relative "openai/models/chat/chat_completion_allowed_tool_choice" require_relative "openai/models/chat/chat_completion_allowed_tools" @@ -1314,6 +1472,21 @@ require_relative "openai/resources/audio/translations" require_relative "openai/resources/batches" require_relative "openai/resources/beta" +require_relative "openai/resources/beta/agents" +require_relative "openai/resources/beta/agents/environments" +require_relative "openai/resources/beta/agents/environments/files" +require_relative "openai/resources/beta/agents/environments/templates" +require_relative "openai/resources/beta/agents/sessions" +require_relative "openai/resources/beta/agents/sessions/artifacts" +require_relative "openai/resources/beta/agents/sessions/events" +require_relative "openai/resources/beta/agents/sessions/items" +require_relative "openai/resources/beta/agents/sessions/subagents" +require_relative "openai/resources/beta/agents/sessions/subagents/items" +require_relative "openai/resources/beta/agents/sessions/subagents/turns" +require_relative "openai/resources/beta/agents/sessions/subagents/turns/items" +require_relative "openai/resources/beta/agents/sessions/turns" +require_relative "openai/resources/beta/agents/vaults" +require_relative "openai/resources/beta/agents/vaults/credentials" require_relative "openai/resources/beta/assistants" require_relative "openai/resources/beta/chatkit" require_relative "openai/resources/beta/chatkit/sessions" @@ -1385,3 +1558,6 @@ require_relative "openai/helpers/websocket" require_relative "openai/helpers/realtime" require_relative "openai/helpers/responses_websocket" + +require_relative "openai/helpers/agents/session_stream" +require_relative "openai/helpers/agents/message" diff --git a/lib/openai/helpers/agents/message.rb b/lib/openai/helpers/agents/message.rb new file mode 100644 index 000000000..0319f0bb1 --- /dev/null +++ b/lib/openai/helpers/agents/message.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionMessage + # Concatenate output-text blocks in message order, without fetching or + # filtering by phase. Reading this method does not change serialization. + # @return [String] + def output_text + content + .filter_map do |part| + (part[:text] || part["text"]) if (part[:type] || part["type"]).to_s == "output_text" + end + .join + end + end + end + end +end diff --git a/lib/openai/helpers/agents/session_stream.rb b/lib/openai/helpers/agents/session_stream.rb new file mode 100644 index 000000000..3737b6388 --- /dev/null +++ b/lib/openai/helpers/agents/session_stream.rb @@ -0,0 +1,168 @@ +# frozen_string_literal: true + +require_relative "tools" + +module OpenAI + module Helpers + module Agents + # Stream one turn on an idle session. The caller must be its only input writer + # until iteration ends, because input submission does not return a turn ID. + # Use a block or ensure #close when abandoning external iteration. + # Closing the connection does not cancel the backend turn. + class SessionStream + include Enumerable + + # @api private + def initialize(sessions:, session_id:, input:, tool_handlers: {}, idempotency_key: nil, request_options: {}) + messages = input.is_a?(String) ? [{role: :user, content: [{type: :input_text, text: input}]}] : input.to_a + raise ArgumentError, "input must not be empty" if input == "" || messages.empty? + + @sessions = sessions + @session_id = session_id + @handlers = tool_handlers.to_h.dup + @options = request_options.to_h.dup + headers = {"OpenAI-Beta" => "agents=v1"}.merge(@options[:extra_headers].to_h) + options_key = @options.delete(:idempotency_key) + input_key = idempotency_key || options_key || SecureRandom.uuid + headers.delete_if do |key, value| + match = key.to_s.casecmp?("idempotency-key") + input_key = value if match + match + end + + @options[:extra_headers] = headers + @recent_events = {} + @handled_calls = {} + @closed = false + session = @sessions.retrieve(@session_id, request_options: @options) + unless session.status == :idle + raise( + ArgumentError, + "sessions.stream requires an idle session; use sessions.events.stream_streaming to follow an active session" + ) + end + + @raw_stream = @sessions.events.stream_streaming(@session_id, request_options: @options) + begin + @sessions.events.create( + @session_id, + events: [{type: :"agent.session.input.message", input: messages}], + idempotency_key: input_key, + request_options: @options + ) + @iterator = iterator + submitted = true + ensure + close unless submitted + end + end + + # Yields the original typed events. Registered handlers run sequentially after + # their function-call event is yielded; unknown tools remain caller-managed. + # @yieldparam event [OpenAI::Models::Beta::AgentSessionEvent] + # @return [Enumerator, self] + def each + return enum_for(:each) unless block_given? + return self if @closed + begin + loop do + break if @closed + yield @iterator.next + end + + ensure + close + end + + self + end + + # Consume remaining events and registered tool calls. + # @return [self] + def until_done + each { |_event| nil } + self + end + + # Close the event connection without cancelling the backend turn. + # @return [void] + def close + return if @closed + + @closed = true + @raw_stream&.close + end + + private + + def iterator + Enumerator.new do |yielder| + begin + @raw_stream.each do |event| + next unless accept?(event) + + terminal = event.type == :"agent.session.failed" || + (event.type == :"agent.session.idle" && @turn_ended) + invocation = prepare_call(event) unless terminal + close if terminal + yielder << event + break if terminal || @closed + + dispatch(invocation.call) if invocation + end + + raise RuntimeError, "Session event stream ended before the turn reached idle or failed" unless @closed + ensure + close + end + end + end + + def accept?(event) + return false if @recent_events.key?(event.event_id) + + @recent_events.shift if @recent_events.size == 1024 + @recent_events[event.event_id] = true + case event.type + when :"agent.session.turn.created" + @turn_id ||= event.turn_id.dup if event.turn.subagent_id.nil? + when :"agent.session.turn.completed", :"agent.session.turn.failed", :"agent.session.turn.cancelled" + @turn_ended = true if @turn_id && event.turn_id == @turn_id + end + + true + end + + def prepare_call(event) + return unless event.type == :"agent.session.turn.item.added" && event.item.type == :function_call + + call = event.item + key = [call.turn_id.dup, call.call_id.dup] + return if @handled_calls.key?(key) + + @handled_calls[key] = true + handler = @handlers[call.name] + return unless handler + + Tools.prepare(call, handler) + end + + def dispatch(result) + idempotency_key = SecureRandom.uuid + delays = [0.1, 0.3, 0.6] + begin + @sessions + .events + .create(@session_id, events: [result], idempotency_key: idempotency_key, request_options: @options) + rescue OpenAI::Errors::BadRequestError => error + delay = delays.shift + raise unless delay && Tools.pending_call_race?(error, result[:call_id]) + + sleep(delay) + retry + end + end + end + end + end +end diff --git a/lib/openai/helpers/agents/tools.rb b/lib/openai/helpers/agents/tools.rb new file mode 100644 index 000000000..9115ee5c7 --- /dev/null +++ b/lib/openai/helpers/agents/tools.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +module OpenAI + module Helpers + module Agents + # @api private + module Tools + # Capture routing and detached arguments before caller code sees the event, + # but defer the application callback until iteration resumes after yielding it. + def self.prepare(call, handler) + base = {type: :"agent.session.input.tool_result", turn_id: call.turn_id.dup, call_id: call.call_id.dup} + arguments = begin + JSON.parse(call.arguments.is_a?(String) ? call.arguments : JSON.generate(call.arguments)) + rescue StandardError + nil + end + + lambda do + begin + raise ArgumentError, "Function arguments must be a JSON object" unless arguments.is_a?(Hash) + + output = handler.call(arguments) + output = JSON.generate(output) if output.is_a?(Hash) + unless output.nil? || output.is_a?(String) || output.is_a?(Array) + raise ArgumentError, "Tool output must be a string, object, content array, or nil" + end + + serialized = JSON.generate(output) + if output.is_a?(Array) && !content_output?(JSON.parse(serialized)) + raise ArgumentError, "Tool output array must contain input text or image content" + end + + base.merge(success: true, output: output) + rescue StandardError + base.merge(success: false, error: "Tool handler failed.") + end + end + end + + def self.content_output?(parts) + parts.all? do |part| + next false unless part.is_a?(Hash) + + case part["type"] + when "input_text" + part["text"].is_a?(String) + when "input_image" + part["image_url"].is_a?(String) + else + false + end + end + end + + def self.pending_call_race?(error, call_id) + body = error.body + body = body[:error] if body.is_a?(Hash) && body[:error].is_a?(Hash) + body.is_a?(Hash) && + body[:code] == "invalid_request_error" && + body[:message] == "Unknown pending tool call: #{call_id}" + end + end + end + end +end diff --git a/lib/openai/internal/token_page.rb b/lib/openai/internal/token_page.rb new file mode 100644 index 000000000..7d39eb59b --- /dev/null +++ b/lib/openai/internal/token_page.rb @@ -0,0 +1,91 @@ +# frozen_string_literal: true + +module OpenAI + module Internal + # @generic Elem + # + # @example + # if token_page.next_page? + # token_page = token_page.next_page + # end + # + # @example + # token_page.auto_paging_each do |role| + # puts(role) + # end + class TokenPage + include OpenAI::Internal::Type::BasePage + + # @return [Array>, nil] + attr_accessor :data + + # @return [Boolean] + attr_accessor :has_more + + # @return [String, nil] + attr_accessor :next_ + + # @return [Boolean] + def next_page? + has_more + end + + # @raise [OpenAI::HTTP::Error] + # @return [self] + def next_page + unless next_page? + message = "No more pages available. Please check #next_page? before calling ##{__method__}" + raise message + end + + req = OpenAI::Internal::Util.deep_merge(@req, {query: {page: next_}}) + @client.request(req) + end + + # @param blk [Proc] + # + # @yieldparam [generic] + def auto_paging_each(&blk) + unless block_given? + raise ArgumentError.new("A block must be given to ##{__method__}") + end + + page = self + loop do + page.data&.each(&blk) + + break unless page.next_page? + page = page.next_page + end + end + + # @api private + # + # @param client [OpenAI::Internal::Transport::BaseClient] + # @param req [Hash{Symbol=>Object}] + # @param response_metadata [OpenAI::ResponseMetadata] + # @param page_data [Hash{Symbol=>Object}] + def initialize(client:, req:, response_metadata:, page_data:) + super + + case page_data + in {data: Array => data} + @data = data.map { OpenAI::Internal::Type::Converter.coerce(@model, _1) } + else + end + + @has_more = page_data[:has_more] + @next_ = page_data[:next] + end + + # @api private + # + # @return [String] + def inspect + model = OpenAI::Internal::Type::Converter.inspect(@model, depth: 1) + + "#<#{self.class}[#{model}]:0x#{object_id.to_s(16)} has_more=#{has_more.inspect} next_=#{next_.inspect}>" + end + end + end +end diff --git a/lib/openai/models/beta/agent.rb b/lib/openai/models/beta/agent.rb new file mode 100644 index 000000000..d79daccbd --- /dev/null +++ b/lib/openai/models/beta/agent.rb @@ -0,0 +1,148 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # @see OpenAI::Resources::Beta::Agents#create + class Agent < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the reusable agent. + # + # @return [String] + required :id, String + + # @!attribute created_at + # The Unix timestamp, in seconds, when the agent was created. + # + # @return [Integer] + required :created_at, Integer + + # @!attribute instructions + # Custom instructions appended to the agent's default base instructions. + # + # @return [String, nil] + required :instructions, String, nil?: true + + # @!attribute metadata + # Custom string key-value pairs attached to the agent. + # + # @return [Hash{Symbol=>String}] + required :metadata, OpenAI::Internal::Type::HashOf[String] + + # @!attribute model + # The requested model name used for inference. + # + # @return [String] + required :model, String + + # @!attribute multi_agent + # The resolved configuration for creating and coordinating subagents. + # + # @return [OpenAI::Models::Beta::MultiAgentConfig] + required :multi_agent, -> { OpenAI::Beta::MultiAgentConfig } + + # @!attribute name + # A human-readable name for the agent, or null if it is unnamed. + # + # @return [String, nil] + required :name, String, nil?: true + + # @!attribute object + # The object type. Always `agent`. + # + # @return [Symbol, :agent] + required :object, const: :agent + + # @!attribute reasoning + # The resolved reasoning configuration, including the model default for an omitted + # effort. + # + # @return [OpenAI::Models::Beta::AgentReasoning] + required :reasoning, -> { OpenAI::Beta::AgentReasoning } + + # @!attribute service_tier + # The resolved service-tier policy used for model requests. + # + # @return [Symbol, OpenAI::Models::Beta::Agent::ServiceTier] + required :service_tier, enum: -> { OpenAI::Beta::Agent::ServiceTier } + + # @!attribute text + # The resolved configuration for text generated by the agent. + # + # @return [OpenAI::Models::Beta::AgentText] + required :text, -> { OpenAI::Beta::AgentText } + + # @!attribute tools + # Tools available to the agent. + # + # @return [Array] + required :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::PersistedAgentTool] } + + # @!attribute updated_at + # The Unix timestamp, in seconds, when the agent was last updated. + # + # @return [Integer] + required :updated_at, Integer + + # @!method initialize(id:, created_at:, instructions:, metadata:, model:, multi_agent:, name:, reasoning:, service_tier:, text:, tools:, updated_at:, object: :agent) + # A reusable agent scoped to the caller's project. + # + # @param id [String] + # The ID of the reusable agent. + # + # @param created_at [Integer] + # The Unix timestamp, in seconds, when the agent was created. + # + # @param instructions [String, nil] + # Custom instructions appended to the agent's default base instructions. + # + # @param metadata [Hash{Symbol=>String}] + # Custom string key-value pairs attached to the agent. + # + # @param model [String] + # The requested model name used for inference. + # + # @param multi_agent [OpenAI::Models::Beta::MultiAgentConfig] + # The resolved configuration for creating and coordinating subagents. + # + # @param name [String, nil] + # A human-readable name for the agent, or null if it is unnamed. + # + # @param reasoning [OpenAI::Models::Beta::AgentReasoning] + # The resolved reasoning configuration, including the model default for an omitted + # effort. + # + # @param service_tier [Symbol, OpenAI::Models::Beta::Agent::ServiceTier] + # The resolved service-tier policy used for model requests. + # + # @param text [OpenAI::Models::Beta::AgentText] + # The resolved configuration for text generated by the agent. + # + # @param tools [Array] + # Tools available to the agent. + # + # @param updated_at [Integer] + # The Unix timestamp, in seconds, when the agent was last updated. + # + # @param object [Symbol, :agent] + # The object type. Always `agent`. + + # The resolved service-tier policy used for model requests. + # + # @see OpenAI::Models::Beta::Agent#service_tier + module ServiceTier + extend OpenAI::Internal::Type::Enum + + AUTO = :auto + DEFAULT = :default + FLEX = :flex + PRIORITY = :priority + FAST = :fast + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agent_close_subagent_call_item.rb b/lib/openai/models/beta/agent_close_subagent_call_item.rb new file mode 100644 index 000000000..1fb8f14d0 --- /dev/null +++ b/lib/openai/models/beta/agent_close_subagent_call_item.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentCloseSubagentCallItem < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the tool call item. + # + # @return [String] + required :id, String + + # @!attribute recipient_agent_id + # The ID of the agent to close. + # + # @return [String] + required :recipient_agent_id, String + + # @!attribute sender_agent_id + # The ID of the agent requesting the close. + # + # @return [String] + required :sender_agent_id, String + + # @!attribute status + # The status of the tool call. + # + # @return [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + required :status, enum: -> { OpenAI::Beta::AgentFunctionCallStatus } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `close_subagent_call`. + # + # @return [Symbol, :close_subagent_call] + required :type, const: :close_subagent_call + + # @!method initialize(id:, recipient_agent_id:, sender_agent_id:, status:, turn_id:, type: :close_subagent_call) + # A request to close a subagent. + # + # @param id [String] + # The ID of the tool call item. + # + # @param recipient_agent_id [String] + # The ID of the agent to close. + # + # @param sender_agent_id [String] + # The ID of the agent requesting the close. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + # The status of the tool call. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :close_subagent_call] + # The item type. Always `close_subagent_call`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_command_execution_item.rb b/lib/openai/models/beta/agent_command_execution_item.rb new file mode 100644 index 000000000..01a768dcb --- /dev/null +++ b/lib/openai/models/beta/agent_command_execution_item.rb @@ -0,0 +1,93 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentCommandExecutionItem < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the command execution item. + # + # @return [String] + required :id, String + + # @!attribute command + # The command that was executed. + # + # @return [String] + required :command, String + + # @!attribute cwd + # The working directory used to execute the command. + # + # @return [String, nil] + required :cwd, String, nil?: true + + # @!attribute duration_ms + # The command duration in milliseconds. + # + # @return [Integer, nil] + required :duration_ms, Integer, nil?: true + + # @!attribute exit_code + # The process exit code, if the command completed. + # + # @return [Integer, nil] + required :exit_code, Integer, nil?: true + + # @!attribute output + # The command output, if available. + # + # @return [String, nil] + required :output, String, nil?: true + + # @!attribute status + # The status of the command execution. + # + # @return [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + required :status, enum: -> { OpenAI::Beta::AgentFunctionCallStatus } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `command_execution`. + # + # @return [Symbol, :command_execution] + required :type, const: :command_execution + + # @!method initialize(id:, command:, cwd:, duration_ms:, exit_code:, output:, status:, turn_id:, type: :command_execution) + # A command execution produced by the agent. + # + # @param id [String] + # The ID of the command execution item. + # + # @param command [String] + # The command that was executed. + # + # @param cwd [String, nil] + # The working directory used to execute the command. + # + # @param duration_ms [Integer, nil] + # The command duration in milliseconds. + # + # @param exit_code [Integer, nil] + # The process exit code, if the command completed. + # + # @param output [String, nil] + # The command output, if available. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + # The status of the command execution. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :command_execution] + # The item type. Always `command_execution`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_content.rb b/lib/openai/models/beta/agent_content.rb new file mode 100644 index 000000000..268bf7934 --- /dev/null +++ b/lib/openai/models/beta/agent_content.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # A plaintext or encrypted content part exchanged between agents. + module AgentContent + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A text content part produced by the agent. + variant :output_text, -> { OpenAI::Beta::OutputText } + + # Encrypted content exchanged between agents. + variant :encrypted_content, -> { OpenAI::Beta::AgentContent::EncryptedContent } + + class EncryptedContent < OpenAI::Internal::Type::BaseModel + # @!attribute encrypted_content + # The encrypted content payload. + # + # @return [String] + required :encrypted_content, String + + # @!attribute type + # The content type. Always `encrypted_content`. + # + # @return [Symbol, :encrypted_content] + required :type, const: :encrypted_content + + # @!method initialize(encrypted_content:, type: :encrypted_content) + # Encrypted content exchanged between agents. + # + # @param encrypted_content [String] + # The encrypted content payload. + # + # @param type [Symbol, :encrypted_content] + # The content type. Always `encrypted_content`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::OutputText, OpenAI::Models::Beta::AgentContent::EncryptedContent)] + end + end + end +end diff --git a/lib/openai/models/beta/agent_create_params.rb b/lib/openai/models/beta/agent_create_params.rb new file mode 100644 index 000000000..a33186e96 --- /dev/null +++ b/lib/openai/models/beta/agent_create_params.rb @@ -0,0 +1,128 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # @see OpenAI::Resources::Beta::Agents#create + class AgentCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute model + # The model to use for the agent. The requested model name is preserved. + # + # @return [String] + required :model, String + + # @!attribute instructions + # Additional instructions appended to the agent's default base instructions. Omit + # or set to null to add no custom instructions. + # + # @return [String, nil] + optional :instructions, String, nil?: true + + # @!attribute metadata + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + # + # @return [Hash{Symbol=>String}, nil] + optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true + + # @!attribute multi_agent + # Explicit configuration for creating and coordinating subagents. + # + # @return [OpenAI::Models::Beta::MultiAgentConfigParam, nil] + optional :multi_agent, -> { OpenAI::Beta::MultiAgentConfigParam }, nil?: true + + # @!attribute name + # A human-readable name for the agent. Omission or null leaves the agent unnamed. + # + # @return [String, nil] + optional :name, String, nil?: true + + # @!attribute reasoning + # Reasoning configuration for the agent. + # + # @return [OpenAI::Models::Beta::AgentReasoningParam, nil] + optional :reasoning, -> { OpenAI::Beta::AgentReasoningParam }, nil?: true + + # @!attribute service_tier + # The service tier used for model requests. + # + # @return [Symbol, OpenAI::Models::Beta::AgentCreateParams::ServiceTier, nil] + optional :service_tier, enum: -> { OpenAI::Beta::AgentCreateParams::ServiceTier }, nil?: true + + # @!attribute text + # Configuration for text generated by the agent. + # + # @return [OpenAI::Models::Beta::AgentTextParam, nil] + optional :text, -> { OpenAI::Beta::AgentTextParam }, nil?: true + + # @!attribute tools + # Tools available to the agent. Defaults to an empty list. + # + # @return [Array, nil] + optional( + :tools, + -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::PersistedAgentToolParam] }, + nil?: true + ) + + # @!method initialize(model:, instructions: nil, metadata: nil, multi_agent: nil, name: nil, reasoning: nil, service_tier: nil, text: nil, tools: nil, request_options: {}) + # @param model [String] + # The model to use for the agent. The requested model name is preserved. + # + # @param instructions [String, nil] + # Additional instructions appended to the agent's default base instructions. Omit + # or set to null to add no custom instructions. + # + # @param metadata [Hash{Symbol=>String}, nil] + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + # + # @param multi_agent [OpenAI::Models::Beta::MultiAgentConfigParam, nil] + # Explicit configuration for creating and coordinating subagents. + # + # @param name [String, nil] + # A human-readable name for the agent. Omission or null leaves the agent unnamed. + # + # @param reasoning [OpenAI::Models::Beta::AgentReasoningParam, nil] + # Reasoning configuration for the agent. + # + # @param service_tier [Symbol, OpenAI::Models::Beta::AgentCreateParams::ServiceTier, nil] + # The service tier used for model requests. + # + # @param text [OpenAI::Models::Beta::AgentTextParam, nil] + # Configuration for text generated by the agent. + # + # @param tools [Array, nil] + # Tools available to the agent. Defaults to an empty list. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # The service tier used for model requests. + module ServiceTier + extend OpenAI::Internal::Type::Enum + + # Selects the service tier automatically. + AUTO = :auto + + # Uses the default service tier. + DEFAULT = :default + + # Uses the flex service tier. + FLEX = :flex + + # Uses the priority service tier. + PRIORITY = :priority + + # Uses the fast service tier. + FAST = :fast + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agent_create_subagent_call_item.rb b/lib/openai/models/beta/agent_create_subagent_call_item.rb new file mode 100644 index 000000000..c55991a0e --- /dev/null +++ b/lib/openai/models/beta/agent_create_subagent_call_item.rb @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentCreateSubagentCallItem < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the tool call item. + # + # @return [String] + required :id, String + + # @!attribute agent_id + # The ID of the agent that requested the subagent. + # + # @return [String] + required :agent_id, String + + # @!attribute content + # The task given to the spawned agent. + # + # @return [Array] + required :content, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent] } + + # @!attribute model + # The model requested for the spawned agent. + # + # @return [String, nil] + required :model, String, nil?: true + + # @!attribute reasoning_effort + # The reasoning effort requested for the spawned agent. + # + # @return [String, nil] + required :reasoning_effort, String, nil?: true + + # @!attribute status + # The status of the tool call. + # + # @return [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + required :status, enum: -> { OpenAI::Beta::AgentFunctionCallStatus } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `create_subagent_call`. + # + # @return [Symbol, :create_subagent_call] + required :type, const: :create_subagent_call + + # @!method initialize(id:, agent_id:, content:, model:, reasoning_effort:, status:, turn_id:, type: :create_subagent_call) + # A request to spawn a subagent. + # + # @param id [String] + # The ID of the tool call item. + # + # @param agent_id [String] + # The ID of the agent that requested the subagent. + # + # @param content [Array] + # The task given to the spawned agent. + # + # @param model [String, nil] + # The model requested for the spawned agent. + # + # @param reasoning_effort [String, nil] + # The reasoning effort requested for the spawned agent. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + # The status of the tool call. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :create_subagent_call] + # The item type. Always `create_subagent_call`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_delete_params.rb b/lib/openai/models/beta/agent_delete_params.rb new file mode 100644 index 000000000..c0ecb58d2 --- /dev/null +++ b/lib/openai/models/beta/agent_delete_params.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # @see OpenAI::Resources::Beta::Agents#delete + class AgentDeleteParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute agent_id + # + # @return [String] + required :agent_id, String + + # @!method initialize(agent_id:, request_options: {}) + # @param agent_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/openai/models/beta/agent_deleted.rb b/lib/openai/models/beta/agent_deleted.rb new file mode 100644 index 000000000..ee9ea8dcf --- /dev/null +++ b/lib/openai/models/beta/agent_deleted.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # @see OpenAI::Resources::Beta::Agents#delete + class AgentDeleted < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the deleted agent. + # + # @return [String] + required :id, String + + # @!attribute deleted + # Whether the agent was deleted. Always `true`. + # + # @return [Boolean] + required :deleted, OpenAI::Internal::Type::Boolean + + # @!attribute object + # The object type. Always `agent.deleted`. + # + # @return [Symbol, :"agent.deleted"] + required :object, const: :"agent.deleted" + + # @!method initialize(id:, deleted:, object: :"agent.deleted") + # A deleted reusable agent. + # + # @param id [String] + # The ID of the deleted agent. + # + # @param deleted [Boolean] + # Whether the agent was deleted. Always `true`. + # + # @param object [Symbol, :"agent.deleted"] + # The object type. Always `agent.deleted`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_function_call_item.rb b/lib/openai/models/beta/agent_function_call_item.rb new file mode 100644 index 000000000..10e9110a8 --- /dev/null +++ b/lib/openai/models/beta/agent_function_call_item.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentFunctionCallItem < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the function call item. + # + # @return [String] + required :id, String + + # @!attribute arguments + # The arguments to pass to the function. + # + # @return [Object] + required :arguments, OpenAI::Internal::Type::Unknown + + # @!attribute call_id + # The ID used to submit the function result. + # + # @return [String] + required :call_id, String + + # @!attribute name + # The name of the function to call. + # + # @return [String] + required :name, String + + # @!attribute status + # The status of the function call. + # + # @return [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + required :status, enum: -> { OpenAI::Beta::AgentFunctionCallStatus } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `function_call`. + # + # @return [Symbol, :function_call] + required :type, const: :function_call + + # @!method initialize(id:, arguments:, call_id:, name:, status:, turn_id:, type: :function_call) + # A function call produced by the agent. + # + # @param id [String] + # The ID of the function call item. + # + # @param arguments [Object] + # The arguments to pass to the function. + # + # @param call_id [String] + # The ID used to submit the function result. + # + # @param name [String] + # The name of the function to call. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + # The status of the function call. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :function_call] + # The item type. Always `function_call`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_function_call_output.rb b/lib/openai/models/beta/agent_function_call_output.rb new file mode 100644 index 000000000..d9c05d691 --- /dev/null +++ b/lib/openai/models/beta/agent_function_call_output.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # The text or model-input content supplied as a function result. + module AgentFunctionCallOutput + extend OpenAI::Internal::Type::Union + + variant String + + variant -> { OpenAI::Models::Beta::AgentFunctionCallOutput::InputContentArray } + + # @!method self.variants + # @return [Array(String, Array)] + + # @type [OpenAI::Internal::Type::Converter] + InputContentArray = OpenAI::Internal::Type::ArrayOf[union: -> { OpenAI::Beta::InputContent }] + end + end + end +end diff --git a/lib/openai/models/beta/agent_function_call_output_param.rb b/lib/openai/models/beta/agent_function_call_output_param.rb new file mode 100644 index 000000000..2a2c88ea1 --- /dev/null +++ b/lib/openai/models/beta/agent_function_call_output_param.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # A function result represented as text or supported model-input content. + module AgentFunctionCallOutputParam + extend OpenAI::Internal::Type::Union + + variant String + + variant -> { OpenAI::Models::Beta::AgentFunctionCallOutputParam::InputContentParamArray } + + # @!method self.variants + # @return [Array(String, Array)] + + # @type [OpenAI::Internal::Type::Converter] + InputContentParamArray = OpenAI::Internal::Type::ArrayOf[union: -> { OpenAI::Beta::InputContentParam }] + end + end + end +end diff --git a/lib/openai/models/beta/agent_function_call_status.rb b/lib/openai/models/beta/agent_function_call_status.rb new file mode 100644 index 000000000..62b76d24a --- /dev/null +++ b/lib/openai/models/beta/agent_function_call_status.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # The status of a tool call. + module AgentFunctionCallStatus + extend OpenAI::Internal::Type::Enum + + # The call is in progress. + IN_PROGRESS = :in_progress + + # The call completed successfully. + COMPLETED = :completed + + # The call failed. + FAILED = :failed + + # The call stopped before completing. + INCOMPLETE = :incomplete + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/openai/models/beta/agent_interrupt_subagent_call_item.rb b/lib/openai/models/beta/agent_interrupt_subagent_call_item.rb new file mode 100644 index 000000000..68a59ec59 --- /dev/null +++ b/lib/openai/models/beta/agent_interrupt_subagent_call_item.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentInterruptSubagentCallItem < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the tool call item. + # + # @return [String] + required :id, String + + # @!attribute recipient_agent_id + # The ID of the agent to interrupt. + # + # @return [String] + required :recipient_agent_id, String + + # @!attribute sender_agent_id + # The ID of the agent requesting the interrupt. + # + # @return [String] + required :sender_agent_id, String + + # @!attribute status + # The status of the tool call. + # + # @return [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + required :status, enum: -> { OpenAI::Beta::AgentFunctionCallStatus } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `interrupt_subagent_call`. + # + # @return [Symbol, :interrupt_subagent_call] + required :type, const: :interrupt_subagent_call + + # @!method initialize(id:, recipient_agent_id:, sender_agent_id:, status:, turn_id:, type: :interrupt_subagent_call) + # A request to interrupt a subagent's current turn. The subagent remains + # available. + # + # @param id [String] + # The ID of the tool call item. + # + # @param recipient_agent_id [String] + # The ID of the agent to interrupt. + # + # @param sender_agent_id [String] + # The ID of the agent requesting the interrupt. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + # The status of the tool call. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :interrupt_subagent_call] + # The item type. Always `interrupt_subagent_call`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_list_params.rb b/lib/openai/models/beta/agent_list_params.rb new file mode 100644 index 000000000..490ed3201 --- /dev/null +++ b/lib/openai/models/beta/agent_list_params.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # @see OpenAI::Resources::Beta::Agents#list + class AgentListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute after + # Return resources after this resource ID in the selected order. + # + # @return [String, nil] + optional :after, String + + # @!attribute limit + # The maximum number of resources to return. + # + # @return [Integer, nil] + optional :limit, Integer, nil?: true + + # @!attribute order + # The order in which resources are returned. Defaults to `desc`. + # + # @return [Symbol, OpenAI::Models::Beta::AgentListParams::Order, nil] + optional :order, enum: -> { OpenAI::Beta::AgentListParams::Order } + + # @!method initialize(after: nil, limit: nil, order: nil, request_options: {}) + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer, nil] + # The maximum number of resources to return. + # + # @param order [Symbol, OpenAI::Models::Beta::AgentListParams::Order] + # The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC = :asc + + # Returns resources in descending order. + DESC = :desc + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agent_mcp_call_item.rb b/lib/openai/models/beta/agent_mcp_call_item.rb new file mode 100644 index 000000000..74f85fa5f --- /dev/null +++ b/lib/openai/models/beta/agent_mcp_call_item.rb @@ -0,0 +1,93 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentMcpCallItem < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the MCP call item. + # + # @return [String] + required :id, String + + # @!attribute arguments + # The arguments passed to the MCP tool. + # + # @return [Object] + required :arguments, OpenAI::Internal::Type::Unknown + + # @!attribute error + # The error returned by the MCP tool, if any. + # + # @return [Object] + required :error, OpenAI::Internal::Type::Unknown + + # @!attribute name + # The name of the MCP tool. + # + # @return [String] + required :name, String + + # @!attribute output + # The output returned by the MCP tool, if any. + # + # @return [Object] + required :output, OpenAI::Internal::Type::Unknown + + # @!attribute server_label + # The label of the MCP server. + # + # @return [String] + required :server_label, String + + # @!attribute status + # The status of the MCP tool call. + # + # @return [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + required :status, enum: -> { OpenAI::Beta::AgentFunctionCallStatus } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `mcp_call`. + # + # @return [Symbol, :mcp_call] + required :type, const: :mcp_call + + # @!method initialize(id:, arguments:, error:, name:, output:, server_label:, status:, turn_id:, type: :mcp_call) + # A call to a tool on an MCP server. + # + # @param id [String] + # The ID of the MCP call item. + # + # @param arguments [Object] + # The arguments passed to the MCP tool. + # + # @param error [Object] + # The error returned by the MCP tool, if any. + # + # @param name [String] + # The name of the MCP tool. + # + # @param output [Object] + # The output returned by the MCP tool, if any. + # + # @param server_label [String] + # The label of the MCP server. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + # The status of the MCP tool call. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :mcp_call] + # The item type. Always `mcp_call`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_output_command_execution_output_delta_event.rb b/lib/openai/models/beta/agent_output_command_execution_output_delta_event.rb new file mode 100644 index 000000000..86b5f737f --- /dev/null +++ b/lib/openai/models/beta/agent_output_command_execution_output_delta_event.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentOutputCommandExecutionOutputDeltaEvent < OpenAI::Internal::Type::BaseModel + # @!attribute delta + # The output text that was appended. + # + # @return [String] + required :delta, String + + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute item_id + # The ID of the command execution item. + # + # @return [String] + required :item_id, String + + # @!attribute output_index + # The index of the item in the turn output. + # + # @return [Integer] + required :output_index, Integer + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.output.command_execution_output.delta`. + # + # @return [Symbol, :"agent.output.command_execution_output.delta"] + required :type, const: :"agent.output.command_execution_output.delta" + + # @!method initialize(delta:, event_id:, item_id:, output_index:, session_id:, turn_id:, type: :"agent.output.command_execution_output.delta") + # Emitted when command execution produces an output delta. + # + # @param delta [String] + # The output text that was appended. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param item_id [String] + # The ID of the command execution item. + # + # @param output_index [Integer] + # The index of the item in the turn output. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.output.command_execution_output.delta"] + # The type of the object. Always `agent.output.command_execution_output.delta`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_output_item.rb b/lib/openai/models/beta/agent_output_item.rb new file mode 100644 index 000000000..cf0987397 --- /dev/null +++ b/lib/openai/models/beta/agent_output_item.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # An output item produced by an agent. + module AgentOutputItem + extend OpenAI::Internal::Type::Union + + discriminator :type + + # An assistant message produced by the agent. + variant :message, -> { OpenAI::Beta::AgentSessionAssistantMessage } + + # A reasoning item produced by the agent. + variant :reasoning, -> { OpenAI::Beta::AgentReasoningItem } + + # A function call produced by the agent. + variant :function_call, -> { OpenAI::Beta::AgentFunctionCallItem } + + # A call to a tool on an MCP server. + variant :mcp_call, -> { OpenAI::Beta::AgentMcpCallItem } + + # A web search call produced by the agent. + variant :web_search_call, -> { OpenAI::Beta::AgentWebSearchCallItem } + + # A command execution produced by the agent. + variant :command_execution, -> { OpenAI::Beta::AgentCommandExecutionItem } + + # A request to spawn a subagent. + variant :create_subagent_call, -> { OpenAI::Beta::AgentCreateSubagentCallItem } + + # A request to send input to another agent. + variant :send_subagent_input_call, -> { OpenAI::Beta::AgentSendSubagentInputCallItem } + + # A request to resume a subagent. + variant :resume_subagent_call, -> { OpenAI::Beta::AgentResumeSubagentCallItem } + + # A request to wait for one or more subagents. + variant :wait_for_subagents_call, -> { OpenAI::Beta::AgentWaitForSubagentsCallItem } + + # A request to interrupt a subagent's current turn. The subagent remains available. + variant :interrupt_subagent_call, -> { OpenAI::Beta::AgentInterruptSubagentCallItem } + + # A request to close a subagent. + variant :close_subagent_call, -> { OpenAI::Beta::AgentCloseSubagentCallItem } + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::AgentSessionAssistantMessage, OpenAI::Models::Beta::AgentReasoningItem, OpenAI::Models::Beta::AgentFunctionCallItem, OpenAI::Models::Beta::AgentMcpCallItem, OpenAI::Models::Beta::AgentWebSearchCallItem, OpenAI::Models::Beta::AgentCommandExecutionItem, OpenAI::Models::Beta::AgentCreateSubagentCallItem, OpenAI::Models::Beta::AgentSendSubagentInputCallItem, OpenAI::Models::Beta::AgentResumeSubagentCallItem, OpenAI::Models::Beta::AgentWaitForSubagentsCallItem, OpenAI::Models::Beta::AgentInterruptSubagentCallItem, OpenAI::Models::Beta::AgentCloseSubagentCallItem)] + end + end + end +end diff --git a/lib/openai/models/beta/agent_output_item_status.rb b/lib/openai/models/beta/agent_output_item_status.rb new file mode 100644 index 000000000..d668b2935 --- /dev/null +++ b/lib/openai/models/beta/agent_output_item_status.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # The status of an agent output item. + module AgentOutputItemStatus + extend OpenAI::Internal::Type::Enum + + # The item is in progress. + IN_PROGRESS = :in_progress + + # The item is complete. + COMPLETED = :completed + + # The item stopped before completing. + INCOMPLETE = :incomplete + + # @!method self.values + # @return [Array] + end + end + end +end diff --git a/lib/openai/models/beta/agent_reasoning.rb b/lib/openai/models/beta/agent_reasoning.rb new file mode 100644 index 000000000..1a3f22ff0 --- /dev/null +++ b/lib/openai/models/beta/agent_reasoning.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentReasoning < OpenAI::Internal::Type::BaseModel + # @!attribute effort + # The amount of reasoning effort used by an agent. + # + # @return [Symbol, OpenAI::Models::Beta::AgentReasoning::Effort, nil] + required :effort, enum: -> { OpenAI::Beta::AgentReasoning::Effort }, nil?: true + + # @!attribute summary + # The reasoning summary format requested from an agent. + # + # @return [Symbol, OpenAI::Models::Beta::AgentReasoning::Summary, nil] + required :summary, enum: -> { OpenAI::Beta::AgentReasoning::Summary }, nil?: true + + # @!method initialize(effort:, summary:) + # The reasoning configuration used by an agent. + # + # @param effort [Symbol, OpenAI::Models::Beta::AgentReasoning::Effort, nil] + # The amount of reasoning effort used by an agent. + # + # @param summary [Symbol, OpenAI::Models::Beta::AgentReasoning::Summary, nil] + # The reasoning summary format requested from an agent. + + # The amount of reasoning effort used by an agent. + # + # @see OpenAI::Models::Beta::AgentReasoning#effort + module Effort + extend OpenAI::Internal::Type::Enum + + NONE = :none + MINIMAL = :minimal + LOW = :low + MEDIUM = :medium + HIGH = :high + XHIGH = :xhigh + MAX = :max + + # @!method self.values + # @return [Array] + end + + # The reasoning summary format requested from an agent. + # + # @see OpenAI::Models::Beta::AgentReasoning#summary + module Summary + extend OpenAI::Internal::Type::Enum + + # Returns a concise reasoning summary when supported. + CONCISE = :concise + + # Returns a detailed reasoning summary when supported. + DETAILED = :detailed + + # Automatically selects the most detailed summary supported by the model. + AUTO = :auto + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agent_reasoning_item.rb b/lib/openai/models/beta/agent_reasoning_item.rb new file mode 100644 index 000000000..ee429b6f5 --- /dev/null +++ b/lib/openai/models/beta/agent_reasoning_item.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentReasoningItem < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the reasoning item. + # + # @return [String] + required :id, String + + # @!attribute status + # The status of an agent output item. + # + # @return [Symbol, OpenAI::Models::Beta::AgentOutputItemStatus, nil] + required :status, enum: -> { OpenAI::Beta::AgentOutputItemStatus }, nil?: true + + # @!attribute summary + # The reasoning summaries produced by the agent. + # + # @return [Array] + required :summary, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::SummaryText] } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `reasoning`. + # + # @return [Symbol, :reasoning] + required :type, const: :reasoning + + # @!method initialize(id:, status:, summary:, turn_id:, type: :reasoning) + # A reasoning item produced by the agent. + # + # @param id [String] + # The ID of the reasoning item. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentOutputItemStatus, nil] + # The status of an agent output item. + # + # @param summary [Array] + # The reasoning summaries produced by the agent. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :reasoning] + # The item type. Always `reasoning`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_reasoning_param.rb b/lib/openai/models/beta/agent_reasoning_param.rb new file mode 100644 index 000000000..56b16156d --- /dev/null +++ b/lib/openai/models/beta/agent_reasoning_param.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentReasoningParam < OpenAI::Internal::Type::BaseModel + # @!attribute effort + # The amount of reasoning effort the model should use. + # + # @return [Symbol, OpenAI::Models::Beta::AgentReasoningParam::Effort, nil] + optional :effort, enum: -> { OpenAI::Beta::AgentReasoningParam::Effort }, nil?: true + + # @!attribute summary + # The reasoning summary format requested from the model. + # + # @return [Symbol, OpenAI::Models::Beta::AgentReasoningParam::Summary, nil] + optional :summary, enum: -> { OpenAI::Beta::AgentReasoningParam::Summary }, nil?: true + + # @!method initialize(effort: nil, summary: nil) + # Reasoning configuration for the agent. + # + # @param effort [Symbol, OpenAI::Models::Beta::AgentReasoningParam::Effort, nil] + # The amount of reasoning effort the model should use. + # + # @param summary [Symbol, OpenAI::Models::Beta::AgentReasoningParam::Summary, nil] + # The reasoning summary format requested from the model. + + # The amount of reasoning effort the model should use. + # + # @see OpenAI::Models::Beta::AgentReasoningParam#effort + module Effort + extend OpenAI::Internal::Type::Enum + + NONE = :none + MINIMAL = :minimal + LOW = :low + MEDIUM = :medium + HIGH = :high + XHIGH = :xhigh + MAX = :max + + # @!method self.values + # @return [Array] + end + + # The reasoning summary format requested from the model. + # + # @see OpenAI::Models::Beta::AgentReasoningParam#summary + module Summary + extend OpenAI::Internal::Type::Enum + + # Returns a concise reasoning summary when supported. + CONCISE = :concise + + # Returns a detailed reasoning summary when supported. + DETAILED = :detailed + + # Automatically selects the most detailed summary supported by the model. + AUTO = :auto + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agent_resume_subagent_call_item.rb b/lib/openai/models/beta/agent_resume_subagent_call_item.rb new file mode 100644 index 000000000..ea81781c7 --- /dev/null +++ b/lib/openai/models/beta/agent_resume_subagent_call_item.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentResumeSubagentCallItem < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the tool call item. + # + # @return [String] + required :id, String + + # @!attribute recipient_agent_id + # The ID of the agent to resume. + # + # @return [String] + required :recipient_agent_id, String + + # @!attribute sender_agent_id + # The ID of the agent requesting the resume. + # + # @return [String] + required :sender_agent_id, String + + # @!attribute status + # The status of the tool call. + # + # @return [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + required :status, enum: -> { OpenAI::Beta::AgentFunctionCallStatus } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `resume_subagent_call`. + # + # @return [Symbol, :resume_subagent_call] + required :type, const: :resume_subagent_call + + # @!method initialize(id:, recipient_agent_id:, sender_agent_id:, status:, turn_id:, type: :resume_subagent_call) + # A request to resume a subagent. + # + # @param id [String] + # The ID of the tool call item. + # + # @param recipient_agent_id [String] + # The ID of the agent to resume. + # + # @param sender_agent_id [String] + # The ID of the agent requesting the resume. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + # The status of the tool call. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :resume_subagent_call] + # The item type. Always `resume_subagent_call`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_retrieve_params.rb b/lib/openai/models/beta/agent_retrieve_params.rb new file mode 100644 index 000000000..28686f95e --- /dev/null +++ b/lib/openai/models/beta/agent_retrieve_params.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # @see OpenAI::Resources::Beta::Agents#retrieve + class AgentRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute agent_id + # + # @return [String] + required :agent_id, String + + # @!method initialize(agent_id:, request_options: {}) + # @param agent_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end +end diff --git a/lib/openai/models/beta/agent_send_subagent_input_call_item.rb b/lib/openai/models/beta/agent_send_subagent_input_call_item.rb new file mode 100644 index 000000000..776860f15 --- /dev/null +++ b/lib/openai/models/beta/agent_send_subagent_input_call_item.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSendSubagentInputCallItem < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the tool call item. + # + # @return [String] + required :id, String + + # @!attribute content + # The input sent to the receiving agent. + # + # @return [Array] + required :content, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent] } + + # @!attribute recipient_agent_id + # The ID of the agent receiving the input. + # + # @return [String] + required :recipient_agent_id, String + + # @!attribute sender_agent_id + # The ID of the agent sending the input. + # + # @return [String] + required :sender_agent_id, String + + # @!attribute status + # The status of the tool call. + # + # @return [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + required :status, enum: -> { OpenAI::Beta::AgentFunctionCallStatus } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `send_subagent_input_call`. + # + # @return [Symbol, :send_subagent_input_call] + required :type, const: :send_subagent_input_call + + # @!method initialize(id:, content:, recipient_agent_id:, sender_agent_id:, status:, turn_id:, type: :send_subagent_input_call) + # A request to send input to another agent. + # + # @param id [String] + # The ID of the tool call item. + # + # @param content [Array] + # The input sent to the receiving agent. + # + # @param recipient_agent_id [String] + # The ID of the agent receiving the input. + # + # @param sender_agent_id [String] + # The ID of the agent sending the input. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + # The status of the tool call. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :send_subagent_input_call] + # The item type. Always `send_subagent_input_call`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session.rb b/lib/openai/models/beta/agent_session.rb new file mode 100644 index 000000000..ba8494872 --- /dev/null +++ b/lib/openai/models/beta/agent_session.rb @@ -0,0 +1,339 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSession < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the session. + # + # @return [String] + required :id, String + + # @!attribute agent + # The agent running in the session. + # + # @return [OpenAI::Models::Beta::AgentSession::Agent] + required :agent, -> { OpenAI::Beta::AgentSession::Agent } + + # @!attribute created_at + # The Unix timestamp, in seconds, when the session was created. + # + # @return [Integer] + required :created_at, Integer + + # @!attribute environment + # The execution environment for the session. + # + # @return [OpenAI::Models::Beta::Environment::None, OpenAI::Models::Beta::Environment::OpenAIHosted, OpenAI::Models::Beta::Environment::SelfHosted] + required :environment, union: -> { OpenAI::Beta::Environment } + + # @!attribute error + # The error that caused the session to fail, if any. + # + # @return [String, nil] + required :error, String, nil?: true + + # @!attribute last_active_at + # The Unix timestamp, in seconds, when the session was last active. + # + # @return [Integer] + required :last_active_at, Integer + + # @!attribute metadata + # Custom string key-value pairs attached to the session. + # + # @return [Hash{Symbol=>String}] + required :metadata, OpenAI::Internal::Type::HashOf[String] + + # @!attribute object + # The object type. Always `agent.session`. + # + # @return [Symbol, :"agent.session"] + required :object, const: :"agent.session" + + # @!attribute required_actions + # Actions that must be completed before the session can continue. + # + # @return [Array] + required( + :required_actions, + -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentSession::RequiredAction] } + ) + + # @!attribute status + # The current status of the session. + # + # @return [Symbol, OpenAI::Models::Beta::AgentSession::Status] + required :status, enum: -> { OpenAI::Beta::AgentSession::Status } + + # @!attribute usage + # Recorded token usage for a session or turn. Usage is best effort and may change. + # + # @return [OpenAI::Models::Beta::TokenUsage, nil] + required :usage, -> { OpenAI::Beta::TokenUsage }, nil?: true + + # @!attribute vault_ids + # The IDs of vaults made available to the session. + # + # @return [Array] + required :vault_ids, OpenAI::Internal::Type::ArrayOf[String] + + # @!method initialize(id:, agent:, created_at:, environment:, error:, last_active_at:, metadata:, required_actions:, status:, usage:, vault_ids:, object: :"agent.session") + # A Managed Agents session. + # + # @param id [String] + # The ID of the session. + # + # @param agent [OpenAI::Models::Beta::AgentSession::Agent] + # The agent running in the session. + # + # @param created_at [Integer] + # The Unix timestamp, in seconds, when the session was created. + # + # @param environment [OpenAI::Models::Beta::Environment::None, OpenAI::Models::Beta::Environment::OpenAIHosted, OpenAI::Models::Beta::Environment::SelfHosted] + # The execution environment for the session. + # + # @param error [String, nil] + # The error that caused the session to fail, if any. + # + # @param last_active_at [Integer] + # The Unix timestamp, in seconds, when the session was last active. + # + # @param metadata [Hash{Symbol=>String}] + # Custom string key-value pairs attached to the session. + # + # @param required_actions [Array] + # Actions that must be completed before the session can continue. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentSession::Status] + # The current status of the session. + # + # @param usage [OpenAI::Models::Beta::TokenUsage, nil] + # Recorded token usage for a session or turn. Usage is best effort and may change. + # + # @param vault_ids [Array] + # The IDs of vaults made available to the session. + # + # @param object [Symbol, :"agent.session"] + # The object type. Always `agent.session`. + + # @see OpenAI::Models::Beta::AgentSession#agent + class Agent < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the agent. + # + # @return [String] + required :id, String + + # @!attribute instructions + # Custom instructions appended to the agent's default base instructions. + # + # @return [String, nil] + required :instructions, String, nil?: true + + # @!attribute model + # The model used by the agent. + # + # @return [String] + required :model, String + + # @!attribute multi_agent + # Configuration for creating and coordinating subagents. + # + # @return [OpenAI::Models::Beta::MultiAgentConfig] + required :multi_agent, -> { OpenAI::Beta::MultiAgentConfig } + + # @!attribute name + # The reusable agent's name when the session was created, or null if no name was + # saved. Later changes to the agent's name do not affect this value. + # + # @return [String, nil] + required :name, String, nil?: true + + # @!attribute reasoning + # The agent's reasoning configuration. + # + # @return [OpenAI::Models::Beta::AgentReasoning] + required :reasoning, -> { OpenAI::Beta::AgentReasoning } + + # @!attribute service_tier + # The effective service-tier policy for model requests. Defaults to `auto`. + # + # @return [Symbol, OpenAI::Models::Beta::AgentSession::Agent::ServiceTier] + required :service_tier, enum: -> { OpenAI::Beta::AgentSession::Agent::ServiceTier } + + # @!attribute text + # Configuration for text generated by the agent. + # + # @return [OpenAI::Models::Beta::AgentText] + required :text, -> { OpenAI::Beta::AgentText } + + # @!attribute tools + # Tools available to the agent. + # + # @return [Array] + required :tools, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentTool] } + + # @!method initialize(id:, instructions:, model:, multi_agent:, name:, reasoning:, service_tier:, text:, tools:) + # The agent running in the session. + # + # @param id [String] + # The ID of the agent. + # + # @param instructions [String, nil] + # Custom instructions appended to the agent's default base instructions. + # + # @param model [String] + # The model used by the agent. + # + # @param multi_agent [OpenAI::Models::Beta::MultiAgentConfig] + # Configuration for creating and coordinating subagents. + # + # @param name [String, nil] + # The reusable agent's name when the session was created, or null if no name was + # saved. Later changes to the agent's name do not affect this value. + # + # @param reasoning [OpenAI::Models::Beta::AgentReasoning] + # The agent's reasoning configuration. + # + # @param service_tier [Symbol, OpenAI::Models::Beta::AgentSession::Agent::ServiceTier] + # The effective service-tier policy for model requests. Defaults to `auto`. + # + # @param text [OpenAI::Models::Beta::AgentText] + # Configuration for text generated by the agent. + # + # @param tools [Array] + # Tools available to the agent. + + # The effective service-tier policy for model requests. Defaults to `auto`. + # + # @see OpenAI::Models::Beta::AgentSession::Agent#service_tier + module ServiceTier + extend OpenAI::Internal::Type::Enum + + AUTO = :auto + DEFAULT = :default + FLEX = :flex + PRIORITY = :priority + FAST = :fast + + # @!method self.values + # @return [Array] + end + end + + # An action that must be completed before a session can continue. + module RequiredAction + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Run a function tool and submit its result. + variant :function_call, -> { OpenAI::Beta::AgentSession::RequiredAction::FunctionCall } + + # Reconnect a session environment. + variant :environment_connection, -> { OpenAI::Beta::AgentSession::RequiredAction::EnvironmentConnection } + + class FunctionCall < OpenAI::Internal::Type::BaseModel + # @!attribute arguments + # The arguments supplied by the model. + # + # @return [Object] + required :arguments, OpenAI::Internal::Type::Unknown + + # @!attribute call_id + # The ID to include when submitting the function result. + # + # @return [String] + required :call_id, String + + # @!attribute name + # The function name. + # + # @return [String] + required :name, String + + # @!attribute turn_id + # The ID of the turn that requested the function call. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The type of the object. Always `function_call`. + # + # @return [Symbol, :function_call] + required :type, const: :function_call + + # @!method initialize(arguments:, call_id:, name:, turn_id:, type: :function_call) + # Run a function tool and submit its result. + # + # @param arguments [Object] + # The arguments supplied by the model. + # + # @param call_id [String] + # The ID to include when submitting the function result. + # + # @param name [String] + # The function name. + # + # @param turn_id [String] + # The ID of the turn that requested the function call. + # + # @param type [Symbol, :function_call] + # The type of the object. Always `function_call`. + end + + class EnvironmentConnection < OpenAI::Internal::Type::BaseModel + # @!attribute environment_id + # The ID of the environment to reconnect. + # + # @return [String] + required :environment_id, String + + # @!attribute type + # The type of the object. Always `environment_connection`. + # + # @return [Symbol, :environment_connection] + required :type, const: :environment_connection + + # @!method initialize(environment_id:, type: :environment_connection) + # Reconnect a session environment. + # + # @param environment_id [String] + # The ID of the environment to reconnect. + # + # @param type [Symbol, :environment_connection] + # The type of the object. Always `environment_connection`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::AgentSession::RequiredAction::FunctionCall, OpenAI::Models::Beta::AgentSession::RequiredAction::EnvironmentConnection)] + end + + # The current status of the session. + # + # @see OpenAI::Models::Beta::AgentSession#status + module Status + extend OpenAI::Internal::Type::Enum + + # The session has no turn in progress and is ready for input. A hosted environment may still be provisioning. + IDLE = :idle + + # The session is processing a turn. + IN_PROGRESS = :in_progress + + # The session is waiting for one or more required actions. + REQUIRES_ACTION = :requires_action + + # The session failed. + FAILED = :failed + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_assistant_message.rb b/lib/openai/models/beta/agent_session_assistant_message.rb new file mode 100644 index 000000000..08811ffad --- /dev/null +++ b/lib/openai/models/beta/agent_session_assistant_message.rb @@ -0,0 +1,91 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionAssistantMessage < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the message. + # + # @return [String] + required :id, String + + # @!attribute content + # The content of the message. + # + # @return [Array] + required :content, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::OutputText] } + + # @!attribute phase + # The phase of an assistant message. + # + # @return [Symbol, OpenAI::Models::Beta::AgentSessionAssistantMessage::Phase, nil] + required :phase, enum: -> { OpenAI::Beta::AgentSessionAssistantMessage::Phase }, nil?: true + + # @!attribute role + # The role of the message author. Always `assistant`. + # + # @return [Symbol, :assistant] + required :role, const: :assistant + + # @!attribute status + # The status of the message. + # + # @return [Symbol, OpenAI::Models::Beta::AgentOutputItemStatus] + required :status, enum: -> { OpenAI::Beta::AgentOutputItemStatus } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `message`. + # + # @return [Symbol, :message] + required :type, const: :message + + # @!method initialize(id:, content:, phase:, status:, turn_id:, role: :assistant, type: :message) + # An assistant message produced by the agent. + # + # @param id [String] + # The ID of the message. + # + # @param content [Array] + # The content of the message. + # + # @param phase [Symbol, OpenAI::Models::Beta::AgentSessionAssistantMessage::Phase, nil] + # The phase of an assistant message. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentOutputItemStatus] + # The status of the message. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param role [Symbol, :assistant] + # The role of the message author. Always `assistant`. + # + # @param type [Symbol, :message] + # The item type. Always `message`. + + # The phase of an assistant message. + # + # @see OpenAI::Models::Beta::AgentSessionAssistantMessage#phase + module Phase + extend OpenAI::Internal::Type::Enum + + # Commentary produced while the agent works. + COMMENTARY = :commentary + + # The agent's final answer. + FINAL_ANSWER = :final_answer + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_created_event.rb b/lib/openai/models/beta/agent_session_created_event.rb new file mode 100644 index 000000000..3f1f82c71 --- /dev/null +++ b/lib/openai/models/beta/agent_session_created_event.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionCreatedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session + # The session that was created. + # + # @return [OpenAI::Models::Beta::AgentSession] + required :session, -> { OpenAI::Beta::AgentSession } + + # @!attribute type + # The type of the object. Always `agent.session.created`. + # + # @return [Symbol, :"agent.session.created"] + required :type, const: :"agent.session.created" + + # @!method initialize(event_id:, session:, type: :"agent.session.created") + # Emitted when a session is created. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session [OpenAI::Models::Beta::AgentSession] + # The session that was created. + # + # @param type [Symbol, :"agent.session.created"] + # The type of the object. Always `agent.session.created`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_deleted.rb b/lib/openai/models/beta/agent_session_deleted.rb new file mode 100644 index 000000000..25c07efea --- /dev/null +++ b/lib/openai/models/beta/agent_session_deleted.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionDeleted < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the deleted session. + # + # @return [String] + required :id, String + + # @!attribute deleted + # Whether the session has been removed from the public API. Always `true`. + # Physical cleanup may still be in progress. + # + # @return [Boolean] + required :deleted, OpenAI::Internal::Type::Boolean + + # @!attribute object + # The object type. Always `agent.session.deleted`. + # + # @return [Symbol, :"agent.session.deleted"] + required :object, const: :"agent.session.deleted" + + # @!method initialize(id:, deleted:, object: :"agent.session.deleted") + # A Managed Agents session removed from the public API. Physical cleanup may + # continue asynchronously. + # + # @param id [String] + # The ID of the deleted session. + # + # @param deleted [Boolean] + # Whether the session has been removed from the public API. Always `true`. + # Physical cleanup may still be in progress. + # + # @param object [Symbol, :"agent.session.deleted"] + # The object type. Always `agent.session.deleted`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_environment_connected_event.rb b/lib/openai/models/beta/agent_session_environment_connected_event.rb new file mode 100644 index 000000000..10a0985a3 --- /dev/null +++ b/lib/openai/models/beta/agent_session_environment_connected_event.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionEnvironmentConnectedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute environment + # The current environment state. + # + # @return [OpenAI::Models::Beta::AgentSessionEnvironmentState] + required :environment, -> { OpenAI::Beta::AgentSessionEnvironmentState } + + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.session.environment.connected`. + # + # @return [Symbol, :"agent.session.environment.connected"] + required :type, const: :"agent.session.environment.connected" + + # @!method initialize(environment:, event_id:, session_id:, turn_id:, type: :"agent.session.environment.connected") + # Emitted when a session environment connects. + # + # @param environment [OpenAI::Models::Beta::AgentSessionEnvironmentState] + # The current environment state. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.environment.connected"] + # The type of the object. Always `agent.session.environment.connected`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_environment_disconnected_event.rb b/lib/openai/models/beta/agent_session_environment_disconnected_event.rb new file mode 100644 index 000000000..02cce2848 --- /dev/null +++ b/lib/openai/models/beta/agent_session_environment_disconnected_event.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionEnvironmentDisconnectedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute environment + # The current environment state. + # + # @return [OpenAI::Models::Beta::AgentSessionEnvironmentState] + required :environment, -> { OpenAI::Beta::AgentSessionEnvironmentState } + + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.session.environment.disconnected`. + # + # @return [Symbol, :"agent.session.environment.disconnected"] + required :type, const: :"agent.session.environment.disconnected" + + # @!method initialize(environment:, event_id:, session_id:, turn_id:, type: :"agent.session.environment.disconnected") + # Emitted when a session environment disconnects. + # + # @param environment [OpenAI::Models::Beta::AgentSessionEnvironmentState] + # The current environment state. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.environment.disconnected"] + # The type of the object. Always `agent.session.environment.disconnected`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_environment_failed_event.rb b/lib/openai/models/beta/agent_session_environment_failed_event.rb new file mode 100644 index 000000000..41820affd --- /dev/null +++ b/lib/openai/models/beta/agent_session_environment_failed_event.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionEnvironmentFailedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute environment + # The current environment state. + # + # @return [OpenAI::Models::Beta::AgentSessionEnvironmentState] + required :environment, -> { OpenAI::Beta::AgentSessionEnvironmentState } + + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.session.environment.failed`. + # + # @return [Symbol, :"agent.session.environment.failed"] + required :type, const: :"agent.session.environment.failed" + + # @!method initialize(environment:, event_id:, session_id:, turn_id:, type: :"agent.session.environment.failed") + # Emitted when a session environment fails. + # + # @param environment [OpenAI::Models::Beta::AgentSessionEnvironmentState] + # The current environment state. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.environment.failed"] + # The type of the object. Always `agent.session.environment.failed`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_environment_pending_event.rb b/lib/openai/models/beta/agent_session_environment_pending_event.rb new file mode 100644 index 000000000..bc8df1174 --- /dev/null +++ b/lib/openai/models/beta/agent_session_environment_pending_event.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionEnvironmentPendingEvent < OpenAI::Internal::Type::BaseModel + # @!attribute environment + # The current environment state. + # + # @return [OpenAI::Models::Beta::AgentSessionEnvironmentState] + required :environment, -> { OpenAI::Beta::AgentSessionEnvironmentState } + + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.session.environment.pending`. + # + # @return [Symbol, :"agent.session.environment.pending"] + required :type, const: :"agent.session.environment.pending" + + # @!method initialize(environment:, event_id:, session_id:, turn_id:, type: :"agent.session.environment.pending") + # Emitted while a session environment is being prepared. + # + # @param environment [OpenAI::Models::Beta::AgentSessionEnvironmentState] + # The current environment state. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.environment.pending"] + # The type of the object. Always `agent.session.environment.pending`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_environment_ready_event.rb b/lib/openai/models/beta/agent_session_environment_ready_event.rb new file mode 100644 index 000000000..1a5173b45 --- /dev/null +++ b/lib/openai/models/beta/agent_session_environment_ready_event.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionEnvironmentReadyEvent < OpenAI::Internal::Type::BaseModel + # @!attribute environment + # The current environment state. + # + # @return [OpenAI::Models::Beta::AgentSessionEnvironmentState] + required :environment, -> { OpenAI::Beta::AgentSessionEnvironmentState } + + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.session.environment.ready`. + # + # @return [Symbol, :"agent.session.environment.ready"] + required :type, const: :"agent.session.environment.ready" + + # @!method initialize(environment:, event_id:, session_id:, turn_id:, type: :"agent.session.environment.ready") + # Emitted when a hosted session environment is ready to connect. + # + # @param environment [OpenAI::Models::Beta::AgentSessionEnvironmentState] + # The current environment state. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.environment.ready"] + # The type of the object. Always `agent.session.environment.ready`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_environment_state.rb b/lib/openai/models/beta/agent_session_environment_state.rb new file mode 100644 index 000000000..8b5ead001 --- /dev/null +++ b/lib/openai/models/beta/agent_session_environment_state.rb @@ -0,0 +1,106 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionEnvironmentState < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The public ID of the environment. + # + # @return [String] + required :id, String + + # @!attribute error + # An error reported while preparing a session environment. + # + # @return [OpenAI::Models::Beta::AgentSessionEnvironmentState::Error, nil] + required :error, -> { OpenAI::Beta::AgentSessionEnvironmentState::Error }, nil?: true + + # @!attribute status + # The environment's connection status. + # + # @return [Symbol, OpenAI::Models::Beta::AgentSessionEnvironmentState::Status] + required :status, enum: -> { OpenAI::Beta::AgentSessionEnvironmentState::Status } + + # @!attribute type + # The environment type. + # + # @return [String] + required :type, String + + # @!method initialize(id:, error:, status:, type:) + # The current state of a session environment. + # + # @param id [String] + # The public ID of the environment. + # + # @param error [OpenAI::Models::Beta::AgentSessionEnvironmentState::Error, nil] + # An error reported while preparing a session environment. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentSessionEnvironmentState::Status] + # The environment's connection status. + # + # @param type [String] + # The environment type. + + # @see OpenAI::Models::Beta::AgentSessionEnvironmentState#error + class Error < OpenAI::Internal::Type::BaseModel + # @!attribute code + # A machine-readable error code. + # + # @return [String] + required :code, String + + # @!attribute message + # A human-readable error message. + # + # @return [String] + required :message, String + + # @!attribute type + # The error type. + # + # @return [String] + required :type, String + + # @!method initialize(code:, message:, type:) + # An error reported while preparing a session environment. + # + # @param code [String] + # A machine-readable error code. + # + # @param message [String] + # A human-readable error message. + # + # @param type [String] + # The error type. + end + + # The environment's connection status. + # + # @see OpenAI::Models::Beta::AgentSessionEnvironmentState#status + module Status + extend OpenAI::Internal::Type::Enum + + # The environment is being prepared. + PENDING = :pending + + # The environment is ready to connect. + READY = :ready + + # The environment is connected. + CONNECTED = :connected + + # The environment is disconnected. + DISCONNECTED = :disconnected + + # The environment failed to connect. + FAILED = :failed + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_error_event.rb b/lib/openai/models/beta/agent_session_error_event.rb new file mode 100644 index 000000000..3825152e2 --- /dev/null +++ b/lib/openai/models/beta/agent_session_error_event.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionErrorEvent < OpenAI::Internal::Type::BaseModel + # @!attribute error + # The error that occurred. + # + # @return [OpenAI::Models::Beta::SessionError] + required :error, -> { OpenAI::Beta::SessionError } + + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute type + # The type of the object. Always `error`. + # + # @return [Symbol, :error] + required :type, const: :error + + # @!method initialize(error:, event_id:, session_id:, type: :error) + # Emitted when a turn or session fails. + # + # @param error [OpenAI::Models::Beta::SessionError] + # The error that occurred. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param type [Symbol, :error] + # The type of the object. Always `error`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_event.rb b/lib/openai/models/beta/agent_session_event.rb new file mode 100644 index 000000000..720daa3f3 --- /dev/null +++ b/lib/openai/models/beta/agent_session_event.rb @@ -0,0 +1,128 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # An event emitted by a Managed Agents session. + module AgentSessionEvent + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Emitted when a turn or session fails. + variant :error, -> { OpenAI::Beta::AgentSessionErrorEvent } + + # Emitted when a hosted session environment is ready to connect. + variant :"agent.session.environment.ready", -> { OpenAI::Beta::AgentSessionEnvironmentReadyEvent } + + # Emitted when command execution produces an output delta. + variant( + :"agent.output.command_execution_output.delta", + -> { OpenAI::Beta::AgentOutputCommandExecutionOutputDeltaEvent } + ) + + # Emitted when a session is created. + variant :"agent.session.created", -> { OpenAI::Beta::AgentSessionCreatedEvent } + + # Emitted when a turn is created. + variant :"agent.session.turn.created", -> { OpenAI::Beta::AgentSessionTurnCreatedEvent } + + # Emitted when a turn starts running. + variant :"agent.session.turn.in_progress", -> { OpenAI::Beta::AgentSessionTurnInProgressEvent } + + # Emitted when a turn completes. + variant :"agent.session.turn.completed", -> { OpenAI::Beta::AgentSessionTurnCompletedEvent } + + # Emitted when a turn fails. + variant :"agent.session.turn.failed", -> { OpenAI::Beta::AgentSessionTurnFailedEvent } + + # Emitted when a turn is cancelled. + variant :"agent.session.turn.cancelled", -> { OpenAI::Beta::AgentSessionTurnCancelledEvent } + + # Emitted when an item is added to a turn. + variant :"agent.session.turn.item.added", -> { OpenAI::Beta::AgentSessionTurnItemAddedEvent } + + # Emitted when a session becomes idle. + variant :"agent.session.idle", -> { OpenAI::Beta::AgentSessionIdleEvent } + + # Emitted when a session starts processing a turn. + variant :"agent.session.in_progress", -> { OpenAI::Beta::AgentSessionInProgressEvent } + + # Emitted when a session is waiting for one or more required actions. + variant :"agent.session.requires_action", -> { OpenAI::Beta::AgentSessionRequiresActionEvent } + + # Emitted when a session fails. + variant :"agent.session.failed", -> { OpenAI::Beta::AgentSessionFailedEvent } + + # Emitted while a session environment is being prepared. + variant :"agent.session.environment.pending", -> { OpenAI::Beta::AgentSessionEnvironmentPendingEvent } + + # Emitted when a session environment connects. + variant :"agent.session.environment.connected", -> { OpenAI::Beta::AgentSessionEnvironmentConnectedEvent } + + # Emitted when a session environment disconnects. + variant( + :"agent.session.environment.disconnected", + -> { OpenAI::Beta::AgentSessionEnvironmentDisconnectedEvent } + ) + + # Emitted when a session environment fails. + variant :"agent.session.environment.failed", -> { OpenAI::Beta::AgentSessionEnvironmentFailedEvent } + + # Emitted when a subagent is created. + variant :"agent.session.subagent.created", -> { OpenAI::Beta::AgentSessionSubagentCreatedEvent } + + # Emitted when a closed subagent successfully resumes. + variant :"agent.session.subagent.active", -> { OpenAI::Beta::AgentSessionSubagentActiveEvent } + + # Emitted when a subagent is closed. + variant :"agent.session.subagent.closed", -> { OpenAI::Beta::AgentSessionSubagentClosedEvent } + + # Emitted when an output item is complete. + variant :"agent.session.turn.item.done", -> { OpenAI::Beta::AgentSessionTurnItemDoneEvent } + + # Emitted when an output text content part is added. + variant( + :"agent.session.turn.content_part.added", + -> { OpenAI::Beta::AgentSessionTurnContentPartAddedEvent } + ) + + # Emitted when an output content part is complete. + variant :"agent.session.turn.content_part.done", -> { OpenAI::Beta::AgentSessionTurnContentPartDoneEvent } + + # Emitted when text is appended to an output text content part. + variant :"agent.session.turn.output_text.delta", -> { OpenAI::Beta::AgentSessionTurnOutputTextDeltaEvent } + + # Emitted when an output text content part is complete. + variant :"agent.session.turn.output_text.done", -> { OpenAI::Beta::AgentSessionTurnOutputTextDoneEvent } + + # Emitted when a reasoning summary content part is added. + variant( + :"agent.session.turn.reasoning_summary_part.added", + -> { OpenAI::Beta::AgentSessionTurnReasoningSummaryPartAddedEvent } + ) + + # Emitted when a reasoning summary part is complete. + variant( + :"agent.session.turn.reasoning_summary_part.done", + -> { OpenAI::Beta::AgentSessionTurnReasoningSummaryPartDoneEvent } + ) + + # Emitted when text is appended to a reasoning summary. + variant( + :"agent.session.turn.reasoning_summary_text.delta", + -> { OpenAI::Beta::AgentSessionTurnReasoningSummaryTextDeltaEvent } + ) + + # Emitted when a reasoning summary content part is complete. + variant( + :"agent.session.turn.reasoning_summary_text.done", + -> { OpenAI::Beta::AgentSessionTurnReasoningSummaryTextDoneEvent } + ) + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::AgentSessionErrorEvent, OpenAI::Models::Beta::AgentSessionEnvironmentReadyEvent, OpenAI::Models::Beta::AgentOutputCommandExecutionOutputDeltaEvent, OpenAI::Models::Beta::AgentSessionCreatedEvent, OpenAI::Models::Beta::AgentSessionTurnCreatedEvent, OpenAI::Models::Beta::AgentSessionTurnInProgressEvent, OpenAI::Models::Beta::AgentSessionTurnCompletedEvent, OpenAI::Models::Beta::AgentSessionTurnFailedEvent, OpenAI::Models::Beta::AgentSessionTurnCancelledEvent, OpenAI::Models::Beta::AgentSessionTurnItemAddedEvent, OpenAI::Models::Beta::AgentSessionIdleEvent, OpenAI::Models::Beta::AgentSessionInProgressEvent, OpenAI::Models::Beta::AgentSessionRequiresActionEvent, OpenAI::Models::Beta::AgentSessionFailedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentPendingEvent, OpenAI::Models::Beta::AgentSessionEnvironmentConnectedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentDisconnectedEvent, OpenAI::Models::Beta::AgentSessionEnvironmentFailedEvent, OpenAI::Models::Beta::AgentSessionSubagentCreatedEvent, OpenAI::Models::Beta::AgentSessionSubagentActiveEvent, OpenAI::Models::Beta::AgentSessionSubagentClosedEvent, OpenAI::Models::Beta::AgentSessionTurnItemDoneEvent, OpenAI::Models::Beta::AgentSessionTurnContentPartAddedEvent, OpenAI::Models::Beta::AgentSessionTurnContentPartDoneEvent, OpenAI::Models::Beta::AgentSessionTurnOutputTextDeltaEvent, OpenAI::Models::Beta::AgentSessionTurnOutputTextDoneEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryPartAddedEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryPartDoneEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryTextDeltaEvent, OpenAI::Models::Beta::AgentSessionTurnReasoningSummaryTextDoneEvent)] + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_failed_event.rb b/lib/openai/models/beta/agent_session_failed_event.rb new file mode 100644 index 000000000..0b197797c --- /dev/null +++ b/lib/openai/models/beta/agent_session_failed_event.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionFailedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session + # The failed session. + # + # @return [OpenAI::Models::Beta::AgentSession] + required :session, -> { OpenAI::Beta::AgentSession } + + # @!attribute type + # The type of the object. Always `agent.session.failed`. + # + # @return [Symbol, :"agent.session.failed"] + required :type, const: :"agent.session.failed" + + # @!method initialize(event_id:, session:, type: :"agent.session.failed") + # Emitted when a session fails. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session [OpenAI::Models::Beta::AgentSession] + # The failed session. + # + # @param type [Symbol, :"agent.session.failed"] + # The type of the object. Always `agent.session.failed`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_idle_event.rb b/lib/openai/models/beta/agent_session_idle_event.rb new file mode 100644 index 000000000..064fb6c47 --- /dev/null +++ b/lib/openai/models/beta/agent_session_idle_event.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionIdleEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session + # The session that became idle. + # + # @return [OpenAI::Models::Beta::AgentSession] + required :session, -> { OpenAI::Beta::AgentSession } + + # @!attribute type + # The type of the object. Always `agent.session.idle`. + # + # @return [Symbol, :"agent.session.idle"] + required :type, const: :"agent.session.idle" + + # @!method initialize(event_id:, session:, type: :"agent.session.idle") + # Emitted when a session becomes idle. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session [OpenAI::Models::Beta::AgentSession] + # The session that became idle. + # + # @param type [Symbol, :"agent.session.idle"] + # The type of the object. Always `agent.session.idle`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_in_progress_event.rb b/lib/openai/models/beta/agent_session_in_progress_event.rb new file mode 100644 index 000000000..38bf12a4a --- /dev/null +++ b/lib/openai/models/beta/agent_session_in_progress_event.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionInProgressEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session + # The session that started processing. + # + # @return [OpenAI::Models::Beta::AgentSession] + required :session, -> { OpenAI::Beta::AgentSession } + + # @!attribute type + # The type of the object. Always `agent.session.in_progress`. + # + # @return [Symbol, :"agent.session.in_progress"] + required :type, const: :"agent.session.in_progress" + + # @!method initialize(event_id:, session:, type: :"agent.session.in_progress") + # Emitted when a session starts processing a turn. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session [OpenAI::Models::Beta::AgentSession] + # The session that started processing. + # + # @param type [Symbol, :"agent.session.in_progress"] + # The type of the object. Always `agent.session.in_progress`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_input_message_param.rb b/lib/openai/models/beta/agent_session_input_message_param.rb new file mode 100644 index 000000000..f572cdb3e --- /dev/null +++ b/lib/openai/models/beta/agent_session_input_message_param.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionInputMessageParam < OpenAI::Internal::Type::BaseModel + # @!attribute content + # The content of the message. + # + # @return [Array] + required :content, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::InputContentParam] } + + # @!attribute role + # The role of the message author. Always `user`. + # + # @return [Symbol, :user] + required :role, const: :user + + # @!attribute type + # The type of the input item. Always `message`. + # + # @return [Symbol, OpenAI::Models::Beta::AgentSessionInputMessageParam::Type, nil] + optional :type, enum: -> { OpenAI::Beta::AgentSessionInputMessageParam::Type } + + # @!method initialize(content:, type: nil, role: :user) + # A user message submitted to a session. + # + # @param content [Array] + # The content of the message. + # + # @param type [Symbol, OpenAI::Models::Beta::AgentSessionInputMessageParam::Type] + # The type of the input item. Always `message`. + # + # @param role [Symbol, :user] + # The role of the message author. Always `user`. + + # The type of the input item. Always `message`. + # + # @see OpenAI::Models::Beta::AgentSessionInputMessageParam#type + module Type + extend OpenAI::Internal::Type::Enum + + MESSAGE = :message + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_input_param.rb b/lib/openai/models/beta/agent_session_input_param.rb new file mode 100644 index 000000000..8d9a4a226 --- /dev/null +++ b/lib/openai/models/beta/agent_session_input_param.rb @@ -0,0 +1,131 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # Input submitted to an existing session. + module AgentSessionInputParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Adds one or more user messages and starts a turn. + variant( + :"agent.session.input.message", + -> { OpenAI::Beta::AgentSessionInputParam::AgentSessionInputMessage } + ) + + # Cancels the session's active turn. + variant( + :"agent.session.input.cancel", + -> { OpenAI::Beta::AgentSessionInputParam::AgentSessionInputCancel } + ) + + # Submits the result of a function call. + variant( + :"agent.session.input.tool_result", + -> { OpenAI::Beta::AgentSessionInputParam::AgentSessionInputToolResult } + ) + + class AgentSessionInputMessage < OpenAI::Internal::Type::BaseModel + # @!attribute input + # The user messages to add to the session. + # + # @return [Array] + required :input, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::AgentSessionInputMessageParam] } + + # @!attribute type + # The type of the object. Always `agent.session.input.message`. + # + # @return [Symbol, :"agent.session.input.message"] + required :type, const: :"agent.session.input.message" + + # @!method initialize(input:, type: :"agent.session.input.message") + # Adds one or more user messages and starts a turn. + # + # @param input [Array] + # The user messages to add to the session. + # + # @param type [Symbol, :"agent.session.input.message"] + # The type of the object. Always `agent.session.input.message`. + end + + class AgentSessionInputCancel < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `agent.session.input.cancel`. + # + # @return [Symbol, :"agent.session.input.cancel"] + required :type, const: :"agent.session.input.cancel" + + # @!method initialize(type: :"agent.session.input.cancel") + # Cancels the session's active turn. + # + # @param type [Symbol, :"agent.session.input.cancel"] + # The type of the object. Always `agent.session.input.cancel`. + end + + class AgentSessionInputToolResult < OpenAI::Internal::Type::BaseModel + # @!attribute call_id + # The ID of the function call. + # + # @return [String] + required :call_id, String + + # @!attribute success + # Whether the function call succeeded. + # + # @return [Boolean] + required :success, OpenAI::Internal::Type::Boolean + + # @!attribute turn_id + # The ID of the turn that requested the function call. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The type of the object. Always `agent.session.input.tool_result`. + # + # @return [Symbol, :"agent.session.input.tool_result"] + required :type, const: :"agent.session.input.tool_result" + + # @!attribute error + # The error message when the call failed. + # + # @return [String, nil] + optional :error, String, nil?: true + + # @!attribute output + # A function result represented as text or supported model-input content. + # + # @return [String, Array, nil] + optional :output, union: -> { OpenAI::Beta::AgentFunctionCallOutputParam }, nil?: true + + # @!method initialize(call_id:, success:, turn_id:, error: nil, output: nil, type: :"agent.session.input.tool_result") + # Submits the result of a function call. + # + # @param call_id [String] + # The ID of the function call. + # + # @param success [Boolean] + # Whether the function call succeeded. + # + # @param turn_id [String] + # The ID of the turn that requested the function call. + # + # @param error [String, nil] + # The error message when the call failed. + # + # @param output [String, Array, nil] + # A function result represented as text or supported model-input content. + # + # @param type [Symbol, :"agent.session.input.tool_result"] + # The type of the object. Always `agent.session.input.tool_result`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::AgentSessionInputParam::AgentSessionInputMessage, OpenAI::Models::Beta::AgentSessionInputParam::AgentSessionInputCancel, OpenAI::Models::Beta::AgentSessionInputParam::AgentSessionInputToolResult)] + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_item.rb b/lib/openai/models/beta/agent_session_item.rb new file mode 100644 index 000000000..b464a95e8 --- /dev/null +++ b/lib/openai/models/beta/agent_session_item.rb @@ -0,0 +1,186 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # An item associated with a session turn. + module AgentSessionItem + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A user or assistant message recorded in a session. + variant :message, -> { OpenAI::Beta::AgentSessionMessage } + + # A reasoning item produced by the agent. + variant :reasoning, -> { OpenAI::Beta::AgentReasoningItem } + + # A function call produced by the agent. + variant :function_call, -> { OpenAI::Beta::AgentFunctionCallItem } + + # The result supplied for a function call. + variant :function_call_output, -> { OpenAI::Beta::AgentSessionItem::FunctionCallOutput } + + # A message exchanged between agent threads. + variant :agent_message, -> { OpenAI::Beta::AgentSessionItem::AgentMessage } + + # A call to a tool on an MCP server. + variant :mcp_call, -> { OpenAI::Beta::AgentMcpCallItem } + + # A web search call produced by the agent. + variant :web_search_call, -> { OpenAI::Beta::AgentWebSearchCallItem } + + # A command execution produced by the agent. + variant :command_execution, -> { OpenAI::Beta::AgentCommandExecutionItem } + + # A request to spawn a subagent. + variant :create_subagent_call, -> { OpenAI::Beta::AgentCreateSubagentCallItem } + + # A request to send input to another agent. + variant :send_subagent_input_call, -> { OpenAI::Beta::AgentSendSubagentInputCallItem } + + # A request to resume a subagent. + variant :resume_subagent_call, -> { OpenAI::Beta::AgentResumeSubagentCallItem } + + # A request to wait for one or more subagents. + variant :wait_for_subagents_call, -> { OpenAI::Beta::AgentWaitForSubagentsCallItem } + + # A request to interrupt a subagent's current turn. The subagent remains available. + variant :interrupt_subagent_call, -> { OpenAI::Beta::AgentInterruptSubagentCallItem } + + # A request to close a subagent. + variant :close_subagent_call, -> { OpenAI::Beta::AgentCloseSubagentCallItem } + + class FunctionCallOutput < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the function call output item. + # + # @return [String] + required :id, String + + # @!attribute call_id + # The ID of the function call that produced this output. + # + # @return [String] + required :call_id, String + + # @!attribute error + # The error message, if the call failed. + # + # @return [String, nil] + required :error, String, nil?: true + + # @!attribute output + # The text or model-input content supplied as a function result. + # + # @return [String, Array, nil] + required :output, union: -> { OpenAI::Beta::AgentFunctionCallOutput }, nil?: true + + # @!attribute status + # The status of the function call. + # + # @return [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + required :status, enum: -> { OpenAI::Beta::AgentFunctionCallStatus } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `function_call_output`. + # + # @return [Symbol, :function_call_output] + required :type, const: :function_call_output + + # @!method initialize(id:, call_id:, error:, output:, status:, turn_id:, type: :function_call_output) + # The result supplied for a function call. + # + # @param id [String] + # The ID of the function call output item. + # + # @param call_id [String] + # The ID of the function call that produced this output. + # + # @param error [String, nil] + # The error message, if the call failed. + # + # @param output [String, Array, nil] + # The text or model-input content supplied as a function result. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + # The status of the function call. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :function_call_output] + # The item type. Always `function_call_output`. + end + + class AgentMessage < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the message. + # + # @return [String] + required :id, String + + # @!attribute content + # The content exchanged between the agents. + # + # @return [Array] + required :content, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent] } + + # @!attribute recipient_agent_id + # The ID or name of the receiving agent. + # + # @return [String] + required :recipient_agent_id, String + + # @!attribute sender_agent_id + # The ID or name of the sending agent. + # + # @return [String] + required :sender_agent_id, String + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `agent_message`. + # + # @return [Symbol, :agent_message] + required :type, const: :agent_message + + # @!method initialize(id:, content:, recipient_agent_id:, sender_agent_id:, turn_id:, type: :agent_message) + # A message exchanged between agent threads. + # + # @param id [String] + # The ID of the message. + # + # @param content [Array] + # The content exchanged between the agents. + # + # @param recipient_agent_id [String] + # The ID or name of the receiving agent. + # + # @param sender_agent_id [String] + # The ID or name of the sending agent. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :agent_message] + # The item type. Always `agent_message`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::AgentSessionMessage, OpenAI::Models::Beta::AgentReasoningItem, OpenAI::Models::Beta::AgentFunctionCallItem, OpenAI::Models::Beta::AgentSessionItem::FunctionCallOutput, OpenAI::Models::Beta::AgentSessionItem::AgentMessage, OpenAI::Models::Beta::AgentMcpCallItem, OpenAI::Models::Beta::AgentWebSearchCallItem, OpenAI::Models::Beta::AgentCommandExecutionItem, OpenAI::Models::Beta::AgentCreateSubagentCallItem, OpenAI::Models::Beta::AgentSendSubagentInputCallItem, OpenAI::Models::Beta::AgentResumeSubagentCallItem, OpenAI::Models::Beta::AgentWaitForSubagentsCallItem, OpenAI::Models::Beta::AgentInterruptSubagentCallItem, OpenAI::Models::Beta::AgentCloseSubagentCallItem)] + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_message.rb b/lib/openai/models/beta/agent_session_message.rb new file mode 100644 index 000000000..d2c9301d0 --- /dev/null +++ b/lib/openai/models/beta/agent_session_message.rb @@ -0,0 +1,106 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionMessage < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of this item, or null for legacy user messages whose ID was not recorded. + # + # @return [String, nil] + required :id, String, nil?: true + + # @!attribute content + # The content of the message. User messages contain input text or images; + # assistant messages contain output text. + # + # @return [Array] + required :content, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentSessionMessageContent] } + + # @!attribute phase + # The phase of an assistant message. + # + # @return [Symbol, OpenAI::Models::Beta::AgentSessionMessage::Phase, nil] + required :phase, enum: -> { OpenAI::Beta::AgentSessionMessage::Phase }, nil?: true + + # @!attribute role + # The role of the message author. + # + # @return [Symbol, OpenAI::Models::Beta::AgentSessionMessage::Role] + required :role, enum: -> { OpenAI::Beta::AgentSessionMessage::Role } + + # @!attribute status + # The status of the message. User messages are always `completed`. + # + # @return [Symbol, OpenAI::Models::Beta::AgentOutputItemStatus] + required :status, enum: -> { OpenAI::Beta::AgentOutputItemStatus } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `message`. + # + # @return [Symbol, :message] + required :type, const: :message + + # @!method initialize(id:, content:, phase:, role:, status:, turn_id:, type: :message) + # A user or assistant message recorded in a session. + # + # @param id [String, nil] + # The ID of this item, or null for legacy user messages whose ID was not recorded. + # + # @param content [Array] + # The content of the message. User messages contain input text or images; + # assistant messages contain output text. + # + # @param phase [Symbol, OpenAI::Models::Beta::AgentSessionMessage::Phase, nil] + # The phase of an assistant message. + # + # @param role [Symbol, OpenAI::Models::Beta::AgentSessionMessage::Role] + # The role of the message author. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentOutputItemStatus] + # The status of the message. User messages are always `completed`. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :message] + # The item type. Always `message`. + + # The phase of an assistant message. + # + # @see OpenAI::Models::Beta::AgentSessionMessage#phase + module Phase + extend OpenAI::Internal::Type::Enum + + # Commentary produced while the agent works. + COMMENTARY = :commentary + + # The agent's final answer. + FINAL_ANSWER = :final_answer + + # @!method self.values + # @return [Array] + end + + # The role of the message author. + # + # @see OpenAI::Models::Beta::AgentSessionMessage#role + module Role + extend OpenAI::Internal::Type::Enum + + USER = :user + ASSISTANT = :assistant + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_message_content.rb b/lib/openai/models/beta/agent_session_message_content.rb new file mode 100644 index 000000000..96486f1a3 --- /dev/null +++ b/lib/openai/models/beta/agent_session_message_content.rb @@ -0,0 +1,97 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # A content part in a session message. + module AgentSessionMessageContent + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Text supplied by the user. + variant :input_text, -> { OpenAI::Beta::AgentSessionMessageContent::InputText } + + # An image supplied by the user. + variant :input_image, -> { OpenAI::Beta::AgentSessionMessageContent::InputImage } + + # Text produced by the assistant. + variant :output_text, -> { OpenAI::Beta::AgentSessionMessageContent::OutputText } + + class InputText < OpenAI::Internal::Type::BaseModel + # @!attribute text + # The text supplied by the user. + # + # @return [String] + required :text, String + + # @!attribute type + # The type of the object. Always `input_text`. + # + # @return [Symbol, :input_text] + required :type, const: :input_text + + # @!method initialize(text:, type: :input_text) + # Text supplied by the user. + # + # @param text [String] + # The text supplied by the user. + # + # @param type [Symbol, :input_text] + # The type of the object. Always `input_text`. + end + + class InputImage < OpenAI::Internal::Type::BaseModel + # @!attribute image_url + # The URL of the image supplied by the user, which may be a base64-encoded data + # URL. + # + # @return [String] + required :image_url, String + + # @!attribute type + # The type of the object. Always `input_image`. + # + # @return [Symbol, :input_image] + required :type, const: :input_image + + # @!method initialize(image_url:, type: :input_image) + # An image supplied by the user. + # + # @param image_url [String] + # The URL of the image supplied by the user, which may be a base64-encoded data + # URL. + # + # @param type [Symbol, :input_image] + # The type of the object. Always `input_image`. + end + + class OutputText < OpenAI::Internal::Type::BaseModel + # @!attribute text + # The text produced by the assistant. + # + # @return [String] + required :text, String + + # @!attribute type + # The type of the object. Always `output_text`. + # + # @return [Symbol, :output_text] + required :type, const: :output_text + + # @!method initialize(text:, type: :output_text) + # Text produced by the assistant. + # + # @param text [String] + # The text produced by the assistant. + # + # @param type [Symbol, :output_text] + # The type of the object. Always `output_text`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::AgentSessionMessageContent::InputText, OpenAI::Models::Beta::AgentSessionMessageContent::InputImage, OpenAI::Models::Beta::AgentSessionMessageContent::OutputText)] + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_requires_action_event.rb b/lib/openai/models/beta/agent_session_requires_action_event.rb new file mode 100644 index 000000000..5addd63e4 --- /dev/null +++ b/lib/openai/models/beta/agent_session_requires_action_event.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionRequiresActionEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session + # The session and its current required actions. + # + # @return [OpenAI::Models::Beta::AgentSession] + required :session, -> { OpenAI::Beta::AgentSession } + + # @!attribute type + # The type of the object. Always `agent.session.requires_action`. + # + # @return [Symbol, :"agent.session.requires_action"] + required :type, const: :"agent.session.requires_action" + + # @!method initialize(event_id:, session:, type: :"agent.session.requires_action") + # Emitted when a session is waiting for one or more required actions. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session [OpenAI::Models::Beta::AgentSession] + # The session and its current required actions. + # + # @param type [Symbol, :"agent.session.requires_action"] + # The type of the object. Always `agent.session.requires_action`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_subagent_active_event.rb b/lib/openai/models/beta/agent_session_subagent_active_event.rb new file mode 100644 index 000000000..ec3e5fcf2 --- /dev/null +++ b/lib/openai/models/beta/agent_session_subagent_active_event.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionSubagentActiveEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute subagent + # The subagent that resumed. + # + # @return [OpenAI::Models::Beta::Subagent] + required :subagent, -> { OpenAI::Beta::Subagent } + + # @!attribute type + # The type of the object. Always `agent.session.subagent.active`. + # + # @return [Symbol, :"agent.session.subagent.active"] + required :type, const: :"agent.session.subagent.active" + + # @!method initialize(event_id:, subagent:, type: :"agent.session.subagent.active") + # Emitted when a closed subagent successfully resumes. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param subagent [OpenAI::Models::Beta::Subagent] + # The subagent that resumed. + # + # @param type [Symbol, :"agent.session.subagent.active"] + # The type of the object. Always `agent.session.subagent.active`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_subagent_closed_event.rb b/lib/openai/models/beta/agent_session_subagent_closed_event.rb new file mode 100644 index 000000000..303f05041 --- /dev/null +++ b/lib/openai/models/beta/agent_session_subagent_closed_event.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionSubagentClosedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute subagent + # The subagent that was closed. + # + # @return [OpenAI::Models::Beta::Subagent] + required :subagent, -> { OpenAI::Beta::Subagent } + + # @!attribute type + # The type of the object. Always `agent.session.subagent.closed`. + # + # @return [Symbol, :"agent.session.subagent.closed"] + required :type, const: :"agent.session.subagent.closed" + + # @!method initialize(event_id:, subagent:, type: :"agent.session.subagent.closed") + # Emitted when a subagent is closed. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param subagent [OpenAI::Models::Beta::Subagent] + # The subagent that was closed. + # + # @param type [Symbol, :"agent.session.subagent.closed"] + # The type of the object. Always `agent.session.subagent.closed`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_subagent_created_event.rb b/lib/openai/models/beta/agent_session_subagent_created_event.rb new file mode 100644 index 000000000..71d860084 --- /dev/null +++ b/lib/openai/models/beta/agent_session_subagent_created_event.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionSubagentCreatedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute subagent + # The subagent that was created. + # + # @return [OpenAI::Models::Beta::Subagent] + required :subagent, -> { OpenAI::Beta::Subagent } + + # @!attribute type + # The type of the object. Always `agent.session.subagent.created`. + # + # @return [Symbol, :"agent.session.subagent.created"] + required :type, const: :"agent.session.subagent.created" + + # @!method initialize(event_id:, subagent:, type: :"agent.session.subagent.created") + # Emitted when a subagent is created. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param subagent [OpenAI::Models::Beta::Subagent] + # The subagent that was created. + # + # @param type [Symbol, :"agent.session.subagent.created"] + # The type of the object. Always `agent.session.subagent.created`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_cancelled_event.rb b/lib/openai/models/beta/agent_session_turn_cancelled_event.rb new file mode 100644 index 000000000..1ee28d736 --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_cancelled_event.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnCancelledEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn + # The cancelled turn. + # + # @return [OpenAI::Models::Beta::Agents::Sessions::Turn] + required :turn, -> { OpenAI::Beta::Agents::Sessions::Turn } + + # @!attribute turn_id + # The ID of the turn associated with the event. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The type of the object. Always `agent.session.turn.cancelled`. + # + # @return [Symbol, :"agent.session.turn.cancelled"] + required :type, const: :"agent.session.turn.cancelled" + + # @!attribute usage + # Recorded token usage for a session or turn. Usage is best effort and may change. + # + # @return [OpenAI::Models::Beta::TokenUsage, nil] + required :usage, -> { OpenAI::Beta::TokenUsage }, nil?: true + + # @!method initialize(event_id:, session_id:, turn:, turn_id:, usage:, type: :"agent.session.turn.cancelled") + # Emitted when a turn is cancelled. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn [OpenAI::Models::Beta::Agents::Sessions::Turn] + # The cancelled turn. + # + # @param turn_id [String] + # The ID of the turn associated with the event. + # + # @param usage [OpenAI::Models::Beta::TokenUsage, nil] + # Recorded token usage for a session or turn. Usage is best effort and may change. + # + # @param type [Symbol, :"agent.session.turn.cancelled"] + # The type of the object. Always `agent.session.turn.cancelled`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_completed_event.rb b/lib/openai/models/beta/agent_session_turn_completed_event.rb new file mode 100644 index 000000000..6cd7df557 --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_completed_event.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnCompletedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn + # The completed turn. + # + # @return [OpenAI::Models::Beta::Agents::Sessions::Turn] + required :turn, -> { OpenAI::Beta::Agents::Sessions::Turn } + + # @!attribute turn_id + # The ID of the turn associated with the event. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The type of the object. Always `agent.session.turn.completed`. + # + # @return [Symbol, :"agent.session.turn.completed"] + required :type, const: :"agent.session.turn.completed" + + # @!attribute usage + # Recorded token usage for a session or turn. Usage is best effort and may change. + # + # @return [OpenAI::Models::Beta::TokenUsage, nil] + required :usage, -> { OpenAI::Beta::TokenUsage }, nil?: true + + # @!method initialize(event_id:, session_id:, turn:, turn_id:, usage:, type: :"agent.session.turn.completed") + # Emitted when a turn completes. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn [OpenAI::Models::Beta::Agents::Sessions::Turn] + # The completed turn. + # + # @param turn_id [String] + # The ID of the turn associated with the event. + # + # @param usage [OpenAI::Models::Beta::TokenUsage, nil] + # Recorded token usage for a session or turn. Usage is best effort and may change. + # + # @param type [Symbol, :"agent.session.turn.completed"] + # The type of the object. Always `agent.session.turn.completed`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_content_part_added_event.rb b/lib/openai/models/beta/agent_session_turn_content_part_added_event.rb new file mode 100644 index 000000000..75db1fffc --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_content_part_added_event.rb @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnContentPartAddedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute content_index + # The index of the content part in the message. + # + # @return [Integer] + required :content_index, Integer + + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute item_id + # The ID of the message item. + # + # @return [String] + required :item_id, String + + # @!attribute output_index + # The index of the item in the turn output. + # + # @return [Integer] + required :output_index, Integer + + # @!attribute part + # The initial content part. + # + # @return [OpenAI::Models::Beta::OutputText] + required :part, -> { OpenAI::Beta::OutputText } + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.session.turn.content_part.added`. + # + # @return [Symbol, :"agent.session.turn.content_part.added"] + required :type, const: :"agent.session.turn.content_part.added" + + # @!method initialize(content_index:, event_id:, item_id:, output_index:, part:, session_id:, turn_id:, type: :"agent.session.turn.content_part.added") + # Emitted when an output text content part is added. + # + # @param content_index [Integer] + # The index of the content part in the message. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param item_id [String] + # The ID of the message item. + # + # @param output_index [Integer] + # The index of the item in the turn output. + # + # @param part [OpenAI::Models::Beta::OutputText] + # The initial content part. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.turn.content_part.added"] + # The type of the object. Always `agent.session.turn.content_part.added`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_content_part_done_event.rb b/lib/openai/models/beta/agent_session_turn_content_part_done_event.rb new file mode 100644 index 000000000..48e9b38db --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_content_part_done_event.rb @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnContentPartDoneEvent < OpenAI::Internal::Type::BaseModel + # @!attribute content_index + # The index of the content part in the message. + # + # @return [Integer] + required :content_index, Integer + + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute item_id + # The ID of the message item. + # + # @return [String] + required :item_id, String + + # @!attribute output_index + # The index of the item in the turn output. + # + # @return [Integer] + required :output_index, Integer + + # @!attribute part + # The completed content part. + # + # @return [OpenAI::Models::Beta::OutputText] + required :part, -> { OpenAI::Beta::OutputText } + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.session.turn.content_part.done`. + # + # @return [Symbol, :"agent.session.turn.content_part.done"] + required :type, const: :"agent.session.turn.content_part.done" + + # @!method initialize(content_index:, event_id:, item_id:, output_index:, part:, session_id:, turn_id:, type: :"agent.session.turn.content_part.done") + # Emitted when an output content part is complete. + # + # @param content_index [Integer] + # The index of the content part in the message. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param item_id [String] + # The ID of the message item. + # + # @param output_index [Integer] + # The index of the item in the turn output. + # + # @param part [OpenAI::Models::Beta::OutputText] + # The completed content part. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.turn.content_part.done"] + # The type of the object. Always `agent.session.turn.content_part.done`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_created_event.rb b/lib/openai/models/beta/agent_session_turn_created_event.rb new file mode 100644 index 000000000..79ebf475c --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_created_event.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnCreatedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn + # The turn at the time it was created. + # + # @return [OpenAI::Models::Beta::Agents::Sessions::Turn] + required :turn, -> { OpenAI::Beta::Agents::Sessions::Turn } + + # @!attribute turn_id + # The ID of the turn associated with the event. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The type of the object. Always `agent.session.turn.created`. + # + # @return [Symbol, :"agent.session.turn.created"] + required :type, const: :"agent.session.turn.created" + + # @!method initialize(event_id:, session_id:, turn:, turn_id:, type: :"agent.session.turn.created") + # Emitted when a turn is created. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn [OpenAI::Models::Beta::Agents::Sessions::Turn] + # The turn at the time it was created. + # + # @param turn_id [String] + # The ID of the turn associated with the event. + # + # @param type [Symbol, :"agent.session.turn.created"] + # The type of the object. Always `agent.session.turn.created`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_failed_event.rb b/lib/openai/models/beta/agent_session_turn_failed_event.rb new file mode 100644 index 000000000..c24a7802e --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_failed_event.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnFailedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn + # The failed turn. + # + # @return [OpenAI::Models::Beta::Agents::Sessions::Turn] + required :turn, -> { OpenAI::Beta::Agents::Sessions::Turn } + + # @!attribute turn_id + # The ID of the turn associated with the event. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The type of the object. Always `agent.session.turn.failed`. + # + # @return [Symbol, :"agent.session.turn.failed"] + required :type, const: :"agent.session.turn.failed" + + # @!attribute usage + # Recorded token usage for a session or turn. Usage is best effort and may change. + # + # @return [OpenAI::Models::Beta::TokenUsage, nil] + required :usage, -> { OpenAI::Beta::TokenUsage }, nil?: true + + # @!method initialize(event_id:, session_id:, turn:, turn_id:, usage:, type: :"agent.session.turn.failed") + # Emitted when a turn fails. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn [OpenAI::Models::Beta::Agents::Sessions::Turn] + # The failed turn. + # + # @param turn_id [String] + # The ID of the turn associated with the event. + # + # @param usage [OpenAI::Models::Beta::TokenUsage, nil] + # Recorded token usage for a session or turn. Usage is best effort and may change. + # + # @param type [Symbol, :"agent.session.turn.failed"] + # The type of the object. Always `agent.session.turn.failed`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_in_progress_event.rb b/lib/openai/models/beta/agent_session_turn_in_progress_event.rb new file mode 100644 index 000000000..e866c14a6 --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_in_progress_event.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnInProgressEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn + # The turn at the time it started running. + # + # @return [OpenAI::Models::Beta::Agents::Sessions::Turn] + required :turn, -> { OpenAI::Beta::Agents::Sessions::Turn } + + # @!attribute turn_id + # The ID of the turn associated with the event. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The type of the object. Always `agent.session.turn.in_progress`. + # + # @return [Symbol, :"agent.session.turn.in_progress"] + required :type, const: :"agent.session.turn.in_progress" + + # @!method initialize(event_id:, session_id:, turn:, turn_id:, type: :"agent.session.turn.in_progress") + # Emitted when a turn starts running. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn [OpenAI::Models::Beta::Agents::Sessions::Turn] + # The turn at the time it started running. + # + # @param turn_id [String] + # The ID of the turn associated with the event. + # + # @param type [Symbol, :"agent.session.turn.in_progress"] + # The type of the object. Always `agent.session.turn.in_progress`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_item_added_event.rb b/lib/openai/models/beta/agent_session_turn_item_added_event.rb new file mode 100644 index 000000000..a06487a7c --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_item_added_event.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnItemAddedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute item + # The item that was added. + # + # @return [OpenAI::Models::Beta::AgentSessionMessage, OpenAI::Models::Beta::AgentReasoningItem, OpenAI::Models::Beta::AgentFunctionCallItem, OpenAI::Models::Beta::AgentSessionItem::FunctionCallOutput, OpenAI::Models::Beta::AgentSessionItem::AgentMessage, OpenAI::Models::Beta::AgentMcpCallItem, OpenAI::Models::Beta::AgentWebSearchCallItem, OpenAI::Models::Beta::AgentCommandExecutionItem, OpenAI::Models::Beta::AgentCreateSubagentCallItem, OpenAI::Models::Beta::AgentSendSubagentInputCallItem, OpenAI::Models::Beta::AgentResumeSubagentCallItem, OpenAI::Models::Beta::AgentWaitForSubagentsCallItem, OpenAI::Models::Beta::AgentInterruptSubagentCallItem, OpenAI::Models::Beta::AgentCloseSubagentCallItem] + required :item, union: -> { OpenAI::Beta::AgentSessionItem } + + # @!attribute output_index + # The index of the item in the turn output, when the item is agent output. + # + # @return [Integer, nil] + required :output_index, Integer, nil?: true + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.session.turn.item.added`. + # + # @return [Symbol, :"agent.session.turn.item.added"] + required :type, const: :"agent.session.turn.item.added" + + # @!method initialize(event_id:, item:, output_index:, session_id:, turn_id:, type: :"agent.session.turn.item.added") + # Emitted when an item is added to a turn. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param item [OpenAI::Models::Beta::AgentSessionMessage, OpenAI::Models::Beta::AgentReasoningItem, OpenAI::Models::Beta::AgentFunctionCallItem, OpenAI::Models::Beta::AgentSessionItem::FunctionCallOutput, OpenAI::Models::Beta::AgentSessionItem::AgentMessage, OpenAI::Models::Beta::AgentMcpCallItem, OpenAI::Models::Beta::AgentWebSearchCallItem, OpenAI::Models::Beta::AgentCommandExecutionItem, OpenAI::Models::Beta::AgentCreateSubagentCallItem, OpenAI::Models::Beta::AgentSendSubagentInputCallItem, OpenAI::Models::Beta::AgentResumeSubagentCallItem, OpenAI::Models::Beta::AgentWaitForSubagentsCallItem, OpenAI::Models::Beta::AgentInterruptSubagentCallItem, OpenAI::Models::Beta::AgentCloseSubagentCallItem] + # The item that was added. + # + # @param output_index [Integer, nil] + # The index of the item in the turn output, when the item is agent output. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.turn.item.added"] + # The type of the object. Always `agent.session.turn.item.added`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_item_done_event.rb b/lib/openai/models/beta/agent_session_turn_item_done_event.rb new file mode 100644 index 000000000..9c09716e3 --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_item_done_event.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnItemDoneEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute item + # The completed output item. + # + # @return [OpenAI::Models::Beta::AgentSessionAssistantMessage, OpenAI::Models::Beta::AgentReasoningItem, OpenAI::Models::Beta::AgentFunctionCallItem, OpenAI::Models::Beta::AgentMcpCallItem, OpenAI::Models::Beta::AgentWebSearchCallItem, OpenAI::Models::Beta::AgentCommandExecutionItem, OpenAI::Models::Beta::AgentCreateSubagentCallItem, OpenAI::Models::Beta::AgentSendSubagentInputCallItem, OpenAI::Models::Beta::AgentResumeSubagentCallItem, OpenAI::Models::Beta::AgentWaitForSubagentsCallItem, OpenAI::Models::Beta::AgentInterruptSubagentCallItem, OpenAI::Models::Beta::AgentCloseSubagentCallItem] + required :item, union: -> { OpenAI::Beta::AgentOutputItem } + + # @!attribute output_index + # The index of the output item in the turn output. + # + # @return [Integer] + required :output_index, Integer + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.session.turn.item.done`. + # + # @return [Symbol, :"agent.session.turn.item.done"] + required :type, const: :"agent.session.turn.item.done" + + # @!method initialize(event_id:, item:, output_index:, session_id:, turn_id:, type: :"agent.session.turn.item.done") + # Emitted when an output item is complete. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param item [OpenAI::Models::Beta::AgentSessionAssistantMessage, OpenAI::Models::Beta::AgentReasoningItem, OpenAI::Models::Beta::AgentFunctionCallItem, OpenAI::Models::Beta::AgentMcpCallItem, OpenAI::Models::Beta::AgentWebSearchCallItem, OpenAI::Models::Beta::AgentCommandExecutionItem, OpenAI::Models::Beta::AgentCreateSubagentCallItem, OpenAI::Models::Beta::AgentSendSubagentInputCallItem, OpenAI::Models::Beta::AgentResumeSubagentCallItem, OpenAI::Models::Beta::AgentWaitForSubagentsCallItem, OpenAI::Models::Beta::AgentInterruptSubagentCallItem, OpenAI::Models::Beta::AgentCloseSubagentCallItem] + # The completed output item. + # + # @param output_index [Integer] + # The index of the output item in the turn output. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.turn.item.done"] + # The type of the object. Always `agent.session.turn.item.done`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_output_text_delta_event.rb b/lib/openai/models/beta/agent_session_turn_output_text_delta_event.rb new file mode 100644 index 000000000..2ad7a7049 --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_output_text_delta_event.rb @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnOutputTextDeltaEvent < OpenAI::Internal::Type::BaseModel + # @!attribute content_index + # The index of the content part in the message. + # + # @return [Integer] + required :content_index, Integer + + # @!attribute delta + # The text that was appended. + # + # @return [String] + required :delta, String + + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute item_id + # The ID of the message item. + # + # @return [String] + required :item_id, String + + # @!attribute output_index + # The index of the item in the turn output. + # + # @return [Integer] + required :output_index, Integer + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.session.turn.output_text.delta`. + # + # @return [Symbol, :"agent.session.turn.output_text.delta"] + required :type, const: :"agent.session.turn.output_text.delta" + + # @!method initialize(content_index:, delta:, event_id:, item_id:, output_index:, session_id:, turn_id:, type: :"agent.session.turn.output_text.delta") + # Emitted when text is appended to an output text content part. + # + # @param content_index [Integer] + # The index of the content part in the message. + # + # @param delta [String] + # The text that was appended. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param item_id [String] + # The ID of the message item. + # + # @param output_index [Integer] + # The index of the item in the turn output. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.turn.output_text.delta"] + # The type of the object. Always `agent.session.turn.output_text.delta`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_output_text_done_event.rb b/lib/openai/models/beta/agent_session_turn_output_text_done_event.rb new file mode 100644 index 000000000..8a0604082 --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_output_text_done_event.rb @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnOutputTextDoneEvent < OpenAI::Internal::Type::BaseModel + # @!attribute content_index + # The index of the content part in the message. + # + # @return [Integer] + required :content_index, Integer + + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute item_id + # The ID of the message item. + # + # @return [String] + required :item_id, String + + # @!attribute output_index + # The index of the item in the turn output. + # + # @return [Integer] + required :output_index, Integer + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute text + # The complete output text. + # + # @return [String] + required :text, String + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.session.turn.output_text.done`. + # + # @return [Symbol, :"agent.session.turn.output_text.done"] + required :type, const: :"agent.session.turn.output_text.done" + + # @!method initialize(content_index:, event_id:, item_id:, output_index:, session_id:, text:, turn_id:, type: :"agent.session.turn.output_text.done") + # Emitted when an output text content part is complete. + # + # @param content_index [Integer] + # The index of the content part in the message. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param item_id [String] + # The ID of the message item. + # + # @param output_index [Integer] + # The index of the item in the turn output. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param text [String] + # The complete output text. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.turn.output_text.done"] + # The type of the object. Always `agent.session.turn.output_text.done`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_reasoning_summary_part_added_event.rb b/lib/openai/models/beta/agent_session_turn_reasoning_summary_part_added_event.rb new file mode 100644 index 000000000..afc365584 --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_reasoning_summary_part_added_event.rb @@ -0,0 +1,86 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnReasoningSummaryPartAddedEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute item_id + # The ID of the reasoning item. + # + # @return [String] + required :item_id, String + + # @!attribute output_index + # The index of the item in the turn output. + # + # @return [Integer] + required :output_index, Integer + + # @!attribute part + # The initial summary part. + # + # @return [OpenAI::Models::Beta::SummaryText] + required :part, -> { OpenAI::Beta::SummaryText } + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute summary_index + # The index of the summary content part. + # + # @return [Integer] + required :summary_index, Integer + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always + # `agent.session.turn.reasoning_summary_part.added`. + # + # @return [Symbol, :"agent.session.turn.reasoning_summary_part.added"] + required :type, const: :"agent.session.turn.reasoning_summary_part.added" + + # @!method initialize(event_id:, item_id:, output_index:, part:, session_id:, summary_index:, turn_id:, type: :"agent.session.turn.reasoning_summary_part.added") + # Emitted when a reasoning summary content part is added. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param item_id [String] + # The ID of the reasoning item. + # + # @param output_index [Integer] + # The index of the item in the turn output. + # + # @param part [OpenAI::Models::Beta::SummaryText] + # The initial summary part. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param summary_index [Integer] + # The index of the summary content part. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.turn.reasoning_summary_part.added"] + # The type of the object. Always + # `agent.session.turn.reasoning_summary_part.added`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_reasoning_summary_part_done_event.rb b/lib/openai/models/beta/agent_session_turn_reasoning_summary_part_done_event.rb new file mode 100644 index 000000000..a7f06baf0 --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_reasoning_summary_part_done_event.rb @@ -0,0 +1,93 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnReasoningSummaryPartDoneEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute item_id + # The ID of the reasoning item. + # + # @return [String] + required :item_id, String + + # @!attribute output_index + # The index of the item in the turn output. + # + # @return [Integer] + required :output_index, Integer + + # @!attribute part + # The completed summary part. + # + # @return [OpenAI::Models::Beta::SummaryText] + required :part, -> { OpenAI::Beta::SummaryText } + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute status + # Present as `incomplete` when summary generation was interrupted. + # + # @return [Symbol, :incomplete, nil] + required :status, const: :incomplete, nil?: true + + # @!attribute summary_index + # The index of the summary part. + # + # @return [Integer] + required :summary_index, Integer + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.session.turn.reasoning_summary_part.done`. + # + # @return [Symbol, :"agent.session.turn.reasoning_summary_part.done"] + required :type, const: :"agent.session.turn.reasoning_summary_part.done" + + # @!method initialize(event_id:, item_id:, output_index:, part:, session_id:, summary_index:, turn_id:, status: :incomplete, type: :"agent.session.turn.reasoning_summary_part.done") + # Emitted when a reasoning summary part is complete. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param item_id [String] + # The ID of the reasoning item. + # + # @param output_index [Integer] + # The index of the item in the turn output. + # + # @param part [OpenAI::Models::Beta::SummaryText] + # The completed summary part. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param summary_index [Integer] + # The index of the summary part. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param status [Symbol, :incomplete, nil] + # Present as `incomplete` when summary generation was interrupted. + # + # @param type [Symbol, :"agent.session.turn.reasoning_summary_part.done"] + # The type of the object. Always `agent.session.turn.reasoning_summary_part.done`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_reasoning_summary_text_delta_event.rb b/lib/openai/models/beta/agent_session_turn_reasoning_summary_text_delta_event.rb new file mode 100644 index 000000000..839c6b361 --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_reasoning_summary_text_delta_event.rb @@ -0,0 +1,86 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnReasoningSummaryTextDeltaEvent < OpenAI::Internal::Type::BaseModel + # @!attribute delta + # The summary text that was appended. + # + # @return [String] + required :delta, String + + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute item_id + # The ID of the reasoning item. + # + # @return [String] + required :item_id, String + + # @!attribute output_index + # The index of the item in the turn output. + # + # @return [Integer] + required :output_index, Integer + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute summary_index + # The index of the summary content part. + # + # @return [Integer] + required :summary_index, Integer + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always + # `agent.session.turn.reasoning_summary_text.delta`. + # + # @return [Symbol, :"agent.session.turn.reasoning_summary_text.delta"] + required :type, const: :"agent.session.turn.reasoning_summary_text.delta" + + # @!method initialize(delta:, event_id:, item_id:, output_index:, session_id:, summary_index:, turn_id:, type: :"agent.session.turn.reasoning_summary_text.delta") + # Emitted when text is appended to a reasoning summary. + # + # @param delta [String] + # The summary text that was appended. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param item_id [String] + # The ID of the reasoning item. + # + # @param output_index [Integer] + # The index of the item in the turn output. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param summary_index [Integer] + # The index of the summary content part. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.turn.reasoning_summary_text.delta"] + # The type of the object. Always + # `agent.session.turn.reasoning_summary_text.delta`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_session_turn_reasoning_summary_text_done_event.rb b/lib/openai/models/beta/agent_session_turn_reasoning_summary_text_done_event.rb new file mode 100644 index 000000000..3a0dec23f --- /dev/null +++ b/lib/openai/models/beta/agent_session_turn_reasoning_summary_text_done_event.rb @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentSessionTurnReasoningSummaryTextDoneEvent < OpenAI::Internal::Type::BaseModel + # @!attribute event_id + # The unique ID of the event. + # + # @return [String] + required :event_id, String + + # @!attribute item_id + # The ID of the reasoning item. + # + # @return [String] + required :item_id, String + + # @!attribute output_index + # The index of the item in the turn output. + # + # @return [Integer] + required :output_index, Integer + + # @!attribute session_id + # The ID of the session associated with the event. + # + # @return [String] + required :session_id, String + + # @!attribute summary_index + # The index of the summary content part. + # + # @return [Integer] + required :summary_index, Integer + + # @!attribute text + # The complete reasoning summary text. + # + # @return [String] + required :text, String + + # @!attribute turn_id + # The ID of the turn associated with the event, when applicable. + # + # @return [String, nil] + required :turn_id, String, nil?: true + + # @!attribute type + # The type of the object. Always `agent.session.turn.reasoning_summary_text.done`. + # + # @return [Symbol, :"agent.session.turn.reasoning_summary_text.done"] + required :type, const: :"agent.session.turn.reasoning_summary_text.done" + + # @!method initialize(event_id:, item_id:, output_index:, session_id:, summary_index:, text:, turn_id:, type: :"agent.session.turn.reasoning_summary_text.done") + # Emitted when a reasoning summary content part is complete. + # + # @param event_id [String] + # The unique ID of the event. + # + # @param item_id [String] + # The ID of the reasoning item. + # + # @param output_index [Integer] + # The index of the item in the turn output. + # + # @param session_id [String] + # The ID of the session associated with the event. + # + # @param summary_index [Integer] + # The index of the summary content part. + # + # @param text [String] + # The complete reasoning summary text. + # + # @param turn_id [String, nil] + # The ID of the turn associated with the event, when applicable. + # + # @param type [Symbol, :"agent.session.turn.reasoning_summary_text.done"] + # The type of the object. Always `agent.session.turn.reasoning_summary_text.done`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_text.rb b/lib/openai/models/beta/agent_text.rb new file mode 100644 index 000000000..0559e35b4 --- /dev/null +++ b/lib/openai/models/beta/agent_text.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentText < OpenAI::Internal::Type::BaseModel + # @!attribute format_ + # The effective output format. Defaults to ordinary text. + # + # @return [OpenAI::Models::Beta::TextFormat::Text, OpenAI::Models::Beta::TextFormat::JSONSchema] + required :format_, union: -> { OpenAI::Beta::TextFormat }, api_name: :format + + # @!attribute verbosity + # The amount of text produced by the agent. Defaults to `medium`. + # + # @return [Symbol, OpenAI::Models::Beta::AgentText::Verbosity] + required :verbosity, enum: -> { OpenAI::Beta::AgentText::Verbosity } + + # @!method initialize(format_:, verbosity:) + # The text configuration used by an agent. + # + # @param format_ [OpenAI::Models::Beta::TextFormat::Text, OpenAI::Models::Beta::TextFormat::JSONSchema] + # The effective output format. Defaults to ordinary text. + # + # @param verbosity [Symbol, OpenAI::Models::Beta::AgentText::Verbosity] + # The amount of text produced by the agent. Defaults to `medium`. + + # The amount of text produced by the agent. Defaults to `medium`. + # + # @see OpenAI::Models::Beta::AgentText#verbosity + module Verbosity + extend OpenAI::Internal::Type::Enum + + LOW = :low + MEDIUM = :medium + HIGH = :high + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agent_text_param.rb b/lib/openai/models/beta/agent_text_param.rb new file mode 100644 index 000000000..10f0c8eb7 --- /dev/null +++ b/lib/openai/models/beta/agent_text_param.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentTextParam < OpenAI::Internal::Type::BaseModel + # @!attribute format_ + # The output format for generated text. + # + # @return [OpenAI::Models::Beta::TextFormatParam::Text, OpenAI::Models::Beta::TextFormatParam::JSONSchema, nil] + optional :format_, union: -> { OpenAI::Beta::TextFormatParam }, api_name: :format, nil?: true + + # @!attribute verbosity + # The amount of text the model should produce. + # + # @return [Symbol, OpenAI::Models::Beta::AgentTextParam::Verbosity, nil] + optional :verbosity, enum: -> { OpenAI::Beta::AgentTextParam::Verbosity }, nil?: true + + # @!method initialize(format_: nil, verbosity: nil) + # Configuration for text generated by the agent. + # + # @param format_ [OpenAI::Models::Beta::TextFormatParam::Text, OpenAI::Models::Beta::TextFormatParam::JSONSchema, nil] + # The output format for generated text. + # + # @param verbosity [Symbol, OpenAI::Models::Beta::AgentTextParam::Verbosity, nil] + # The amount of text the model should produce. + + # The amount of text the model should produce. + # + # @see OpenAI::Models::Beta::AgentTextParam#verbosity + module Verbosity + extend OpenAI::Internal::Type::Enum + + # Produces less text. + LOW = :low + + # Uses the default amount of text. + MEDIUM = :medium + + # Produces more text. + HIGH = :high + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agent_tool.rb b/lib/openai/models/beta/agent_tool.rb new file mode 100644 index 000000000..f751acb8c --- /dev/null +++ b/lib/openai/models/beta/agent_tool.rb @@ -0,0 +1,314 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # A tool available to the agent. + module AgentTool + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A function defined by the application. + variant :function, -> { OpenAI::Beta::AgentTool::Function } + + # Enables calling tools from model-generated code. + variant :programmatic_tool_calling, -> { OpenAI::Beta::AgentTool::ProgrammaticToolCalling } + + # Tools provided by a remote MCP server. + variant :mcp, -> { OpenAI::Beta::AgentTool::Mcp } + + # Web search. + variant :web_search, -> { OpenAI::Beta::AgentTool::WebSearch } + + class Function < OpenAI::Internal::Type::BaseModel + # @!attribute defer_loading + # Whether the function is deferred and discovered through tool search. + # + # @return [Boolean] + required :defer_loading, OpenAI::Internal::Type::Boolean + + # @!attribute description + # A description of what the function does. + # + # @return [String] + required :description, String + + # @!attribute name + # The name of the function. + # + # @return [String] + required :name, String + + # @!attribute parameters + # A JSON Schema object describing the function's arguments. + # + # @return [Hash{Symbol=>Object}] + required :parameters, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown] + + # @!attribute type + # The type of the object. Always `function`. + # + # @return [Symbol, :function] + required :type, const: :function + + # @!method initialize(defer_loading:, description:, name:, parameters:, type: :function) + # A function defined by the application. + # + # @param defer_loading [Boolean] + # Whether the function is deferred and discovered through tool search. + # + # @param description [String] + # A description of what the function does. + # + # @param name [String] + # The name of the function. + # + # @param parameters [Hash{Symbol=>Object}] + # A JSON Schema object describing the function's arguments. + # + # @param type [Symbol, :function] + # The type of the object. Always `function`. + end + + class ProgrammaticToolCalling < OpenAI::Internal::Type::BaseModel + # @!attribute enabled + # Whether tools can be called from model-generated code. + # + # @return [Boolean] + required :enabled, OpenAI::Internal::Type::Boolean + + # @!attribute type + # The type of the object. Always `programmatic_tool_calling`. + # + # @return [Symbol, :programmatic_tool_calling] + required :type, const: :programmatic_tool_calling + + # @!method initialize(enabled:, type: :programmatic_tool_calling) + # Enables calling tools from model-generated code. + # + # @param enabled [Boolean] + # Whether tools can be called from model-generated code. + # + # @param type [Symbol, :programmatic_tool_calling] + # The type of the object. Always `programmatic_tool_calling`. + end + + class Mcp < OpenAI::Internal::Type::BaseModel + # @!attribute allowed_tools + # The MCP tools the agent may call. + # + # @return [Array, nil] + required :allowed_tools, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute connection_origin + # Where outbound MCP HTTP connections originate. + # + # @return [Symbol, OpenAI::Models::Beta::AgentTool::Mcp::ConnectionOrigin] + required :connection_origin, enum: -> { OpenAI::Beta::AgentTool::Mcp::ConnectionOrigin } + + # @!attribute credential_id + # The attached vault credential selected for this MCP server, if any. Optional + # when exactly one attached credential matches the server URL. + # + # @return [String, nil] + required :credential_id, String, nil?: true + + # @!attribute request_metadata + # Metadata included with requests to this MCP server. + # + # @return [Hash{Symbol=>Object}] + required :request_metadata, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown] + + # @!attribute required + # Whether this MCP server must initialize before the first turn. + # + # @return [Boolean] + required :required, OpenAI::Internal::Type::Boolean + + # @!attribute server_label + # A label used to identify the MCP server in tool calls. + # + # @return [String] + required :server_label, String + + # @!attribute transport + # The transport used to connect to the MCP server. + # + # @return [OpenAI::Models::Beta::McpTransport::HTTP, OpenAI::Models::Beta::McpTransport::Stdio] + required :transport, union: -> { OpenAI::Beta::McpTransport } + + # @!attribute type + # The type of the object. Always `mcp`. + # + # @return [Symbol, :mcp] + required :type, const: :mcp + + # @!method initialize(allowed_tools:, connection_origin:, credential_id:, request_metadata:, required:, server_label:, transport:, type: :mcp) + # Tools provided by a remote MCP server. + # + # @param allowed_tools [Array, nil] + # The MCP tools the agent may call. + # + # @param connection_origin [Symbol, OpenAI::Models::Beta::AgentTool::Mcp::ConnectionOrigin] + # Where outbound MCP HTTP connections originate. + # + # @param credential_id [String, nil] + # The attached vault credential selected for this MCP server, if any. Optional + # when exactly one attached credential matches the server URL. + # + # @param request_metadata [Hash{Symbol=>Object}] + # Metadata included with requests to this MCP server. + # + # @param required [Boolean] + # Whether this MCP server must initialize before the first turn. + # + # @param server_label [String] + # A label used to identify the MCP server in tool calls. + # + # @param transport [OpenAI::Models::Beta::McpTransport::HTTP, OpenAI::Models::Beta::McpTransport::Stdio] + # The transport used to connect to the MCP server. + # + # @param type [Symbol, :mcp] + # The type of the object. Always `mcp`. + + # Where outbound MCP HTTP connections originate. + # + # @see OpenAI::Models::Beta::AgentTool::Mcp#connection_origin + module ConnectionOrigin + extend OpenAI::Internal::Type::Enum + + SERVICE = :service + ENVIRONMENT = :environment + + # @!method self.values + # @return [Array] + end + end + + class WebSearch < OpenAI::Internal::Type::BaseModel + # @!attribute allowed_domains + # Allowed search domains, or `null` when the search is unrestricted. + # + # @return [Array, nil] + required :allowed_domains, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute context_size + # The amount of search context made available to the model. Defaults to `medium`. + # + # @return [Symbol, OpenAI::Models::Beta::AgentTool::WebSearch::ContextSize] + required :context_size, enum: -> { OpenAI::Beta::AgentTool::WebSearch::ContextSize } + + # @!attribute location + # Approximate user location used to localize web search results. + # + # @return [OpenAI::Models::Beta::AgentTool::WebSearch::Location, nil] + required :location, -> { OpenAI::Beta::AgentTool::WebSearch::Location }, nil?: true + + # @!attribute mode + # The source used for web search results. + # + # @return [Symbol, OpenAI::Models::Beta::AgentTool::WebSearch::Mode] + required :mode, enum: -> { OpenAI::Beta::AgentTool::WebSearch::Mode } + + # @!attribute type + # The type of the object. Always `web_search`. + # + # @return [Symbol, :web_search] + required :type, const: :web_search + + # @!method initialize(allowed_domains:, context_size:, location:, mode:, type: :web_search) + # Web search. + # + # @param allowed_domains [Array, nil] + # Allowed search domains, or `null` when the search is unrestricted. + # + # @param context_size [Symbol, OpenAI::Models::Beta::AgentTool::WebSearch::ContextSize] + # The amount of search context made available to the model. Defaults to `medium`. + # + # @param location [OpenAI::Models::Beta::AgentTool::WebSearch::Location, nil] + # Approximate user location used to localize web search results. + # + # @param mode [Symbol, OpenAI::Models::Beta::AgentTool::WebSearch::Mode] + # The source used for web search results. + # + # @param type [Symbol, :web_search] + # The type of the object. Always `web_search`. + + # The amount of search context made available to the model. Defaults to `medium`. + # + # @see OpenAI::Models::Beta::AgentTool::WebSearch#context_size + module ContextSize + extend OpenAI::Internal::Type::Enum + + LOW = :low + MEDIUM = :medium + HIGH = :high + + # @!method self.values + # @return [Array] + end + + # @see OpenAI::Models::Beta::AgentTool::WebSearch#location + class Location < OpenAI::Internal::Type::BaseModel + # @!attribute city + # The city name. + # + # @return [String, nil] + required :city, String, nil?: true + + # @!attribute country + # The two-letter ISO country code, such as `US`. + # + # @return [String, nil] + required :country, String, nil?: true + + # @!attribute region + # The region or state name. + # + # @return [String, nil] + required :region, String, nil?: true + + # @!attribute timezone + # The IANA timezone, such as `America/Los_Angeles`. + # + # @return [String, nil] + required :timezone, String, nil?: true + + # @!method initialize(city:, country:, region:, timezone:) + # Approximate user location used to localize web search results. + # + # @param city [String, nil] + # The city name. + # + # @param country [String, nil] + # The two-letter ISO country code, such as `US`. + # + # @param region [String, nil] + # The region or state name. + # + # @param timezone [String, nil] + # The IANA timezone, such as `America/Los_Angeles`. + end + + # The source used for web search results. + # + # @see OpenAI::Models::Beta::AgentTool::WebSearch#mode + module Mode + extend OpenAI::Internal::Type::Enum + + DISABLED = :disabled + CACHED = :cached + LIVE = :live + + # @!method self.values + # @return [Array] + end + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::AgentTool::Function, OpenAI::Models::Beta::AgentTool::ProgrammaticToolCalling, OpenAI::Models::Beta::AgentTool::Mcp, OpenAI::Models::Beta::AgentTool::WebSearch)] + end + end + end +end diff --git a/lib/openai/models/beta/agent_tool_param.rb b/lib/openai/models/beta/agent_tool_param.rb new file mode 100644 index 000000000..f45a9266a --- /dev/null +++ b/lib/openai/models/beta/agent_tool_param.rb @@ -0,0 +1,359 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # A tool available to the agent. + module AgentToolParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A function defined by the application. + variant :function, -> { OpenAI::Beta::AgentToolParam::Function } + + # Discovers deferred function tools and loads them into the model context. + variant :tool_search, -> { OpenAI::Beta::AgentToolParam::ToolSearch } + + # Enables calling tools from model-generated code. + variant :programmatic_tool_calling, -> { OpenAI::Beta::AgentToolParam::ProgrammaticToolCalling } + + # Tools provided by a remote MCP server. + variant :mcp, -> { OpenAI::Beta::AgentToolParam::Mcp } + + # Web search. + variant :web_search, -> { OpenAI::Beta::AgentToolParam::WebSearch } + + class Function < OpenAI::Internal::Type::BaseModel + # @!attribute description + # A description of what the function does. + # + # @return [String] + required :description, String + + # @!attribute name + # The name of the function. + # + # @return [String] + required :name, String + + # @!attribute parameters + # A JSON Schema object describing the function's arguments. + # + # @return [Hash{Symbol=>Object}] + required :parameters, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown] + + # @!attribute type + # The type of the object. Always `function`. + # + # @return [Symbol, :function] + required :type, const: :function + + # @!attribute defer_loading + # Whether this function is deferred and discovered through tool search. Defaults + # to `false`. + # + # @return [Boolean, nil] + optional :defer_loading, OpenAI::Internal::Type::Boolean + + # @!method initialize(description:, name:, parameters:, defer_loading: nil, type: :function) + # A function defined by the application. + # + # @param description [String] + # A description of what the function does. + # + # @param name [String] + # The name of the function. + # + # @param parameters [Hash{Symbol=>Object}] + # A JSON Schema object describing the function's arguments. + # + # @param defer_loading [Boolean] + # Whether this function is deferred and discovered through tool search. Defaults + # to `false`. + # + # @param type [Symbol, :function] + # The type of the object. Always `function`. + end + + class ToolSearch < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `tool_search`. + # + # @return [Symbol, :tool_search] + required :type, const: :tool_search + + # @!method initialize(type: :tool_search) + # Discovers deferred function tools and loads them into the model context. + # + # @param type [Symbol, :tool_search] + # The type of the object. Always `tool_search`. + end + + class ProgrammaticToolCalling < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `programmatic_tool_calling`. + # + # @return [Symbol, :programmatic_tool_calling] + required :type, const: :programmatic_tool_calling + + # @!attribute enabled + # Whether tools can be called from model-generated code. Defaults to `true`. + # + # @return [Boolean, nil] + optional :enabled, OpenAI::Internal::Type::Boolean + + # @!method initialize(enabled: nil, type: :programmatic_tool_calling) + # Enables calling tools from model-generated code. + # + # @param enabled [Boolean] + # Whether tools can be called from model-generated code. Defaults to `true`. + # + # @param type [Symbol, :programmatic_tool_calling] + # The type of the object. Always `programmatic_tool_calling`. + end + + class Mcp < OpenAI::Internal::Type::BaseModel + # @!attribute server_label + # A label used to identify the MCP server in tool calls. + # + # @return [String] + required :server_label, String + + # @!attribute transport + # The transport used to connect to the MCP server. + # + # @return [OpenAI::Models::Beta::McpTransportParam::HTTP, OpenAI::Models::Beta::McpTransportParam::Stdio] + required :transport, union: -> { OpenAI::Beta::McpTransportParam } + + # @!attribute type + # The type of the object. Always `mcp`. + # + # @return [Symbol, :mcp] + required :type, const: :mcp + + # @!attribute allowed_tools + # The MCP tools the agent may call. All server tools are allowed when omitted. + # + # @return [Array, nil] + optional :allowed_tools, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute connection_origin + # Where outbound MCP HTTP connections originate. + # + # @return [Symbol, OpenAI::Models::Beta::AgentToolParam::Mcp::ConnectionOrigin, nil] + optional( + :connection_origin, + enum: -> { + OpenAI::Beta::AgentToolParam::Mcp::ConnectionOrigin + }, + nil?: true + ) + + # @!attribute credential_id + # The attached vault credential used to authenticate this MCP server. Optional + # when exactly one attached credential matches the server URL. + # + # @return [String, nil] + optional :credential_id, String, nil?: true + + # @!attribute request_metadata + # Metadata included with requests to this MCP server. + # + # @return [Hash{Symbol=>Object}, nil] + optional( + :request_metadata, + OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown], + nil?: true + ) + + # @!attribute required + # Whether this MCP server must initialize before the first turn. Defaults to + # `false`. + # + # @return [Boolean, nil] + optional :required, OpenAI::Internal::Type::Boolean + + # @!method initialize(server_label:, transport:, allowed_tools: nil, connection_origin: nil, credential_id: nil, request_metadata: nil, required: nil, type: :mcp) + # Tools provided by a remote MCP server. + # + # @param server_label [String] + # A label used to identify the MCP server in tool calls. + # + # @param transport [OpenAI::Models::Beta::McpTransportParam::HTTP, OpenAI::Models::Beta::McpTransportParam::Stdio] + # The transport used to connect to the MCP server. + # + # @param allowed_tools [Array, nil] + # The MCP tools the agent may call. All server tools are allowed when omitted. + # + # @param connection_origin [Symbol, OpenAI::Models::Beta::AgentToolParam::Mcp::ConnectionOrigin, nil] + # Where outbound MCP HTTP connections originate. + # + # @param credential_id [String, nil] + # The attached vault credential used to authenticate this MCP server. Optional + # when exactly one attached credential matches the server URL. + # + # @param request_metadata [Hash{Symbol=>Object}, nil] + # Metadata included with requests to this MCP server. + # + # @param required [Boolean] + # Whether this MCP server must initialize before the first turn. Defaults to + # `false`. + # + # @param type [Symbol, :mcp] + # The type of the object. Always `mcp`. + + # Where outbound MCP HTTP connections originate. + # + # @see OpenAI::Models::Beta::AgentToolParam::Mcp#connection_origin + module ConnectionOrigin + extend OpenAI::Internal::Type::Enum + + # Uses the Managed Agents service network. + SERVICE = :service + + # Uses the session's execution environment. + ENVIRONMENT = :environment + + # @!method self.values + # @return [Array] + end + end + + class WebSearch < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `web_search`. + # + # @return [Symbol, :web_search] + required :type, const: :web_search + + # @!attribute allowed_domains + # Domains the search may include. + # + # @return [Array, nil] + optional :allowed_domains, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute context_size + # The amount of web search context made available to the model. + # + # @return [Symbol, OpenAI::Models::Beta::AgentToolParam::WebSearch::ContextSize, nil] + optional( + :context_size, + enum: -> { + OpenAI::Beta::AgentToolParam::WebSearch::ContextSize + }, + nil?: true + ) + + # @!attribute location + # Approximate user location used to localize web search results. + # + # @return [OpenAI::Models::Beta::AgentToolParam::WebSearch::Location, nil] + optional :location, -> { OpenAI::Beta::AgentToolParam::WebSearch::Location }, nil?: true + + # @!attribute mode + # The source used for web search results. + # + # @return [Symbol, OpenAI::Models::Beta::AgentToolParam::WebSearch::Mode, nil] + optional :mode, enum: -> { OpenAI::Beta::AgentToolParam::WebSearch::Mode }, nil?: true + + # @!method initialize(allowed_domains: nil, context_size: nil, location: nil, mode: nil, type: :web_search) + # Web search. + # + # @param allowed_domains [Array, nil] + # Domains the search may include. + # + # @param context_size [Symbol, OpenAI::Models::Beta::AgentToolParam::WebSearch::ContextSize, nil] + # The amount of web search context made available to the model. + # + # @param location [OpenAI::Models::Beta::AgentToolParam::WebSearch::Location, nil] + # Approximate user location used to localize web search results. + # + # @param mode [Symbol, OpenAI::Models::Beta::AgentToolParam::WebSearch::Mode, nil] + # The source used for web search results. + # + # @param type [Symbol, :web_search] + # The type of the object. Always `web_search`. + + # The amount of web search context made available to the model. + # + # @see OpenAI::Models::Beta::AgentToolParam::WebSearch#context_size + module ContextSize + extend OpenAI::Internal::Type::Enum + + LOW = :low + MEDIUM = :medium + HIGH = :high + + # @!method self.values + # @return [Array] + end + + # @see OpenAI::Models::Beta::AgentToolParam::WebSearch#location + class Location < OpenAI::Internal::Type::BaseModel + # @!attribute city + # The city name. + # + # @return [String, nil] + optional :city, String, nil?: true + + # @!attribute country + # The two-letter ISO country code, such as `US`. + # + # @return [String, nil] + optional :country, String, nil?: true + + # @!attribute region + # The region or state name. + # + # @return [String, nil] + optional :region, String, nil?: true + + # @!attribute timezone + # The IANA timezone, such as `America/Los_Angeles`. + # + # @return [String, nil] + optional :timezone, String, nil?: true + + # @!method initialize(city: nil, country: nil, region: nil, timezone: nil) + # Approximate user location used to localize web search results. + # + # @param city [String, nil] + # The city name. + # + # @param country [String, nil] + # The two-letter ISO country code, such as `US`. + # + # @param region [String, nil] + # The region or state name. + # + # @param timezone [String, nil] + # The IANA timezone, such as `America/Los_Angeles`. + end + + # The source used for web search results. + # + # @see OpenAI::Models::Beta::AgentToolParam::WebSearch#mode + module Mode + extend OpenAI::Internal::Type::Enum + + # Disables web search. + DISABLED = :disabled + + # Uses cached search results. + CACHED = :cached + + # Searches the live web. + LIVE = :live + + # @!method self.values + # @return [Array] + end + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::AgentToolParam::Function, OpenAI::Models::Beta::AgentToolParam::ToolSearch, OpenAI::Models::Beta::AgentToolParam::ProgrammaticToolCalling, OpenAI::Models::Beta::AgentToolParam::Mcp, OpenAI::Models::Beta::AgentToolParam::WebSearch)] + end + end + end +end diff --git a/lib/openai/models/beta/agent_update_params.rb b/lib/openai/models/beta/agent_update_params.rb new file mode 100644 index 000000000..15ed51208 --- /dev/null +++ b/lib/openai/models/beta/agent_update_params.rb @@ -0,0 +1,137 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # @see OpenAI::Resources::Beta::Agents#update + class AgentUpdateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute agent_id + # + # @return [String] + required :agent_id, String + + # @!attribute instructions + # Additional instructions appended to the agent's default base instructions. Omit + # to leave unchanged. + # + # @return [String, nil] + optional :instructions, String, nil?: true + + # @!attribute metadata + # Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. + # + # @return [Hash{Symbol=>String}, nil] + optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true + + # @!attribute model + # The model to use for the agent. The requested model name is preserved. + # + # @return [String, nil] + optional :model, String + + # @!attribute multi_agent + # Explicit configuration for creating and coordinating subagents. + # + # @return [OpenAI::Models::Beta::MultiAgentConfigParam, nil] + optional :multi_agent, -> { OpenAI::Beta::MultiAgentConfigParam }, nil?: true + + # @!attribute name + # A replacement name. Omit to leave unchanged, or pass null to clear it. + # + # @return [String, nil] + optional :name, String, nil?: true + + # @!attribute reasoning + # Reasoning configuration for the agent. + # + # @return [OpenAI::Models::Beta::AgentReasoningParam, nil] + optional :reasoning, -> { OpenAI::Beta::AgentReasoningParam }, nil?: true + + # @!attribute service_tier + # The service tier used for model requests. + # + # @return [Symbol, OpenAI::Models::Beta::AgentUpdateParams::ServiceTier, nil] + optional :service_tier, enum: -> { OpenAI::Beta::AgentUpdateParams::ServiceTier }, nil?: true + + # @!attribute text + # Configuration for text generated by the agent. + # + # @return [OpenAI::Models::Beta::AgentTextParam, nil] + optional :text, -> { OpenAI::Beta::AgentTextParam }, nil?: true + + # @!attribute tools + # Tools available to the agent. + # + # @return [Array, nil] + optional( + :tools, + -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::PersistedAgentToolParam] }, + nil?: true + ) + + # @!method initialize(agent_id:, instructions: nil, metadata: nil, model: nil, multi_agent: nil, name: nil, reasoning: nil, service_tier: nil, text: nil, tools: nil, request_options: {}) + # @param agent_id [String] + # + # @param instructions [String, nil] + # Additional instructions appended to the agent's default base instructions. Omit + # to leave unchanged. + # + # @param metadata [Hash{Symbol=>String}, nil] + # Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. + # + # @param model [String] + # The model to use for the agent. The requested model name is preserved. + # + # @param multi_agent [OpenAI::Models::Beta::MultiAgentConfigParam, nil] + # Explicit configuration for creating and coordinating subagents. + # + # @param name [String, nil] + # A replacement name. Omit to leave unchanged, or pass null to clear it. + # + # @param reasoning [OpenAI::Models::Beta::AgentReasoningParam, nil] + # Reasoning configuration for the agent. + # + # @param service_tier [Symbol, OpenAI::Models::Beta::AgentUpdateParams::ServiceTier, nil] + # The service tier used for model requests. + # + # @param text [OpenAI::Models::Beta::AgentTextParam, nil] + # Configuration for text generated by the agent. + # + # @param tools [Array, nil] + # Tools available to the agent. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # The service tier used for model requests. + module ServiceTier + extend OpenAI::Internal::Type::Enum + + # Selects the service tier automatically. + AUTO = :auto + + # Uses the default service tier. + DEFAULT = :default + + # Uses the flex service tier. + FLEX = :flex + + # Uses the priority service tier. + PRIORITY = :priority + + # Uses the fast service tier. + FAST = :fast + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agent_wait_for_subagents_call_item.rb b/lib/openai/models/beta/agent_wait_for_subagents_call_item.rb new file mode 100644 index 000000000..36a5f80c9 --- /dev/null +++ b/lib/openai/models/beta/agent_wait_for_subagents_call_item.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentWaitForSubagentsCallItem < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the tool call item. + # + # @return [String] + required :id, String + + # @!attribute recipient_agent_ids + # The IDs of the agents to wait for. + # + # @return [Array] + required :recipient_agent_ids, OpenAI::Internal::Type::ArrayOf[String] + + # @!attribute sender_agent_id + # The ID of the agent waiting for results. + # + # @return [String] + required :sender_agent_id, String + + # @!attribute status + # The status of the tool call. + # + # @return [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + required :status, enum: -> { OpenAI::Beta::AgentFunctionCallStatus } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `wait_for_subagents_call`. + # + # @return [Symbol, :wait_for_subagents_call] + required :type, const: :wait_for_subagents_call + + # @!method initialize(id:, recipient_agent_ids:, sender_agent_id:, status:, turn_id:, type: :wait_for_subagents_call) + # A request to wait for one or more subagents. + # + # @param id [String] + # The ID of the tool call item. + # + # @param recipient_agent_ids [Array] + # The IDs of the agents to wait for. + # + # @param sender_agent_id [String] + # The ID of the agent waiting for results. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentFunctionCallStatus] + # The status of the tool call. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :wait_for_subagents_call] + # The item type. Always `wait_for_subagents_call`. + end + end + end +end diff --git a/lib/openai/models/beta/agent_web_search_call_item.rb b/lib/openai/models/beta/agent_web_search_call_item.rb new file mode 100644 index 000000000..1c5698301 --- /dev/null +++ b/lib/openai/models/beta/agent_web_search_call_item.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class AgentWebSearchCallItem < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the web search call. + # + # @return [String] + required :id, String + + # @!attribute action + # An action performed by the web search tool. + # + # @return [OpenAI::Models::Beta::WebSearchAction::Search, OpenAI::Models::Beta::WebSearchAction::OpenPage, OpenAI::Models::Beta::WebSearchAction::FindInPage, OpenAI::Models::Beta::WebSearchAction::Other, nil] + required :action, union: -> { OpenAI::Beta::WebSearchAction }, nil?: true + + # @!attribute status + # The status of the web search call. + # + # @return [Symbol, OpenAI::Models::Beta::AgentOutputItemStatus] + required :status, enum: -> { OpenAI::Beta::AgentOutputItemStatus } + + # @!attribute turn_id + # The ID of the turn that contains this item. + # + # @return [String] + required :turn_id, String + + # @!attribute type + # The item type. Always `web_search_call`. + # + # @return [Symbol, :web_search_call] + required :type, const: :web_search_call + + # @!method initialize(id:, action:, status:, turn_id:, type: :web_search_call) + # A web search call produced by the agent. + # + # @param id [String] + # The ID of the web search call. + # + # @param action [OpenAI::Models::Beta::WebSearchAction::Search, OpenAI::Models::Beta::WebSearchAction::OpenPage, OpenAI::Models::Beta::WebSearchAction::FindInPage, OpenAI::Models::Beta::WebSearchAction::Other, nil] + # An action performed by the web search tool. + # + # @param status [Symbol, OpenAI::Models::Beta::AgentOutputItemStatus] + # The status of the web search call. + # + # @param turn_id [String] + # The ID of the turn that contains this item. + # + # @param type [Symbol, :web_search_call] + # The item type. Always `web_search_call`. + end + end + end +end diff --git a/lib/openai/models/beta/agents/environment_info.rb b/lib/openai/models/beta/agents/environment_info.rb new file mode 100644 index 000000000..100f8e3ff --- /dev/null +++ b/lib/openai/models/beta/agents/environment_info.rb @@ -0,0 +1,107 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # @see OpenAI::Resources::Beta::Agents::Environments#retrieve + class EnvironmentInfo < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the environment. + # + # @return [String] + required :id, String + + # @!attribute files + # Files installed in the environment, without their contents. + # + # @return [Array] + required :files, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::HostedEnvironmentFile] } + + # @!attribute object + # The object type. Always `agent.environment`. + # + # @return [Symbol, :"agent.environment"] + required :object, const: :"agent.environment" + + # @!attribute plugins + # Plugins installed in the environment, without their archive contents. + # + # @return [Array] + required :plugins, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::HostedPlugin] } + + # @!attribute skills + # Skills installed in the environment, without their archive contents. + # + # @return [Array] + required :skills, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::HostedSkill] } + + # @!attribute status + # The current environment connection status. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::EnvironmentInfo::Status] + required :status, enum: -> { OpenAI::Beta::Agents::EnvironmentInfo::Status } + + # @!attribute type + # Whether the environment is hosted by OpenAI or by the application. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::EnvironmentInfo::Type] + required :type, enum: -> { OpenAI::Beta::Agents::EnvironmentInfo::Type } + + # @!method initialize(id:, files:, plugins:, skills:, status:, type:, object: :"agent.environment") + # Safe metadata for a first-class execution environment. + # + # @param id [String] + # The ID of the environment. + # + # @param files [Array] + # Files installed in the environment, without their contents. + # + # @param plugins [Array] + # Plugins installed in the environment, without their archive contents. + # + # @param skills [Array] + # Skills installed in the environment, without their archive contents. + # + # @param status [Symbol, OpenAI::Models::Beta::Agents::EnvironmentInfo::Status] + # The current environment connection status. + # + # @param type [Symbol, OpenAI::Models::Beta::Agents::EnvironmentInfo::Type] + # Whether the environment is hosted by OpenAI or by the application. + # + # @param object [Symbol, :"agent.environment"] + # The object type. Always `agent.environment`. + + # The current environment connection status. + # + # @see OpenAI::Models::Beta::Agents::EnvironmentInfo#status + module Status + extend OpenAI::Internal::Type::Enum + + PENDING = :pending + CONNECTED = :connected + DISCONNECTED = :disconnected + EXPIRED = :expired + FAILED = :failed + + # @!method self.values + # @return [Array] + end + + # Whether the environment is hosted by OpenAI or by the application. + # + # @see OpenAI::Models::Beta::Agents::EnvironmentInfo#type + module Type + extend OpenAI::Internal::Type::Enum + + OPENAI_HOSTED = :openai_hosted + SELF_HOSTED = :self_hosted + + # @!method self.values + # @return [Array] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/environment_retrieve_params.rb b/lib/openai/models/beta/agents/environment_retrieve_params.rb new file mode 100644 index 000000000..8bdcaf342 --- /dev/null +++ b/lib/openai/models/beta/agents/environment_retrieve_params.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # @see OpenAI::Resources::Beta::Agents::Environments#retrieve + class EnvironmentRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute environment_id + # + # @return [String] + required :environment_id, String + + # @!method initialize(environment_id:, request_options: {}) + # @param environment_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/environments/environment_file.rb b/lib/openai/models/beta/agents/environments/environment_file.rb new file mode 100644 index 000000000..0ebf8648f --- /dev/null +++ b/lib/openai/models/beta/agents/environments/environment_file.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Environments + # @see OpenAI::Resources::Beta::Agents::Environments::Files#create + class EnvironmentFile < OpenAI::Internal::Type::BaseModel + # @!attribute environment_id + # The ID of the environment containing this file. + # + # @return [String] + required :environment_id, String + + # @!attribute object + # The object type. Always `agent.environment.file`. + # + # @return [Symbol, :"agent.environment.file"] + required :object, const: :"agent.environment.file" + + # @!attribute path + # The absolute file path inside the environment's workspace. + # + # @return [String] + required :path, String + + # @!attribute size_bytes + # The file size in bytes. + # + # @return [Integer] + required :size_bytes, Integer + + # @!method initialize(environment_id:, path:, size_bytes:, object: :"agent.environment.file") + # A live file in an execution environment. + # + # @param environment_id [String] + # The ID of the environment containing this file. + # + # @param path [String] + # The absolute file path inside the environment's workspace. + # + # @param size_bytes [Integer] + # The file size in bytes. + # + # @param object [Symbol, :"agent.environment.file"] + # The object type. Always `agent.environment.file`. + end + end + + EnvironmentFile = Environments::EnvironmentFile + end + end + end +end diff --git a/lib/openai/models/beta/agents/environments/environment_template.rb b/lib/openai/models/beta/agents/environments/environment_template.rb new file mode 100644 index 000000000..d8477a8b4 --- /dev/null +++ b/lib/openai/models/beta/agents/environments/environment_template.rb @@ -0,0 +1,368 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Environments + # @see OpenAI::Resources::Beta::Agents::Environments::Templates#create + class EnvironmentTemplate < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the reusable environment template. + # + # @return [String] + required :id, String + + # @!attribute capability_directories + # Directories that expose capabilities to the agent. + # + # @return [Array] + required :capability_directories, OpenAI::Internal::Type::ArrayOf[String] + + # @!attribute created_at + # The Unix timestamp, in seconds, when the template was created. + # + # @return [Integer] + required :created_at, Integer + + # @!attribute files + # Safe file metadata, excluding contents and session-scoped file IDs. + # + # @return [Array] + required( + :files, + -> { + OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File] + } + ) + + # @!attribute name + # An optional human-readable display name for the template. + # + # @return [String, nil] + required :name, String, nil?: true + + # @!attribute network + # Runtime network access for each OpenAI-hosted environment. + # + # @return [OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Network] + required :network, -> { OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network } + + # @!attribute object + # The object type. Always `agent.environment.template`. + # + # @return [Symbol, :"agent.environment.template"] + required :object, const: :"agent.environment.template" + + # @!attribute packages + # Packages installed in each fresh OpenAI-hosted environment. + # + # @return [OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Packages] + required :packages, -> { OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages } + + # @!attribute plugins + # Safe plugin metadata, excluding inline archive contents. + # + # @return [Array] + required :plugins, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::HostedPlugin] } + + # @!attribute skills + # Safe skill metadata, preserving unresolved version selectors. + # + # @return [Array] + required( + :skills, + -> { + OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill] + } + ) + + # @!attribute updated_at + # The Unix timestamp, in seconds, when the template was last updated. + # + # @return [Integer] + required :updated_at, Integer + + # @!method initialize(id:, capability_directories:, created_at:, files:, name:, network:, packages:, plugins:, skills:, updated_at:, object: :"agent.environment.template") + # Reusable configuration that provisions a fresh OpenAI-hosted environment for + # each session. + # + # @param id [String] + # The ID of the reusable environment template. + # + # @param capability_directories [Array] + # Directories that expose capabilities to the agent. + # + # @param created_at [Integer] + # The Unix timestamp, in seconds, when the template was created. + # + # @param files [Array] + # Safe file metadata, excluding contents and session-scoped file IDs. + # + # @param name [String, nil] + # An optional human-readable display name for the template. + # + # @param network [OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Network] + # Runtime network access for each OpenAI-hosted environment. + # + # @param packages [OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Packages] + # Packages installed in each fresh OpenAI-hosted environment. + # + # @param plugins [Array] + # Safe plugin metadata, excluding inline archive contents. + # + # @param skills [Array] + # Safe skill metadata, preserving unresolved version selectors. + # + # @param updated_at [Integer] + # The Unix timestamp, in seconds, when the template was last updated. + # + # @param object [Symbol, :"agent.environment.template"] + # The object type. Always `agent.environment.template`. + + # Safe metadata for a file configured by an environment template. + module File + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A project-scoped Files API reference resolved separately for each session. + variant :file_id, -> { OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File::FileID } + + # Metadata for confidential inline file contents. + variant :inline, -> { OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File::Inline } + + class FileID < OpenAI::Internal::Type::BaseModel + # @!attribute file_id + # The ID of the uploaded file. + # + # @return [String] + required :file_id, String + + # @!attribute path + # The file's absolute path inside the environment. + # + # @return [String] + required :path, String + + # @!attribute type + # The type of the object. Always `file_id`. + # + # @return [Symbol, :file_id] + required :type, const: :file_id + + # @!method initialize(file_id:, path:, type: :file_id) + # A project-scoped Files API reference resolved separately for each session. + # + # @param file_id [String] + # The ID of the uploaded file. + # + # @param path [String] + # The file's absolute path inside the environment. + # + # @param type [Symbol, :file_id] + # The type of the object. Always `file_id`. + end + + class Inline < OpenAI::Internal::Type::BaseModel + # @!attribute path + # The file's absolute path inside the environment. + # + # @return [String] + required :path, String + + # @!attribute size_bytes + # The decoded size of the inline file in bytes. + # + # @return [Integer] + required :size_bytes, Integer + + # @!attribute type + # The type of the object. Always `inline`. + # + # @return [Symbol, :inline] + required :type, const: :inline + + # @!method initialize(path:, size_bytes:, type: :inline) + # Metadata for confidential inline file contents. + # + # @param path [String] + # The file's absolute path inside the environment. + # + # @param size_bytes [Integer] + # The decoded size of the inline file in bytes. + # + # @param type [Symbol, :inline] + # The type of the object. Always `inline`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::File::FileID, OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::File::Inline)] + end + + # @see OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate#network + class Network < OpenAI::Internal::Type::BaseModel + # @!attribute access + # The environment's network access mode. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Network::Access] + required :access, enum: -> { OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network::Access } + + # @!attribute allowed_domains + # Domains the environment may access when network access is restricted. + # + # @return [Array] + required :allowed_domains, OpenAI::Internal::Type::ArrayOf[String] + + # @!method initialize(access:, allowed_domains:) + # Runtime network access for each OpenAI-hosted environment. + # + # @param access [Symbol, OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Network::Access] + # The environment's network access mode. + # + # @param allowed_domains [Array] + # Domains the environment may access when network access is restricted. + + # The environment's network access mode. + # + # @see OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Network#access + module Access + extend OpenAI::Internal::Type::Enum + + # Allows unrestricted network access. + ENABLED = :enabled + + # Disables network access. + DISABLED = :disabled + + # Allows access only to configured domains. + RESTRICTED = :restricted + + # @!method self.values + # @return [Array] + end + end + + # @see OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate#packages + class Packages < OpenAI::Internal::Type::BaseModel + # @!attribute npm + # npm packages installed globally in the environment. + # + # @return [Array] + required :npm, OpenAI::Internal::Type::ArrayOf[String] + + # @!attribute python + # Python packages installed in the environment. + # + # @return [Array] + required :python, OpenAI::Internal::Type::ArrayOf[String] + + # @!attribute system_ + # System packages installed in the environment. + # + # @return [Array] + required :system_, OpenAI::Internal::Type::ArrayOf[String], api_name: :system + + # @!method initialize(npm:, python:, system_:) + # Packages installed in each fresh OpenAI-hosted environment. + # + # @param npm [Array] + # npm packages installed globally in the environment. + # + # @param python [Array] + # Python packages installed in the environment. + # + # @param system_ [Array] + # System packages installed in the environment. + end + + # Safe metadata for a skill configured by an environment template. + module Skill + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A skill resolved afresh from the Skills API whenever a session starts. + variant( + :skill_reference, + -> { OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill::SkillReference } + ) + + # Safe metadata for an inline skill archive. + variant :inline, -> { OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill::Inline } + + class SkillReference < OpenAI::Internal::Type::BaseModel + # @!attribute skill_id + # The referenced skill ID. + # + # @return [String] + required :skill_id, String + + # @!attribute type + # The type of the object. Always `skill_reference`. + # + # @return [Symbol, :skill_reference] + required :type, const: :skill_reference + + # @!attribute version + # The requested version selector, including `latest`. + # + # @return [String, nil] + required :version, String, nil?: true + + # @!method initialize(skill_id:, version:, type: :skill_reference) + # A skill resolved afresh from the Skills API whenever a session starts. + # + # @param skill_id [String] + # The referenced skill ID. + # + # @param version [String, nil] + # The requested version selector, including `latest`. + # + # @param type [Symbol, :skill_reference] + # The type of the object. Always `skill_reference`. + end + + class Inline < OpenAI::Internal::Type::BaseModel + # @!attribute description + # The skill description declared in `SKILL.md`. + # + # @return [String] + required :description, String + + # @!attribute name + # The skill name declared in `SKILL.md`. + # + # @return [String] + required :name, String + + # @!attribute type + # The type of the object. Always `inline`. + # + # @return [Symbol, :inline] + required :type, const: :inline + + # @!method initialize(description:, name:, type: :inline) + # Safe metadata for an inline skill archive. + # + # @param description [String] + # The skill description declared in `SKILL.md`. + # + # @param name [String] + # The skill name declared in `SKILL.md`. + # + # @param type [Symbol, :inline] + # The type of the object. Always `inline`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Skill::SkillReference, OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Skill::Inline)] + end + end + end + + EnvironmentTemplate = Environments::EnvironmentTemplate + end + end + end +end diff --git a/lib/openai/models/beta/agents/environments/environment_template_deleted.rb b/lib/openai/models/beta/agents/environments/environment_template_deleted.rb new file mode 100644 index 000000000..bc4410472 --- /dev/null +++ b/lib/openai/models/beta/agents/environments/environment_template_deleted.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Environments + # @see OpenAI::Resources::Beta::Agents::Environments::Templates#delete + class EnvironmentTemplateDeleted < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the deleted environment template. + # + # @return [String] + required :id, String + + # @!attribute deleted + # Whether the environment template was deleted. Always `true`. + # + # @return [Boolean] + required :deleted, OpenAI::Internal::Type::Boolean + + # @!attribute object + # The object type. Always `agent.environment.template.deleted`. + # + # @return [Symbol, :"agent.environment.template.deleted"] + required :object, const: :"agent.environment.template.deleted" + + # @!method initialize(id:, deleted:, object: :"agent.environment.template.deleted") + # A deleted reusable environment template. + # + # @param id [String] + # The ID of the deleted environment template. + # + # @param deleted [Boolean] + # Whether the environment template was deleted. Always `true`. + # + # @param object [Symbol, :"agent.environment.template.deleted"] + # The object type. Always `agent.environment.template.deleted`. + end + end + + EnvironmentTemplateDeleted = Environments::EnvironmentTemplateDeleted + end + end + end +end diff --git a/lib/openai/models/beta/agents/environments/file_create_params.rb b/lib/openai/models/beta/agents/environments/file_create_params.rb new file mode 100644 index 000000000..0b645fd77 --- /dev/null +++ b/lib/openai/models/beta/agents/environments/file_create_params.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Environments + # @see OpenAI::Resources::Beta::Agents::Environments::Files#create + class FileCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute environment_id + # + # @return [String] + required :environment_id, String + + # @!method initialize(environment_id:, request_options: {}) + # @param environment_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/environments/file_list_params.rb b/lib/openai/models/beta/agents/environments/file_list_params.rb new file mode 100644 index 000000000..d5ed1e4e2 --- /dev/null +++ b/lib/openai/models/beta/agents/environments/file_list_params.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Environments + # @see OpenAI::Resources::Beta::Agents::Environments::Files#list + class FileListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute environment_id + # + # @return [String] + required :environment_id, String + + # @!attribute limit + # The maximum number of files to return, between 1 and 100. + # + # @return [Integer, nil] + optional :limit, Integer, nil?: true + + # @!attribute order + # Sort by case-sensitive path components. Defaults to descending. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Environments::FileListParams::Order, nil] + optional :order, enum: -> { OpenAI::Beta::Agents::Environments::FileListParams::Order } + + # @!attribute page + # The opaque token from the previous page. Keep the same path, order, and limit. + # + # @return [String, nil] + optional :page, String + + # @!attribute path + # Restrict the listing to this absolute workspace directory. + # + # @return [String, nil] + optional :path, String, nil?: true + + # @!method initialize(environment_id:, limit: nil, order: nil, page: nil, path: nil, request_options: {}) + # @param environment_id [String] + # + # @param limit [Integer, nil] + # The maximum number of files to return, between 1 and 100. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Environments::FileListParams::Order] + # Sort by case-sensitive path components. Defaults to descending. + # + # @param page [String] + # The opaque token from the previous page. Keep the same path, order, and limit. + # + # @param path [String, nil] + # Restrict the listing to this absolute workspace directory. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # Sort by case-sensitive path components. Defaults to descending. + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC = :asc + + # Returns resources in descending order. + DESC = :desc + + # @!method self.values + # @return [Array] + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/environments/template_create_params.rb b/lib/openai/models/beta/agents/environments/template_create_params.rb new file mode 100644 index 000000000..b3288521b --- /dev/null +++ b/lib/openai/models/beta/agents/environments/template_create_params.rb @@ -0,0 +1,209 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Environments + # @see OpenAI::Resources::Beta::Agents::Environments::Templates#create + class TemplateCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute capability_directories + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + # + # @return [Array, nil] + optional :capability_directories, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute env + # Environment variables made available to the agent. + # + # @return [Hash{Symbol=>String}, nil] + optional :env, OpenAI::Internal::Type::HashOf[String], nil?: true + + # @!attribute files + # Files available before the agent starts. Defaults to an empty list. + # + # @return [Array, nil] + optional( + :files, + -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::HostedEnvironmentFileParam] }, + nil?: true + ) + + # @!attribute name + # An optional human-readable display name for the template. + # + # @return [String, nil] + optional :name, String, nil?: true + + # @!attribute network + # Network access for an OpenAI-hosted environment. + # + # @return [OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Network, nil] + optional( + :network, + -> { + OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network + }, + nil?: true + ) + + # @!attribute packages + # Packages to install in an OpenAI-hosted environment. + # + # @return [OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Packages, nil] + optional( + :packages, + -> { + OpenAI::Beta::Agents::Environments::TemplateCreateParams::Packages + }, + nil?: true + ) + + # @!attribute plugins + # Plugins provided as inline ZIP archives. Defaults to an empty list. + # + # @return [Array, nil] + optional( + :plugins, + -> { + OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::HostedPluginParam] + }, + nil?: true + ) + + # @!attribute setup_commands + # Ordered, confidential setup commands. Command bodies are never returned. + # + # @return [Array, nil] + optional( + :setup_commands, + -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::SetupCommandParam] }, + nil?: true + ) + + # @!attribute skills + # Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty + # list. + # + # @return [Array, nil] + optional( + :skills, + -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::HostedSkillParam] }, + nil?: true + ) + + # @!method initialize(capability_directories: nil, env: nil, files: nil, name: nil, network: nil, packages: nil, plugins: nil, setup_commands: nil, skills: nil, request_options: {}) + # @param capability_directories [Array, nil] + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + # + # @param env [Hash{Symbol=>String}, nil] + # Environment variables made available to the agent. + # + # @param files [Array, nil] + # Files available before the agent starts. Defaults to an empty list. + # + # @param name [String, nil] + # An optional human-readable display name for the template. + # + # @param network [OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Network, nil] + # Network access for an OpenAI-hosted environment. + # + # @param packages [OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Packages, nil] + # Packages to install in an OpenAI-hosted environment. + # + # @param plugins [Array, nil] + # Plugins provided as inline ZIP archives. Defaults to an empty list. + # + # @param setup_commands [Array, nil] + # Ordered, confidential setup commands. Command bodies are never returned. + # + # @param skills [Array, nil] + # Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty + # list. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + class Network < OpenAI::Internal::Type::BaseModel + # @!attribute access + # The environment's network access mode. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Network::Access] + required :access, enum: -> { OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network::Access } + + # @!attribute allowed_domains + # Domains the environment may access when network access is restricted. + # + # @return [Array, nil] + optional :allowed_domains, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!method initialize(access:, allowed_domains: nil) + # Network access for an OpenAI-hosted environment. + # + # @param access [Symbol, OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Network::Access] + # The environment's network access mode. + # + # @param allowed_domains [Array, nil] + # Domains the environment may access when network access is restricted. + + # The environment's network access mode. + # + # @see OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Network#access + module Access + extend OpenAI::Internal::Type::Enum + + # Allows unrestricted network access, matching an omitted network policy. + ENABLED = :enabled + + # Disables network access. + DISABLED = :disabled + + # Allows access only to configured domains. + RESTRICTED = :restricted + + # @!method self.values + # @return [Array] + end + end + + class Packages < OpenAI::Internal::Type::BaseModel + # @!attribute npm + # npm packages to install globally. Defaults to an empty list. + # + # @return [Array, nil] + optional :npm, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute python + # Python packages to install. Defaults to an empty list. + # + # @return [Array, nil] + optional :python, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute system_ + # System packages to install. Defaults to an empty list. + # + # @return [Array, nil] + optional :system_, OpenAI::Internal::Type::ArrayOf[String], api_name: :system, nil?: true + + # @!method initialize(npm: nil, python: nil, system_: nil) + # Packages to install in an OpenAI-hosted environment. + # + # @param npm [Array, nil] + # npm packages to install globally. Defaults to an empty list. + # + # @param python [Array, nil] + # Python packages to install. Defaults to an empty list. + # + # @param system_ [Array, nil] + # System packages to install. Defaults to an empty list. + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/environments/template_delete_params.rb b/lib/openai/models/beta/agents/environments/template_delete_params.rb new file mode 100644 index 000000000..0a91b6249 --- /dev/null +++ b/lib/openai/models/beta/agents/environments/template_delete_params.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Environments + # @see OpenAI::Resources::Beta::Agents::Environments::Templates#delete + class TemplateDeleteParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute environment_template_id + # + # @return [String] + required :environment_template_id, String + + # @!method initialize(environment_template_id:, request_options: {}) + # @param environment_template_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/environments/template_list_params.rb b/lib/openai/models/beta/agents/environments/template_list_params.rb new file mode 100644 index 000000000..701c20dd1 --- /dev/null +++ b/lib/openai/models/beta/agents/environments/template_list_params.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Environments + # @see OpenAI::Resources::Beta::Agents::Environments::Templates#list + class TemplateListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute after + # Return resources after this resource ID in the selected order. + # + # @return [String, nil] + optional :after, String + + # @!attribute limit + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @return [Integer, nil] + optional :limit, Integer + + # @!attribute order + # The order in which resources are returned. Defaults to `desc`. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Environments::TemplateListParams::Order, nil] + optional :order, enum: -> { OpenAI::Beta::Agents::Environments::TemplateListParams::Order } + + # @!method initialize(after: nil, limit: nil, order: nil, request_options: {}) + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Environments::TemplateListParams::Order] + # The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC = :asc + + # Returns resources in descending order. + DESC = :desc + + # @!method self.values + # @return [Array] + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/environments/template_retrieve_params.rb b/lib/openai/models/beta/agents/environments/template_retrieve_params.rb new file mode 100644 index 000000000..a5583aa3d --- /dev/null +++ b/lib/openai/models/beta/agents/environments/template_retrieve_params.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Environments + # @see OpenAI::Resources::Beta::Agents::Environments::Templates#retrieve + class TemplateRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute environment_template_id + # + # @return [String] + required :environment_template_id, String + + # @!method initialize(environment_template_id:, request_options: {}) + # @param environment_template_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/environments/template_update_params.rb b/lib/openai/models/beta/agents/environments/template_update_params.rb new file mode 100644 index 000000000..bee781f4e --- /dev/null +++ b/lib/openai/models/beta/agents/environments/template_update_params.rb @@ -0,0 +1,212 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Environments + # @see OpenAI::Resources::Beta::Agents::Environments::Templates#update + class TemplateUpdateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute environment_template_id + # + # @return [String] + required :environment_template_id, String + + # @!attribute capability_directories + # Directories that expose capabilities to the agent. + # + # @return [Array, nil] + optional :capability_directories, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute env + # Replacement confidential environment values. + # + # @return [Hash{Symbol=>String}, nil] + optional :env, OpenAI::Internal::Type::HashOf[String], nil?: true + + # @!attribute files + # Replacement file configuration materialized for each new session. + # + # @return [Array, nil] + optional( + :files, + -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::HostedEnvironmentFileParam] }, + nil?: true + ) + + # @!attribute name + # A replacement human-readable display name, or `null` to clear the name. + # + # @return [String, nil] + optional :name, String, nil?: true + + # @!attribute network + # Network access for an OpenAI-hosted environment. + # + # @return [OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Network, nil] + optional( + :network, + -> { + OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network + }, + nil?: true + ) + + # @!attribute packages + # Packages to install in an OpenAI-hosted environment. + # + # @return [OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Packages, nil] + optional( + :packages, + -> { + OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Packages + }, + nil?: true + ) + + # @!attribute plugins + # Replacement plugin configuration installed for each new session. + # + # @return [Array, nil] + optional( + :plugins, + -> { + OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::HostedPluginParam] + }, + nil?: true + ) + + # @!attribute setup_commands + # Replacement confidential setup commands, never included in returned resources. + # + # @return [Array, nil] + optional( + :setup_commands, + -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::SetupCommandParam] }, + nil?: true + ) + + # @!attribute skills + # Replacement skill configuration installed for each new session. + # + # @return [Array, nil] + optional( + :skills, + -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::HostedSkillParam] }, + nil?: true + ) + + # @!method initialize(environment_template_id:, capability_directories: nil, env: nil, files: nil, name: nil, network: nil, packages: nil, plugins: nil, setup_commands: nil, skills: nil, request_options: {}) + # @param environment_template_id [String] + # + # @param capability_directories [Array, nil] + # Directories that expose capabilities to the agent. + # + # @param env [Hash{Symbol=>String}, nil] + # Replacement confidential environment values. + # + # @param files [Array, nil] + # Replacement file configuration materialized for each new session. + # + # @param name [String, nil] + # A replacement human-readable display name, or `null` to clear the name. + # + # @param network [OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Network, nil] + # Network access for an OpenAI-hosted environment. + # + # @param packages [OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Packages, nil] + # Packages to install in an OpenAI-hosted environment. + # + # @param plugins [Array, nil] + # Replacement plugin configuration installed for each new session. + # + # @param setup_commands [Array, nil] + # Replacement confidential setup commands, never included in returned resources. + # + # @param skills [Array, nil] + # Replacement skill configuration installed for each new session. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + class Network < OpenAI::Internal::Type::BaseModel + # @!attribute access + # The environment's network access mode. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Network::Access] + required :access, enum: -> { OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network::Access } + + # @!attribute allowed_domains + # Domains the environment may access when network access is restricted. + # + # @return [Array, nil] + optional :allowed_domains, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!method initialize(access:, allowed_domains: nil) + # Network access for an OpenAI-hosted environment. + # + # @param access [Symbol, OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Network::Access] + # The environment's network access mode. + # + # @param allowed_domains [Array, nil] + # Domains the environment may access when network access is restricted. + + # The environment's network access mode. + # + # @see OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Network#access + module Access + extend OpenAI::Internal::Type::Enum + + # Allows unrestricted network access, matching an omitted network policy. + ENABLED = :enabled + + # Disables network access. + DISABLED = :disabled + + # Allows access only to configured domains. + RESTRICTED = :restricted + + # @!method self.values + # @return [Array] + end + end + + class Packages < OpenAI::Internal::Type::BaseModel + # @!attribute npm + # npm packages to install globally. Defaults to an empty list. + # + # @return [Array, nil] + optional :npm, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute python + # Python packages to install. Defaults to an empty list. + # + # @return [Array, nil] + optional :python, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute system_ + # System packages to install. Defaults to an empty list. + # + # @return [Array, nil] + optional :system_, OpenAI::Internal::Type::ArrayOf[String], api_name: :system, nil?: true + + # @!method initialize(npm: nil, python: nil, system_: nil) + # Packages to install in an OpenAI-hosted environment. + # + # @param npm [Array, nil] + # npm packages to install globally. Defaults to an empty list. + # + # @param python [Array, nil] + # Python packages to install. Defaults to an empty list. + # + # @param system_ [Array, nil] + # System packages to install. Defaults to an empty list. + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/session_create_params.rb b/lib/openai/models/beta/agents/session_create_params.rb new file mode 100644 index 000000000..7eb473156 --- /dev/null +++ b/lib/openai/models/beta/agents/session_create_params.rb @@ -0,0 +1,203 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # @see OpenAI::Resources::Beta::Agents::Sessions#create + # + # @see OpenAI::Resources::Beta::Agents::Sessions#create_streaming + class SessionCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute environment + # An inline execution environment or a reference to an environment template. + # + # @return [OpenAI::Models::Beta::EnvironmentParam::None, OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted, OpenAI::Models::Beta::EnvironmentParam::SelfHosted] + required :environment, union: -> { OpenAI::Beta::EnvironmentParam } + + # @!attribute agent + # Agent configuration. With `agent_id`, supplied fields override the saved agent + # for this session. Without `agent_id`, `model` is required. + # + # @return [OpenAI::Models::Beta::Agents::SessionCreateParams::Agent, nil] + optional :agent, -> { OpenAI::Beta::Agents::SessionCreateParams::Agent } + + # @!attribute agent_id + # The ID of a saved reusable agent. Omit `agent` to use its configuration + # unchanged. + # + # @return [String, nil] + optional :agent_id, String + + # @!attribute input + # Initial input submitted when creating a session. + # + # @return [String, Array, nil] + optional :input, union: -> { OpenAI::Beta::Agents::SessionCreateParams::Input }, nil?: true + + # @!attribute metadata + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + # + # @return [Hash{Symbol=>String}, nil] + optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true + + # @!attribute vault_ids + # The IDs of vaults made available to the session. + # + # @return [Array, nil] + optional :vault_ids, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!method initialize(environment:, agent: nil, agent_id: nil, input: nil, metadata: nil, vault_ids: nil, request_options: {}) + # @param environment [OpenAI::Models::Beta::EnvironmentParam::None, OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted, OpenAI::Models::Beta::EnvironmentParam::SelfHosted] + # An inline execution environment or a reference to an environment template. + # + # @param agent [OpenAI::Models::Beta::Agents::SessionCreateParams::Agent] + # Agent configuration. With `agent_id`, supplied fields override the saved agent + # for this session. Without `agent_id`, `model` is required. + # + # @param agent_id [String] + # The ID of a saved reusable agent. Omit `agent` to use its configuration + # unchanged. + # + # @param input [String, Array, nil] + # Initial input submitted when creating a session. + # + # @param metadata [Hash{Symbol=>String}, nil] + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + # + # @param vault_ids [Array, nil] + # The IDs of vaults made available to the session. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + class Agent < OpenAI::Internal::Type::BaseModel + # @!attribute instructions + # Additional instructions appended to the agent's default base instructions. Omit + # to leave unchanged. + # + # @return [String, nil] + optional :instructions, String, nil?: true + + # @!attribute model + # The model to use for the agent. The requested model name is preserved. + # + # @return [String, nil] + optional :model, String + + # @!attribute multi_agent + # Explicit configuration for creating and coordinating subagents. + # + # @return [OpenAI::Models::Beta::MultiAgentConfigParam, nil] + optional :multi_agent, -> { OpenAI::Beta::MultiAgentConfigParam }, nil?: true + + # @!attribute reasoning + # Reasoning configuration for the agent. + # + # @return [OpenAI::Models::Beta::AgentReasoningParam, nil] + optional :reasoning, -> { OpenAI::Beta::AgentReasoningParam }, nil?: true + + # @!attribute service_tier + # The service tier used for model requests. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::SessionCreateParams::Agent::ServiceTier, nil] + optional( + :service_tier, + enum: -> { OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier }, + nil?: true + ) + + # @!attribute text + # Configuration for text generated by the agent. + # + # @return [OpenAI::Models::Beta::AgentTextParam, nil] + optional :text, -> { OpenAI::Beta::AgentTextParam }, nil?: true + + # @!attribute tools + # Tools available to the agent. Omit to inherit, or pass null to clear them. + # + # @return [Array, nil] + optional( + :tools, + -> { + OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentToolParam] + }, + nil?: true + ) + + # @!method initialize(instructions: nil, model: nil, multi_agent: nil, reasoning: nil, service_tier: nil, text: nil, tools: nil) + # Agent configuration. With `agent_id`, supplied fields override the saved agent + # for this session. Without `agent_id`, `model` is required. + # + # @param instructions [String, nil] + # Additional instructions appended to the agent's default base instructions. Omit + # to leave unchanged. + # + # @param model [String] + # The model to use for the agent. The requested model name is preserved. + # + # @param multi_agent [OpenAI::Models::Beta::MultiAgentConfigParam, nil] + # Explicit configuration for creating and coordinating subagents. + # + # @param reasoning [OpenAI::Models::Beta::AgentReasoningParam, nil] + # Reasoning configuration for the agent. + # + # @param service_tier [Symbol, OpenAI::Models::Beta::Agents::SessionCreateParams::Agent::ServiceTier, nil] + # The service tier used for model requests. + # + # @param text [OpenAI::Models::Beta::AgentTextParam, nil] + # Configuration for text generated by the agent. + # + # @param tools [Array, nil] + # Tools available to the agent. Omit to inherit, or pass null to clear them. + + # The service tier used for model requests. + # + # @see OpenAI::Models::Beta::Agents::SessionCreateParams::Agent#service_tier + module ServiceTier + extend OpenAI::Internal::Type::Enum + + # Selects the service tier automatically. + AUTO = :auto + + # Uses the default service tier. + DEFAULT = :default + + # Uses the flex service tier. + FLEX = :flex + + # Uses the priority service tier. + PRIORITY = :priority + + # Uses the fast service tier. + FAST = :fast + + # @!method self.values + # @return [Array] + end + end + + # Initial input submitted when creating a session. + module Input + extend OpenAI::Internal::Type::Union + + variant String + + variant -> { OpenAI::Models::Beta::Agents::SessionCreateParams::Input::AgentSessionInputMessageParamArray } + + # @!method self.variants + # @return [Array(String, Array)] + + # @type [OpenAI::Internal::Type::Converter] + AgentSessionInputMessageParamArray = OpenAI::Internal::Type::ArrayOf[ + -> { OpenAI::Beta::AgentSessionInputMessageParam } + ] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/session_delete_params.rb b/lib/openai/models/beta/agents/session_delete_params.rb new file mode 100644 index 000000000..2b409031e --- /dev/null +++ b/lib/openai/models/beta/agents/session_delete_params.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # @see OpenAI::Resources::Beta::Agents::Sessions#delete + class SessionDeleteParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!method initialize(session_id:, request_options: {}) + # @param session_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/session_list_params.rb b/lib/openai/models/beta/agents/session_list_params.rb new file mode 100644 index 000000000..cdaba9301 --- /dev/null +++ b/lib/openai/models/beta/agents/session_list_params.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # @see OpenAI::Resources::Beta::Agents::Sessions#list + class SessionListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute after + # Return resources after this resource ID in the selected order. + # + # @return [String, nil] + optional :after, String + + # @!attribute agent_id + # Only return sessions whose root agent has this ID. Omit to return sessions for + # all agents. + # + # @return [String, nil] + optional :agent_id, String + + # @!attribute limit + # The maximum number of resources to return. + # + # @return [Integer, nil] + optional :limit, Integer, nil?: true + + # @!attribute order + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::SessionListParams::Order, nil] + optional :order, enum: -> { OpenAI::Beta::Agents::SessionListParams::Order } + + # @!method initialize(after: nil, agent_id: nil, limit: nil, order: nil, request_options: {}) + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param agent_id [String] + # Only return sessions whose root agent has this ID. Omit to return sessions for + # all agents. + # + # @param limit [Integer, nil] + # The maximum number of resources to return. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::SessionListParams::Order] + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC = :asc + + # Returns resources in descending order. + DESC = :desc + + # @!method self.values + # @return [Array] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/session_retrieve_params.rb b/lib/openai/models/beta/agents/session_retrieve_params.rb new file mode 100644 index 000000000..56fcbb42f --- /dev/null +++ b/lib/openai/models/beta/agents/session_retrieve_params.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # @see OpenAI::Resources::Beta::Agents::Sessions#retrieve + class SessionRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!method initialize(session_id:, request_options: {}) + # @param session_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/session_update_params.rb b/lib/openai/models/beta/agents/session_update_params.rb new file mode 100644 index 000000000..4abaeb72c --- /dev/null +++ b/lib/openai/models/beta/agents/session_update_params.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # @see OpenAI::Resources::Beta::Agents::Sessions#update + class SessionUpdateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute metadata + # Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. + # + # @return [Hash{Symbol=>String}, nil] + optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true + + # @!method initialize(session_id:, metadata: nil, request_options: {}) + # @param session_id [String] + # + # @param metadata [Hash{Symbol=>String}, nil] + # Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/artifact_content_params.rb b/lib/openai/models/beta/agents/sessions/artifact_content_params.rb new file mode 100644 index 000000000..75fce10d0 --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/artifact_content_params.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Artifacts#content + class ArtifactContentParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute artifact_id + # + # @return [String] + required :artifact_id, String + + # @!method initialize(session_id:, artifact_id:, request_options: {}) + # @param session_id [String] + # @param artifact_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/artifact_delete_params.rb b/lib/openai/models/beta/agents/sessions/artifact_delete_params.rb new file mode 100644 index 000000000..4084dd6d2 --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/artifact_delete_params.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Artifacts#delete + class ArtifactDeleteParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute artifact_id + # + # @return [String] + required :artifact_id, String + + # @!method initialize(session_id:, artifact_id:, request_options: {}) + # @param session_id [String] + # @param artifact_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/artifact_list_params.rb b/lib/openai/models/beta/agents/sessions/artifact_list_params.rb new file mode 100644 index 000000000..71dc03553 --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/artifact_list_params.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Artifacts#list + class ArtifactListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute after + # Return artifacts after this immutable artifact ID. + # + # @return [String, nil] + optional :after, String, nil?: true + + # @!attribute environment_id + # Restrict the listing to artifacts produced by this environment. + # + # @return [String, nil] + optional :environment_id, String, nil?: true + + # @!attribute limit + # The maximum number of artifacts to return, between 1 and 100. + # + # @return [Integer, nil] + optional :limit, Integer, nil?: true + + # @!attribute order + # Sort by creation time and ID. Defaults to descending. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Sessions::ArtifactListParams::Order, nil] + optional :order, enum: -> { OpenAI::Beta::Agents::Sessions::ArtifactListParams::Order } + + # @!method initialize(session_id:, after: nil, environment_id: nil, limit: nil, order: nil, request_options: {}) + # @param session_id [String] + # + # @param after [String, nil] + # Return artifacts after this immutable artifact ID. + # + # @param environment_id [String, nil] + # Restrict the listing to artifacts produced by this environment. + # + # @param limit [Integer, nil] + # The maximum number of artifacts to return, between 1 and 100. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::ArtifactListParams::Order] + # Sort by creation time and ID. Defaults to descending. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # Sort by creation time and ID. Defaults to descending. + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC = :asc + + # Returns resources in descending order. + DESC = :desc + + # @!method self.values + # @return [Array] + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/artifact_retrieve_params.rb b/lib/openai/models/beta/agents/sessions/artifact_retrieve_params.rb new file mode 100644 index 000000000..33a6f5ee6 --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/artifact_retrieve_params.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Artifacts#retrieve + class ArtifactRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute artifact_id + # + # @return [String] + required :artifact_id, String + + # @!method initialize(session_id:, artifact_id:, request_options: {}) + # @param session_id [String] + # @param artifact_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/event_create_params.rb b/lib/openai/models/beta/agents/sessions/event_create_params.rb new file mode 100644 index 000000000..a7c3a3316 --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/event_create_params.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Events#create + class EventCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute events + # The input events to submit to the session. + # + # @return [Array] + required :events, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentSessionInputParam] } + + # @!attribute idempotency_key + # + # @return [String, nil] + optional :idempotency_key, String + + # @!method initialize(session_id:, events:, idempotency_key: nil, request_options: {}) + # @param session_id [String] + # + # @param events [Array] + # The input events to submit to the session. + # + # @param idempotency_key [String] + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/event_stream_params.rb b/lib/openai/models/beta/agents/sessions/event_stream_params.rb new file mode 100644 index 000000000..ab2a2f876 --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/event_stream_params.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Events#stream_streaming + class EventStreamParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!method initialize(session_id:, request_options: {}) + # @param session_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/item_list_params.rb b/lib/openai/models/beta/agents/sessions/item_list_params.rb new file mode 100644 index 000000000..c3abdb761 --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/item_list_params.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Items#list + class ItemListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute after + # Return resources after this resource ID in the selected order. + # + # @return [String, nil] + optional :after, String + + # @!attribute limit + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @return [Integer, nil] + optional :limit, Integer + + # @!attribute order + # The order in which resources are returned. Defaults to `desc`. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Sessions::ItemListParams::Order, nil] + optional :order, enum: -> { OpenAI::Beta::Agents::Sessions::ItemListParams::Order } + + # @!method initialize(session_id:, after: nil, limit: nil, order: nil, request_options: {}) + # @param session_id [String] + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::ItemListParams::Order] + # The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC = :asc + + # Returns resources in descending order. + DESC = :desc + + # @!method self.values + # @return [Array] + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/session_artifact.rb b/lib/openai/models/beta/agents/sessions/session_artifact.rb new file mode 100644 index 000000000..d7592b9ae --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/session_artifact.rb @@ -0,0 +1,91 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Artifacts#retrieve + class SessionArtifact < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The immutable artifact ID. + # + # @return [String] + required :id, String + + # @!attribute created_at + # The Unix timestamp, in seconds, when the artifact was published. + # + # @return [Integer] + required :created_at, Integer + + # @!attribute environment_id + # The ID of the environment that produced the artifact. + # + # @return [String] + required :environment_id, String + + # @!attribute object + # The object type. Always `agent.session.artifact`. + # + # @return [Symbol, :"agent.session.artifact"] + required :object, const: :"agent.session.artifact" + + # @!attribute path + # The original absolute file path in the execution environment. + # + # @return [String] + required :path, String + + # @!attribute session_id + # The ID of the session that owns the artifact. + # + # @return [String] + required :session_id, String + + # @!attribute size_bytes + # The immutable artifact size in bytes. + # + # @return [Integer] + required :size_bytes, Integer + + # @!attribute turn_id + # The ID of the completed turn that published the artifact. + # + # @return [String] + required :turn_id, String + + # @!method initialize(id:, created_at:, environment_id:, path:, session_id:, size_bytes:, turn_id:, object: :"agent.session.artifact") + # An immutable file published by a completed hosted session turn. + # + # @param id [String] + # The immutable artifact ID. + # + # @param created_at [Integer] + # The Unix timestamp, in seconds, when the artifact was published. + # + # @param environment_id [String] + # The ID of the environment that produced the artifact. + # + # @param path [String] + # The original absolute file path in the execution environment. + # + # @param session_id [String] + # The ID of the session that owns the artifact. + # + # @param size_bytes [Integer] + # The immutable artifact size in bytes. + # + # @param turn_id [String] + # The ID of the completed turn that published the artifact. + # + # @param object [Symbol, :"agent.session.artifact"] + # The object type. Always `agent.session.artifact`. + end + end + + SessionArtifact = Sessions::SessionArtifact + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/session_artifact_deleted.rb b/lib/openai/models/beta/agents/sessions/session_artifact_deleted.rb new file mode 100644 index 000000000..5f248c40b --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/session_artifact_deleted.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Artifacts#delete + class SessionArtifactDeleted < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the deleted session artifact. + # + # @return [String] + required :id, String + + # @!attribute deleted + # Whether the session artifact was deleted. Always `true`. + # + # @return [Boolean] + required :deleted, OpenAI::Internal::Type::Boolean + + # @!attribute object + # The object type. Always `agent.session.artifact.deleted`. + # + # @return [Symbol, :"agent.session.artifact.deleted"] + required :object, const: :"agent.session.artifact.deleted" + + # @!method initialize(id:, deleted:, object: :"agent.session.artifact.deleted") + # Confirmation that an immutable session artifact was deleted. + # + # @param id [String] + # The ID of the deleted session artifact. + # + # @param deleted [Boolean] + # Whether the session artifact was deleted. Always `true`. + # + # @param object [Symbol, :"agent.session.artifact.deleted"] + # The object type. Always `agent.session.artifact.deleted`. + end + end + + SessionArtifactDeleted = Sessions::SessionArtifactDeleted + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/subagent_list_params.rb b/lib/openai/models/beta/agents/sessions/subagent_list_params.rb new file mode 100644 index 000000000..aabdd94a3 --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/subagent_list_params.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Subagents#list + class SubagentListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute after + # Return resources after this resource ID in the selected order. + # + # @return [String, nil] + optional :after, String + + # @!attribute limit + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @return [Integer, nil] + optional :limit, Integer + + # @!attribute order + # The order in which resources are returned. Defaults to `desc`. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Sessions::SubagentListParams::Order, nil] + optional :order, enum: -> { OpenAI::Beta::Agents::Sessions::SubagentListParams::Order } + + # @!method initialize(session_id:, after: nil, limit: nil, order: nil, request_options: {}) + # @param session_id [String] + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::SubagentListParams::Order] + # The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC = :asc + + # Returns resources in descending order. + DESC = :desc + + # @!method self.values + # @return [Array] + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/subagent_retrieve_params.rb b/lib/openai/models/beta/agents/sessions/subagent_retrieve_params.rb new file mode 100644 index 000000000..a6655c9de --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/subagent_retrieve_params.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Subagents#retrieve + class SubagentRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute subagent_id + # + # @return [String] + required :subagent_id, String + + # @!method initialize(session_id:, subagent_id:, request_options: {}) + # @param session_id [String] + # @param subagent_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/subagents/item_list_params.rb b/lib/openai/models/beta/agents/sessions/subagents/item_list_params.rb new file mode 100644 index 000000000..8818f516d --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/subagents/item_list_params.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + module Subagents + # @see OpenAI::Resources::Beta::Agents::Sessions::Subagents::Items#list + class ItemListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute subagent_id + # + # @return [String] + required :subagent_id, String + + # @!attribute after + # Return resources after this resource ID in the selected order. + # + # @return [String, nil] + optional :after, String + + # @!attribute limit + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @return [Integer, nil] + optional :limit, Integer + + # @!attribute order + # The order in which resources are returned. Defaults to `desc`. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Sessions::Subagents::ItemListParams::Order, nil] + optional :order, enum: -> { OpenAI::Beta::Agents::Sessions::Subagents::ItemListParams::Order } + + # @!method initialize(session_id:, subagent_id:, after: nil, limit: nil, order: nil, request_options: {}) + # @param session_id [String] + # + # @param subagent_id [String] + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::Subagents::ItemListParams::Order] + # The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC = :asc + + # Returns resources in descending order. + DESC = :desc + + # @!method self.values + # @return [Array] + end + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/subagents/turn_list_params.rb b/lib/openai/models/beta/agents/sessions/subagents/turn_list_params.rb new file mode 100644 index 000000000..dd3221c35 --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/subagents/turn_list_params.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + module Subagents + # @see OpenAI::Resources::Beta::Agents::Sessions::Subagents::Turns#list + class TurnListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute subagent_id + # + # @return [String] + required :subagent_id, String + + # @!attribute after + # Return resources after this resource ID in the selected order. + # + # @return [String, nil] + optional :after, String + + # @!attribute limit + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @return [Integer, nil] + optional :limit, Integer + + # @!attribute order + # The order in which resources are returned. Defaults to `desc`. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Sessions::Subagents::TurnListParams::Order, nil] + optional :order, enum: -> { OpenAI::Beta::Agents::Sessions::Subagents::TurnListParams::Order } + + # @!method initialize(session_id:, subagent_id:, after: nil, limit: nil, order: nil, request_options: {}) + # @param session_id [String] + # + # @param subagent_id [String] + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::Subagents::TurnListParams::Order] + # The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC = :asc + + # Returns resources in descending order. + DESC = :desc + + # @!method self.values + # @return [Array] + end + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/subagents/turn_retrieve_params.rb b/lib/openai/models/beta/agents/sessions/subagents/turn_retrieve_params.rb new file mode 100644 index 000000000..cfe03a78e --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/subagents/turn_retrieve_params.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + module Subagents + # @see OpenAI::Resources::Beta::Agents::Sessions::Subagents::Turns#retrieve + class TurnRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute subagent_id + # + # @return [String] + required :subagent_id, String + + # @!attribute turn_id + # + # @return [String] + required :turn_id, String + + # @!method initialize(session_id:, subagent_id:, turn_id:, request_options: {}) + # @param session_id [String] + # @param subagent_id [String] + # @param turn_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/subagents/turns/item_list_params.rb b/lib/openai/models/beta/agents/sessions/subagents/turns/item_list_params.rb new file mode 100644 index 000000000..185e77b5a --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/subagents/turns/item_list_params.rb @@ -0,0 +1,86 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + module Subagents + module Turns + # @see OpenAI::Resources::Beta::Agents::Sessions::Subagents::Turns::Items#list + class ItemListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute subagent_id + # + # @return [String] + required :subagent_id, String + + # @!attribute turn_id + # + # @return [String] + required :turn_id, String + + # @!attribute after + # Return resources after this resource ID in the selected order. + # + # @return [String, nil] + optional :after, String + + # @!attribute limit + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @return [Integer, nil] + optional :limit, Integer + + # @!attribute order + # The order in which resources are returned. Defaults to `desc`. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::Order, nil] + optional :order, enum: -> { OpenAI::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::Order } + + # @!method initialize(session_id:, subagent_id:, turn_id:, after: nil, limit: nil, order: nil, request_options: {}) + # @param session_id [String] + # + # @param subagent_id [String] + # + # @param turn_id [String] + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::Order] + # The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC = :asc + + # Returns resources in descending order. + DESC = :desc + + # @!method self.values + # @return [Array] + end + end + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/turn.rb b/lib/openai/models/beta/agents/sessions/turn.rb new file mode 100644 index 000000000..92329057a --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/turn.rb @@ -0,0 +1,148 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Turns#retrieve + class Turn < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the turn. + # + # @return [String] + required :id, String + + # @!attribute agent_id + # The ID of the agent that ran the turn. + # + # @return [String] + required :agent_id, String + + # @!attribute completed_at + # The Unix timestamp, in seconds, when the turn reached a terminal state. + # + # @return [Integer, nil] + required :completed_at, Integer, nil?: true + + # @!attribute created_at + # The Unix timestamp, in seconds, used to order the turn by creation time. + # Subagent turns use their start time, falling back to completion time or the + # subagent opening time when the preceding timestamps are unavailable. + # + # @return [Integer] + required :created_at, Integer + + # @!attribute error + # A customer-safe error describing why a session request failed. + # + # @return [OpenAI::Models::Beta::SessionTurnError, nil] + required :error, -> { OpenAI::Beta::SessionTurnError }, nil?: true + + # @!attribute object + # The object type. Always `agent.session.turn`. + # + # @return [Symbol, :"agent.session.turn"] + required :object, const: :"agent.session.turn" + + # @!attribute session_id + # The ID of the session that owns the turn. + # + # @return [String] + required :session_id, String + + # @!attribute started_at + # The Unix timestamp, in seconds, when the turn started. + # + # @return [Integer, nil] + required :started_at, Integer, nil?: true + + # @!attribute status + # The current status of the turn. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Sessions::Turn::Status] + required :status, enum: -> { OpenAI::Beta::Agents::Sessions::Turn::Status } + + # @!attribute subagent_id + # The ID of the subagent that ran the turn, if applicable. + # + # @return [String, nil] + required :subagent_id, String, nil?: true + + # @!attribute usage + # Recorded token usage for a session or turn. Usage is best effort and may change. + # + # @return [OpenAI::Models::Beta::TokenUsage, nil] + required :usage, -> { OpenAI::Beta::TokenUsage }, nil?: true + + # @!method initialize(id:, agent_id:, completed_at:, created_at:, error:, session_id:, started_at:, status:, subagent_id:, usage:, object: :"agent.session.turn") + # The canonical public representation of a session turn. + # + # @param id [String] + # The ID of the turn. + # + # @param agent_id [String] + # The ID of the agent that ran the turn. + # + # @param completed_at [Integer, nil] + # The Unix timestamp, in seconds, when the turn reached a terminal state. + # + # @param created_at [Integer] + # The Unix timestamp, in seconds, used to order the turn by creation time. + # Subagent turns use their start time, falling back to completion time or the + # subagent opening time when the preceding timestamps are unavailable. + # + # @param error [OpenAI::Models::Beta::SessionTurnError, nil] + # A customer-safe error describing why a session request failed. + # + # @param session_id [String] + # The ID of the session that owns the turn. + # + # @param started_at [Integer, nil] + # The Unix timestamp, in seconds, when the turn started. + # + # @param status [Symbol, OpenAI::Models::Beta::Agents::Sessions::Turn::Status] + # The current status of the turn. + # + # @param subagent_id [String, nil] + # The ID of the subagent that ran the turn, if applicable. + # + # @param usage [OpenAI::Models::Beta::TokenUsage, nil] + # Recorded token usage for a session or turn. Usage is best effort and may change. + # + # @param object [Symbol, :"agent.session.turn"] + # The object type. Always `agent.session.turn`. + + # The current status of the turn. + # + # @see OpenAI::Models::Beta::Agents::Sessions::Turn#status + module Status + extend OpenAI::Internal::Type::Enum + + # The turn is waiting to start. + QUEUED = :queued + + # The turn is in progress. + IN_PROGRESS = :in_progress + + # The turn is waiting for external input. + WAITING = :waiting + + # The turn completed successfully. + COMPLETED = :completed + + # The turn failed. + FAILED = :failed + + # The turn was cancelled. + CANCELLED = :cancelled + + # @!method self.values + # @return [Array] + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/turn_list_params.rb b/lib/openai/models/beta/agents/sessions/turn_list_params.rb new file mode 100644 index 000000000..7af8b263e --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/turn_list_params.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Turns#list + class TurnListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute after + # Return resources after this resource ID in the selected order. + # + # @return [String, nil] + optional :after, String + + # @!attribute limit + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @return [Integer, nil] + optional :limit, Integer + + # @!attribute order + # The order in which resources are returned. Defaults to `desc`. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Sessions::TurnListParams::Order, nil] + optional :order, enum: -> { OpenAI::Beta::Agents::Sessions::TurnListParams::Order } + + # @!method initialize(session_id:, after: nil, limit: nil, order: nil, request_options: {}) + # @param session_id [String] + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::TurnListParams::Order] + # The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC = :asc + + # Returns resources in descending order. + DESC = :desc + + # @!method self.values + # @return [Array] + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/sessions/turn_retrieve_params.rb b/lib/openai/models/beta/agents/sessions/turn_retrieve_params.rb new file mode 100644 index 000000000..f5a6230b1 --- /dev/null +++ b/lib/openai/models/beta/agents/sessions/turn_retrieve_params.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Sessions + # @see OpenAI::Resources::Beta::Agents::Sessions::Turns#retrieve + class TurnRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute session_id + # + # @return [String] + required :session_id, String + + # @!attribute turn_id + # + # @return [String] + required :turn_id, String + + # @!method initialize(session_id:, turn_id:, request_options: {}) + # @param session_id [String] + # @param turn_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vault.rb b/lib/openai/models/beta/agents/vault.rb new file mode 100644 index 000000000..c873616de --- /dev/null +++ b/lib/openai/models/beta/agents/vault.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # @see OpenAI::Resources::Beta::Agents::Vaults#create + class Vault < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the vault. + # + # @return [String] + required :id, String + + # @!attribute created_at + # The Unix timestamp, in seconds, when the vault was created. + # + # @return [Integer] + required :created_at, Integer + + # @!attribute metadata + # Key-value pairs associated with the vault, such as an application or team + # identifier. + # + # @return [Hash{Symbol=>String}] + required :metadata, OpenAI::Internal::Type::HashOf[String] + + # @!attribute name + # The human-readable name of the vault, if set. + # + # @return [String, nil] + required :name, String, nil?: true + + # @!attribute object + # The object type. Always `vault`. + # + # @return [Symbol, :vault] + required :object, const: :vault + + # @!method initialize(id:, created_at:, metadata:, name:, object: :vault) + # A collection of credentials that agent tools can use to authenticate to MCP + # servers. + # + # @param id [String] + # The ID of the vault. + # + # @param created_at [Integer] + # The Unix timestamp, in seconds, when the vault was created. + # + # @param metadata [Hash{Symbol=>String}] + # Key-value pairs associated with the vault, such as an application or team + # identifier. + # + # @param name [String, nil] + # The human-readable name of the vault, if set. + # + # @param object [Symbol, :vault] + # The object type. Always `vault`. + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vault_create_params.rb b/lib/openai/models/beta/agents/vault_create_params.rb new file mode 100644 index 000000000..074d13a87 --- /dev/null +++ b/lib/openai/models/beta/agents/vault_create_params.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # @see OpenAI::Resources::Beta::Agents::Vaults#create + class VaultCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute metadata + # Key-value pairs to associate with the vault, such as an application or team + # identifier. + # + # @return [Hash{Symbol=>String}, nil] + optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true + + # @!attribute name + # The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after + # trimming. + # + # @return [String, nil] + optional :name, String + + # @!method initialize(metadata: nil, name: nil, request_options: {}) + # @param metadata [Hash{Symbol=>String}, nil] + # Key-value pairs to associate with the vault, such as an application or team + # identifier. + # + # @param name [String] + # The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after + # trimming. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vault_delete_params.rb b/lib/openai/models/beta/agents/vault_delete_params.rb new file mode 100644 index 000000000..adc8357a8 --- /dev/null +++ b/lib/openai/models/beta/agents/vault_delete_params.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # @see OpenAI::Resources::Beta::Agents::Vaults#delete + class VaultDeleteParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute vault_id + # + # @return [String] + required :vault_id, String + + # @!method initialize(vault_id:, request_options: {}) + # @param vault_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vault_deleted.rb b/lib/openai/models/beta/agents/vault_deleted.rb new file mode 100644 index 000000000..42b2bf958 --- /dev/null +++ b/lib/openai/models/beta/agents/vault_deleted.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # @see OpenAI::Resources::Beta::Agents::Vaults#delete + class VaultDeleted < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the deleted vault. + # + # @return [String] + required :id, String + + # @!attribute deleted + # Whether the resource was deleted. Always `true`. + # + # @return [Boolean] + required :deleted, OpenAI::Internal::Type::Boolean + + # @!attribute object + # The object type. Always `vault.deleted`. + # + # @return [Symbol, :"vault.deleted"] + required :object, const: :"vault.deleted" + + # @!method initialize(id:, deleted:, object: :"vault.deleted") + # Confirmation that a vault was deleted. + # + # @param id [String] + # The ID of the deleted vault. + # + # @param deleted [Boolean] + # Whether the resource was deleted. Always `true`. + # + # @param object [Symbol, :"vault.deleted"] + # The object type. Always `vault.deleted`. + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vault_list_params.rb b/lib/openai/models/beta/agents/vault_list_params.rb new file mode 100644 index 000000000..538186b4a --- /dev/null +++ b/lib/openai/models/beta/agents/vault_list_params.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # @see OpenAI::Resources::Beta::Agents::Vaults#list + class VaultListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute after + # Return resources after this resource ID in the selected order. + # + # @return [String, nil] + optional :after, String + + # @!attribute limit + # The maximum number of resources to return. Defaults to 20. Values are clamped + # between 1 and 100. + # + # @return [Integer, nil] + optional :limit, Integer, nil?: true + + # @!attribute order + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::VaultListParams::Order, nil] + optional :order, enum: -> { OpenAI::Beta::Agents::VaultListParams::Order } + + # @!attribute status + # Filter by one status or a list, such as `status=active` or + # `status[]=active&status[]=archived`. Both statuses are included by default. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::VaultStatus, Array, nil] + optional :status, union: -> { OpenAI::Beta::Agents::VaultStatusFilter } + + # @!method initialize(after: nil, limit: nil, order: nil, status: nil, request_options: {}) + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer, nil] + # The maximum number of resources to return. Defaults to 20. Values are clamped + # between 1 and 100. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::VaultListParams::Order] + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + # + # @param status [Symbol, OpenAI::Models::Beta::Agents::VaultStatus, Array] + # Filter by one status or a list, such as `status=active` or + # `status[]=active&status[]=archived`. Both statuses are included by default. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC = :asc + + # Returns resources in descending order. + DESC = :desc + + # @!method self.values + # @return [Array] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vault_retrieve_params.rb b/lib/openai/models/beta/agents/vault_retrieve_params.rb new file mode 100644 index 000000000..0c993a56d --- /dev/null +++ b/lib/openai/models/beta/agents/vault_retrieve_params.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # @see OpenAI::Resources::Beta::Agents::Vaults#retrieve + class VaultRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute vault_id + # + # @return [String] + required :vault_id, String + + # @!method initialize(vault_id:, request_options: {}) + # @param vault_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vault_status.rb b/lib/openai/models/beta/agents/vault_status.rb new file mode 100644 index 000000000..e47fe9047 --- /dev/null +++ b/lib/openai/models/beta/agents/vault_status.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # Whether a vault or credential is active or archived. + module VaultStatus + extend OpenAI::Internal::Type::Enum + + ACTIVE = :active + ARCHIVED = :archived + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vault_status_filter.rb b/lib/openai/models/beta/agents/vault_status_filter.rb new file mode 100644 index 000000000..9eeca0fff --- /dev/null +++ b/lib/openai/models/beta/agents/vault_status_filter.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + # One or more lifecycle statuses to include when listing vaults or credentials. + module VaultStatusFilter + extend OpenAI::Internal::Type::Union + + # Whether a vault or credential is active or archived. + variant enum: -> { OpenAI::Beta::Agents::VaultStatus } + + variant -> { OpenAI::Models::Beta::Agents::VaultStatusFilter::VaultStatusArray } + + # @!method self.variants + # @return [Array(Symbol, OpenAI::Models::Beta::Agents::VaultStatus, Array)] + + # @type [OpenAI::Internal::Type::Converter] + VaultStatusArray = OpenAI::Internal::Type::ArrayOf[ + enum: -> { OpenAI::Models::Beta::Agents::VaultStatus } + ] + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vaults/credential.rb b/lib/openai/models/beta/agents/vaults/credential.rb new file mode 100644 index 000000000..96923ba48 --- /dev/null +++ b/lib/openai/models/beta/agents/vaults/credential.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Vaults + # @see OpenAI::Resources::Beta::Agents::Vaults::Credentials#create + class Credential < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the credential. + # + # @return [String] + required :id, String + + # @!attribute auth + # The authentication method and non-secret configuration for the MCP server. + # + # @return [OpenAI::Models::Beta::Agents::Vaults::CredentialAuth::McpOauth, OpenAI::Models::Beta::Agents::Vaults::CredentialAuth::StaticBearer] + required :auth, union: -> { OpenAI::Beta::Agents::Vaults::CredentialAuth } + + # @!attribute created_at + # The Unix timestamp, in seconds, when the credential was created. + # + # @return [Integer] + required :created_at, Integer + + # @!attribute name + # The human-readable name of the credential. + # + # @return [String] + required :name, String + + # @!attribute object + # The object type. Always `vault.credential`. + # + # @return [Symbol, :"vault.credential"] + required :object, const: :"vault.credential" + + # @!attribute updated_at + # The Unix timestamp, in seconds, when the credential was last updated. + # + # @return [Integer] + required :updated_at, Integer + + # @!attribute vault_id + # The ID of the vault containing this credential. + # + # @return [String] + required :vault_id, String + + # @!method initialize(id:, auth:, created_at:, name:, updated_at:, vault_id:, object: :"vault.credential") + # Metadata for a stored MCP server credential. Secret values are never returned. + # + # @param id [String] + # The ID of the credential. + # + # @param auth [OpenAI::Models::Beta::Agents::Vaults::CredentialAuth::McpOauth, OpenAI::Models::Beta::Agents::Vaults::CredentialAuth::StaticBearer] + # The authentication method and non-secret configuration for the MCP server. + # + # @param created_at [Integer] + # The Unix timestamp, in seconds, when the credential was created. + # + # @param name [String] + # The human-readable name of the credential. + # + # @param updated_at [Integer] + # The Unix timestamp, in seconds, when the credential was last updated. + # + # @param vault_id [String] + # The ID of the vault containing this credential. + # + # @param object [Symbol, :"vault.credential"] + # The object type. Always `vault.credential`. + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vaults/credential_auth.rb b/lib/openai/models/beta/agents/vaults/credential_auth.rb new file mode 100644 index 000000000..8d2fd11bd --- /dev/null +++ b/lib/openai/models/beta/agents/vaults/credential_auth.rb @@ -0,0 +1,155 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Vaults + # The MCP server and authentication configuration of a vault credential, excluding + # secrets. + module CredentialAuth + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Public metadata for an OAuth credential; tokens and client secrets are never returned. + variant :mcp_oauth, -> { OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth } + + # Metadata for a bearer-token credential, without automatic OAuth refresh. + variant :static_bearer, -> { OpenAI::Beta::Agents::Vaults::CredentialAuth::StaticBearer } + + class McpOauth < OpenAI::Internal::Type::BaseModel + # @!attribute expires_at + # When the OAuth access token expires, as an RFC 3339 timestamp, if known. + # + # @return [String, nil] + required :expires_at, String, nil?: true + + # @!attribute mcp_server_url + # The HTTPS MCP server URL authorized by this credential. + # + # @return [String] + required :mcp_server_url, String + + # @!attribute refresh + # Configuration used to refresh an MCP OAuth access token, excluding secret + # values. + # + # @return [OpenAI::Models::Beta::Agents::Vaults::CredentialAuth::McpOauth::Refresh, nil] + required( + :refresh, + -> { + OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth::Refresh + }, + nil?: true + ) + + # @!attribute type + # The type of the object. Always `mcp_oauth`. + # + # @return [Symbol, :mcp_oauth] + required :type, const: :mcp_oauth + + # @!method initialize(expires_at:, mcp_server_url:, refresh:, type: :mcp_oauth) + # Public metadata for an OAuth credential; tokens and client secrets are never + # returned. + # + # @param expires_at [String, nil] + # When the OAuth access token expires, as an RFC 3339 timestamp, if known. + # + # @param mcp_server_url [String] + # The HTTPS MCP server URL authorized by this credential. + # + # @param refresh [OpenAI::Models::Beta::Agents::Vaults::CredentialAuth::McpOauth::Refresh, nil] + # Configuration used to refresh an MCP OAuth access token, excluding secret + # values. + # + # @param type [Symbol, :mcp_oauth] + # The type of the object. Always `mcp_oauth`. + + # @see OpenAI::Models::Beta::Agents::Vaults::CredentialAuth::McpOauth#refresh + class Refresh < OpenAI::Internal::Type::BaseModel + # @!attribute client_id + # The OAuth client ID used when requesting a new access token. + # + # @return [String] + required :client_id, String + + # @!attribute resource + # The resource URI sent to the OAuth token endpoint during refresh, if configured. + # + # @return [String, nil] + required :resource, String, nil?: true + + # @!attribute scope + # Space-separated OAuth scopes requested during refresh, if configured. + # + # @return [String, nil] + required :scope, String, nil?: true + + # @!attribute token_endpoint + # The HTTPS OAuth token endpoint used for refresh. + # + # @return [String] + required :token_endpoint, String + + # @!attribute token_endpoint_auth + # How the OAuth client authenticates to the token endpoint, excluding its client + # secret. + # + # @return [OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::None, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretBasic, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretPost] + required :token_endpoint_auth, union: -> { OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth } + + # @!method initialize(client_id:, resource:, scope:, token_endpoint:, token_endpoint_auth:) + # Configuration used to refresh an MCP OAuth access token, excluding secret + # values. + # + # @param client_id [String] + # The OAuth client ID used when requesting a new access token. + # + # @param resource [String, nil] + # The resource URI sent to the OAuth token endpoint during refresh, if configured. + # + # @param scope [String, nil] + # Space-separated OAuth scopes requested during refresh, if configured. + # + # @param token_endpoint [String] + # The HTTPS OAuth token endpoint used for refresh. + # + # @param token_endpoint_auth [OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::None, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretBasic, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretPost] + # How the OAuth client authenticates to the token endpoint, excluding its client + # secret. + end + end + + class StaticBearer < OpenAI::Internal::Type::BaseModel + # @!attribute mcp_server_url + # The HTTPS MCP server URL authorized by this credential. + # + # @return [String] + required :mcp_server_url, String + + # @!attribute type + # The type of the object. Always `static_bearer`. + # + # @return [Symbol, :static_bearer] + required :type, const: :static_bearer + + # @!method initialize(mcp_server_url:, type: :static_bearer) + # Metadata for a bearer-token credential, without automatic OAuth refresh. + # + # @param mcp_server_url [String] + # The HTTPS MCP server URL authorized by this credential. + # + # @param type [Symbol, :static_bearer] + # The type of the object. Always `static_bearer`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::Agents::Vaults::CredentialAuth::McpOauth, OpenAI::Models::Beta::Agents::Vaults::CredentialAuth::StaticBearer)] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vaults/credential_auth_create_param.rb b/lib/openai/models/beta/agents/vaults/credential_auth_create_param.rb new file mode 100644 index 000000000..26e3bc25f --- /dev/null +++ b/lib/openai/models/beta/agents/vaults/credential_auth_create_param.rb @@ -0,0 +1,184 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Vaults + # Authentication credentials for an MCP server used by agent tools. + module CredentialAuthCreateParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # An OAuth credential for an HTTPS MCP destination. + variant :mcp_oauth, -> { OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth } + + # A bearer token for an MCP server, without automatic OAuth refresh. + variant :static_bearer, -> { OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::StaticBearer } + + class McpOauth < OpenAI::Internal::Type::BaseModel + # @!attribute access_token + # A write-only OAuth access token; never returned by credential resources. + # + # @return [String] + required :access_token, String + + # @!attribute mcp_server_url + # The HTTPS MCP server URL authorized by this credential. + # + # @return [String] + required :mcp_server_url, String + + # @!attribute type + # The type of the object. Always `mcp_oauth`. + # + # @return [Symbol, :mcp_oauth] + required :type, const: :mcp_oauth + + # @!attribute expires_at + # When the OAuth access token expires, as an RFC 3339 timestamp, if known. + # + # @return [String, nil] + optional :expires_at, String, nil?: true + + # @!attribute refresh + # Configuration for refreshing the access token of an MCP OAuth credential. + # + # @return [OpenAI::Models::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::Refresh, nil] + optional( + :refresh, + -> { OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::Refresh }, + nil?: true + ) + + # @!method initialize(access_token:, mcp_server_url:, expires_at: nil, refresh: nil, type: :mcp_oauth) + # An OAuth credential for an HTTPS MCP destination. + # + # @param access_token [String] + # A write-only OAuth access token; never returned by credential resources. + # + # @param mcp_server_url [String] + # The HTTPS MCP server URL authorized by this credential. + # + # @param expires_at [String, nil] + # When the OAuth access token expires, as an RFC 3339 timestamp, if known. + # + # @param refresh [OpenAI::Models::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::Refresh, nil] + # Configuration for refreshing the access token of an MCP OAuth credential. + # + # @param type [Symbol, :mcp_oauth] + # The type of the object. Always `mcp_oauth`. + + # @see OpenAI::Models::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth#refresh + class Refresh < OpenAI::Internal::Type::BaseModel + # @!attribute client_id + # The OAuth client ID used when requesting a new access token. + # + # @return [String] + required :client_id, String + + # @!attribute refresh_token + # The refresh token to store. This secret is never returned in credential + # resources. + # + # @return [String] + required :refresh_token, String + + # @!attribute token_endpoint + # The HTTPS OAuth token endpoint used to exchange the refresh token for a new + # access token. + # + # @return [String] + required :token_endpoint, String + + # @!attribute token_endpoint_auth + # How the OAuth client authenticates to the token endpoint. + # + # @return [OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::None, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretBasic, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretPost] + required( + :token_endpoint_auth, + union: -> { OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam } + ) + + # @!attribute resource + # The resource URI to send to the OAuth token endpoint during refresh, if + # required. + # + # @return [String, nil] + optional :resource, String, nil?: true + + # @!attribute scope + # Space-separated OAuth scopes to request during refresh, if required. + # + # @return [String, nil] + optional :scope, String, nil?: true + + # @!method initialize(client_id:, refresh_token:, token_endpoint:, token_endpoint_auth:, resource: nil, scope: nil) + # Configuration for refreshing the access token of an MCP OAuth credential. + # + # @param client_id [String] + # The OAuth client ID used when requesting a new access token. + # + # @param refresh_token [String] + # The refresh token to store. This secret is never returned in credential + # resources. + # + # @param token_endpoint [String] + # The HTTPS OAuth token endpoint used to exchange the refresh token for a new + # access token. + # + # @param token_endpoint_auth [OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::None, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretBasic, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretPost] + # How the OAuth client authenticates to the token endpoint. + # + # @param resource [String, nil] + # The resource URI to send to the OAuth token endpoint during refresh, if + # required. + # + # @param scope [String, nil] + # Space-separated OAuth scopes to request during refresh, if required. + end + end + + class StaticBearer < OpenAI::Internal::Type::BaseModel + # @!attribute token + # The bearer token to store. This secret is never returned in credential + # resources. + # + # @return [String] + required :token, String + + # @!attribute mcp_server_url + # The HTTPS MCP server URL authorized by this credential. + # + # @return [String] + required :mcp_server_url, String + + # @!attribute type + # The type of the object. Always `static_bearer`. + # + # @return [Symbol, :static_bearer] + required :type, const: :static_bearer + + # @!method initialize(token:, mcp_server_url:, type: :static_bearer) + # A bearer token for an MCP server, without automatic OAuth refresh. + # + # @param token [String] + # The bearer token to store. This secret is never returned in credential + # resources. + # + # @param mcp_server_url [String] + # The HTTPS MCP server URL authorized by this credential. + # + # @param type [Symbol, :static_bearer] + # The type of the object. Always `static_bearer`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth, OpenAI::Models::Beta::Agents::Vaults::CredentialAuthCreateParam::StaticBearer)] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vaults/credential_auth_rotate_param.rb b/lib/openai/models/beta/agents/vaults/credential_auth_rotate_param.rb new file mode 100644 index 000000000..fe584483f --- /dev/null +++ b/lib/openai/models/beta/agents/vaults/credential_auth_rotate_param.rb @@ -0,0 +1,147 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Vaults + # Updates to a vault credential without changing its authentication method or MCP + # server. + module CredentialAuthRotateParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Rotate an OAuth credential for an HTTPS MCP destination. + variant :mcp_oauth, -> { OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth } + + # Replace the bearer token for the credential's MCP server. + variant :static_bearer, -> { OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::StaticBearer } + + class McpOauth < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `mcp_oauth`. + # + # @return [Symbol, :mcp_oauth] + required :type, const: :mcp_oauth + + # @!attribute access_token + # A write-only replacement OAuth access token. + # + # @return [String, nil] + optional :access_token, String, nil?: true + + # @!attribute expires_at + # The replacement expiry as an RFC 3339 timestamp, or `null` to clear it. Omitting + # this field preserves the expiry unless a new access token is supplied, in which + # case the expiry is cleared. + # + # @return [String, nil] + optional :expires_at, String, nil?: true + + # @!attribute refresh + # Updates to an MCP credential's existing OAuth refresh configuration. + # + # @return [OpenAI::Models::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::Refresh, nil] + optional( + :refresh, + -> { OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::Refresh }, + nil?: true + ) + + # @!method initialize(access_token: nil, expires_at: nil, refresh: nil, type: :mcp_oauth) + # Rotate an OAuth credential for an HTTPS MCP destination. + # + # @param access_token [String, nil] + # A write-only replacement OAuth access token. + # + # @param expires_at [String, nil] + # The replacement expiry as an RFC 3339 timestamp, or `null` to clear it. Omitting + # this field preserves the expiry unless a new access token is supplied, in which + # case the expiry is cleared. + # + # @param refresh [OpenAI::Models::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::Refresh, nil] + # Updates to an MCP credential's existing OAuth refresh configuration. + # + # @param type [Symbol, :mcp_oauth] + # The type of the object. Always `mcp_oauth`. + + # @see OpenAI::Models::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth#refresh + class Refresh < OpenAI::Internal::Type::BaseModel + # @!attribute refresh_token + # The replacement refresh token. Omit or pass `null` to keep the stored token. + # This secret is never returned in resources. + # + # @return [String, nil] + optional :refresh_token, String, nil?: true + + # @!attribute scope + # Replacement space-separated OAuth scopes for refresh requests. Omit to keep the + # scopes, or pass `null` to stop sending a scope parameter. + # + # @return [String, nil] + optional :scope, String, nil?: true + + # @!attribute token_endpoint_auth + # Client-secret updates that preserve the credential's OAuth authentication + # method. + # + # @return [OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretBasic, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretPost, nil] + optional( + :token_endpoint_auth, + union: -> { + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam + }, + nil?: true + ) + + # @!method initialize(refresh_token: nil, scope: nil, token_endpoint_auth: nil) + # Updates to an MCP credential's existing OAuth refresh configuration. + # + # @param refresh_token [String, nil] + # The replacement refresh token. Omit or pass `null` to keep the stored token. + # This secret is never returned in resources. + # + # @param scope [String, nil] + # Replacement space-separated OAuth scopes for refresh requests. Omit to keep the + # scopes, or pass `null` to stop sending a scope parameter. + # + # @param token_endpoint_auth [OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretBasic, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretPost, nil] + # Client-secret updates that preserve the credential's OAuth authentication + # method. + end + end + + class StaticBearer < OpenAI::Internal::Type::BaseModel + # @!attribute token + # The replacement bearer token. This secret is never returned in credential + # resources. + # + # @return [String] + required :token, String + + # @!attribute type + # The type of the object. Always `static_bearer`. + # + # @return [Symbol, :static_bearer] + required :type, const: :static_bearer + + # @!method initialize(token:, type: :static_bearer) + # Replace the bearer token for the credential's MCP server. + # + # @param token [String] + # The replacement bearer token. This secret is never returned in credential + # resources. + # + # @param type [Symbol, :static_bearer] + # The type of the object. Always `static_bearer`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth, OpenAI::Models::Beta::Agents::Vaults::CredentialAuthRotateParam::StaticBearer)] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vaults/credential_create_params.rb b/lib/openai/models/beta/agents/vaults/credential_create_params.rb new file mode 100644 index 000000000..eb98ac608 --- /dev/null +++ b/lib/openai/models/beta/agents/vaults/credential_create_params.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Vaults + # @see OpenAI::Resources::Beta::Agents::Vaults::Credentials#create + class CredentialCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute vault_id + # + # @return [String] + required :vault_id, String + + # @!attribute auth + # The authentication method and secret values to store for the MCP server. + # + # @return [OpenAI::Models::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth, OpenAI::Models::Beta::Agents::Vaults::CredentialAuthCreateParam::StaticBearer] + required :auth, union: -> { OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam } + + # @!attribute name + # The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after + # trimming. + # + # @return [String] + required :name, String + + # @!method initialize(vault_id:, auth:, name:, request_options: {}) + # @param vault_id [String] + # + # @param auth [OpenAI::Models::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth, OpenAI::Models::Beta::Agents::Vaults::CredentialAuthCreateParam::StaticBearer] + # The authentication method and secret values to store for the MCP server. + # + # @param name [String] + # The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after + # trimming. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vaults/credential_delete_params.rb b/lib/openai/models/beta/agents/vaults/credential_delete_params.rb new file mode 100644 index 000000000..df8a92a18 --- /dev/null +++ b/lib/openai/models/beta/agents/vaults/credential_delete_params.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Vaults + # @see OpenAI::Resources::Beta::Agents::Vaults::Credentials#delete + class CredentialDeleteParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute vault_id + # + # @return [String] + required :vault_id, String + + # @!attribute credential_id + # + # @return [String] + required :credential_id, String + + # @!method initialize(vault_id:, credential_id:, request_options: {}) + # @param vault_id [String] + # @param credential_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vaults/credential_deleted.rb b/lib/openai/models/beta/agents/vaults/credential_deleted.rb new file mode 100644 index 000000000..d38d181c9 --- /dev/null +++ b/lib/openai/models/beta/agents/vaults/credential_deleted.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Vaults + # @see OpenAI::Resources::Beta::Agents::Vaults::Credentials#delete + class CredentialDeleted < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the deleted credential. + # + # @return [String] + required :id, String + + # @!attribute deleted + # Whether the resource was deleted. Always `true`. + # + # @return [Boolean] + required :deleted, OpenAI::Internal::Type::Boolean + + # @!attribute object + # The object type. Always `vault.credential.deleted`. + # + # @return [Symbol, :"vault.credential.deleted"] + required :object, const: :"vault.credential.deleted" + + # @!method initialize(id:, deleted:, object: :"vault.credential.deleted") + # Confirmation that a vault credential was deleted. + # + # @param id [String] + # The ID of the deleted credential. + # + # @param deleted [Boolean] + # Whether the resource was deleted. Always `true`. + # + # @param object [Symbol, :"vault.credential.deleted"] + # The object type. Always `vault.credential.deleted`. + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vaults/credential_list_params.rb b/lib/openai/models/beta/agents/vaults/credential_list_params.rb new file mode 100644 index 000000000..5a46d92e5 --- /dev/null +++ b/lib/openai/models/beta/agents/vaults/credential_list_params.rb @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Vaults + # @see OpenAI::Resources::Beta::Agents::Vaults::Credentials#list + class CredentialListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute vault_id + # + # @return [String] + required :vault_id, String + + # @!attribute after + # Return resources after this resource ID in the selected order. + # + # @return [String, nil] + optional :after, String + + # @!attribute limit + # The maximum number of resources to return. Defaults to 20. Values are clamped + # between 1 and 100. + # + # @return [Integer, nil] + optional :limit, Integer, nil?: true + + # @!attribute order + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::Vaults::CredentialListParams::Order, nil] + optional :order, enum: -> { OpenAI::Beta::Agents::Vaults::CredentialListParams::Order } + + # @!attribute status + # Filter by one status or a list, such as `status=active` or + # `status[]=active&status[]=archived`. Both statuses are included by default. + # + # @return [Symbol, OpenAI::Models::Beta::Agents::VaultStatus, Array, nil] + optional :status, union: -> { OpenAI::Beta::Agents::VaultStatusFilter } + + # @!method initialize(vault_id:, after: nil, limit: nil, order: nil, status: nil, request_options: {}) + # @param vault_id [String] + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer, nil] + # The maximum number of resources to return. Defaults to 20. Values are clamped + # between 1 and 100. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Vaults::CredentialListParams::Order] + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + # + # @param status [Symbol, OpenAI::Models::Beta::Agents::VaultStatus, Array] + # Filter by one status or a list, such as `status=active` or + # `status[]=active&status[]=archived`. Both statuses are included by default. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC = :asc + + # Returns resources in descending order. + DESC = :desc + + # @!method self.values + # @return [Array] + end + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vaults/credential_retrieve_params.rb b/lib/openai/models/beta/agents/vaults/credential_retrieve_params.rb new file mode 100644 index 000000000..1bba033cd --- /dev/null +++ b/lib/openai/models/beta/agents/vaults/credential_retrieve_params.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Vaults + # @see OpenAI::Resources::Beta::Agents::Vaults::Credentials#retrieve + class CredentialRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute vault_id + # + # @return [String] + required :vault_id, String + + # @!attribute credential_id + # + # @return [String] + required :credential_id, String + + # @!method initialize(vault_id:, credential_id:, request_options: {}) + # @param vault_id [String] + # @param credential_id [String] + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vaults/credential_update_params.rb b/lib/openai/models/beta/agents/vaults/credential_update_params.rb new file mode 100644 index 000000000..23d255ddf --- /dev/null +++ b/lib/openai/models/beta/agents/vaults/credential_update_params.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Vaults + # @see OpenAI::Resources::Beta::Agents::Vaults::Credentials#update + class CredentialUpdateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + # @!attribute vault_id + # + # @return [String] + required :vault_id, String + + # @!attribute credential_id + # + # @return [String] + required :credential_id, String + + # @!attribute auth + # Replacement values for the credential's existing authentication method. + # + # @return [OpenAI::Models::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth, OpenAI::Models::Beta::Agents::Vaults::CredentialAuthRotateParam::StaticBearer] + required :auth, union: -> { OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam } + + # @!method initialize(vault_id:, credential_id:, auth:, request_options: {}) + # @param vault_id [String] + # + # @param credential_id [String] + # + # @param auth [OpenAI::Models::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth, OpenAI::Models::Beta::Agents::Vaults::CredentialAuthRotateParam::StaticBearer] + # Replacement values for the credential's existing authentication method. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth.rb b/lib/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth.rb new file mode 100644 index 000000000..560642231 --- /dev/null +++ b/lib/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Vaults + # The client authentication method used for OAuth token refresh. + module McpOauthTokenEndpointAuth + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Sends the client ID without a client secret. + variant :none, -> { OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::None } + + # Sends the client ID and secret using HTTP Basic authentication. + variant( + :client_secret_basic, + -> { OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretBasic } + ) + + # Sends the client ID and secret in the token request body. + variant( + :client_secret_post, + -> { OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretPost } + ) + + class None < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `none`. + # + # @return [Symbol, :none] + required :type, const: :none + + # @!method initialize(type: :none) + # Sends the client ID without a client secret. + # + # @param type [Symbol, :none] + # The type of the object. Always `none`. + end + + class ClientSecretBasic < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `client_secret_basic`. + # + # @return [Symbol, :client_secret_basic] + required :type, const: :client_secret_basic + + # @!method initialize(type: :client_secret_basic) + # Sends the client ID and secret using HTTP Basic authentication. + # + # @param type [Symbol, :client_secret_basic] + # The type of the object. Always `client_secret_basic`. + end + + class ClientSecretPost < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `client_secret_post`. + # + # @return [Symbol, :client_secret_post] + required :type, const: :client_secret_post + + # @!method initialize(type: :client_secret_post) + # Sends the client ID and secret in the token request body. + # + # @param type [Symbol, :client_secret_post] + # The type of the object. Always `client_secret_post`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::None, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretBasic, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretPost)] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_create_param.rb b/lib/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_create_param.rb new file mode 100644 index 000000000..461d38424 --- /dev/null +++ b/lib/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_create_param.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Vaults + # Client authentication credentials for OAuth token refresh. + module McpOauthTokenEndpointAuthCreateParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Sends the client ID without a client secret. + variant :none, -> { OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::None } + + # Sends the client ID and secret using HTTP Basic authentication. + variant( + :client_secret_basic, + -> { OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretBasic } + ) + + # Sends the client ID and secret in the token request body. + variant( + :client_secret_post, + -> { OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretPost } + ) + + class None < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `none`. + # + # @return [Symbol, :none] + required :type, const: :none + + # @!method initialize(type: :none) + # Sends the client ID without a client secret. + # + # @param type [Symbol, :none] + # The type of the object. Always `none`. + end + + class ClientSecretBasic < OpenAI::Internal::Type::BaseModel + # @!attribute client_secret + # The OAuth client secret to store. Never returned in credential resources. + # + # @return [String] + required :client_secret, String + + # @!attribute type + # The type of the object. Always `client_secret_basic`. + # + # @return [Symbol, :client_secret_basic] + required :type, const: :client_secret_basic + + # @!method initialize(client_secret:, type: :client_secret_basic) + # Sends the client ID and secret using HTTP Basic authentication. + # + # @param client_secret [String] + # The OAuth client secret to store. Never returned in credential resources. + # + # @param type [Symbol, :client_secret_basic] + # The type of the object. Always `client_secret_basic`. + end + + class ClientSecretPost < OpenAI::Internal::Type::BaseModel + # @!attribute client_secret + # The OAuth client secret to store. Never returned in credential resources. + # + # @return [String] + required :client_secret, String + + # @!attribute type + # The type of the object. Always `client_secret_post`. + # + # @return [Symbol, :client_secret_post] + required :type, const: :client_secret_post + + # @!method initialize(client_secret:, type: :client_secret_post) + # Sends the client ID and secret in the token request body. + # + # @param client_secret [String] + # The OAuth client secret to store. Never returned in credential resources. + # + # @param type [Symbol, :client_secret_post] + # The type of the object. Always `client_secret_post`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::None, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretBasic, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretPost)] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_rotate_param.rb b/lib/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_rotate_param.rb new file mode 100644 index 000000000..91f6300a8 --- /dev/null +++ b/lib/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_rotate_param.rb @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + module Agents + module Vaults + # Client-secret updates that preserve the credential's OAuth authentication + # method. + module McpOauthTokenEndpointAuthRotateParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Updates credentials sent using HTTP Basic authentication. + variant( + :client_secret_basic, + -> { OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretBasic } + ) + + # Updates credentials sent in the token request body. + variant( + :client_secret_post, + -> { OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretPost } + ) + + class ClientSecretBasic < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `client_secret_basic`. + # + # @return [Symbol, :client_secret_basic] + required :type, const: :client_secret_basic + + # @!attribute client_secret + # The replacement OAuth client secret. Omit or pass `null` to keep the stored + # secret. This secret is never returned in resources. + # + # @return [String, nil] + optional :client_secret, String, nil?: true + + # @!method initialize(client_secret: nil, type: :client_secret_basic) + # Updates credentials sent using HTTP Basic authentication. + # + # @param client_secret [String, nil] + # The replacement OAuth client secret. Omit or pass `null` to keep the stored + # secret. This secret is never returned in resources. + # + # @param type [Symbol, :client_secret_basic] + # The type of the object. Always `client_secret_basic`. + end + + class ClientSecretPost < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `client_secret_post`. + # + # @return [Symbol, :client_secret_post] + required :type, const: :client_secret_post + + # @!attribute client_secret + # The replacement OAuth client secret. Omit or pass `null` to keep the stored + # secret. This secret is never returned in resources. + # + # @return [String, nil] + optional :client_secret, String, nil?: true + + # @!method initialize(client_secret: nil, type: :client_secret_post) + # Updates credentials sent in the token request body. + # + # @param client_secret [String, nil] + # The replacement OAuth client secret. Omit or pass `null` to keep the stored + # secret. This secret is never returned in resources. + # + # @param type [Symbol, :client_secret_post] + # The type of the object. Always `client_secret_post`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretBasic, OpenAI::Models::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretPost)] + end + end + end + end + end +end diff --git a/lib/openai/models/beta/environment.rb b/lib/openai/models/beta/environment.rb new file mode 100644 index 000000000..26acbdb7c --- /dev/null +++ b/lib/openai/models/beta/environment.rb @@ -0,0 +1,246 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # The execution environment for a session. + module Environment + extend OpenAI::Internal::Type::Union + + discriminator :type + + # The session talks to CCA without selecting or provisioning an execution environment. + variant :none, -> { OpenAI::Beta::Environment::None } + + # An environment hosted by OpenAI. + variant :openai_hosted, -> { OpenAI::Beta::Environment::OpenAIHosted } + + # An environment hosted by the application. + variant :self_hosted, -> { OpenAI::Beta::Environment::SelfHosted } + + class None < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `none`. + # + # @return [Symbol, :none] + required :type, const: :none + + # @!method initialize(type: :none) + # The session talks to CCA without selecting or provisioning an execution + # environment. + # + # @param type [Symbol, :none] + # The type of the object. Always `none`. + end + + class OpenAIHosted < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The public ID of the environment. + # + # @return [String] + required :id, String + + # @!attribute capability_directories + # Directories that contain capabilities exposed to the agent. + # + # @return [Array] + required :capability_directories, OpenAI::Internal::Type::ArrayOf[String] + + # @!attribute files + # Files available in the environment, excluding their contents. + # + # @return [Array] + required :files, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::HostedEnvironmentFile] } + + # @!attribute network + # The effective network access policy for the environment. + # + # @return [OpenAI::Models::Beta::Environment::OpenAIHosted::Network] + required :network, -> { OpenAI::Beta::Environment::OpenAIHosted::Network } + + # @!attribute packages + # Packages installed in the environment. + # + # @return [OpenAI::Models::Beta::Environment::OpenAIHosted::Packages] + required :packages, -> { OpenAI::Beta::Environment::OpenAIHosted::Packages } + + # @!attribute plugins + # Plugins installed in the environment, excluding their archive contents. + # + # @return [Array] + required :plugins, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::HostedPlugin] } + + # @!attribute skills + # Skills installed in the environment, excluding their archive contents. + # + # @return [Array] + required :skills, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::HostedSkill] } + + # @!attribute type + # The type of the object. Always `openai_hosted`. + # + # @return [Symbol, :openai_hosted] + required :type, const: :openai_hosted + + # @!method initialize(id:, capability_directories:, files:, network:, packages:, plugins:, skills:, type: :openai_hosted) + # An environment hosted by OpenAI. + # + # @param id [String] + # The public ID of the environment. + # + # @param capability_directories [Array] + # Directories that contain capabilities exposed to the agent. + # + # @param files [Array] + # Files available in the environment, excluding their contents. + # + # @param network [OpenAI::Models::Beta::Environment::OpenAIHosted::Network] + # The effective network access policy for the environment. + # + # @param packages [OpenAI::Models::Beta::Environment::OpenAIHosted::Packages] + # Packages installed in the environment. + # + # @param plugins [Array] + # Plugins installed in the environment, excluding their archive contents. + # + # @param skills [Array] + # Skills installed in the environment, excluding their archive contents. + # + # @param type [Symbol, :openai_hosted] + # The type of the object. Always `openai_hosted`. + + # @see OpenAI::Models::Beta::Environment::OpenAIHosted#network + class Network < OpenAI::Internal::Type::BaseModel + # @!attribute access + # The environment's network access mode. + # + # @return [Symbol, OpenAI::Models::Beta::Environment::OpenAIHosted::Network::Access] + required :access, enum: -> { OpenAI::Beta::Environment::OpenAIHosted::Network::Access } + + # @!attribute allowed_domains + # Domains the environment may access when network access is restricted. + # + # @return [Array] + required :allowed_domains, OpenAI::Internal::Type::ArrayOf[String] + + # @!method initialize(access:, allowed_domains:) + # The effective network access policy for the environment. + # + # @param access [Symbol, OpenAI::Models::Beta::Environment::OpenAIHosted::Network::Access] + # The environment's network access mode. + # + # @param allowed_domains [Array] + # Domains the environment may access when network access is restricted. + + # The environment's network access mode. + # + # @see OpenAI::Models::Beta::Environment::OpenAIHosted::Network#access + module Access + extend OpenAI::Internal::Type::Enum + + # Allows unrestricted network access. + ENABLED = :enabled + + # Disables network access. + DISABLED = :disabled + + # Allows access only to configured domains. + RESTRICTED = :restricted + + # @!method self.values + # @return [Array] + end + end + + # @see OpenAI::Models::Beta::Environment::OpenAIHosted#packages + class Packages < OpenAI::Internal::Type::BaseModel + # @!attribute npm + # npm packages installed globally in the environment. + # + # @return [Array] + required :npm, OpenAI::Internal::Type::ArrayOf[String] + + # @!attribute python + # Python packages installed in the environment. + # + # @return [Array] + required :python, OpenAI::Internal::Type::ArrayOf[String] + + # @!attribute system_ + # System packages installed in the environment. + # + # @return [Array] + required :system_, OpenAI::Internal::Type::ArrayOf[String], api_name: :system + + # @!method initialize(npm:, python:, system_:) + # Packages installed in the environment. + # + # @param npm [Array] + # npm packages installed globally in the environment. + # + # @param python [Array] + # Python packages installed in the environment. + # + # @param system_ [Array] + # System packages installed in the environment. + end + end + + class SelfHosted < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The public ID of the environment. + # + # @return [String] + required :id, String + + # @!attribute capability_directories + # Directories that contain capabilities exposed to the agent. + # + # @return [Array] + required :capability_directories, OpenAI::Internal::Type::ArrayOf[String] + + # @!attribute remote_url + # Pass this URL unchanged to `codex exec-server --remote` when connecting this + # environment. + # + # @return [String] + required :remote_url, String + + # @!attribute type + # The type of the object. Always `self_hosted`. + # + # @return [Symbol, :self_hosted] + required :type, const: :self_hosted + + # @!attribute workspace_directory + # The absolute project directory inside the environment. Defaults to `/workspace`. + # + # @return [String] + required :workspace_directory, String + + # @!method initialize(id:, capability_directories:, remote_url:, workspace_directory:, type: :self_hosted) + # An environment hosted by the application. + # + # @param id [String] + # The public ID of the environment. + # + # @param capability_directories [Array] + # Directories that contain capabilities exposed to the agent. + # + # @param remote_url [String] + # Pass this URL unchanged to `codex exec-server --remote` when connecting this + # environment. + # + # @param workspace_directory [String] + # The absolute project directory inside the environment. Defaults to `/workspace`. + # + # @param type [Symbol, :self_hosted] + # The type of the object. Always `self_hosted`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::Environment::None, OpenAI::Models::Beta::Environment::OpenAIHosted, OpenAI::Models::Beta::Environment::SelfHosted)] + end + end + end +end diff --git a/lib/openai/models/beta/environment_param.rb b/lib/openai/models/beta/environment_param.rb new file mode 100644 index 000000000..22817bc8d --- /dev/null +++ b/lib/openai/models/beta/environment_param.rb @@ -0,0 +1,269 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # The execution environment and optional reusable template for a session. + module EnvironmentParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Runs the agent without an execution environment. + variant :none, -> { OpenAI::Beta::EnvironmentParam::None } + + # An OpenAI-hosted environment, optionally based on a reusable template. + variant :openai_hosted, -> { OpenAI::Beta::EnvironmentParam::OpenAIHosted } + + # An application-hosted environment configured inline. + variant :self_hosted, -> { OpenAI::Beta::EnvironmentParam::SelfHosted } + + class None < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `none`. + # + # @return [Symbol, :none] + required :type, const: :none + + # @!method initialize(type: :none) + # Runs the agent without an execution environment. + # + # @param type [Symbol, :none] + # The type of the object. Always `none`. + end + + class OpenAIHosted < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `openai_hosted`. + # + # @return [Symbol, :openai_hosted] + required :type, const: :openai_hosted + + # @!attribute capability_directories + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + # + # @return [Array, nil] + optional :capability_directories, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute env + # Environment variables made available to the agent. + # + # @return [Hash{Symbol=>String}, nil] + optional :env, OpenAI::Internal::Type::HashOf[String], nil?: true + + # @!attribute environment_template_id + # A reusable hosted template applied before inline session configuration. Omitted + # fields inherit the template; network overrides cannot broaden its policy. + # + # @return [String, nil] + optional :environment_template_id, String + + # @!attribute files + # Files available before the agent starts. Defaults to an empty list. + # + # @return [Array, nil] + optional( + :files, + -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::HostedEnvironmentFileParam] }, + nil?: true + ) + + # @!attribute network + # Network access for an OpenAI-hosted environment. + # + # @return [OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::Network, nil] + optional :network, -> { OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network }, nil?: true + + # @!attribute packages + # Packages to install in an OpenAI-hosted environment. + # + # @return [OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::Packages, nil] + optional :packages, -> { OpenAI::Beta::EnvironmentParam::OpenAIHosted::Packages }, nil?: true + + # @!attribute plugins + # Plugins provided as inline ZIP archives. Defaults to an empty list. + # + # @return [Array, nil] + optional( + :plugins, + -> { + OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::HostedPluginParam] + }, + nil?: true + ) + + # @!attribute setup_commands + # Ordered, confidential setup commands. Command bodies are never returned. + # + # @return [Array, nil] + optional( + :setup_commands, + -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::SetupCommandParam] }, + nil?: true + ) + + # @!attribute skills + # Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty + # list. + # + # @return [Array, nil] + optional( + :skills, + -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::HostedSkillParam] }, + nil?: true + ) + + # @!method initialize(capability_directories: nil, env: nil, environment_template_id: nil, files: nil, network: nil, packages: nil, plugins: nil, setup_commands: nil, skills: nil, type: :openai_hosted) + # An OpenAI-hosted environment, optionally based on a reusable template. + # + # @param capability_directories [Array, nil] + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + # + # @param env [Hash{Symbol=>String}, nil] + # Environment variables made available to the agent. + # + # @param environment_template_id [String] + # A reusable hosted template applied before inline session configuration. Omitted + # fields inherit the template; network overrides cannot broaden its policy. + # + # @param files [Array, nil] + # Files available before the agent starts. Defaults to an empty list. + # + # @param network [OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::Network, nil] + # Network access for an OpenAI-hosted environment. + # + # @param packages [OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::Packages, nil] + # Packages to install in an OpenAI-hosted environment. + # + # @param plugins [Array, nil] + # Plugins provided as inline ZIP archives. Defaults to an empty list. + # + # @param setup_commands [Array, nil] + # Ordered, confidential setup commands. Command bodies are never returned. + # + # @param skills [Array, nil] + # Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty + # list. + # + # @param type [Symbol, :openai_hosted] + # The type of the object. Always `openai_hosted`. + + # @see OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted#network + class Network < OpenAI::Internal::Type::BaseModel + # @!attribute access + # The environment's network access mode. + # + # @return [Symbol, OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::Network::Access] + required :access, enum: -> { OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network::Access } + + # @!attribute allowed_domains + # Domains the environment may access when network access is restricted. + # + # @return [Array, nil] + optional :allowed_domains, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!method initialize(access:, allowed_domains: nil) + # Network access for an OpenAI-hosted environment. + # + # @param access [Symbol, OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::Network::Access] + # The environment's network access mode. + # + # @param allowed_domains [Array, nil] + # Domains the environment may access when network access is restricted. + + # The environment's network access mode. + # + # @see OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::Network#access + module Access + extend OpenAI::Internal::Type::Enum + + # Allows unrestricted network access, matching an omitted network policy. + ENABLED = :enabled + + # Disables network access. + DISABLED = :disabled + + # Allows access only to configured domains. + RESTRICTED = :restricted + + # @!method self.values + # @return [Array] + end + end + + # @see OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted#packages + class Packages < OpenAI::Internal::Type::BaseModel + # @!attribute npm + # npm packages to install globally. Defaults to an empty list. + # + # @return [Array, nil] + optional :npm, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute python + # Python packages to install. Defaults to an empty list. + # + # @return [Array, nil] + optional :python, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute system_ + # System packages to install. Defaults to an empty list. + # + # @return [Array, nil] + optional :system_, OpenAI::Internal::Type::ArrayOf[String], api_name: :system, nil?: true + + # @!method initialize(npm: nil, python: nil, system_: nil) + # Packages to install in an OpenAI-hosted environment. + # + # @param npm [Array, nil] + # npm packages to install globally. Defaults to an empty list. + # + # @param python [Array, nil] + # Python packages to install. Defaults to an empty list. + # + # @param system_ [Array, nil] + # System packages to install. Defaults to an empty list. + end + end + + class SelfHosted < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `self_hosted`. + # + # @return [Symbol, :self_hosted] + required :type, const: :self_hosted + + # @!attribute workspace_directory + # Absolute project directory inside the self-hosted environment. + # + # @return [String] + required :workspace_directory, String + + # @!attribute capability_directories + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + # + # @return [Array, nil] + optional :capability_directories, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!method initialize(workspace_directory:, capability_directories: nil, type: :self_hosted) + # An application-hosted environment configured inline. + # + # @param workspace_directory [String] + # Absolute project directory inside the self-hosted environment. + # + # @param capability_directories [Array, nil] + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + # + # @param type [Symbol, :self_hosted] + # The type of the object. Always `self_hosted`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::EnvironmentParam::None, OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted, OpenAI::Models::Beta::EnvironmentParam::SelfHosted)] + end + end + end +end diff --git a/lib/openai/models/beta/hosted_environment_file.rb b/lib/openai/models/beta/hosted_environment_file.rb new file mode 100644 index 000000000..eb5bb17e2 --- /dev/null +++ b/lib/openai/models/beta/hosted_environment_file.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # Metadata for a file materialized in an OpenAI-hosted execution environment. + module HostedEnvironmentFile + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A file copied from the OpenAI Files API. + variant :file_id, -> { OpenAI::Beta::HostedEnvironmentFileID } + + # A file supplied inline when the session was created. + variant :inline, -> { OpenAI::Beta::HostedEnvironmentFile::Inline } + + class Inline < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The session-scoped ID of the file in the execution environment. + # + # @return [String] + required :id, String + + # @!attribute path + # The file's absolute path inside the environment. + # + # @return [String] + required :path, String + + # @!attribute size_bytes + # The decoded file size in bytes. + # + # @return [Integer] + required :size_bytes, Integer + + # @!attribute type + # The type of the object. Always `inline`. + # + # @return [Symbol, :inline] + required :type, const: :inline + + # @!method initialize(id:, path:, size_bytes:, type: :inline) + # A file supplied inline when the session was created. + # + # @param id [String] + # The session-scoped ID of the file in the execution environment. + # + # @param path [String] + # The file's absolute path inside the environment. + # + # @param size_bytes [Integer] + # The decoded file size in bytes. + # + # @param type [Symbol, :inline] + # The type of the object. Always `inline`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::HostedEnvironmentFileID, OpenAI::Models::Beta::HostedEnvironmentFile::Inline)] + end + end + end +end diff --git a/lib/openai/models/beta/hosted_environment_file_id.rb b/lib/openai/models/beta/hosted_environment_file_id.rb new file mode 100644 index 000000000..8e54fd776 --- /dev/null +++ b/lib/openai/models/beta/hosted_environment_file_id.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class HostedEnvironmentFileID < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The session-scoped ID of the file in the execution environment. + # + # @return [String] + required :id, String + + # @!attribute file_id + # The ID of the uploaded file. + # + # @return [String] + required :file_id, String + + # @!attribute path + # The file's absolute path inside the environment. + # + # @return [String] + required :path, String + + # @!attribute size_bytes + # The decoded file size in bytes. + # + # @return [Integer] + required :size_bytes, Integer + + # @!attribute type + # The type of the object. Always `file_id`. + # + # @return [Symbol, :file_id] + required :type, const: :file_id + + # @!method initialize(id:, file_id:, path:, size_bytes:, type: :file_id) + # A file copied from the OpenAI Files API. + # + # @param id [String] + # The session-scoped ID of the file in the execution environment. + # + # @param file_id [String] + # The ID of the uploaded file. + # + # @param path [String] + # The file's absolute path inside the environment. + # + # @param size_bytes [Integer] + # The decoded file size in bytes. + # + # @param type [Symbol, :file_id] + # The type of the object. Always `file_id`. + end + end + end +end diff --git a/lib/openai/models/beta/hosted_environment_file_param.rb b/lib/openai/models/beta/hosted_environment_file_param.rb new file mode 100644 index 000000000..6b1b75bdd --- /dev/null +++ b/lib/openai/models/beta/hosted_environment_file_param.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # A file materialized in an OpenAI-hosted execution environment. + module HostedEnvironmentFileParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A file previously uploaded through the OpenAI Files API. + variant :file_id, -> { OpenAI::Beta::HostedEnvironmentFileParam::FileID } + + # A file supplied directly as standard-base64 data. + variant :inline, -> { OpenAI::Beta::HostedEnvironmentFileParam::Inline } + + class FileID < OpenAI::Internal::Type::BaseModel + # @!attribute file_id + # The ID of the uploaded file. + # + # @return [String] + required :file_id, String + + # @!attribute path + # The absolute destination path inside `/workspace`. + # + # @return [String] + required :path, String + + # @!attribute type + # The type of the object. Always `file_id`. + # + # @return [Symbol, :file_id] + required :type, const: :file_id + + # @!method initialize(file_id:, path:, type: :file_id) + # A file previously uploaded through the OpenAI Files API. + # + # @param file_id [String] + # The ID of the uploaded file. + # + # @param path [String] + # The absolute destination path inside `/workspace`. + # + # @param type [Symbol, :file_id] + # The type of the object. Always `file_id`. + end + + class Inline < OpenAI::Internal::Type::BaseModel + # @!attribute data + # The standard-base64-encoded file contents. + # + # @return [String] + required :data, String + + # @!attribute path + # The absolute destination path inside `/workspace`. + # + # @return [String] + required :path, String + + # @!attribute type + # The type of the object. Always `inline`. + # + # @return [Symbol, :inline] + required :type, const: :inline + + # @!method initialize(data:, path:, type: :inline) + # A file supplied directly as standard-base64 data. + # + # @param data [String] + # The standard-base64-encoded file contents. + # + # @param path [String] + # The absolute destination path inside `/workspace`. + # + # @param type [Symbol, :inline] + # The type of the object. Always `inline`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::HostedEnvironmentFileParam::FileID, OpenAI::Models::Beta::HostedEnvironmentFileParam::Inline)] + end + end + end +end diff --git a/lib/openai/models/beta/hosted_plugin.rb b/lib/openai/models/beta/hosted_plugin.rb new file mode 100644 index 000000000..058e9a97b --- /dev/null +++ b/lib/openai/models/beta/hosted_plugin.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class HostedPlugin < OpenAI::Internal::Type::BaseModel + # @!attribute description + # The installed plugin description. + # + # @return [String] + required :description, String + + # @!attribute name + # The installed plugin name. + # + # @return [String] + required :name, String + + # @!attribute type + # The type of the object. Always `inline`. + # + # @return [Symbol, :inline] + required :type, const: :inline + + # @!method initialize(description:, name:, type: :inline) + # A plugin installed from an inline ZIP archive. + # + # @param description [String] + # The installed plugin description. + # + # @param name [String] + # The installed plugin name. + # + # @param type [Symbol, :inline] + # The type of the object. Always `inline`. + end + end + end +end diff --git a/lib/openai/models/beta/hosted_plugin_param.rb b/lib/openai/models/beta/hosted_plugin_param.rb new file mode 100644 index 000000000..09aed993e --- /dev/null +++ b/lib/openai/models/beta/hosted_plugin_param.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class HostedPluginParam < OpenAI::Internal::Type::BaseModel + # @!attribute description + # The plugin description declared in `.codex-plugin/plugin.json`. + # + # @return [String] + required :description, String + + # @!attribute name + # The plugin name declared in `.codex-plugin/plugin.json`. + # + # @return [String] + required :name, String + + # @!attribute source + # Provides ZIP bytes encoded with standard base64. + # + # @return [OpenAI::Models::Beta::InlineCapabilitySourceParam] + required :source, -> { OpenAI::Beta::InlineCapabilitySourceParam } + + # @!attribute type + # The type of the object. Always `inline`. + # + # @return [Symbol, :inline] + required :type, const: :inline + + # @!method initialize(description:, name:, source:, type: :inline) + # Supplies a plugin ZIP directly in the session request. + # + # @param description [String] + # The plugin description declared in `.codex-plugin/plugin.json`. + # + # @param name [String] + # The plugin name declared in `.codex-plugin/plugin.json`. + # + # @param source [OpenAI::Models::Beta::InlineCapabilitySourceParam] + # Provides ZIP bytes encoded with standard base64. + # + # @param type [Symbol, :inline] + # The type of the object. Always `inline`. + end + end + end +end diff --git a/lib/openai/models/beta/hosted_skill.rb b/lib/openai/models/beta/hosted_skill.rb new file mode 100644 index 000000000..0ce461234 --- /dev/null +++ b/lib/openai/models/beta/hosted_skill.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # A skill installed in an OpenAI-hosted environment. + module HostedSkill + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A skill installed from the Skills API. + variant :skill_reference, -> { OpenAI::Beta::HostedSkillReference } + + # A skill installed from an inline ZIP archive. + variant :inline, -> { OpenAI::Beta::HostedSkill::Inline } + + class Inline < OpenAI::Internal::Type::BaseModel + # @!attribute description + # The installed skill description. + # + # @return [String] + required :description, String + + # @!attribute name + # The installed skill name. + # + # @return [String] + required :name, String + + # @!attribute type + # The type of the object. Always `inline`. + # + # @return [Symbol, :inline] + required :type, const: :inline + + # @!method initialize(description:, name:, type: :inline) + # A skill installed from an inline ZIP archive. + # + # @param description [String] + # The installed skill description. + # + # @param name [String] + # The installed skill name. + # + # @param type [Symbol, :inline] + # The type of the object. Always `inline`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::HostedSkillReference, OpenAI::Models::Beta::HostedSkill::Inline)] + end + end + end +end diff --git a/lib/openai/models/beta/hosted_skill_param.rb b/lib/openai/models/beta/hosted_skill_param.rb new file mode 100644 index 000000000..0843db4f1 --- /dev/null +++ b/lib/openai/models/beta/hosted_skill_param.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # A skill installed in an OpenAI-hosted environment. + module HostedSkillParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # References a skill uploaded through the Skills API. + variant :skill_reference, -> { OpenAI::Beta::HostedSkillParam::SkillReference } + + # Supplies a skill ZIP directly in the session request. + variant :inline, -> { OpenAI::Beta::HostedSkillParam::Inline } + + class SkillReference < OpenAI::Internal::Type::BaseModel + # @!attribute skill_id + # The ID of the skill created through `/v1/skills`. + # + # @return [String] + required :skill_id, String + + # @!attribute type + # The type of the object. Always `skill_reference`. + # + # @return [Symbol, :skill_reference] + required :type, const: :skill_reference + + # @!attribute version + # The skill version, a positive integer or `latest`; omission selects the default. + # + # @return [String, nil] + optional :version, String, nil?: true + + # @!method initialize(skill_id:, version: nil, type: :skill_reference) + # References a skill uploaded through the Skills API. + # + # @param skill_id [String] + # The ID of the skill created through `/v1/skills`. + # + # @param version [String, nil] + # The skill version, a positive integer or `latest`; omission selects the default. + # + # @param type [Symbol, :skill_reference] + # The type of the object. Always `skill_reference`. + end + + class Inline < OpenAI::Internal::Type::BaseModel + # @!attribute description + # The skill description declared in `SKILL.md`. + # + # @return [String] + required :description, String + + # @!attribute name + # The skill name declared in `SKILL.md`. + # + # @return [String] + required :name, String + + # @!attribute source + # Provides ZIP bytes encoded with standard base64. + # + # @return [OpenAI::Models::Beta::InlineCapabilitySourceParam] + required :source, -> { OpenAI::Beta::InlineCapabilitySourceParam } + + # @!attribute type + # The type of the object. Always `inline`. + # + # @return [Symbol, :inline] + required :type, const: :inline + + # @!method initialize(description:, name:, source:, type: :inline) + # Supplies a skill ZIP directly in the session request. + # + # @param description [String] + # The skill description declared in `SKILL.md`. + # + # @param name [String] + # The skill name declared in `SKILL.md`. + # + # @param source [OpenAI::Models::Beta::InlineCapabilitySourceParam] + # Provides ZIP bytes encoded with standard base64. + # + # @param type [Symbol, :inline] + # The type of the object. Always `inline`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::HostedSkillParam::SkillReference, OpenAI::Models::Beta::HostedSkillParam::Inline)] + end + end + end +end diff --git a/lib/openai/models/beta/hosted_skill_reference.rb b/lib/openai/models/beta/hosted_skill_reference.rb new file mode 100644 index 000000000..a4fc64900 --- /dev/null +++ b/lib/openai/models/beta/hosted_skill_reference.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class HostedSkillReference < OpenAI::Internal::Type::BaseModel + # @!attribute description + # The installed skill description. + # + # @return [String] + required :description, String + + # @!attribute name + # The installed skill name. + # + # @return [String] + required :name, String + + # @!attribute skill_id + # The referenced skill ID. + # + # @return [String] + required :skill_id, String + + # @!attribute type + # The type of the object. Always `skill_reference`. + # + # @return [Symbol, :skill_reference] + required :type, const: :skill_reference + + # @!attribute version + # The concrete skill version installed for this session. + # + # @return [String] + required :version, String + + # @!method initialize(description:, name:, skill_id:, version:, type: :skill_reference) + # A skill installed from the Skills API. + # + # @param description [String] + # The installed skill description. + # + # @param name [String] + # The installed skill name. + # + # @param skill_id [String] + # The referenced skill ID. + # + # @param version [String] + # The concrete skill version installed for this session. + # + # @param type [Symbol, :skill_reference] + # The type of the object. Always `skill_reference`. + end + end + end +end diff --git a/lib/openai/models/beta/inline_capability_source_param.rb b/lib/openai/models/beta/inline_capability_source_param.rb new file mode 100644 index 000000000..eb53ae828 --- /dev/null +++ b/lib/openai/models/beta/inline_capability_source_param.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class InlineCapabilitySourceParam < OpenAI::Internal::Type::BaseModel + # @!attribute data + # Standard-base64 encoded ZIP archive bytes. + # + # @return [String] + required :data, String + + # @!attribute media_type + # The archive media type, always `application/zip`. + # + # @return [Symbol, :"application/zip"] + required :media_type, const: :"application/zip" + + # @!attribute type + # The type of the object. Always `base64`. + # + # @return [Symbol, :base64] + required :type, const: :base64 + + # @!method initialize(data:, media_type: :"application/zip", type: :base64) + # Provides ZIP bytes encoded with standard base64. + # + # @param data [String] + # Standard-base64 encoded ZIP archive bytes. + # + # @param media_type [Symbol, :"application/zip"] + # The archive media type, always `application/zip`. + # + # @param type [Symbol, :base64] + # The type of the object. Always `base64`. + end + end + end +end diff --git a/lib/openai/models/beta/input_content.rb b/lib/openai/models/beta/input_content.rb new file mode 100644 index 000000000..191b92a4a --- /dev/null +++ b/lib/openai/models/beta/input_content.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # User-provided content recorded in a session item. + module InputContent + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Text input recorded in a session item. + variant :input_text, -> { OpenAI::Beta::InputContent::InputText } + + # Image input recorded in a session item. + variant :input_image, -> { OpenAI::Beta::InputContent::InputImage } + + class InputText < OpenAI::Internal::Type::BaseModel + # @!attribute text + # The text supplied to the agent. + # + # @return [String] + required :text, String + + # @!attribute type + # The type of the object. Always `input_text`. + # + # @return [Symbol, :input_text] + required :type, const: :input_text + + # @!method initialize(text:, type: :input_text) + # Text input recorded in a session item. + # + # @param text [String] + # The text supplied to the agent. + # + # @param type [Symbol, :input_text] + # The type of the object. Always `input_text`. + end + + class InputImage < OpenAI::Internal::Type::BaseModel + # @!attribute image_url + # The URL of the image supplied to the agent, which may be a base64-encoded data + # URL. + # + # @return [String] + required :image_url, String + + # @!attribute type + # The type of the object. Always `input_image`. + # + # @return [Symbol, :input_image] + required :type, const: :input_image + + # @!method initialize(image_url:, type: :input_image) + # Image input recorded in a session item. + # + # @param image_url [String] + # The URL of the image supplied to the agent, which may be a base64-encoded data + # URL. + # + # @param type [Symbol, :input_image] + # The type of the object. Always `input_image`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::InputContent::InputText, OpenAI::Models::Beta::InputContent::InputImage)] + end + end + end +end diff --git a/lib/openai/models/beta/input_content_param.rb b/lib/openai/models/beta/input_content_param.rb new file mode 100644 index 000000000..82d1dbba2 --- /dev/null +++ b/lib/openai/models/beta/input_content_param.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # Content included in an input message. + module InputContentParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Text input to the model. + variant :input_text, -> { OpenAI::Beta::InputContentParam::InputText } + + # Image input to the model. + variant :input_image, -> { OpenAI::Beta::InputContentParam::InputImage } + + class InputText < OpenAI::Internal::Type::BaseModel + # @!attribute text + # The text sent to the model. + # + # @return [String] + required :text, String + + # @!attribute type + # The type of the object. Always `input_text`. + # + # @return [Symbol, :input_text] + required :type, const: :input_text + + # @!method initialize(text:, type: :input_text) + # Text input to the model. + # + # @param text [String] + # The text sent to the model. + # + # @param type [Symbol, :input_text] + # The type of the object. Always `input_text`. + end + + class InputImage < OpenAI::Internal::Type::BaseModel + # @!attribute image_url + # The URL of the image sent to the model. + # + # @return [String] + required :image_url, String + + # @!attribute type + # The type of the object. Always `input_image`. + # + # @return [Symbol, :input_image] + required :type, const: :input_image + + # @!method initialize(image_url:, type: :input_image) + # Image input to the model. + # + # @param image_url [String] + # The URL of the image sent to the model. + # + # @param type [Symbol, :input_image] + # The type of the object. Always `input_image`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::InputContentParam::InputText, OpenAI::Models::Beta::InputContentParam::InputImage)] + end + end + end +end diff --git a/lib/openai/models/beta/mcp_transport.rb b/lib/openai/models/beta/mcp_transport.rb new file mode 100644 index 000000000..d54c1b05f --- /dev/null +++ b/lib/openai/models/beta/mcp_transport.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # The transport used to connect to an MCP server. + module McpTransport + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Connects to an MCP server over HTTP. + variant :http, -> { OpenAI::Beta::McpTransport::HTTP } + + # Starts an MCP server as a local process. + variant :stdio, -> { OpenAI::Beta::McpTransport::Stdio } + + class HTTP < OpenAI::Internal::Type::BaseModel + # @!attribute server_url + # The URL of the MCP server. + # + # @return [String] + required :server_url, String + + # @!attribute type + # The type of the object. Always `http`. + # + # @return [Symbol, :http] + required :type, const: :http + + # @!method initialize(server_url:, type: :http) + # Connects to an MCP server over HTTP. + # + # @param server_url [String] + # The URL of the MCP server. + # + # @param type [Symbol, :http] + # The type of the object. Always `http`. + end + + class Stdio < OpenAI::Internal::Type::BaseModel + # @!attribute args + # Arguments passed to the MCP server command. + # + # @return [Array] + required :args, OpenAI::Internal::Type::ArrayOf[String] + + # @!attribute command + # The command used to start the MCP server. + # + # @return [String] + required :command, String + + # @!attribute cwd + # The working directory used to start the MCP server. + # + # @return [String] + required :cwd, String + + # @!attribute env_vars + # Environment variable names inherited from the execution environment. + # + # @return [Array] + required :env_vars, OpenAI::Internal::Type::ArrayOf[String] + + # @!attribute type + # The type of the object. Always `stdio`. + # + # @return [Symbol, :stdio] + required :type, const: :stdio + + # @!method initialize(args:, command:, cwd:, env_vars:, type: :stdio) + # Starts an MCP server as a local process. + # + # @param args [Array] + # Arguments passed to the MCP server command. + # + # @param command [String] + # The command used to start the MCP server. + # + # @param cwd [String] + # The working directory used to start the MCP server. + # + # @param env_vars [Array] + # Environment variable names inherited from the execution environment. + # + # @param type [Symbol, :stdio] + # The type of the object. Always `stdio`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::McpTransport::HTTP, OpenAI::Models::Beta::McpTransport::Stdio)] + end + end + end +end diff --git a/lib/openai/models/beta/mcp_transport_param.rb b/lib/openai/models/beta/mcp_transport_param.rb new file mode 100644 index 000000000..4eecf26ff --- /dev/null +++ b/lib/openai/models/beta/mcp_transport_param.rb @@ -0,0 +1,123 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # The transport used to connect to an MCP server. + module McpTransportParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Connects to an MCP server over HTTP. + variant :http, -> { OpenAI::Beta::McpTransportParam::HTTP } + + # Starts an MCP server as a local process. + variant :stdio, -> { OpenAI::Beta::McpTransportParam::Stdio } + + class HTTP < OpenAI::Internal::Type::BaseModel + # @!attribute server_url + # The URL of the MCP server. + # + # @return [String] + required :server_url, String + + # @!attribute type + # The type of the object. Always `http`. + # + # @return [Symbol, :http] + required :type, const: :http + + # @!attribute authorization + # The authorization value sent to the MCP server, if any. + # + # @return [String, nil] + optional :authorization, String, nil?: true + + # @!attribute headers + # Additional HTTP headers sent to the MCP server. + # + # @return [Hash{Symbol=>String}, nil] + optional :headers, OpenAI::Internal::Type::HashOf[String], nil?: true + + # @!method initialize(server_url:, authorization: nil, headers: nil, type: :http) + # Connects to an MCP server over HTTP. + # + # @param server_url [String] + # The URL of the MCP server. + # + # @param authorization [String, nil] + # The authorization value sent to the MCP server, if any. + # + # @param headers [Hash{Symbol=>String}, nil] + # Additional HTTP headers sent to the MCP server. + # + # @param type [Symbol, :http] + # The type of the object. Always `http`. + end + + class Stdio < OpenAI::Internal::Type::BaseModel + # @!attribute command + # The command used to start the MCP server. + # + # @return [String] + required :command, String + + # @!attribute cwd + # The working directory used to start the MCP server. + # + # @return [String] + required :cwd, String + + # @!attribute type + # The type of the object. Always `stdio`. + # + # @return [Symbol, :stdio] + required :type, const: :stdio + + # @!attribute args + # Arguments passed to the MCP server command. + # + # @return [Array, nil] + optional :args, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute env + # Environment variables set for the MCP server process. + # + # @return [Hash{Symbol=>String}, nil] + optional :env, OpenAI::Internal::Type::HashOf[String], nil?: true + + # @!attribute env_vars + # Environment variable names to inherit from the selected execution environment. + # + # @return [Array, nil] + optional :env_vars, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!method initialize(command:, cwd:, args: nil, env: nil, env_vars: nil, type: :stdio) + # Starts an MCP server as a local process. + # + # @param command [String] + # The command used to start the MCP server. + # + # @param cwd [String] + # The working directory used to start the MCP server. + # + # @param args [Array, nil] + # Arguments passed to the MCP server command. + # + # @param env [Hash{Symbol=>String}, nil] + # Environment variables set for the MCP server process. + # + # @param env_vars [Array, nil] + # Environment variable names to inherit from the selected execution environment. + # + # @param type [Symbol, :stdio] + # The type of the object. Always `stdio`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::McpTransportParam::HTTP, OpenAI::Models::Beta::McpTransportParam::Stdio)] + end + end + end +end diff --git a/lib/openai/models/beta/multi_agent_config.rb b/lib/openai/models/beta/multi_agent_config.rb new file mode 100644 index 000000000..add120ed0 --- /dev/null +++ b/lib/openai/models/beta/multi_agent_config.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class MultiAgentConfig < OpenAI::Internal::Type::BaseModel + # @!attribute enabled + # Whether subagent tools are enabled. Defaults to false. + # + # @return [Boolean] + required :enabled, OpenAI::Internal::Type::Boolean + + # @!attribute max_concurrent_subagents + # Maximum number of subagents that may run concurrently, or null when disabled. + # Defaults to 6 when enabled. + # + # @return [Integer, nil] + required :max_concurrent_subagents, Integer, nil?: true + + # @!method initialize(enabled:, max_concurrent_subagents:) + # The resolved configuration for creating and coordinating subagents. + # + # @param enabled [Boolean] + # Whether subagent tools are enabled. Defaults to false. + # + # @param max_concurrent_subagents [Integer, nil] + # Maximum number of subagents that may run concurrently, or null when disabled. + # Defaults to 6 when enabled. + end + end + end +end diff --git a/lib/openai/models/beta/multi_agent_config_param.rb b/lib/openai/models/beta/multi_agent_config_param.rb new file mode 100644 index 000000000..afa8ab296 --- /dev/null +++ b/lib/openai/models/beta/multi_agent_config_param.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class MultiAgentConfigParam < OpenAI::Internal::Type::BaseModel + # @!attribute enabled + # Whether subagent tools are enabled. + # + # @return [Boolean] + required :enabled, OpenAI::Internal::Type::Boolean + + # @!attribute max_concurrent_subagents + # Maximum number of subagents that may run concurrently. Defaults to 6. + # + # @return [Integer, nil] + optional :max_concurrent_subagents, Integer + + # @!method initialize(enabled:, max_concurrent_subagents: nil) + # Explicit configuration for creating and coordinating subagents. + # + # @param enabled [Boolean] + # Whether subagent tools are enabled. + # + # @param max_concurrent_subagents [Integer] + # Maximum number of subagents that may run concurrently. Defaults to 6. + end + end + end +end diff --git a/lib/openai/models/beta/output_text.rb b/lib/openai/models/beta/output_text.rb new file mode 100644 index 000000000..1c6b001aa --- /dev/null +++ b/lib/openai/models/beta/output_text.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class OutputText < OpenAI::Internal::Type::BaseModel + # @!attribute text + # The text produced by the agent. + # + # @return [String] + required :text, String + + # @!attribute type + # The content type. Always `output_text`. + # + # @return [Symbol, :output_text] + required :type, const: :output_text + + # @!method initialize(text:, type: :output_text) + # A text content part produced by the agent. + # + # @param text [String] + # The text produced by the agent. + # + # @param type [Symbol, :output_text] + # The content type. Always `output_text`. + end + end + end +end diff --git a/lib/openai/models/beta/persisted_agent_tool.rb b/lib/openai/models/beta/persisted_agent_tool.rb new file mode 100644 index 000000000..39bb3bd57 --- /dev/null +++ b/lib/openai/models/beta/persisted_agent_tool.rb @@ -0,0 +1,329 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # A credential-free tool available to a reusable agent. + module PersistedAgentTool + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A function defined by the application. + variant :function, -> { OpenAI::Beta::PersistedAgentTool::Function } + + # Discovers deferred function tools and loads them into the model context. + variant :tool_search, -> { OpenAI::Beta::PersistedAgentTool::ToolSearch } + + # Enables calling tools from model-generated code. + variant :programmatic_tool_calling, -> { OpenAI::Beta::PersistedAgentTool::ProgrammaticToolCalling } + + # Tools provided by a remote MCP server without stored credentials. + variant :mcp, -> { OpenAI::Beta::PersistedAgentTool::Mcp } + + # Web search. + variant :web_search, -> { OpenAI::Beta::PersistedAgentTool::WebSearch } + + class Function < OpenAI::Internal::Type::BaseModel + # @!attribute defer_loading + # Whether the function is deferred and discovered through tool search. + # + # @return [Boolean] + required :defer_loading, OpenAI::Internal::Type::Boolean + + # @!attribute description + # A description of what the function does. + # + # @return [String] + required :description, String + + # @!attribute name + # The name of the function. + # + # @return [String] + required :name, String + + # @!attribute parameters + # A JSON Schema object describing the function's arguments. + # + # @return [Hash{Symbol=>Object}] + required :parameters, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown] + + # @!attribute type + # The type of the object. Always `function`. + # + # @return [Symbol, :function] + required :type, const: :function + + # @!method initialize(defer_loading:, description:, name:, parameters:, type: :function) + # A function defined by the application. + # + # @param defer_loading [Boolean] + # Whether the function is deferred and discovered through tool search. + # + # @param description [String] + # A description of what the function does. + # + # @param name [String] + # The name of the function. + # + # @param parameters [Hash{Symbol=>Object}] + # A JSON Schema object describing the function's arguments. + # + # @param type [Symbol, :function] + # The type of the object. Always `function`. + end + + class ToolSearch < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `tool_search`. + # + # @return [Symbol, :tool_search] + required :type, const: :tool_search + + # @!method initialize(type: :tool_search) + # Discovers deferred function tools and loads them into the model context. + # + # @param type [Symbol, :tool_search] + # The type of the object. Always `tool_search`. + end + + class ProgrammaticToolCalling < OpenAI::Internal::Type::BaseModel + # @!attribute enabled + # Whether tools can be called from model-generated code. + # + # @return [Boolean] + required :enabled, OpenAI::Internal::Type::Boolean + + # @!attribute type + # The type of the object. Always `programmatic_tool_calling`. + # + # @return [Symbol, :programmatic_tool_calling] + required :type, const: :programmatic_tool_calling + + # @!method initialize(enabled:, type: :programmatic_tool_calling) + # Enables calling tools from model-generated code. + # + # @param enabled [Boolean] + # Whether tools can be called from model-generated code. + # + # @param type [Symbol, :programmatic_tool_calling] + # The type of the object. Always `programmatic_tool_calling`. + end + + class Mcp < OpenAI::Internal::Type::BaseModel + # @!attribute allowed_tools + # The MCP tools the agent may call, or null when all server tools are allowed. + # + # @return [Array, nil] + required :allowed_tools, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute connection_origin + # Where outbound MCP HTTP connections originate. + # + # @return [Symbol, OpenAI::Models::Beta::PersistedAgentTool::Mcp::ConnectionOrigin] + required :connection_origin, enum: -> { OpenAI::Beta::PersistedAgentTool::Mcp::ConnectionOrigin } + + # @!attribute credential_id + # The vault credential selected for this MCP server, if any. + # + # @return [String, nil] + required :credential_id, String, nil?: true + + # @!attribute request_metadata + # Metadata included with requests to this MCP server. + # + # @return [Hash{Symbol=>Object}] + required :request_metadata, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown] + + # @!attribute required + # Whether this MCP server must initialize before the first turn. + # + # @return [Boolean] + required :required, OpenAI::Internal::Type::Boolean + + # @!attribute server_label + # A label used to identify the MCP server in tool calls. + # + # @return [String] + required :server_label, String + + # @!attribute transport + # The credential-free transport used to connect to the MCP server. + # + # @return [OpenAI::Models::Beta::PersistedMcpTransport::HTTP, OpenAI::Models::Beta::PersistedMcpTransport::Stdio] + required :transport, union: -> { OpenAI::Beta::PersistedMcpTransport } + + # @!attribute type + # The type of the object. Always `mcp`. + # + # @return [Symbol, :mcp] + required :type, const: :mcp + + # @!method initialize(allowed_tools:, connection_origin:, credential_id:, request_metadata:, required:, server_label:, transport:, type: :mcp) + # Tools provided by a remote MCP server without stored credentials. + # + # @param allowed_tools [Array, nil] + # The MCP tools the agent may call, or null when all server tools are allowed. + # + # @param connection_origin [Symbol, OpenAI::Models::Beta::PersistedAgentTool::Mcp::ConnectionOrigin] + # Where outbound MCP HTTP connections originate. + # + # @param credential_id [String, nil] + # The vault credential selected for this MCP server, if any. + # + # @param request_metadata [Hash{Symbol=>Object}] + # Metadata included with requests to this MCP server. + # + # @param required [Boolean] + # Whether this MCP server must initialize before the first turn. + # + # @param server_label [String] + # A label used to identify the MCP server in tool calls. + # + # @param transport [OpenAI::Models::Beta::PersistedMcpTransport::HTTP, OpenAI::Models::Beta::PersistedMcpTransport::Stdio] + # The credential-free transport used to connect to the MCP server. + # + # @param type [Symbol, :mcp] + # The type of the object. Always `mcp`. + + # Where outbound MCP HTTP connections originate. + # + # @see OpenAI::Models::Beta::PersistedAgentTool::Mcp#connection_origin + module ConnectionOrigin + extend OpenAI::Internal::Type::Enum + + SERVICE = :service + ENVIRONMENT = :environment + + # @!method self.values + # @return [Array] + end + end + + class WebSearch < OpenAI::Internal::Type::BaseModel + # @!attribute allowed_domains + # Allowed search domains, or `null` when the search is unrestricted. + # + # @return [Array, nil] + required :allowed_domains, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute context_size + # The amount of search context made available to the model. Defaults to `medium`. + # + # @return [Symbol, OpenAI::Models::Beta::PersistedAgentTool::WebSearch::ContextSize] + required :context_size, enum: -> { OpenAI::Beta::PersistedAgentTool::WebSearch::ContextSize } + + # @!attribute location + # Approximate user location used to localize web search results. + # + # @return [OpenAI::Models::Beta::PersistedAgentTool::WebSearch::Location, nil] + required :location, -> { OpenAI::Beta::PersistedAgentTool::WebSearch::Location }, nil?: true + + # @!attribute mode + # The source used for web search results. + # + # @return [Symbol, OpenAI::Models::Beta::PersistedAgentTool::WebSearch::Mode] + required :mode, enum: -> { OpenAI::Beta::PersistedAgentTool::WebSearch::Mode } + + # @!attribute type + # The type of the object. Always `web_search`. + # + # @return [Symbol, :web_search] + required :type, const: :web_search + + # @!method initialize(allowed_domains:, context_size:, location:, mode:, type: :web_search) + # Web search. + # + # @param allowed_domains [Array, nil] + # Allowed search domains, or `null` when the search is unrestricted. + # + # @param context_size [Symbol, OpenAI::Models::Beta::PersistedAgentTool::WebSearch::ContextSize] + # The amount of search context made available to the model. Defaults to `medium`. + # + # @param location [OpenAI::Models::Beta::PersistedAgentTool::WebSearch::Location, nil] + # Approximate user location used to localize web search results. + # + # @param mode [Symbol, OpenAI::Models::Beta::PersistedAgentTool::WebSearch::Mode] + # The source used for web search results. + # + # @param type [Symbol, :web_search] + # The type of the object. Always `web_search`. + + # The amount of search context made available to the model. Defaults to `medium`. + # + # @see OpenAI::Models::Beta::PersistedAgentTool::WebSearch#context_size + module ContextSize + extend OpenAI::Internal::Type::Enum + + LOW = :low + MEDIUM = :medium + HIGH = :high + + # @!method self.values + # @return [Array] + end + + # @see OpenAI::Models::Beta::PersistedAgentTool::WebSearch#location + class Location < OpenAI::Internal::Type::BaseModel + # @!attribute city + # The city name. + # + # @return [String, nil] + required :city, String, nil?: true + + # @!attribute country + # The two-letter ISO country code, such as `US`. + # + # @return [String, nil] + required :country, String, nil?: true + + # @!attribute region + # The region or state name. + # + # @return [String, nil] + required :region, String, nil?: true + + # @!attribute timezone + # The IANA timezone, such as `America/Los_Angeles`. + # + # @return [String, nil] + required :timezone, String, nil?: true + + # @!method initialize(city:, country:, region:, timezone:) + # Approximate user location used to localize web search results. + # + # @param city [String, nil] + # The city name. + # + # @param country [String, nil] + # The two-letter ISO country code, such as `US`. + # + # @param region [String, nil] + # The region or state name. + # + # @param timezone [String, nil] + # The IANA timezone, such as `America/Los_Angeles`. + end + + # The source used for web search results. + # + # @see OpenAI::Models::Beta::PersistedAgentTool::WebSearch#mode + module Mode + extend OpenAI::Internal::Type::Enum + + DISABLED = :disabled + CACHED = :cached + LIVE = :live + + # @!method self.values + # @return [Array] + end + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::PersistedAgentTool::Function, OpenAI::Models::Beta::PersistedAgentTool::ToolSearch, OpenAI::Models::Beta::PersistedAgentTool::ProgrammaticToolCalling, OpenAI::Models::Beta::PersistedAgentTool::Mcp, OpenAI::Models::Beta::PersistedAgentTool::WebSearch)] + end + end + end +end diff --git a/lib/openai/models/beta/persisted_agent_tool_param.rb b/lib/openai/models/beta/persisted_agent_tool_param.rb new file mode 100644 index 000000000..5d357d05b --- /dev/null +++ b/lib/openai/models/beta/persisted_agent_tool_param.rb @@ -0,0 +1,355 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # A tool that can be stored on a reusable agent without session credentials. + module PersistedAgentToolParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A function defined by the application. + variant :function, -> { OpenAI::Beta::PersistedAgentToolParam::Function } + + # Discovers deferred function tools and loads them into the model context. + variant :tool_search, -> { OpenAI::Beta::PersistedAgentToolParam::ToolSearch } + + # Enables calling tools from model-generated code. + variant :programmatic_tool_calling, -> { OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling } + + # Tools provided by a remote MCP server without stored credentials. + variant :mcp, -> { OpenAI::Beta::PersistedAgentToolParam::Mcp } + + # Web search. + variant :web_search, -> { OpenAI::Beta::PersistedAgentToolParam::WebSearch } + + class Function < OpenAI::Internal::Type::BaseModel + # @!attribute description + # A description of what the function does. + # + # @return [String] + required :description, String + + # @!attribute name + # The name of the function. + # + # @return [String] + required :name, String + + # @!attribute parameters + # A JSON Schema object describing the function's arguments. + # + # @return [Hash{Symbol=>Object}] + required :parameters, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown] + + # @!attribute type + # The type of the object. Always `function`. + # + # @return [Symbol, :function] + required :type, const: :function + + # @!attribute defer_loading + # Whether this function is deferred and discovered through tool search. Defaults + # to `false`. + # + # @return [Boolean, nil] + optional :defer_loading, OpenAI::Internal::Type::Boolean + + # @!method initialize(description:, name:, parameters:, defer_loading: nil, type: :function) + # A function defined by the application. + # + # @param description [String] + # A description of what the function does. + # + # @param name [String] + # The name of the function. + # + # @param parameters [Hash{Symbol=>Object}] + # A JSON Schema object describing the function's arguments. + # + # @param defer_loading [Boolean] + # Whether this function is deferred and discovered through tool search. Defaults + # to `false`. + # + # @param type [Symbol, :function] + # The type of the object. Always `function`. + end + + class ToolSearch < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `tool_search`. + # + # @return [Symbol, :tool_search] + required :type, const: :tool_search + + # @!method initialize(type: :tool_search) + # Discovers deferred function tools and loads them into the model context. + # + # @param type [Symbol, :tool_search] + # The type of the object. Always `tool_search`. + end + + class ProgrammaticToolCalling < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `programmatic_tool_calling`. + # + # @return [Symbol, :programmatic_tool_calling] + required :type, const: :programmatic_tool_calling + + # @!attribute enabled + # Whether tools can be called from model-generated code. Defaults to `true`. + # + # @return [Boolean, nil] + optional :enabled, OpenAI::Internal::Type::Boolean + + # @!method initialize(enabled: nil, type: :programmatic_tool_calling) + # Enables calling tools from model-generated code. + # + # @param enabled [Boolean] + # Whether tools can be called from model-generated code. Defaults to `true`. + # + # @param type [Symbol, :programmatic_tool_calling] + # The type of the object. Always `programmatic_tool_calling`. + end + + class Mcp < OpenAI::Internal::Type::BaseModel + # @!attribute server_label + # A label used to identify the MCP server in tool calls. + # + # @return [String] + required :server_label, String + + # @!attribute transport + # The credential-free transport used to connect to the MCP server. + # + # @return [OpenAI::Models::Beta::PersistedMcpTransportParam::HTTP, OpenAI::Models::Beta::PersistedMcpTransportParam::Stdio] + required :transport, union: -> { OpenAI::Beta::PersistedMcpTransportParam } + + # @!attribute type + # The type of the object. Always `mcp`. + # + # @return [Symbol, :mcp] + required :type, const: :mcp + + # @!attribute allowed_tools + # The MCP tools the agent may call. All server tools are allowed when omitted. + # + # @return [Array, nil] + optional :allowed_tools, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute connection_origin + # Where outbound MCP HTTP connections originate. + # + # @return [Symbol, OpenAI::Models::Beta::PersistedAgentToolParam::Mcp::ConnectionOrigin, nil] + optional( + :connection_origin, + enum: -> { OpenAI::Beta::PersistedAgentToolParam::Mcp::ConnectionOrigin }, + nil?: true + ) + + # @!attribute credential_id + # The vault credential selected for this MCP server. Optional when exactly one + # attached credential matches the server URL. + # + # @return [String, nil] + optional :credential_id, String, nil?: true + + # @!attribute request_metadata + # Metadata included with requests to this MCP server. + # + # @return [Hash{Symbol=>Object}, nil] + optional( + :request_metadata, + OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown], + nil?: true + ) + + # @!attribute required + # Whether this MCP server must initialize before the first turn. Defaults to + # `false`. + # + # @return [Boolean, nil] + optional :required, OpenAI::Internal::Type::Boolean + + # @!method initialize(server_label:, transport:, allowed_tools: nil, connection_origin: nil, credential_id: nil, request_metadata: nil, required: nil, type: :mcp) + # Tools provided by a remote MCP server without stored credentials. + # + # @param server_label [String] + # A label used to identify the MCP server in tool calls. + # + # @param transport [OpenAI::Models::Beta::PersistedMcpTransportParam::HTTP, OpenAI::Models::Beta::PersistedMcpTransportParam::Stdio] + # The credential-free transport used to connect to the MCP server. + # + # @param allowed_tools [Array, nil] + # The MCP tools the agent may call. All server tools are allowed when omitted. + # + # @param connection_origin [Symbol, OpenAI::Models::Beta::PersistedAgentToolParam::Mcp::ConnectionOrigin, nil] + # Where outbound MCP HTTP connections originate. + # + # @param credential_id [String, nil] + # The vault credential selected for this MCP server. Optional when exactly one + # attached credential matches the server URL. + # + # @param request_metadata [Hash{Symbol=>Object}, nil] + # Metadata included with requests to this MCP server. + # + # @param required [Boolean] + # Whether this MCP server must initialize before the first turn. Defaults to + # `false`. + # + # @param type [Symbol, :mcp] + # The type of the object. Always `mcp`. + + # Where outbound MCP HTTP connections originate. + # + # @see OpenAI::Models::Beta::PersistedAgentToolParam::Mcp#connection_origin + module ConnectionOrigin + extend OpenAI::Internal::Type::Enum + + # Uses the Managed Agents service network. + SERVICE = :service + + # Uses the session's execution environment. + ENVIRONMENT = :environment + + # @!method self.values + # @return [Array] + end + end + + class WebSearch < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `web_search`. + # + # @return [Symbol, :web_search] + required :type, const: :web_search + + # @!attribute allowed_domains + # Domains the search may include. + # + # @return [Array, nil] + optional :allowed_domains, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute context_size + # The amount of web search context made available to the model. + # + # @return [Symbol, OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::ContextSize, nil] + optional( + :context_size, + enum: -> { OpenAI::Beta::PersistedAgentToolParam::WebSearch::ContextSize }, + nil?: true + ) + + # @!attribute location + # Approximate user location used to localize web search results. + # + # @return [OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::Location, nil] + optional :location, -> { OpenAI::Beta::PersistedAgentToolParam::WebSearch::Location }, nil?: true + + # @!attribute mode + # The source used for web search results. + # + # @return [Symbol, OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::Mode, nil] + optional :mode, enum: -> { OpenAI::Beta::PersistedAgentToolParam::WebSearch::Mode }, nil?: true + + # @!method initialize(allowed_domains: nil, context_size: nil, location: nil, mode: nil, type: :web_search) + # Web search. + # + # @param allowed_domains [Array, nil] + # Domains the search may include. + # + # @param context_size [Symbol, OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::ContextSize, nil] + # The amount of web search context made available to the model. + # + # @param location [OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::Location, nil] + # Approximate user location used to localize web search results. + # + # @param mode [Symbol, OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::Mode, nil] + # The source used for web search results. + # + # @param type [Symbol, :web_search] + # The type of the object. Always `web_search`. + + # The amount of web search context made available to the model. + # + # @see OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch#context_size + module ContextSize + extend OpenAI::Internal::Type::Enum + + LOW = :low + MEDIUM = :medium + HIGH = :high + + # @!method self.values + # @return [Array] + end + + # @see OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch#location + class Location < OpenAI::Internal::Type::BaseModel + # @!attribute city + # The city name. + # + # @return [String, nil] + optional :city, String, nil?: true + + # @!attribute country + # The two-letter ISO country code, such as `US`. + # + # @return [String, nil] + optional :country, String, nil?: true + + # @!attribute region + # The region or state name. + # + # @return [String, nil] + optional :region, String, nil?: true + + # @!attribute timezone + # The IANA timezone, such as `America/Los_Angeles`. + # + # @return [String, nil] + optional :timezone, String, nil?: true + + # @!method initialize(city: nil, country: nil, region: nil, timezone: nil) + # Approximate user location used to localize web search results. + # + # @param city [String, nil] + # The city name. + # + # @param country [String, nil] + # The two-letter ISO country code, such as `US`. + # + # @param region [String, nil] + # The region or state name. + # + # @param timezone [String, nil] + # The IANA timezone, such as `America/Los_Angeles`. + end + + # The source used for web search results. + # + # @see OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch#mode + module Mode + extend OpenAI::Internal::Type::Enum + + # Disables web search. + DISABLED = :disabled + + # Uses cached search results. + CACHED = :cached + + # Searches the live web. + LIVE = :live + + # @!method self.values + # @return [Array] + end + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::PersistedAgentToolParam::Function, OpenAI::Models::Beta::PersistedAgentToolParam::ToolSearch, OpenAI::Models::Beta::PersistedAgentToolParam::ProgrammaticToolCalling, OpenAI::Models::Beta::PersistedAgentToolParam::Mcp, OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch)] + end + end + end +end diff --git a/lib/openai/models/beta/persisted_mcp_transport.rb b/lib/openai/models/beta/persisted_mcp_transport.rb new file mode 100644 index 000000000..2088ca5b2 --- /dev/null +++ b/lib/openai/models/beta/persisted_mcp_transport.rb @@ -0,0 +1,105 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # A credential-free transport used to connect to an MCP server. + module PersistedMcpTransport + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Connects to an MCP server over HTTP. + variant :http, -> { OpenAI::Beta::PersistedMcpTransport::HTTP } + + # Starts an MCP server as a local process. + variant :stdio, -> { OpenAI::Beta::PersistedMcpTransport::Stdio } + + class HTTP < OpenAI::Internal::Type::BaseModel + # @!attribute headers + # Non-secret HTTP headers sent to the MCP server. + # + # @return [Hash{Symbol=>String}] + required :headers, OpenAI::Internal::Type::HashOf[String] + + # @!attribute server_url + # The URL of the MCP server. + # + # @return [String] + required :server_url, String + + # @!attribute type + # The type of the object. Always `http`. + # + # @return [Symbol, :http] + required :type, const: :http + + # @!method initialize(headers:, server_url:, type: :http) + # Connects to an MCP server over HTTP. + # + # @param headers [Hash{Symbol=>String}] + # Non-secret HTTP headers sent to the MCP server. + # + # @param server_url [String] + # The URL of the MCP server. + # + # @param type [Symbol, :http] + # The type of the object. Always `http`. + end + + class Stdio < OpenAI::Internal::Type::BaseModel + # @!attribute args + # Arguments passed to the MCP server command. + # + # @return [Array] + required :args, OpenAI::Internal::Type::ArrayOf[String] + + # @!attribute command + # The command used to start the MCP server. + # + # @return [String] + required :command, String + + # @!attribute cwd + # The working directory used to start the MCP server. + # + # @return [String] + required :cwd, String + + # @!attribute env_vars + # Environment variable names inherited from the execution environment. + # + # @return [Array] + required :env_vars, OpenAI::Internal::Type::ArrayOf[String] + + # @!attribute type + # The type of the object. Always `stdio`. + # + # @return [Symbol, :stdio] + required :type, const: :stdio + + # @!method initialize(args:, command:, cwd:, env_vars:, type: :stdio) + # Starts an MCP server as a local process. + # + # @param args [Array] + # Arguments passed to the MCP server command. + # + # @param command [String] + # The command used to start the MCP server. + # + # @param cwd [String] + # The working directory used to start the MCP server. + # + # @param env_vars [Array] + # Environment variable names inherited from the execution environment. + # + # @param type [Symbol, :stdio] + # The type of the object. Always `stdio`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::PersistedMcpTransport::HTTP, OpenAI::Models::Beta::PersistedMcpTransport::Stdio)] + end + end + end +end diff --git a/lib/openai/models/beta/persisted_mcp_transport_param.rb b/lib/openai/models/beta/persisted_mcp_transport_param.rb new file mode 100644 index 000000000..89fab1375 --- /dev/null +++ b/lib/openai/models/beta/persisted_mcp_transport_param.rb @@ -0,0 +1,105 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # A credential-free transport used to connect to an MCP server. + module PersistedMcpTransportParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Connects to an MCP server over HTTP. + variant :http, -> { OpenAI::Beta::PersistedMcpTransportParam::HTTP } + + # Starts an MCP server as a local process. + variant :stdio, -> { OpenAI::Beta::PersistedMcpTransportParam::Stdio } + + class HTTP < OpenAI::Internal::Type::BaseModel + # @!attribute server_url + # The URL of the MCP server. + # + # @return [String] + required :server_url, String + + # @!attribute type + # The type of the object. Always `http`. + # + # @return [Symbol, :http] + required :type, const: :http + + # @!attribute headers + # Non-secret HTTP headers sent to the MCP server. + # + # @return [Hash{Symbol=>String}, nil] + optional :headers, OpenAI::Internal::Type::HashOf[String], nil?: true + + # @!method initialize(server_url:, headers: nil, type: :http) + # Connects to an MCP server over HTTP. + # + # @param server_url [String] + # The URL of the MCP server. + # + # @param headers [Hash{Symbol=>String}, nil] + # Non-secret HTTP headers sent to the MCP server. + # + # @param type [Symbol, :http] + # The type of the object. Always `http`. + end + + class Stdio < OpenAI::Internal::Type::BaseModel + # @!attribute command + # The command used to start the MCP server. + # + # @return [String] + required :command, String + + # @!attribute cwd + # The working directory used to start the MCP server. + # + # @return [String] + required :cwd, String + + # @!attribute type + # The type of the object. Always `stdio`. + # + # @return [Symbol, :stdio] + required :type, const: :stdio + + # @!attribute args + # Arguments passed to the MCP server command. + # + # @return [Array, nil] + optional :args, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute env_vars + # Environment variable names to inherit from the selected execution environment. + # + # @return [Array, nil] + optional :env_vars, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!method initialize(command:, cwd:, args: nil, env_vars: nil, type: :stdio) + # Starts an MCP server as a local process. + # + # @param command [String] + # The command used to start the MCP server. + # + # @param cwd [String] + # The working directory used to start the MCP server. + # + # @param args [Array, nil] + # Arguments passed to the MCP server command. + # + # @param env_vars [Array, nil] + # Environment variable names to inherit from the selected execution environment. + # + # @param type [Symbol, :stdio] + # The type of the object. Always `stdio`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::PersistedMcpTransportParam::HTTP, OpenAI::Models::Beta::PersistedMcpTransportParam::Stdio)] + end + end + end +end diff --git a/lib/openai/models/beta/session_error.rb b/lib/openai/models/beta/session_error.rb new file mode 100644 index 000000000..8b1093575 --- /dev/null +++ b/lib/openai/models/beta/session_error.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class SessionError < OpenAI::Internal::Type::BaseModel + # @!attribute code + # The machine-readable error code, if any. + # + # @return [String, nil] + required :code, String, nil?: true + + # @!attribute message + # A customer-safe explanation of the error. + # + # @return [String] + required :message, String + + # @!attribute param + # The request parameter associated with the error, if any. + # + # @return [String, nil] + required :param, String, nil?: true + + # @!attribute type + # The error type. + # + # @return [String] + required :type, String + + # @!method initialize(code:, message:, param:, type:) + # An error payload with the same public fields as Responses API streaming errors. + # + # @param code [String, nil] + # The machine-readable error code, if any. + # + # @param message [String] + # A customer-safe explanation of the error. + # + # @param param [String, nil] + # The request parameter associated with the error, if any. + # + # @param type [String] + # The error type. + end + end + end +end diff --git a/lib/openai/models/beta/session_turn_error.rb b/lib/openai/models/beta/session_turn_error.rb new file mode 100644 index 000000000..e2baca589 --- /dev/null +++ b/lib/openai/models/beta/session_turn_error.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class SessionTurnError < OpenAI::Internal::Type::BaseModel + # @!attribute code + # A stable, machine-readable failure category. + # + # @return [Symbol, OpenAI::Models::Beta::SessionTurnError::Code] + required :code, enum: -> { OpenAI::Beta::SessionTurnError::Code } + + # @!attribute message + # A customer-safe explanation of the failure. + # + # @return [String] + required :message, String + + # @!method initialize(code:, message:) + # A customer-safe error describing why a session request failed. + # + # @param code [Symbol, OpenAI::Models::Beta::SessionTurnError::Code] + # A stable, machine-readable failure category. + # + # @param message [String] + # A customer-safe explanation of the failure. + + # A stable, machine-readable failure category. + # + # @see OpenAI::Models::Beta::SessionTurnError#code + module Code + extend OpenAI::Internal::Type::Enum + + # The request exceeds the model's context window. + CONTEXT_LENGTH_EXCEEDED = :context_length_exceeded + + # The session has reached its usage budget. + SESSION_BUDGET_EXCEEDED = :session_budget_exceeded + + # The organization has reached a usage, plan, or billing limit. + USAGE_LIMIT_EXCEEDED = :usage_limit_exceeded + + # The request exceeds the available rate limit. + RATE_LIMIT_EXCEEDED = :rate_limit_exceeded + + # The model service is temporarily overloaded. + SERVER_OVERLOADED = :server_overloaded + + # The request was rejected by a safety policy. + CYBER_POLICY = :cyber_policy + + # The request could not connect to the model service. + CONNECTION_FAILED = :connection_failed + + # The model service encountered an unexpected error. + SERVER_ERROR = :server_error + + # The API credentials are invalid or lack the required access. + AUTHENTICATION_ERROR = :authentication_error + + # The request contains invalid input or configuration. + INVALID_REQUEST = :invalid_request + + # The requested model or resource is unavailable. + RESOURCE_NOT_FOUND = :resource_not_found + + # The request could not complete in its execution environment. + SANDBOX_ERROR = :sandbox_error + + # The executor must be upgraded before it can run this turn. + EXECUTOR_VERSION_INCOMPATIBLE = :executor_version_incompatible + + # The session cannot accept additional input while a request is running. + ACTIVE_TURN_NOT_STEERABLE = :active_turn_not_steerable + + # The request timed out before the model service responded. + REQUEST_TIMEOUT = :request_timeout + + # An unexpected internal error prevented the session request from completing. + INTERNAL_ERROR = :internal_error + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/setup_command_param.rb b/lib/openai/models/beta/setup_command_param.rb new file mode 100644 index 000000000..6619bffc5 --- /dev/null +++ b/lib/openai/models/beta/setup_command_param.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class SetupCommandParam < OpenAI::Internal::Type::BaseModel + # @!attribute command + # The shell command to execute. + # + # @return [String] + required :command, String + + # @!attribute cwd + # The absolute working directory. Defaults to `/workspace`. + # + # @return [String, nil] + optional :cwd, String, nil?: true + + # @!method initialize(command:, cwd: nil) + # A confidential setup command executed before the hosted agent starts. + # + # @param command [String] + # The shell command to execute. + # + # @param cwd [String, nil] + # The absolute working directory. Defaults to `/workspace`. + end + end + end +end diff --git a/lib/openai/models/beta/subagent.rb b/lib/openai/models/beta/subagent.rb new file mode 100644 index 000000000..07495ca1c --- /dev/null +++ b/lib/openai/models/beta/subagent.rb @@ -0,0 +1,121 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class Subagent < OpenAI::Internal::Type::BaseModel + # @!attribute id + # The ID of the subagent. + # + # @return [String] + required :id, String + + # @!attribute closed_at + # The Unix timestamp, in seconds, when the subagent was closed. Null while active, + # including after resume. + # + # @return [Integer, nil] + required :closed_at, Integer, nil?: true + + # @!attribute instructions + # Initial task content, or null when unavailable. Text may contain placeholders + # for images or audio when only a preview is available. + # + # @return [Array, nil] + required( + :instructions, + -> { + OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent] + }, + nil?: true + ) + + # @!attribute name + # The runner-assigned nickname, or null when unavailable. + # + # @return [String, nil] + required :name, String, nil?: true + + # @!attribute object + # The object type. Always `agent.session.subagent`. + # + # @return [Symbol, :"agent.session.subagent"] + required :object, const: :"agent.session.subagent" + + # @!attribute opened_at + # The Unix timestamp, in seconds, when the subagent was first opened. Resuming + # does not change it. + # + # @return [Integer] + required :opened_at, Integer + + # @!attribute parent_agent_id + # The ID of the agent that created this subagent. + # + # @return [String] + required :parent_agent_id, String + + # @!attribute session_id + # The ID of the session that owns the subagent. + # + # @return [String] + required :session_id, String + + # @!attribute status + # The current status of the subagent. + # + # @return [Symbol, OpenAI::Models::Beta::Subagent::Status] + required :status, enum: -> { OpenAI::Beta::Subagent::Status } + + # @!method initialize(id:, closed_at:, instructions:, name:, opened_at:, parent_agent_id:, session_id:, status:, object: :"agent.session.subagent") + # A subagent created within a session. + # + # @param id [String] + # The ID of the subagent. + # + # @param closed_at [Integer, nil] + # The Unix timestamp, in seconds, when the subagent was closed. Null while active, + # including after resume. + # + # @param instructions [Array, nil] + # Initial task content, or null when unavailable. Text may contain placeholders + # for images or audio when only a preview is available. + # + # @param name [String, nil] + # The runner-assigned nickname, or null when unavailable. + # + # @param opened_at [Integer] + # The Unix timestamp, in seconds, when the subagent was first opened. Resuming + # does not change it. + # + # @param parent_agent_id [String] + # The ID of the agent that created this subagent. + # + # @param session_id [String] + # The ID of the session that owns the subagent. + # + # @param status [Symbol, OpenAI::Models::Beta::Subagent::Status] + # The current status of the subagent. + # + # @param object [Symbol, :"agent.session.subagent"] + # The object type. Always `agent.session.subagent`. + + # The current status of the subagent. + # + # @see OpenAI::Models::Beta::Subagent#status + module Status + extend OpenAI::Internal::Type::Enum + + # The subagent remains available, including while idle between turns. + ACTIVE = :active + + # The subagent is closed. + CLOSED = :closed + + # @!method self.values + # @return [Array] + end + end + end + end +end diff --git a/lib/openai/models/beta/summary_text.rb b/lib/openai/models/beta/summary_text.rb new file mode 100644 index 000000000..07bc8f118 --- /dev/null +++ b/lib/openai/models/beta/summary_text.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class SummaryText < OpenAI::Internal::Type::BaseModel + # @!attribute text + # The reasoning summary text. + # + # @return [String] + required :text, String + + # @!attribute type + # The content type. Always `summary_text`. + # + # @return [Symbol, :summary_text] + required :type, const: :summary_text + + # @!method initialize(text:, type: :summary_text) + # A reasoning summary content part. + # + # @param text [String] + # The reasoning summary text. + # + # @param type [Symbol, :summary_text] + # The content type. Always `summary_text`. + end + end + end +end diff --git a/lib/openai/models/beta/text_format.rb b/lib/openai/models/beta/text_format.rb new file mode 100644 index 000000000..7ee1afa59 --- /dev/null +++ b/lib/openai/models/beta/text_format.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # The effective output format for generated text. + module TextFormat + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Generates ordinary text without a structured-output constraint. + variant :text, -> { OpenAI::Beta::TextFormat::Text } + + # Constrains generated text to a JSON Schema. + variant :json_schema, -> { OpenAI::Beta::TextFormat::JSONSchema } + + class Text < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `text`. + # + # @return [Symbol, :text] + required :type, const: :text + + # @!method initialize(type: :text) + # Generates ordinary text without a structured-output constraint. + # + # @param type [Symbol, :text] + # The type of the object. Always `text`. + end + + class JSONSchema < OpenAI::Internal::Type::BaseModel + # @!attribute schema + # The JSON Schema that generated text must match. + # + # @return [Hash{Symbol=>Object}] + required :schema, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown] + + # @!attribute type + # The type of the object. Always `json_schema`. + # + # @return [Symbol, :json_schema] + required :type, const: :json_schema + + # @!method initialize(schema:, type: :json_schema) + # Constrains generated text to a JSON Schema. + # + # @param schema [Hash{Symbol=>Object}] + # The JSON Schema that generated text must match. + # + # @param type [Symbol, :json_schema] + # The type of the object. Always `json_schema`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::TextFormat::Text, OpenAI::Models::Beta::TextFormat::JSONSchema)] + end + end + end +end diff --git a/lib/openai/models/beta/text_format_param.rb b/lib/openai/models/beta/text_format_param.rb new file mode 100644 index 000000000..d3985a894 --- /dev/null +++ b/lib/openai/models/beta/text_format_param.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # The output format for generated text. + module TextFormatParam + extend OpenAI::Internal::Type::Union + + discriminator :type + + # Generates ordinary text without a structured-output constraint. + variant :text, -> { OpenAI::Beta::TextFormatParam::Text } + + # Constrains generated text to a JSON Schema. + variant :json_schema, -> { OpenAI::Beta::TextFormatParam::JSONSchema } + + class Text < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `text`. + # + # @return [Symbol, :text] + required :type, const: :text + + # @!method initialize(type: :text) + # Generates ordinary text without a structured-output constraint. + # + # @param type [Symbol, :text] + # The type of the object. Always `text`. + end + + class JSONSchema < OpenAI::Internal::Type::BaseModel + # @!attribute schema + # The JSON Schema that generated text must match. + # + # @return [Hash{Symbol=>Object}] + required :schema, OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown] + + # @!attribute type + # The type of the object. Always `json_schema`. + # + # @return [Symbol, :json_schema] + required :type, const: :json_schema + + # @!method initialize(schema:, type: :json_schema) + # Constrains generated text to a JSON Schema. + # + # @param schema [Hash{Symbol=>Object}] + # The JSON Schema that generated text must match. + # + # @param type [Symbol, :json_schema] + # The type of the object. Always `json_schema`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::TextFormatParam::Text, OpenAI::Models::Beta::TextFormatParam::JSONSchema)] + end + end + end +end diff --git a/lib/openai/models/beta/token_usage.rb b/lib/openai/models/beta/token_usage.rb new file mode 100644 index 000000000..c7da9bd39 --- /dev/null +++ b/lib/openai/models/beta/token_usage.rb @@ -0,0 +1,87 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + class TokenUsage < OpenAI::Internal::Type::BaseModel + # @!attribute input_tokens + # The number of input tokens used by the agent. + # + # @return [Integer] + required :input_tokens, Integer + + # @!attribute input_tokens_details + # A breakdown of the agent's input token usage. + # + # @return [OpenAI::Models::Beta::TokenUsage::InputTokensDetails] + required :input_tokens_details, -> { OpenAI::Beta::TokenUsage::InputTokensDetails } + + # @!attribute output_tokens + # The number of output tokens generated by the agent. + # + # @return [Integer] + required :output_tokens, Integer + + # @!attribute output_tokens_details + # A breakdown of the agent's output token usage. + # + # @return [OpenAI::Models::Beta::TokenUsage::OutputTokensDetails] + required :output_tokens_details, -> { OpenAI::Beta::TokenUsage::OutputTokensDetails } + + # @!attribute total_tokens + # The total number of input and output tokens used by the agent. + # + # @return [Integer] + required :total_tokens, Integer + + # @!method initialize(input_tokens:, input_tokens_details:, output_tokens:, output_tokens_details:, total_tokens:) + # Recorded token usage for a session or turn. Usage is best effort and may change. + # + # @param input_tokens [Integer] + # The number of input tokens used by the agent. + # + # @param input_tokens_details [OpenAI::Models::Beta::TokenUsage::InputTokensDetails] + # A breakdown of the agent's input token usage. + # + # @param output_tokens [Integer] + # The number of output tokens generated by the agent. + # + # @param output_tokens_details [OpenAI::Models::Beta::TokenUsage::OutputTokensDetails] + # A breakdown of the agent's output token usage. + # + # @param total_tokens [Integer] + # The total number of input and output tokens used by the agent. + + # @see OpenAI::Models::Beta::TokenUsage#input_tokens_details + class InputTokensDetails < OpenAI::Internal::Type::BaseModel + # @!attribute cached_tokens + # The number of input tokens retrieved from the prompt cache. + # + # @return [Integer] + required :cached_tokens, Integer + + # @!method initialize(cached_tokens:) + # A breakdown of the agent's input token usage. + # + # @param cached_tokens [Integer] + # The number of input tokens retrieved from the prompt cache. + end + + # @see OpenAI::Models::Beta::TokenUsage#output_tokens_details + class OutputTokensDetails < OpenAI::Internal::Type::BaseModel + # @!attribute reasoning_tokens + # The number of output tokens used for reasoning. + # + # @return [Integer] + required :reasoning_tokens, Integer + + # @!method initialize(reasoning_tokens:) + # A breakdown of the agent's output token usage. + # + # @param reasoning_tokens [Integer] + # The number of output tokens used for reasoning. + end + end + end + end +end diff --git a/lib/openai/models/beta/web_search_action.rb b/lib/openai/models/beta/web_search_action.rb new file mode 100644 index 000000000..a12d06006 --- /dev/null +++ b/lib/openai/models/beta/web_search_action.rb @@ -0,0 +1,130 @@ +# frozen_string_literal: true + +module OpenAI + module Models + module Beta + # An action performed by the web search tool. + module WebSearchAction + extend OpenAI::Internal::Type::Union + + discriminator :type + + # A search query or group of search queries. + variant :search, -> { OpenAI::Beta::WebSearchAction::Search } + + # Opens a web page. + variant :open_page, -> { OpenAI::Beta::WebSearchAction::OpenPage } + + # Finds text within a web page. + variant :find_in_page, -> { OpenAI::Beta::WebSearchAction::FindInPage } + + # Another web search action. + variant :other, -> { OpenAI::Beta::WebSearchAction::Other } + + class Search < OpenAI::Internal::Type::BaseModel + # @!attribute queries + # The search queries, when multiple queries were used. + # + # @return [Array, nil] + required :queries, OpenAI::Internal::Type::ArrayOf[String], nil?: true + + # @!attribute query + # The search query, when a single query was used. + # + # @return [String, nil] + required :query, String, nil?: true + + # @!attribute type + # The type of the object. Always `search`. + # + # @return [Symbol, :search] + required :type, const: :search + + # @!method initialize(queries:, query:, type: :search) + # A search query or group of search queries. + # + # @param queries [Array, nil] + # The search queries, when multiple queries were used. + # + # @param query [String, nil] + # The search query, when a single query was used. + # + # @param type [Symbol, :search] + # The type of the object. Always `search`. + end + + class OpenPage < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `open_page`. + # + # @return [Symbol, :open_page] + required :type, const: :open_page + + # @!attribute url + # The URL of the page that was opened. + # + # @return [String, nil] + required :url, String, nil?: true + + # @!method initialize(url:, type: :open_page) + # Opens a web page. + # + # @param url [String, nil] + # The URL of the page that was opened. + # + # @param type [Symbol, :open_page] + # The type of the object. Always `open_page`. + end + + class FindInPage < OpenAI::Internal::Type::BaseModel + # @!attribute pattern + # The text pattern that was searched for. + # + # @return [String, nil] + required :pattern, String, nil?: true + + # @!attribute type + # The type of the object. Always `find_in_page`. + # + # @return [Symbol, :find_in_page] + required :type, const: :find_in_page + + # @!attribute url + # The URL of the page that was searched. + # + # @return [String, nil] + required :url, String, nil?: true + + # @!method initialize(pattern:, url:, type: :find_in_page) + # Finds text within a web page. + # + # @param pattern [String, nil] + # The text pattern that was searched for. + # + # @param url [String, nil] + # The URL of the page that was searched. + # + # @param type [Symbol, :find_in_page] + # The type of the object. Always `find_in_page`. + end + + class Other < OpenAI::Internal::Type::BaseModel + # @!attribute type + # The type of the object. Always `other`. + # + # @return [Symbol, :other] + required :type, const: :other + + # @!method initialize(type: :other) + # Another web search action. + # + # @param type [Symbol, :other] + # The type of the object. Always `other`. + end + + # @!method self.variants + # @return [Array(OpenAI::Models::Beta::WebSearchAction::Search, OpenAI::Models::Beta::WebSearchAction::OpenPage, OpenAI::Models::Beta::WebSearchAction::FindInPage, OpenAI::Models::Beta::WebSearchAction::Other)] + end + end + end +end diff --git a/lib/openai/models/chat/completion_create_params.rb b/lib/openai/models/chat/completion_create_params.rb index bbc5c47ca..df826f6c5 100644 --- a/lib/openai/models/chat/completion_create_params.rb +++ b/lib/openai/models/chat/completion_create_params.rb @@ -1080,7 +1080,7 @@ module ResponseFormat # An {OpenAI::BaseModel} can be provided and implicitly converted into {OpenAI::Models::ResponseFormatJSONSchema}. # See examples for more details. # - # Learn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs). + # Learn more about [Structured Outputs](https://developers.openai.com/api/docs/guides/structured-outputs). variant -> { OpenAI::StructuredOutput::JsonSchemaConverter } # JSON object response format. An older method of generating JSON responses. diff --git a/lib/openai/resources/beta.rb b/lib/openai/resources/beta.rb index 65171368f..c30c1ae1c 100644 --- a/lib/openai/resources/beta.rb +++ b/lib/openai/resources/beta.rb @@ -3,6 +3,9 @@ module OpenAI module Resources class Beta + # @return [OpenAI::Resources::Beta::Agents] + attr_reader :agents + # @return [OpenAI::Resources::Beta::Responses] attr_reader :responses @@ -22,6 +25,7 @@ class Beta # @param client [OpenAI::Client] def initialize(client:) @client = client + @agents = OpenAI::Resources::Beta::Agents.new(client: client) @responses = OpenAI::Resources::Beta::Responses.new(client: client) @chatkit = OpenAI::Resources::Beta::ChatKit.new(client: client) @assistants = OpenAI::Resources::Beta::Assistants.new(client: client) diff --git a/lib/openai/resources/beta/agents.rb b/lib/openai/resources/beta/agents.rb new file mode 100644 index 000000000..e5d597029 --- /dev/null +++ b/lib/openai/resources/beta/agents.rb @@ -0,0 +1,213 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + # @return [OpenAI::Resources::Beta::Agents::Environments] + attr_reader :environments + + # @return [OpenAI::Resources::Beta::Agents::Vaults] + attr_reader :vaults + + # @return [OpenAI::Resources::Beta::Agents::Sessions] + attr_reader :sessions + + # Creates a reusable agent without storing credentials. See + # [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + # + # @overload create(model:, instructions: nil, metadata: nil, multi_agent: nil, name: nil, reasoning: nil, service_tier: nil, text: nil, tools: nil, request_options: {}) + # + # @param model [String] + # The model to use for the agent. The requested model name is preserved. + # + # @param instructions [String, nil] + # Additional instructions appended to the agent's default base instructions. Omit + # or set to null to add no custom instructions. + # + # @param metadata [Hash{Symbol=>String}, nil] + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + # + # @param multi_agent [OpenAI::Models::Beta::MultiAgentConfigParam, nil] + # Explicit configuration for creating and coordinating subagents. + # + # @param name [String, nil] + # A human-readable name for the agent. Omission or null leaves the agent unnamed. + # + # @param reasoning [OpenAI::Models::Beta::AgentReasoningParam, nil] + # Reasoning configuration for the agent. + # + # @param service_tier [Symbol, OpenAI::Models::Beta::AgentCreateParams::ServiceTier, nil] + # The service tier used for model requests. + # + # @param text [OpenAI::Models::Beta::AgentTextParam, nil] + # Configuration for text generated by the agent. + # + # @param tools [Array, nil] + # Tools available to the agent. Defaults to an empty list. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agent] + # + # @see OpenAI::Models::Beta::AgentCreateParams + def create(params) + parsed, options = OpenAI::Beta::AgentCreateParams.dump_request(params) + @client.request( + method: :post, + path: "agents", + body: parsed, + model: OpenAI::Beta::Agent, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Retrieves a reusable agent by ID. See + # [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + # + # @overload retrieve(agent_id, request_options: {}) + # + # @param agent_id [String] + # The ID of the reusable agent. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agent] + # + # @see OpenAI::Models::Beta::AgentRetrieveParams + def retrieve(agent_id, params = {}) + @client.request( + method: :get, + path: ["agents/%1$s", agent_id], + model: OpenAI::Beta::Agent, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **params[:request_options].to_h} + ) + end + + # Updates a reusable agent. See + # [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + # + # @overload update(agent_id, instructions: nil, metadata: nil, model: nil, multi_agent: nil, name: nil, reasoning: nil, service_tier: nil, text: nil, tools: nil, request_options: {}) + # + # @param agent_id [String] + # The ID of the reusable agent. + # + # @param instructions [String, nil] + # Additional instructions appended to the agent's default base instructions. Omit + # to leave unchanged. + # + # @param metadata [Hash{Symbol=>String}, nil] + # Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. + # + # @param model [String] + # The model to use for the agent. The requested model name is preserved. + # + # @param multi_agent [OpenAI::Models::Beta::MultiAgentConfigParam, nil] + # Explicit configuration for creating and coordinating subagents. + # + # @param name [String, nil] + # A replacement name. Omit to leave unchanged, or pass null to clear it. + # + # @param reasoning [OpenAI::Models::Beta::AgentReasoningParam, nil] + # Reasoning configuration for the agent. + # + # @param service_tier [Symbol, OpenAI::Models::Beta::AgentUpdateParams::ServiceTier, nil] + # The service tier used for model requests. + # + # @param text [OpenAI::Models::Beta::AgentTextParam, nil] + # Configuration for text generated by the agent. + # + # @param tools [Array, nil] + # Tools available to the agent. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agent] + # + # @see OpenAI::Models::Beta::AgentUpdateParams + def update(agent_id, params = {}) + parsed, options = OpenAI::Beta::AgentUpdateParams.dump_request(params) + @client.request( + method: :post, + path: ["agents/%1$s", agent_id], + body: parsed, + model: OpenAI::Beta::Agent, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Lists reusable agents in the current project. See + # [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + # + # @overload list(after: nil, limit: nil, order: nil, request_options: {}) + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer, nil] + # The maximum number of resources to return. + # + # @param order [Symbol, OpenAI::Models::Beta::AgentListParams::Order] + # The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::CursorPage] + # + # @see OpenAI::Models::Beta::AgentListParams + def list(params = {}) + parsed, options = OpenAI::Beta::AgentListParams.dump_request(params) + query = OpenAI::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: "agents", + query: query, + page: OpenAI::Internal::CursorPage, + model: OpenAI::Beta::Agent, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Deletes a reusable agent. See + # [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + # + # @overload delete(agent_id, request_options: {}) + # + # @param agent_id [String] + # The ID of the reusable agent. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::AgentDeleted] + # + # @see OpenAI::Models::Beta::AgentDeleteParams + def delete(agent_id, params = {}) + @client.request( + method: :delete, + path: ["agents/%1$s", agent_id], + model: OpenAI::Beta::AgentDeleted, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **params[:request_options].to_h} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + @environments = OpenAI::Resources::Beta::Agents::Environments.new(client: client) + @vaults = OpenAI::Resources::Beta::Agents::Vaults.new(client: client) + @sessions = OpenAI::Resources::Beta::Agents::Sessions.new(client: client) + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/environments.rb b/lib/openai/resources/beta/agents/environments.rb new file mode 100644 index 000000000..2b91d3c5f --- /dev/null +++ b/lib/openai/resources/beta/agents/environments.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Environments + # @return [OpenAI::Resources::Beta::Agents::Environments::Files] + attr_reader :files + + # @return [OpenAI::Resources::Beta::Agents::Environments::Templates] + attr_reader :templates + + # Retrieves an execution environment's connection status and safe installed + # metadata. See + # [environment lifecycle](https://developers.openai.com/api/docs/guides/agents-api/environments/lifecycle). + # + # @overload retrieve(environment_id, request_options: {}) + # + # @param environment_id [String] + # The ID of the environment. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::EnvironmentInfo] + # + # @see OpenAI::Models::Beta::Agents::EnvironmentRetrieveParams + def retrieve(environment_id, params = {}) + @client.request( + method: :get, + path: ["agents/environments/%1$s", environment_id], + model: OpenAI::Beta::Agents::EnvironmentInfo, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **params[:request_options].to_h} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + @files = OpenAI::Resources::Beta::Agents::Environments::Files.new(client: client) + @templates = OpenAI::Resources::Beta::Agents::Environments::Templates.new(client: client) + end + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/environments/files.rb b/lib/openai/resources/beta/agents/environments/files.rb new file mode 100644 index 000000000..f87638ead --- /dev/null +++ b/lib/openai/resources/beta/agents/environments/files.rb @@ -0,0 +1,89 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Environments + class Files + # Copies inline bytes or a Files API file into a connected execution environment. + # See + # [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files). + # + # @overload create(environment_id, hosted_environment_file_param:, request_options: {}) + # + # @param environment_id [String] + # The ID of the environment. + # + # @param hosted_environment_file_param [OpenAI::Models::Beta::HostedEnvironmentFileParam::FileID, OpenAI::Models::Beta::HostedEnvironmentFileParam::Inline] + # A file materialized in an OpenAI-hosted execution environment. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Environments::EnvironmentFile] + # + # @see OpenAI::Models::Beta::Agents::Environments::FileCreateParams + def create(environment_id, params) + parsed, options = OpenAI::Beta::Agents::Environments::FileCreateParams.dump_request(params) + @client.request( + method: :post, + path: ["agents/environments/%1$s/files", environment_id], + body: parsed[:hosted_environment_file_param], + model: OpenAI::Beta::Agents::Environments::EnvironmentFile, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Lists live files on a connected execution environment with optional directory + # filtering and opaque cursor pagination. See + # [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files). + # + # @overload list(environment_id, limit: nil, order: nil, page: nil, path: nil, request_options: {}) + # + # @param environment_id [String] + # The ID of the environment. + # + # @param limit [Integer, nil] + # The maximum number of files to return, between 1 and 100. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Environments::FileListParams::Order] + # Sort by case-sensitive path components. Defaults to descending. + # + # @param page [String] + # The opaque token from the previous page. Keep the same path, order, and limit. + # + # @param path [String, nil] + # Restrict the listing to this absolute workspace directory. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::TokenPage] + # + # @see OpenAI::Models::Beta::Agents::Environments::FileListParams + def list(environment_id, params = {}) + parsed, options = OpenAI::Beta::Agents::Environments::FileListParams.dump_request(params) + query = OpenAI::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: ["agents/environments/%1$s/files", environment_id], + query: query, + page: OpenAI::Internal::TokenPage, + model: OpenAI::Beta::Agents::Environments::EnvironmentFile, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/environments/templates.rb b/lib/openai/resources/beta/agents/environments/templates.rb new file mode 100644 index 000000000..4e18c81f4 --- /dev/null +++ b/lib/openai/resources/beta/agents/environments/templates.rb @@ -0,0 +1,206 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Environments + class Templates + # Creates reusable environment configuration without returning confidential setup + # commands or environment values. See + # [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + # + # @overload create(capability_directories: nil, env: nil, files: nil, name: nil, network: nil, packages: nil, plugins: nil, setup_commands: nil, skills: nil, request_options: {}) + # + # @param capability_directories [Array, nil] + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + # + # @param env [Hash{Symbol=>String}, nil] + # Environment variables made available to the agent. + # + # @param files [Array, nil] + # Files available before the agent starts. Defaults to an empty list. + # + # @param name [String, nil] + # An optional human-readable display name for the template. + # + # @param network [OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Network, nil] + # Network access for an OpenAI-hosted environment. + # + # @param packages [OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Packages, nil] + # Packages to install in an OpenAI-hosted environment. + # + # @param plugins [Array, nil] + # Plugins provided as inline ZIP archives. Defaults to an empty list. + # + # @param setup_commands [Array, nil] + # Ordered, confidential setup commands. Command bodies are never returned. + # + # @param skills [Array, nil] + # Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty + # list. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate] + # + # @see OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams + def create(params = {}) + parsed, options = OpenAI::Beta::Agents::Environments::TemplateCreateParams.dump_request(params) + @client.request( + method: :post, + path: "agents/environments/templates", + body: parsed, + model: OpenAI::Beta::Agents::Environments::EnvironmentTemplate, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Retrieves reusable environment configuration without returning confidential + # values. See + # [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + # + # @overload retrieve(environment_template_id, request_options: {}) + # + # @param environment_template_id [String] + # The ID of the reusable environment template. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate] + # + # @see OpenAI::Models::Beta::Agents::Environments::TemplateRetrieveParams + def retrieve(environment_template_id, params = {}) + @client.request( + method: :get, + path: ["agents/environments/templates/%1$s", environment_template_id], + model: OpenAI::Beta::Agents::Environments::EnvironmentTemplate, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **params[:request_options].to_h} + ) + end + + # Updates reusable environment configuration without returning confidential + # values. See + # [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + # + # @overload update(environment_template_id, capability_directories: nil, env: nil, files: nil, name: nil, network: nil, packages: nil, plugins: nil, setup_commands: nil, skills: nil, request_options: {}) + # + # @param environment_template_id [String] + # The ID of the reusable environment template. + # + # @param capability_directories [Array, nil] + # Directories that expose capabilities to the agent. + # + # @param env [Hash{Symbol=>String}, nil] + # Replacement confidential environment values. + # + # @param files [Array, nil] + # Replacement file configuration materialized for each new session. + # + # @param name [String, nil] + # A replacement human-readable display name, or `null` to clear the name. + # + # @param network [OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Network, nil] + # Network access for an OpenAI-hosted environment. + # + # @param packages [OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Packages, nil] + # Packages to install in an OpenAI-hosted environment. + # + # @param plugins [Array, nil] + # Replacement plugin configuration installed for each new session. + # + # @param setup_commands [Array, nil] + # Replacement confidential setup commands, never included in returned resources. + # + # @param skills [Array, nil] + # Replacement skill configuration installed for each new session. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate] + # + # @see OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams + def update(environment_template_id, params = {}) + parsed, options = OpenAI::Beta::Agents::Environments::TemplateUpdateParams.dump_request(params) + @client.request( + method: :post, + path: ["agents/environments/templates/%1$s", environment_template_id], + body: parsed, + model: OpenAI::Beta::Agents::Environments::EnvironmentTemplate, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Lists reusable environment templates without returning confidential values. See + # [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + # + # @overload list(after: nil, limit: nil, order: nil, request_options: {}) + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Environments::TemplateListParams::Order] + # The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::CursorPage] + # + # @see OpenAI::Models::Beta::Agents::Environments::TemplateListParams + def list(params = {}) + parsed, options = OpenAI::Beta::Agents::Environments::TemplateListParams.dump_request(params) + query = OpenAI::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: "agents/environments/templates", + query: query, + page: OpenAI::Internal::CursorPage, + model: OpenAI::Beta::Agents::Environments::EnvironmentTemplate, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Deletes reusable environment configuration and all confidential template inputs. + # See + # [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + # + # @overload delete(environment_template_id, request_options: {}) + # + # @param environment_template_id [String] + # The ID of the reusable environment template. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplateDeleted] + # + # @see OpenAI::Models::Beta::Agents::Environments::TemplateDeleteParams + def delete(environment_template_id, params = {}) + @client.request( + method: :delete, + path: ["agents/environments/templates/%1$s", environment_template_id], + model: OpenAI::Beta::Agents::Environments::EnvironmentTemplateDeleted, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **params[:request_options].to_h} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/sessions.rb b/lib/openai/resources/beta/agents/sessions.rb new file mode 100644 index 000000000..5d985b774 --- /dev/null +++ b/lib/openai/resources/beta/agents/sessions.rb @@ -0,0 +1,294 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Sessions + # @return [OpenAI::Resources::Beta::Agents::Sessions::Subagents] + attr_reader :subagents + + # @return [OpenAI::Resources::Beta::Agents::Sessions::Artifacts] + attr_reader :artifacts + + # @return [OpenAI::Resources::Beta::Agents::Sessions::Items] + attr_reader :items + + # @return [OpenAI::Resources::Beta::Agents::Sessions::Events] + attr_reader :events + + # @return [OpenAI::Resources::Beta::Agents::Sessions::Turns] + attr_reader :turns + + # See {OpenAI::Resources::Beta::Agents::Sessions#create_streaming} for streaming + # counterpart. + # + # Creates a managed agent session, optionally submits initial input, and returns + # the session or streams its events when stream is true. See + # [running sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions). + # + # @overload create(environment:, agent: nil, agent_id: nil, input: nil, metadata: nil, vault_ids: nil, request_options: {}) + # + # @param environment [OpenAI::Models::Beta::EnvironmentParam::None, OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted, OpenAI::Models::Beta::EnvironmentParam::SelfHosted] + # An inline execution environment or a reference to an environment template. + # + # @param agent [OpenAI::Models::Beta::Agents::SessionCreateParams::Agent] + # Agent configuration. With `agent_id`, supplied fields override the saved agent + # for this session. Without `agent_id`, `model` is required. + # + # @param agent_id [String] + # The ID of a saved reusable agent. Omit `agent` to use its configuration + # unchanged. + # + # @param input [String, Array, nil] + # Initial input submitted when creating a session. + # + # @param metadata [Hash{Symbol=>String}, nil] + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + # + # @param vault_ids [Array, nil] + # The IDs of vaults made available to the session. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::AgentSession] + # + # @see OpenAI::Models::Beta::Agents::SessionCreateParams + def create(params) + parsed, options = OpenAI::Beta::Agents::SessionCreateParams.dump_request(params) + if parsed[:stream] + message = "Please use `#create_streaming` for the streaming use case." + raise ArgumentError.new(message) + end + + @client.request( + method: :post, + path: "agents/sessions", + body: parsed, + model: OpenAI::Beta::AgentSession, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # See {OpenAI::Resources::Beta::Agents::Sessions#create} for non-streaming + # counterpart. + # + # Creates a managed agent session, optionally submits initial input, and returns + # the session or streams its events when stream is true. See + # [running sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions). + # + # @overload create_streaming(environment:, agent: nil, agent_id: nil, input: nil, metadata: nil, vault_ids: nil, request_options: {}) + # + # @param environment [OpenAI::Models::Beta::EnvironmentParam::None, OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted, OpenAI::Models::Beta::EnvironmentParam::SelfHosted] + # An inline execution environment or a reference to an environment template. + # + # @param agent [OpenAI::Models::Beta::Agents::SessionCreateParams::Agent] + # Agent configuration. With `agent_id`, supplied fields override the saved agent + # for this session. Without `agent_id`, `model` is required. + # + # @param agent_id [String] + # The ID of a saved reusable agent. Omit `agent` to use its configuration + # unchanged. + # + # @param input [String, Array, nil] + # Initial input submitted when creating a session. + # + # @param metadata [Hash{Symbol=>String}, nil] + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + # + # @param vault_ids [Array, nil] + # The IDs of vaults made available to the session. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::Stream] + # + # @see OpenAI::Models::Beta::Agents::SessionCreateParams + def create_streaming(params) + parsed, options = OpenAI::Beta::Agents::SessionCreateParams.dump_request(params) + unless parsed.fetch(:stream, true) + message = "Please use `#create` for the non-streaming use case." + raise ArgumentError.new(message) + end + + parsed.store(:stream, true) + @client.request( + method: :post, + path: "agents/sessions", + headers: {"accept" => "text/event-stream", "accept-encoding" => "identity"}, + body: parsed, + stream: OpenAI::Internal::Stream, + model: OpenAI::Beta::AgentSessionEvent, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Retrieves the current state of a managed agent session. See + # [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + # + # @overload retrieve(session_id, request_options: {}) + # + # @param session_id [String] + # The ID of the session. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::AgentSession] + # + # @see OpenAI::Models::Beta::Agents::SessionRetrieveParams + def retrieve(session_id, params = {}) + @client.request( + method: :get, + path: ["agents/sessions/%1$s", session_id], + model: OpenAI::Beta::AgentSession, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **params[:request_options].to_h} + ) + end + + # Updates session metadata. Omitted fields are unchanged. See + # [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + # + # @overload update(session_id, metadata: nil, request_options: {}) + # + # @param session_id [String] + # The ID of the session. + # + # @param metadata [Hash{Symbol=>String}, nil] + # Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::AgentSession] + # + # @see OpenAI::Models::Beta::Agents::SessionUpdateParams + def update(session_id, params = {}) + parsed, options = OpenAI::Beta::Agents::SessionUpdateParams.dump_request(params) + @client.request( + method: :post, + path: ["agents/sessions/%1$s", session_id], + body: parsed, + model: OpenAI::Beta::AgentSession, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Lists managed agent sessions using ID-based pagination and the requested sort + # order. See + # [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + # + # @overload list(after: nil, agent_id: nil, limit: nil, order: nil, request_options: {}) + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param agent_id [String] + # Only return sessions whose root agent has this ID. Omit to return sessions for + # all agents. + # + # @param limit [Integer, nil] + # The maximum number of resources to return. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::SessionListParams::Order] + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::CursorPage] + # + # @see OpenAI::Models::Beta::Agents::SessionListParams + def list(params = {}) + parsed, options = OpenAI::Beta::Agents::SessionListParams.dump_request(params) + query = OpenAI::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: "agents/sessions", + query: query, + page: OpenAI::Internal::CursorPage, + model: OpenAI::Beta::AgentSession, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Removes a managed agent session from the public API and returns a deletion + # confirmation. Physical cleanup may continue asynchronously. See + # [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + # + # @overload delete(session_id, request_options: {}) + # + # @param session_id [String] + # The ID of the session. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::AgentSessionDeleted] + # + # @see OpenAI::Models::Beta::Agents::SessionDeleteParams + def delete(session_id, params = {}) + @client.request( + method: :delete, + path: ["agents/sessions/%1$s", session_id], + model: OpenAI::Beta::AgentSessionDeleted, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **params[:request_options].to_h} + ) + end + + # Submit input to an idle session and stream one turn through idle or failure. + # The caller must be the session's only input writer during iteration. + # Handlers run sequentially; failures submit a generic error without exception text. + # Input and each tool result use distinct retry-safe idempotency keys. + # A block closes the connection on every exit path without cancelling the turn. + # + # @param session_id [String] + # @param input [String, Array] + # @param tool_handlers [Hash{String=>Proc}] + # @param idempotency_key [String, nil] Applies only to the input submission. + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # @yieldparam stream [OpenAI::Helpers::Agents::SessionStream] + # @return [OpenAI::Helpers::Agents::SessionStream] + def stream(session_id, input:, tool_handlers: {}, idempotency_key: nil, request_options: {}) + stream = OpenAI::Helpers::Agents::SessionStream.new( + sessions: self, + session_id: session_id, + input: input, + tool_handlers: tool_handlers, + idempotency_key: idempotency_key, + request_options: request_options + ) + return stream unless block_given? + + begin + yield stream + ensure + stream.close + end + + stream + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + @subagents = OpenAI::Resources::Beta::Agents::Sessions::Subagents.new(client: client) + @artifacts = OpenAI::Resources::Beta::Agents::Sessions::Artifacts.new(client: client) + @items = OpenAI::Resources::Beta::Agents::Sessions::Items.new(client: client) + @events = OpenAI::Resources::Beta::Agents::Sessions::Events.new(client: client) + @turns = OpenAI::Resources::Beta::Agents::Sessions::Turns.new(client: client) + end + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/sessions/artifacts.rb b/lib/openai/resources/beta/agents/sessions/artifacts.rb new file mode 100644 index 000000000..61b7bf782 --- /dev/null +++ b/lib/openai/resources/beta/agents/sessions/artifacts.rb @@ -0,0 +1,155 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Artifacts + # Retrieves immutable metadata for one durable session artifact. See + # [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + # + # @overload retrieve(artifact_id, session_id:, request_options: {}) + # + # @param artifact_id [String] + # The immutable session artifact ID. + # + # @param session_id [String] + # The ID of the session that owns the artifact. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Sessions::SessionArtifact] + # + # @see OpenAI::Models::Beta::Agents::Sessions::ArtifactRetrieveParams + def retrieve(artifact_id, params) + parsed, options = OpenAI::Beta::Agents::Sessions::ArtifactRetrieveParams.dump_request(params) + session_id = parsed.delete(:session_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + @client.request( + method: :get, + path: ["agents/sessions/%1$s/artifacts/%2$s", session_id, artifact_id], + model: OpenAI::Beta::Agents::Sessions::SessionArtifact, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Lists immutable artifacts published by completed hosted session turns. See + # [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + # + # @overload list(session_id, after: nil, environment_id: nil, limit: nil, order: nil, request_options: {}) + # + # @param session_id [String] + # The ID of the session. + # + # @param after [String, nil] + # Return artifacts after this immutable artifact ID. + # + # @param environment_id [String, nil] + # Restrict the listing to artifacts produced by this environment. + # + # @param limit [Integer, nil] + # The maximum number of artifacts to return, between 1 and 100. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::ArtifactListParams::Order] + # Sort by creation time and ID. Defaults to descending. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::CursorPage] + # + # @see OpenAI::Models::Beta::Agents::Sessions::ArtifactListParams + def list(session_id, params = {}) + parsed, options = OpenAI::Beta::Agents::Sessions::ArtifactListParams.dump_request(params) + query = OpenAI::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: ["agents/sessions/%1$s/artifacts", session_id], + query: query, + page: OpenAI::Internal::CursorPage, + model: OpenAI::Beta::Agents::Sessions::SessionArtifact, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Deletes an immutable session artifact without deleting its live environment file + # or original Files API object. See + # [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + # + # @overload delete(artifact_id, session_id:, request_options: {}) + # + # @param artifact_id [String] + # The immutable session artifact ID. + # + # @param session_id [String] + # The ID of the session that owns the artifact. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Sessions::SessionArtifactDeleted] + # + # @see OpenAI::Models::Beta::Agents::Sessions::ArtifactDeleteParams + def delete(artifact_id, params) + parsed, options = OpenAI::Beta::Agents::Sessions::ArtifactDeleteParams.dump_request(params) + session_id = parsed.delete(:session_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + @client.request( + method: :delete, + path: ["agents/sessions/%1$s/artifacts/%2$s", session_id, artifact_id], + model: OpenAI::Beta::Agents::Sessions::SessionArtifactDeleted, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Downloads immutable session artifact bytes after the execution environment + # expires. See + # [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + # + # @overload content(artifact_id, session_id:, request_options: {}) + # + # @param artifact_id [String] + # The immutable session artifact ID. + # + # @param session_id [String] + # The ID of the session that owns the artifact. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [StringIO] + # + # @see OpenAI::Models::Beta::Agents::Sessions::ArtifactContentParams + def content(artifact_id, params) + parsed, options = OpenAI::Beta::Agents::Sessions::ArtifactContentParams.dump_request(params) + session_id = parsed.delete(:session_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + @client.request( + method: :get, + path: ["agents/sessions/%1$s/artifacts/%2$s/content", session_id, artifact_id], + headers: {"accept" => "application/octet-stream"}, + model: StringIO, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/sessions/events.rb b/lib/openai/resources/beta/agents/sessions/events.rb new file mode 100644 index 000000000..5e0264fd0 --- /dev/null +++ b/lib/openai/resources/beta/agents/sessions/events.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Events + # Submits message, cancellation, or tool-result events to a managed agent session. + # See + # [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events). + # + # @overload create(session_id, events:, idempotency_key: nil, request_options: {}) + # + # @param session_id [String] + # Path param: The ID of the session. + # + # @param events [Array] + # Body param: The input events to submit to the session. + # + # @param idempotency_key [String] + # Header param: An optional client-generated key that makes retries of submitted + # messages idempotent. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [nil] + # + # @see OpenAI::Models::Beta::Agents::Sessions::EventCreateParams + def create(session_id, params) + parsed, options = OpenAI::Beta::Agents::Sessions::EventCreateParams.dump_request(params) + header_params = {idempotency_key: "idempotency-key"} + @client.request( + method: :post, + path: ["agents/sessions/%1$s/events", session_id], + headers: parsed.slice(*header_params.keys).transform_keys(header_params), + body: parsed.except(*header_params.keys), + model: NilClass, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Streams live events for an agent session. See + # [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events). + # + # @overload stream_streaming(session_id, request_options: {}) + # + # @param session_id [String] + # The ID of the session. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::Stream] + # + # @see OpenAI::Models::Beta::Agents::Sessions::EventStreamParams + def stream_streaming(session_id, params = {}) + @client.request( + method: :get, + path: ["agents/sessions/%1$s/events", session_id], + headers: {"accept" => "text/event-stream", "accept-encoding" => "identity"}, + stream: OpenAI::Internal::Stream, + model: OpenAI::Beta::AgentSessionEvent, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **params[:request_options].to_h} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/sessions/items.rb b/lib/openai/resources/beta/agents/sessions/items.rb new file mode 100644 index 000000000..00fffc8d2 --- /dev/null +++ b/lib/openai/resources/beta/agents/sessions/items.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Items + # Lists items produced by the session's root agent, including its interactions + # with subagents. Each subagent has its own item history. See + # [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability). + # + # @overload list(session_id, after: nil, limit: nil, order: nil, request_options: {}) + # + # @param session_id [String] + # The ID of the session. + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::ItemListParams::Order] + # The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::CursorPage] + # + # @see OpenAI::Models::Beta::Agents::Sessions::ItemListParams + def list(session_id, params = {}) + parsed, options = OpenAI::Beta::Agents::Sessions::ItemListParams.dump_request(params) + query = OpenAI::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: ["agents/sessions/%1$s/items", session_id], + query: query, + page: OpenAI::Internal::CursorPage, + model: OpenAI::Beta::AgentSessionItem, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/sessions/subagents.rb b/lib/openai/resources/beta/agents/sessions/subagents.rb new file mode 100644 index 000000000..d6e2694ab --- /dev/null +++ b/lib/openai/resources/beta/agents/sessions/subagents.rb @@ -0,0 +1,95 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Subagents + # @return [OpenAI::Resources::Beta::Agents::Sessions::Subagents::Items] + attr_reader :items + + # @return [OpenAI::Resources::Beta::Agents::Sessions::Subagents::Turns] + attr_reader :turns + + # Retrieves a subagent belonging to this session. See + # [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + # + # @overload retrieve(subagent_id, session_id:, request_options: {}) + # + # @param subagent_id [String] + # The ID of the subagent in this session. + # + # @param session_id [String] + # The ID of the session. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Subagent] + # + # @see OpenAI::Models::Beta::Agents::Sessions::SubagentRetrieveParams + def retrieve(subagent_id, params) + parsed, options = OpenAI::Beta::Agents::Sessions::SubagentRetrieveParams.dump_request(params) + session_id = parsed.delete(:session_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + @client.request( + method: :get, + path: ["agents/sessions/%1$s/subagents/%2$s", session_id, subagent_id], + model: OpenAI::Beta::Subagent, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Lists subagents in a session, including nested and closed subagents. See + # [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + # + # @overload list(session_id, after: nil, limit: nil, order: nil, request_options: {}) + # + # @param session_id [String] + # The ID of the session. + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::SubagentListParams::Order] + # The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::CursorPage] + # + # @see OpenAI::Models::Beta::Agents::Sessions::SubagentListParams + def list(session_id, params = {}) + parsed, options = OpenAI::Beta::Agents::Sessions::SubagentListParams.dump_request(params) + query = OpenAI::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: ["agents/sessions/%1$s/subagents", session_id], + query: query, + page: OpenAI::Internal::CursorPage, + model: OpenAI::Beta::Subagent, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + @items = OpenAI::Resources::Beta::Agents::Sessions::Subagents::Items.new(client: client) + @turns = OpenAI::Resources::Beta::Agents::Sessions::Subagents::Turns.new(client: client) + end + end + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/sessions/subagents/items.rb b/lib/openai/resources/beta/agents/sessions/subagents/items.rb new file mode 100644 index 000000000..150c30ff2 --- /dev/null +++ b/lib/openai/resources/beta/agents/sessions/subagents/items.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Subagents + class Items + # Lists this subagent's own items across all of its turns. See + # [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + # + # @overload list(subagent_id, session_id:, after: nil, limit: nil, order: nil, request_options: {}) + # + # @param subagent_id [String] + # Path param: The ID of the subagent in this session. + # + # @param session_id [String] + # Path param: The ID of the session. + # + # @param after [String] + # Query param: Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # Query param: The maximum number of resources to return, between 1 and 100. + # Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::Subagents::ItemListParams::Order] + # Query param: The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::CursorPage] + # + # @see OpenAI::Models::Beta::Agents::Sessions::Subagents::ItemListParams + def list(subagent_id, params) + parsed, options = OpenAI::Beta::Agents::Sessions::Subagents::ItemListParams.dump_request(params) + session_id = parsed.delete(:session_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + query = OpenAI::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: ["agents/sessions/%1$s/subagents/%2$s/items", session_id, subagent_id], + query: query, + page: OpenAI::Internal::CursorPage, + model: OpenAI::Beta::AgentSessionItem, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/sessions/subagents/turns.rb b/lib/openai/resources/beta/agents/sessions/subagents/turns.rb new file mode 100644 index 000000000..9eb5086bb --- /dev/null +++ b/lib/openai/resources/beta/agents/sessions/subagents/turns.rb @@ -0,0 +1,108 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Subagents + class Turns + # @return [OpenAI::Resources::Beta::Agents::Sessions::Subagents::Turns::Items] + attr_reader :items + + # Retrieves a turn belonging to this subagent. See + # [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + # + # @overload retrieve(turn_id, session_id:, subagent_id:, request_options: {}) + # + # @param turn_id [String] + # The ID of a turn belonging to this subagent. + # + # @param session_id [String] + # The ID of the session. + # + # @param subagent_id [String] + # The ID of the subagent in this session. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Sessions::Turn] + # + # @see OpenAI::Models::Beta::Agents::Sessions::Subagents::TurnRetrieveParams + def retrieve(turn_id, params) + parsed, options = OpenAI::Beta::Agents::Sessions::Subagents::TurnRetrieveParams.dump_request(params) + session_id = parsed.delete(:session_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + subagent_id = parsed.delete(:subagent_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + @client.request( + method: :get, + path: ["agents/sessions/%1$s/subagents/%2$s/turns/%3$s", session_id, subagent_id, turn_id], + model: OpenAI::Beta::Agents::Sessions::Turn, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Lists all turns of this subagent, including turns after a resume. See + # [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + # + # @overload list(subagent_id, session_id:, after: nil, limit: nil, order: nil, request_options: {}) + # + # @param subagent_id [String] + # Path param: The ID of the subagent in this session. + # + # @param session_id [String] + # Path param: The ID of the session. + # + # @param after [String] + # Query param: Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # Query param: The maximum number of resources to return, between 1 and 100. + # Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::Subagents::TurnListParams::Order] + # Query param: The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::CursorPage] + # + # @see OpenAI::Models::Beta::Agents::Sessions::Subagents::TurnListParams + def list(subagent_id, params) + parsed, options = OpenAI::Beta::Agents::Sessions::Subagents::TurnListParams.dump_request(params) + session_id = parsed.delete(:session_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + query = OpenAI::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: ["agents/sessions/%1$s/subagents/%2$s/turns", session_id, subagent_id], + query: query, + page: OpenAI::Internal::CursorPage, + model: OpenAI::Beta::Agents::Sessions::Turn, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + @items = OpenAI::Resources::Beta::Agents::Sessions::Subagents::Turns::Items.new(client: client) + end + end + end + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/sessions/subagents/turns/items.rb b/lib/openai/resources/beta/agents/sessions/subagents/turns/items.rb new file mode 100644 index 000000000..2c8c09455 --- /dev/null +++ b/lib/openai/resources/beta/agents/sessions/subagents/turns/items.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Subagents + class Turns + class Items + # Lists items belonging to one turn of this subagent. See + # [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + # + # @overload list(turn_id, session_id:, subagent_id:, after: nil, limit: nil, order: nil, request_options: {}) + # + # @param turn_id [String] + # Path param: The ID of a turn belonging to this subagent. + # + # @param session_id [String] + # Path param: The ID of the session. + # + # @param subagent_id [String] + # Path param: The ID of the subagent in this session. + # + # @param after [String] + # Query param: Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # Query param: The maximum number of resources to return, between 1 and 100. + # Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::Order] + # Query param: The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::CursorPage] + # + # @see OpenAI::Models::Beta::Agents::Sessions::Subagents::Turns::ItemListParams + def list(turn_id, params) + parsed, options = OpenAI::Beta::Agents::Sessions::Subagents::Turns::ItemListParams.dump_request( + params + ) + session_id = parsed.delete(:session_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + subagent_id = parsed.delete(:subagent_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + query = OpenAI::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: [ + "agents/sessions/%1$s/subagents/%2$s/turns/%3$s/items", + session_id, + subagent_id, + turn_id + ], + query: query, + page: OpenAI::Internal::CursorPage, + model: OpenAI::Beta::AgentSessionItem, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/sessions/turns.rb b/lib/openai/resources/beta/agents/sessions/turns.rb new file mode 100644 index 000000000..7f93a2f8e --- /dev/null +++ b/lib/openai/resources/beta/agents/sessions/turns.rb @@ -0,0 +1,89 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Turns + # Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if + # the turn does not belong to the session. See + # [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns). + # + # @overload retrieve(turn_id, session_id:, request_options: {}) + # + # @param turn_id [String] + # The ID of the turn. + # + # @param session_id [String] + # The ID of the session that owns the turn. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Sessions::Turn] + # + # @see OpenAI::Models::Beta::Agents::Sessions::TurnRetrieveParams + def retrieve(turn_id, params) + parsed, options = OpenAI::Beta::Agents::Sessions::TurnRetrieveParams.dump_request(params) + session_id = parsed.delete(:session_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + @client.request( + method: :get, + path: ["agents/sessions/%1$s/turns/%2$s", session_id, turn_id], + model: OpenAI::Beta::Agents::Sessions::Turn, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Lists turns by creation time and turn ID. The after cursor is exclusive in the + # selected order. See + # [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns). + # + # @overload list(session_id, after: nil, limit: nil, order: nil, request_options: {}) + # + # @param session_id [String] + # The ID of the session. + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer] + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Sessions::TurnListParams::Order] + # The order in which resources are returned. Defaults to `desc`. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::CursorPage] + # + # @see OpenAI::Models::Beta::Agents::Sessions::TurnListParams + def list(session_id, params = {}) + parsed, options = OpenAI::Beta::Agents::Sessions::TurnListParams.dump_request(params) + query = OpenAI::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: ["agents/sessions/%1$s/turns", session_id], + query: query, + page: OpenAI::Internal::CursorPage, + model: OpenAI::Beta::Agents::Sessions::Turn, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/vaults.rb b/lib/openai/resources/beta/agents/vaults.rb new file mode 100644 index 000000000..9520c9c7e --- /dev/null +++ b/lib/openai/resources/beta/agents/vaults.rb @@ -0,0 +1,137 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Vaults + # @return [OpenAI::Resources::Beta::Agents::Vaults::Credentials] + attr_reader :credentials + + # Creates a vault for the current project. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + # + # @overload create(metadata: nil, name: nil, request_options: {}) + # + # @param metadata [Hash{Symbol=>String}, nil] + # Key-value pairs to associate with the vault, such as an application or team + # identifier. + # + # @param name [String] + # The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after + # trimming. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Vault] + # + # @see OpenAI::Models::Beta::Agents::VaultCreateParams + def create(params = {}) + parsed, options = OpenAI::Beta::Agents::VaultCreateParams.dump_request(params) + @client.request( + method: :post, + path: "vaults", + body: parsed, + model: OpenAI::Beta::Agents::Vault, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Retrieves a vault by its ID. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + # + # @overload retrieve(vault_id, request_options: {}) + # + # @param vault_id [String] + # The ID of the vault. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Vault] + # + # @see OpenAI::Models::Beta::Agents::VaultRetrieveParams + def retrieve(vault_id, params = {}) + @client.request( + method: :get, + path: ["vaults/%1$s", vault_id], + model: OpenAI::Beta::Agents::Vault, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **params[:request_options].to_h} + ) + end + + # Lists vaults using ID-based pagination. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + # + # @overload list(after: nil, limit: nil, order: nil, status: nil, request_options: {}) + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer, nil] + # The maximum number of resources to return. Defaults to 20. Values are clamped + # between 1 and 100. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::VaultListParams::Order] + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + # + # @param status [Symbol, OpenAI::Models::Beta::Agents::VaultStatus, Array] + # Filter by one status or a list, such as `status=active` or + # `status[]=active&status[]=archived`. Both statuses are included by default. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::CursorPage] + # + # @see OpenAI::Models::Beta::Agents::VaultListParams + def list(params = {}) + parsed, options = OpenAI::Beta::Agents::VaultListParams.dump_request(params) + query = OpenAI::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: "vaults", + query: query, + page: OpenAI::Internal::CursorPage, + model: OpenAI::Beta::Agents::Vault, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Deletes a vault and all its credentials. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + # + # @overload delete(vault_id, request_options: {}) + # + # @param vault_id [String] + # The ID of the vault. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::VaultDeleted] + # + # @see OpenAI::Models::Beta::Agents::VaultDeleteParams + def delete(vault_id, params = {}) + @client.request( + method: :delete, + path: ["vaults/%1$s", vault_id], + model: OpenAI::Beta::Agents::VaultDeleted, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **params[:request_options].to_h} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + @credentials = OpenAI::Resources::Beta::Agents::Vaults::Credentials.new(client: client) + end + end + end + end + end +end diff --git a/lib/openai/resources/beta/agents/vaults/credentials.rb b/lib/openai/resources/beta/agents/vaults/credentials.rb new file mode 100644 index 000000000..6b3c97e7f --- /dev/null +++ b/lib/openai/resources/beta/agents/vaults/credentials.rb @@ -0,0 +1,195 @@ +# frozen_string_literal: true + +module OpenAI + module Resources + class Beta + class Agents + class Vaults + class Credentials + # Creates a vault credential. Secret values are write-only and are never returned. + # See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + # + # @overload create(vault_id, auth:, name:, request_options: {}) + # + # @param vault_id [String] + # The ID of the vault. + # + # @param auth [OpenAI::Models::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth, OpenAI::Models::Beta::Agents::Vaults::CredentialAuthCreateParam::StaticBearer] + # The authentication method and secret values to store for the MCP server. + # + # @param name [String] + # The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after + # trimming. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Vaults::Credential] + # + # @see OpenAI::Models::Beta::Agents::Vaults::CredentialCreateParams + def create(vault_id, params) + parsed, options = OpenAI::Beta::Agents::Vaults::CredentialCreateParams.dump_request(params) + @client.request( + method: :post, + path: ["vaults/%1$s/credentials", vault_id], + body: parsed, + model: OpenAI::Beta::Agents::Vaults::Credential, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Retrieves vault credential metadata without returning secret values. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + # + # @overload retrieve(credential_id, vault_id:, request_options: {}) + # + # @param credential_id [String] + # The ID of the vault credential. + # + # @param vault_id [String] + # The ID of the vault. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Vaults::Credential] + # + # @see OpenAI::Models::Beta::Agents::Vaults::CredentialRetrieveParams + def retrieve(credential_id, params) + parsed, options = OpenAI::Beta::Agents::Vaults::CredentialRetrieveParams.dump_request(params) + vault_id = parsed.delete(:vault_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + @client.request( + method: :get, + path: ["vaults/%1$s/credentials/%2$s", vault_id, credential_id], + model: OpenAI::Beta::Agents::Vaults::Credential, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Rotates a vault credential's write-only secret and returns only credential + # metadata. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + # + # @overload update(credential_id, vault_id:, auth:, request_options: {}) + # + # @param credential_id [String] + # Path param: The ID of the vault credential. + # + # @param vault_id [String] + # Path param: The ID of the vault. + # + # @param auth [OpenAI::Models::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth, OpenAI::Models::Beta::Agents::Vaults::CredentialAuthRotateParam::StaticBearer] + # Body param: Replacement values for the credential's existing authentication + # method. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Vaults::Credential] + # + # @see OpenAI::Models::Beta::Agents::Vaults::CredentialUpdateParams + def update(credential_id, params) + parsed, options = OpenAI::Beta::Agents::Vaults::CredentialUpdateParams.dump_request(params) + vault_id = parsed.delete(:vault_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + @client.request( + method: :post, + path: ["vaults/%1$s/credentials/%2$s", vault_id, credential_id], + body: parsed, + model: OpenAI::Beta::Agents::Vaults::Credential, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Lists a vault's credentials using ID-based pagination without returning secret + # values. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + # + # @overload list(vault_id, after: nil, limit: nil, order: nil, status: nil, request_options: {}) + # + # @param vault_id [String] + # The ID of the vault. + # + # @param after [String] + # Return resources after this resource ID in the selected order. + # + # @param limit [Integer, nil] + # The maximum number of resources to return. Defaults to 20. Values are clamped + # between 1 and 100. + # + # @param order [Symbol, OpenAI::Models::Beta::Agents::Vaults::CredentialListParams::Order] + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + # + # @param status [Symbol, OpenAI::Models::Beta::Agents::VaultStatus, Array] + # Filter by one status or a list, such as `status=active` or + # `status[]=active&status[]=archived`. Both statuses are included by default. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Internal::CursorPage] + # + # @see OpenAI::Models::Beta::Agents::Vaults::CredentialListParams + def list(vault_id, params = {}) + parsed, options = OpenAI::Beta::Agents::Vaults::CredentialListParams.dump_request(params) + query = OpenAI::Internal::Util.encode_query_params(parsed) + @client.request( + method: :get, + path: ["vaults/%1$s/credentials", vault_id], + query: query, + page: OpenAI::Internal::CursorPage, + model: OpenAI::Beta::Agents::Vaults::Credential, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # Deletes a vault credential. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + # + # @overload delete(credential_id, vault_id:, request_options: {}) + # + # @param credential_id [String] + # The ID of the vault credential. + # + # @param vault_id [String] + # The ID of the vault. + # + # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil] + # + # @return [OpenAI::Models::Beta::Agents::Vaults::CredentialDeleted] + # + # @see OpenAI::Models::Beta::Agents::Vaults::CredentialDeleteParams + def delete(credential_id, params) + parsed, options = OpenAI::Beta::Agents::Vaults::CredentialDeleteParams.dump_request(params) + vault_id = parsed.delete(:vault_id) do + raise ArgumentError.new("missing required path argument #{_1}") + end + + @client.request( + method: :delete, + path: ["vaults/%1$s/credentials/%2$s", vault_id, credential_id], + model: OpenAI::Beta::Agents::Vaults::CredentialDeleted, + security: {bearer_auth: true}, + options: {extra_headers: {"OpenAI-Beta" => "agents=v1"}, **options} + ) + end + + # @api private + # + # @param client [OpenAI::Client] + def initialize(client:) + @client = client + end + end + end + end + end + end +end diff --git a/lib/openai/resources/live/sessions.rb b/lib/openai/resources/live/sessions.rb index 51fcb4818..6e63eaed2 100644 --- a/lib/openai/resources/live/sessions.rb +++ b/lib/openai/resources/live/sessions.rb @@ -4,7 +4,11 @@ module OpenAI module Resources class Live class Sessions - # Accept an incoming SIP call with Live startup configuration. + # Accept an incoming SIP call. Supply session with type live, the model, and + # startup configuration. Before accepting calls, follow the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) + # to write frontend conversation instructions and a separate backend prompt. SIP + # media format is negotiated; omit audio.format. # # @overload accept(session_id, session:, request_options: {}) # @@ -88,7 +92,7 @@ def fork(session_id, params) ) end - # Hang up a Live session. + # End a SIP call identified by session_id. # # @overload hangup(session_id, request_options: {}) # @@ -111,7 +115,8 @@ def hangup(session_id, params = {}) ) end - # Transfer a Live SIP call to another destination. + # Transfer a SIP call to another destination. Supply a nonblank target_uri for the + # SIP Refer-To header. # # @overload refer(session_id, target_uri:, request_options: {}) # @@ -140,7 +145,8 @@ def refer(session_id, params) ) end - # Reject an incoming SIP call. + # Reject an incoming SIP call. Send a required SIP rejection status_code between + # 300 and 699. # # @overload reject(session_id, status_code:, request_options: {}) # diff --git a/rbi/openai/helpers/agents.rbi b/rbi/openai/helpers/agents.rbi new file mode 100644 index 000000000..d8d3e7af7 --- /dev/null +++ b/rbi/openai/helpers/agents.rbi @@ -0,0 +1,71 @@ +# typed: strong + +module OpenAI + module Helpers + module Agents + ToolOutput = T.type_alias { + T.nilable( + T.any( + String, + OpenAI::Internal::AnyHash, + T::Array[T.any(OpenAI::Models::Beta::InputContentParam::Variants, OpenAI::Internal::AnyHash)] + ) + ) + } + ToolHandler = T.type_alias { T.proc.params(arguments: T::Hash[String, T.untyped]).returns(ToolOutput) } + + class SessionStream + include Enumerable + Elem = type_member { {fixed: OpenAI::Models::Beta::AgentSessionEvent::Variants} } + + sig { + params(block: T.nilable(T.proc.params(event: OpenAI::Models::Beta::AgentSessionEvent::Variants).void)).returns( + T.any(T.self_type, T::Enumerator[OpenAI::Models::Beta::AgentSessionEvent::Variants]) + ) + } + def each(&block) + end + + sig { void } + def close + end + + sig { returns(T.self_type) } + def until_done + end + end + end + end + + module Resources + class Beta + class Agents + class Sessions + sig do + params( + session_id: String, + input: T.any(String, T::Array[OpenAI::Models::Beta::AgentSessionInputMessageParam::OrHash]), + tool_handlers: T::Hash[String, OpenAI::Helpers::Agents::ToolHandler], + idempotency_key: T.nilable(String), + request_options: T.nilable(OpenAI::RequestOptions::OrHash), + block: T.nilable(T.proc.params(stream: OpenAI::Helpers::Agents::SessionStream).void) + ) + .returns(OpenAI::Helpers::Agents::SessionStream) + end + def stream(session_id, input:, tool_handlers: {}, idempotency_key: nil, request_options: {}, &block) + end + end + end + end + end + + module Models + module Beta + class AgentSessionMessage < OpenAI::Internal::Type::BaseModel + sig { returns(String) } + def output_text + end + end + end + end +end diff --git a/rbi/openai/internal/token_page.rbi b/rbi/openai/internal/token_page.rbi new file mode 100644 index 000000000..aa9dc94de --- /dev/null +++ b/rbi/openai/internal/token_page.rbi @@ -0,0 +1,25 @@ +# typed: strong + +module OpenAI + module Internal + class TokenPage + include OpenAI::Internal::Type::BasePage + + Elem = type_member + + sig { returns(T.nilable(T::Array[Elem])) } + attr_accessor :data + + sig { returns(T::Boolean) } + attr_accessor :has_more + + sig { returns(T.nilable(String)) } + attr_accessor :next_ + + # @api private + sig { returns(String) } + def inspect + end + end + end +end diff --git a/rbi/openai/models/beta/agent.rbi b/rbi/openai/models/beta/agent.rbi new file mode 100644 index 000000000..bf63ae9ef --- /dev/null +++ b/rbi/openai/models/beta/agent.rbi @@ -0,0 +1,209 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class Agent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agent, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the reusable agent. + sig { returns(String) } + attr_accessor :id + + # The Unix timestamp, in seconds, when the agent was created. + sig { returns(Integer) } + attr_accessor :created_at + + # Custom instructions appended to the agent's default base instructions. + sig { returns(T.nilable(String)) } + attr_accessor :instructions + + # Custom string key-value pairs attached to the agent. + sig { returns(T::Hash[Symbol, String]) } + attr_accessor :metadata + + # The requested model name used for inference. + sig { returns(String) } + attr_accessor :model + + # The resolved configuration for creating and coordinating subagents. + sig { returns(OpenAI::Beta::MultiAgentConfig) } + attr_reader :multi_agent + + sig { params(multi_agent: OpenAI::Beta::MultiAgentConfig::OrHash).void } + attr_writer :multi_agent + + # A human-readable name for the agent, or null if it is unnamed. + sig { returns(T.nilable(String)) } + attr_accessor :name + + # The object type. Always `agent`. + sig { returns(Symbol) } + attr_accessor :object + + # The resolved reasoning configuration, including the model default for an omitted + # effort. + sig { returns(OpenAI::Beta::AgentReasoning) } + attr_reader :reasoning + + sig { params(reasoning: OpenAI::Beta::AgentReasoning::OrHash).void } + attr_writer :reasoning + + # The resolved service-tier policy used for model requests. + sig { returns(OpenAI::Beta::Agent::ServiceTier::TaggedSymbol) } + attr_accessor :service_tier + + # The resolved configuration for text generated by the agent. + sig { returns(OpenAI::Beta::AgentText) } + attr_reader :text + + sig { params(text: OpenAI::Beta::AgentText::OrHash).void } + attr_writer :text + + # Tools available to the agent. + sig { returns(T::Array[OpenAI::Beta::PersistedAgentTool::Variants]) } + attr_accessor :tools + + # The Unix timestamp, in seconds, when the agent was last updated. + sig { returns(Integer) } + attr_accessor :updated_at + + # A reusable agent scoped to the caller's project. + sig do + params( + + id: String, + + created_at: Integer, + + instructions: T.nilable(String), + + metadata: T::Hash[Symbol, String], + + model: String, + + multi_agent: OpenAI::Beta::MultiAgentConfig::OrHash, + + name: T.nilable(String), + + reasoning: OpenAI::Beta::AgentReasoning::OrHash, + + service_tier: OpenAI::Beta::Agent::ServiceTier::OrSymbol, + + text: OpenAI::Beta::AgentText::OrHash, + + tools: T::Array[ + T.any( + OpenAI::Beta::PersistedAgentTool::Function::OrHash, + OpenAI::Beta::PersistedAgentTool::ToolSearch::OrHash, + OpenAI::Beta::PersistedAgentTool::ProgrammaticToolCalling::OrHash, + OpenAI::Beta::PersistedAgentTool::Mcp::OrHash, + OpenAI::Beta::PersistedAgentTool::WebSearch::OrHash + ) + ], + + updated_at: Integer, + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the reusable agent. + id:, + + # The Unix timestamp, in seconds, when the agent was created. + created_at:, + + # Custom instructions appended to the agent's default base instructions. + instructions:, + + # Custom string key-value pairs attached to the agent. + metadata:, + + # The requested model name used for inference. + model:, + + # The resolved configuration for creating and coordinating subagents. + multi_agent:, + + # A human-readable name for the agent, or null if it is unnamed. + name:, + + # The resolved reasoning configuration, including the model default for an omitted + # effort. + reasoning:, + + # The resolved service-tier policy used for model requests. + service_tier:, + + # The resolved configuration for text generated by the agent. + text:, + + # Tools available to the agent. + tools:, + + # The Unix timestamp, in seconds, when the agent was last updated. + updated_at:, + + # The object type. Always `agent`. + + object: :agent + ) + end + + sig do + override.returns( + { + id: String, + created_at: Integer, + instructions: T.nilable(String), + metadata: T::Hash[Symbol, String], + model: String, + multi_agent: OpenAI::Beta::MultiAgentConfig, + name: T.nilable(String), + object: Symbol, + reasoning: OpenAI::Beta::AgentReasoning, + service_tier: OpenAI::Beta::Agent::ServiceTier::TaggedSymbol, + text: OpenAI::Beta::AgentText, + tools: T::Array[OpenAI::Beta::PersistedAgentTool::Variants], + updated_at: Integer + } + ) + end + def to_hash + end + + # The resolved service-tier policy used for model requests. + module ServiceTier + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Agent::ServiceTier) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AUTO = T.let(:auto, OpenAI::Beta::Agent::ServiceTier::TaggedSymbol) + DEFAULT = T.let(:default, OpenAI::Beta::Agent::ServiceTier::TaggedSymbol) + FLEX = T.let(:flex, OpenAI::Beta::Agent::ServiceTier::TaggedSymbol) + PRIORITY = T.let(:priority, OpenAI::Beta::Agent::ServiceTier::TaggedSymbol) + FAST = T.let(:fast, OpenAI::Beta::Agent::ServiceTier::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::Agent::ServiceTier::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_close_subagent_call_item.rbi b/rbi/openai/models/beta/agent_close_subagent_call_item.rbi new file mode 100644 index 000000000..97c28c65d --- /dev/null +++ b/rbi/openai/models/beta/agent_close_subagent_call_item.rbi @@ -0,0 +1,102 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentCloseSubagentCallItem < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentCloseSubagentCallItem, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the tool call item. + sig { returns(String) } + attr_accessor :id + + # The ID of the agent to close. + sig { returns(String) } + attr_accessor :recipient_agent_id + + # The ID of the agent requesting the close. + sig { returns(String) } + attr_accessor :sender_agent_id + + # The status of the tool call. + sig { returns(OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) } + attr_accessor :status + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `close_subagent_call`. + sig { returns(Symbol) } + attr_accessor :type + + # A request to close a subagent. + sig do + params( + + id: String, + + recipient_agent_id: String, + + sender_agent_id: String, + + status: OpenAI::Beta::AgentFunctionCallStatus::OrSymbol, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the tool call item. + id:, + + # The ID of the agent to close. + recipient_agent_id:, + + # The ID of the agent requesting the close. + sender_agent_id:, + + # The status of the tool call. + status:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `close_subagent_call`. + + type: :close_subagent_call + ) + end + + sig do + override.returns( + { + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_command_execution_item.rbi b/rbi/openai/models/beta/agent_command_execution_item.rbi new file mode 100644 index 000000000..4baacf22b --- /dev/null +++ b/rbi/openai/models/beta/agent_command_execution_item.rbi @@ -0,0 +1,132 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentCommandExecutionItem < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentCommandExecutionItem, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the command execution item. + sig { returns(String) } + attr_accessor :id + + # The command that was executed. + sig { returns(String) } + attr_accessor :command + + # The working directory used to execute the command. + sig { returns(T.nilable(String)) } + attr_accessor :cwd + + # The command duration in milliseconds. + sig { returns(T.nilable(Integer)) } + attr_accessor :duration_ms + + # The process exit code, if the command completed. + sig { returns(T.nilable(Integer)) } + attr_accessor :exit_code + + # The command output, if available. + sig { returns(T.nilable(String)) } + attr_accessor :output + + # The status of the command execution. + sig { returns(OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) } + attr_accessor :status + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `command_execution`. + sig { returns(Symbol) } + attr_accessor :type + + # A command execution produced by the agent. + sig do + params( + + id: String, + + command: String, + + cwd: T.nilable(String), + + duration_ms: T.nilable(Integer), + + exit_code: T.nilable(Integer), + + output: T.nilable(String), + + status: OpenAI::Beta::AgentFunctionCallStatus::OrSymbol, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the command execution item. + id:, + + # The command that was executed. + command:, + + # The working directory used to execute the command. + cwd:, + + # The command duration in milliseconds. + duration_ms:, + + # The process exit code, if the command completed. + exit_code:, + + # The command output, if available. + output:, + + # The status of the command execution. + status:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `command_execution`. + + type: :command_execution + ) + end + + sig do + override.returns( + { + id: String, + command: String, + cwd: T.nilable(String), + duration_ms: T.nilable(Integer), + exit_code: T.nilable(Integer), + output: T.nilable(String), + status: OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_content.rbi b/rbi/openai/models/beta/agent_content.rbi new file mode 100644 index 000000000..c92e9125e --- /dev/null +++ b/rbi/openai/models/beta/agent_content.rbi @@ -0,0 +1,75 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # A plaintext or encrypted content part exchanged between agents. + module AgentContent + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::OutputText, + OpenAI::Beta::AgentContent::EncryptedContent + ) + end + + class EncryptedContent < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentContent::EncryptedContent, + OpenAI::Internal::AnyHash + ) + end + + # The encrypted content payload. + sig { returns(String) } + attr_accessor :encrypted_content + + # The content type. Always `encrypted_content`. + sig { returns(Symbol) } + attr_accessor :type + + # Encrypted content exchanged between agents. + sig do + params( + + encrypted_content: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The encrypted content payload. + encrypted_content:, + + # The content type. Always `encrypted_content`. + + type: :encrypted_content + ) + end + + sig do + override.returns( + {encrypted_content: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::AgentContent::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_create_params.rbi b/rbi/openai/models/beta/agent_create_params.rbi new file mode 100644 index 000000000..38d269419 --- /dev/null +++ b/rbi/openai/models/beta/agent_create_params.rbi @@ -0,0 +1,212 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentCreateParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentCreateParams, + OpenAI::Internal::AnyHash + ) + end + + # The model to use for the agent. The requested model name is preserved. + sig { returns(String) } + attr_accessor :model + + # Additional instructions appended to the agent's default base instructions. Omit + # or set to null to add no custom instructions. + sig { returns(T.nilable(String)) } + attr_accessor :instructions + + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :metadata + + # Explicit configuration for creating and coordinating subagents. + sig { returns(T.nilable(OpenAI::Beta::MultiAgentConfigParam)) } + attr_reader :multi_agent + + sig { params(multi_agent: T.nilable(OpenAI::Beta::MultiAgentConfigParam::OrHash)).void } + attr_writer :multi_agent + + # A human-readable name for the agent. Omission or null leaves the agent unnamed. + sig { returns(T.nilable(String)) } + attr_accessor :name + + # Reasoning configuration for the agent. + sig { returns(T.nilable(OpenAI::Beta::AgentReasoningParam)) } + attr_reader :reasoning + + sig { params(reasoning: T.nilable(OpenAI::Beta::AgentReasoningParam::OrHash)).void } + attr_writer :reasoning + + # The service tier used for model requests. + sig { returns(T.nilable(OpenAI::Beta::AgentCreateParams::ServiceTier::OrSymbol)) } + attr_accessor :service_tier + + # Configuration for text generated by the agent. + sig { returns(T.nilable(OpenAI::Beta::AgentTextParam)) } + attr_reader :text + + sig { params(text: T.nilable(OpenAI::Beta::AgentTextParam::OrHash)).void } + attr_writer :text + + # Tools available to the agent. Defaults to an empty list. + sig { + returns( + T.nilable( + T::Array[ + T.any( + OpenAI::Beta::PersistedAgentToolParam::Function, + OpenAI::Beta::PersistedAgentToolParam::ToolSearch, + OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling, + OpenAI::Beta::PersistedAgentToolParam::Mcp, + OpenAI::Beta::PersistedAgentToolParam::WebSearch + ) + ] + ) + ) + } + attr_accessor :tools + + sig do + params( + + model: String, + + instructions: T.nilable(String), + + metadata: T.nilable(T::Hash[Symbol, String]), + + multi_agent: T.nilable(OpenAI::Beta::MultiAgentConfigParam::OrHash), + + name: T.nilable(String), + + reasoning: T.nilable(OpenAI::Beta::AgentReasoningParam::OrHash), + + service_tier: T.nilable(OpenAI::Beta::AgentCreateParams::ServiceTier::OrSymbol), + + text: T.nilable(OpenAI::Beta::AgentTextParam::OrHash), + + tools: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::PersistedAgentToolParam::Function::OrHash, + OpenAI::Beta::PersistedAgentToolParam::ToolSearch::OrHash, + OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling::OrHash, + OpenAI::Beta::PersistedAgentToolParam::Mcp::OrHash, + OpenAI::Beta::PersistedAgentToolParam::WebSearch::OrHash + ) + ] + ), + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # The model to use for the agent. The requested model name is preserved. + model:, + + # Additional instructions appended to the agent's default base instructions. Omit + # or set to null to add no custom instructions. + instructions: nil, + + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + metadata: nil, + + # Explicit configuration for creating and coordinating subagents. + multi_agent: nil, + + # A human-readable name for the agent. Omission or null leaves the agent unnamed. + name: nil, + + # Reasoning configuration for the agent. + reasoning: nil, + + # The service tier used for model requests. + service_tier: nil, + + # Configuration for text generated by the agent. + text: nil, + + # Tools available to the agent. Defaults to an empty list. + tools: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + model: String, + instructions: T.nilable(String), + metadata: T.nilable(T::Hash[Symbol, String]), + multi_agent: T.nilable(OpenAI::Beta::MultiAgentConfigParam), + name: T.nilable(String), + reasoning: T.nilable(OpenAI::Beta::AgentReasoningParam), + service_tier: T.nilable(OpenAI::Beta::AgentCreateParams::ServiceTier::OrSymbol), + text: T.nilable(OpenAI::Beta::AgentTextParam), + tools: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::PersistedAgentToolParam::Function, + OpenAI::Beta::PersistedAgentToolParam::ToolSearch, + OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling, + OpenAI::Beta::PersistedAgentToolParam::Mcp, + OpenAI::Beta::PersistedAgentToolParam::WebSearch + ) + ] + ), + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # The service tier used for model requests. + module ServiceTier + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentCreateParams::ServiceTier) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Selects the service tier automatically. + AUTO = T.let(:auto, OpenAI::Beta::AgentCreateParams::ServiceTier::TaggedSymbol) + + # Uses the default service tier. + DEFAULT = T.let(:default, OpenAI::Beta::AgentCreateParams::ServiceTier::TaggedSymbol) + + # Uses the flex service tier. + FLEX = T.let(:flex, OpenAI::Beta::AgentCreateParams::ServiceTier::TaggedSymbol) + + # Uses the priority service tier. + PRIORITY = T.let(:priority, OpenAI::Beta::AgentCreateParams::ServiceTier::TaggedSymbol) + + # Uses the fast service tier. + FAST = T.let(:fast, OpenAI::Beta::AgentCreateParams::ServiceTier::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentCreateParams::ServiceTier::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_create_subagent_call_item.rbi b/rbi/openai/models/beta/agent_create_subagent_call_item.rbi new file mode 100644 index 000000000..192b8d112 --- /dev/null +++ b/rbi/openai/models/beta/agent_create_subagent_call_item.rbi @@ -0,0 +1,124 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentCreateSubagentCallItem < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentCreateSubagentCallItem, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the tool call item. + sig { returns(String) } + attr_accessor :id + + # The ID of the agent that requested the subagent. + sig { returns(String) } + attr_accessor :agent_id + + # The task given to the spawned agent. + sig { returns(T::Array[OpenAI::Beta::AgentContent::Variants]) } + attr_accessor :content + + # The model requested for the spawned agent. + sig { returns(T.nilable(String)) } + attr_accessor :model + + # The reasoning effort requested for the spawned agent. + sig { returns(T.nilable(String)) } + attr_accessor :reasoning_effort + + # The status of the tool call. + sig { returns(OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) } + attr_accessor :status + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `create_subagent_call`. + sig { returns(Symbol) } + attr_accessor :type + + # A request to spawn a subagent. + sig do + params( + + id: String, + + agent_id: String, + + content: T::Array[ + T.any(OpenAI::Beta::OutputText::OrHash, OpenAI::Beta::AgentContent::EncryptedContent::OrHash) + ], + + model: T.nilable(String), + + reasoning_effort: T.nilable(String), + + status: OpenAI::Beta::AgentFunctionCallStatus::OrSymbol, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the tool call item. + id:, + + # The ID of the agent that requested the subagent. + agent_id:, + + # The task given to the spawned agent. + content:, + + # The model requested for the spawned agent. + model:, + + # The reasoning effort requested for the spawned agent. + reasoning_effort:, + + # The status of the tool call. + status:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `create_subagent_call`. + + type: :create_subagent_call + ) + end + + sig do + override.returns( + { + id: String, + agent_id: String, + content: T::Array[OpenAI::Beta::AgentContent::Variants], + model: T.nilable(String), + reasoning_effort: T.nilable(String), + status: OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_delete_params.rbi b/rbi/openai/models/beta/agent_delete_params.rbi new file mode 100644 index 000000000..fb40e9b41 --- /dev/null +++ b/rbi/openai/models/beta/agent_delete_params.rbi @@ -0,0 +1,53 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentDeleteParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentDeleteParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :agent_id + + sig do + params( + + agent_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + agent_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {agent_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_deleted.rbi b/rbi/openai/models/beta/agent_deleted.rbi new file mode 100644 index 000000000..b3db5b4b4 --- /dev/null +++ b/rbi/openai/models/beta/agent_deleted.rbi @@ -0,0 +1,68 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentDeleted < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentDeleted, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the deleted agent. + sig { returns(String) } + attr_accessor :id + + # Whether the agent was deleted. Always `true`. + sig { returns(T::Boolean) } + attr_accessor :deleted + + # The object type. Always `agent.deleted`. + sig { returns(Symbol) } + attr_accessor :object + + # A deleted reusable agent. + sig do + params( + + id: String, + + deleted: T::Boolean, + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the deleted agent. + id:, + + # Whether the agent was deleted. Always `true`. + deleted:, + + # The object type. Always `agent.deleted`. + + object: :"agent.deleted" + ) + end + + sig do + override.returns( + {id: String, deleted: T::Boolean, object: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_function_call_item.rbi b/rbi/openai/models/beta/agent_function_call_item.rbi new file mode 100644 index 000000000..466ab40c2 --- /dev/null +++ b/rbi/openai/models/beta/agent_function_call_item.rbi @@ -0,0 +1,112 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentFunctionCallItem < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentFunctionCallItem, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the function call item. + sig { returns(String) } + attr_accessor :id + + # The arguments to pass to the function. + sig { returns(T.anything) } + attr_accessor :arguments + + # The ID used to submit the function result. + sig { returns(String) } + attr_accessor :call_id + + # The name of the function to call. + sig { returns(String) } + attr_accessor :name + + # The status of the function call. + sig { returns(OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) } + attr_accessor :status + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `function_call`. + sig { returns(Symbol) } + attr_accessor :type + + # A function call produced by the agent. + sig do + params( + + id: String, + + arguments: T.anything, + + call_id: String, + + name: String, + + status: OpenAI::Beta::AgentFunctionCallStatus::OrSymbol, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the function call item. + id:, + + # The arguments to pass to the function. + arguments:, + + # The ID used to submit the function result. + call_id:, + + # The name of the function to call. + name:, + + # The status of the function call. + status:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `function_call`. + + type: :function_call + ) + end + + sig do + override.returns( + { + id: String, + arguments: T.anything, + call_id: String, + name: String, + status: OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_function_call_output.rbi b/rbi/openai/models/beta/agent_function_call_output.rbi new file mode 100644 index 000000000..428ff04bc --- /dev/null +++ b/rbi/openai/models/beta/agent_function_call_output.rbi @@ -0,0 +1,33 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # The text or model-input content supplied as a function result. + module AgentFunctionCallOutput + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + String, + T::Array[OpenAI::Beta::InputContent::Variants] + ) + end + + sig { override.returns(T::Array[OpenAI::Beta::AgentFunctionCallOutput::Variants]) } + def self.variants + end + + InputContentArray = T.let( + OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::InputContent], + OpenAI::Internal::Type::Converter + ) + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_function_call_output_param.rbi b/rbi/openai/models/beta/agent_function_call_output_param.rbi new file mode 100644 index 000000000..377fc76a8 --- /dev/null +++ b/rbi/openai/models/beta/agent_function_call_output_param.rbi @@ -0,0 +1,33 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # A function result represented as text or supported model-input content. + module AgentFunctionCallOutputParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + String, + T::Array[OpenAI::Beta::InputContentParam::Variants] + ) + end + + sig { override.returns(T::Array[OpenAI::Beta::AgentFunctionCallOutputParam::Variants]) } + def self.variants + end + + InputContentParamArray = T.let( + OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::InputContentParam], + OpenAI::Internal::Type::Converter + ) + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_function_call_status.rbi b/rbi/openai/models/beta/agent_function_call_status.rbi new file mode 100644 index 000000000..42c7162b8 --- /dev/null +++ b/rbi/openai/models/beta/agent_function_call_status.rbi @@ -0,0 +1,35 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # The status of a tool call. + module AgentFunctionCallStatus + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentFunctionCallStatus) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # The call is in progress. + IN_PROGRESS = T.let(:in_progress, OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) + + # The call completed successfully. + COMPLETED = T.let(:completed, OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) + + # The call failed. + FAILED = T.let(:failed, OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) + + # The call stopped before completing. + INCOMPLETE = T.let(:incomplete, OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol]) } + def self.values + end + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_interrupt_subagent_call_item.rbi b/rbi/openai/models/beta/agent_interrupt_subagent_call_item.rbi new file mode 100644 index 000000000..cbf1d9f7b --- /dev/null +++ b/rbi/openai/models/beta/agent_interrupt_subagent_call_item.rbi @@ -0,0 +1,103 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentInterruptSubagentCallItem < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentInterruptSubagentCallItem, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the tool call item. + sig { returns(String) } + attr_accessor :id + + # The ID of the agent to interrupt. + sig { returns(String) } + attr_accessor :recipient_agent_id + + # The ID of the agent requesting the interrupt. + sig { returns(String) } + attr_accessor :sender_agent_id + + # The status of the tool call. + sig { returns(OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) } + attr_accessor :status + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `interrupt_subagent_call`. + sig { returns(Symbol) } + attr_accessor :type + + # A request to interrupt a subagent's current turn. The subagent remains + # available. + sig do + params( + + id: String, + + recipient_agent_id: String, + + sender_agent_id: String, + + status: OpenAI::Beta::AgentFunctionCallStatus::OrSymbol, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the tool call item. + id:, + + # The ID of the agent to interrupt. + recipient_agent_id:, + + # The ID of the agent requesting the interrupt. + sender_agent_id:, + + # The status of the tool call. + status:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `interrupt_subagent_call`. + + type: :interrupt_subagent_call + ) + end + + sig do + override.returns( + { + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_list_params.rbi b/rbi/openai/models/beta/agent_list_params.rbi new file mode 100644 index 000000000..14783d8ea --- /dev/null +++ b/rbi/openai/models/beta/agent_list_params.rbi @@ -0,0 +1,102 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentListParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentListParams, + OpenAI::Internal::AnyHash + ) + end + + # Return resources after this resource ID in the selected order. + sig { returns(T.nilable(String)) } + attr_reader :after + + sig { params(after: String).void } + attr_writer :after + + # The maximum number of resources to return. + sig { returns(T.nilable(Integer)) } + attr_accessor :limit + + # The order in which resources are returned. Defaults to `desc`. + sig { returns(T.nilable(OpenAI::Beta::AgentListParams::Order::OrSymbol)) } + attr_reader :order + + sig { params(order: OpenAI::Beta::AgentListParams::Order::OrSymbol).void } + attr_writer :order + + sig do + params( + + after: String, + + limit: T.nilable(Integer), + + order: OpenAI::Beta::AgentListParams::Order::OrSymbol, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # Return resources after this resource ID in the selected order. + after: nil, + + # The maximum number of resources to return. + limit: nil, + + # The order in which resources are returned. Defaults to `desc`. + order: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + after: String, + limit: T.nilable(Integer), + order: OpenAI::Beta::AgentListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentListParams::Order) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns resources in ascending order. + ASC = T.let(:asc, OpenAI::Beta::AgentListParams::Order::TaggedSymbol) + + # Returns resources in descending order. + DESC = T.let(:desc, OpenAI::Beta::AgentListParams::Order::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentListParams::Order::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_mcp_call_item.rbi b/rbi/openai/models/beta/agent_mcp_call_item.rbi new file mode 100644 index 000000000..e966c8cd5 --- /dev/null +++ b/rbi/openai/models/beta/agent_mcp_call_item.rbi @@ -0,0 +1,132 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentMcpCallItem < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentMcpCallItem, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the MCP call item. + sig { returns(String) } + attr_accessor :id + + # The arguments passed to the MCP tool. + sig { returns(T.anything) } + attr_accessor :arguments + + # The error returned by the MCP tool, if any. + sig { returns(T.anything) } + attr_accessor :error + + # The name of the MCP tool. + sig { returns(String) } + attr_accessor :name + + # The output returned by the MCP tool, if any. + sig { returns(T.anything) } + attr_accessor :output + + # The label of the MCP server. + sig { returns(String) } + attr_accessor :server_label + + # The status of the MCP tool call. + sig { returns(OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) } + attr_accessor :status + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `mcp_call`. + sig { returns(Symbol) } + attr_accessor :type + + # A call to a tool on an MCP server. + sig do + params( + + id: String, + + arguments: T.anything, + + error: T.anything, + + name: String, + + output: T.anything, + + server_label: String, + + status: OpenAI::Beta::AgentFunctionCallStatus::OrSymbol, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the MCP call item. + id:, + + # The arguments passed to the MCP tool. + arguments:, + + # The error returned by the MCP tool, if any. + error:, + + # The name of the MCP tool. + name:, + + # The output returned by the MCP tool, if any. + output:, + + # The label of the MCP server. + server_label:, + + # The status of the MCP tool call. + status:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `mcp_call`. + + type: :mcp_call + ) + end + + sig do + override.returns( + { + id: String, + arguments: T.anything, + error: T.anything, + name: String, + output: T.anything, + server_label: String, + status: OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_output_command_execution_output_delta_event.rbi b/rbi/openai/models/beta/agent_output_command_execution_output_delta_event.rbi new file mode 100644 index 000000000..41f08a60c --- /dev/null +++ b/rbi/openai/models/beta/agent_output_command_execution_output_delta_event.rbi @@ -0,0 +1,112 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentOutputCommandExecutionOutputDeltaEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentOutputCommandExecutionOutputDeltaEvent, + OpenAI::Internal::AnyHash + ) + end + + # The output text that was appended. + sig { returns(String) } + attr_accessor :delta + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the command execution item. + sig { returns(String) } + attr_accessor :item_id + + # The index of the item in the turn output. + sig { returns(Integer) } + attr_accessor :output_index + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.output.command_execution_output.delta`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when command execution produces an output delta. + sig do + params( + + delta: String, + + event_id: String, + + item_id: String, + + output_index: Integer, + + session_id: String, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The output text that was appended. + delta:, + + # The unique ID of the event. + event_id:, + + # The ID of the command execution item. + item_id:, + + # The index of the item in the turn output. + output_index:, + + # The ID of the session associated with the event. + session_id:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always `agent.output.command_execution_output.delta`. + + type: :"agent.output.command_execution_output.delta" + ) + end + + sig do + override.returns( + { + delta: String, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_output_item.rbi b/rbi/openai/models/beta/agent_output_item.rbi new file mode 100644 index 000000000..95f0a82c7 --- /dev/null +++ b/rbi/openai/models/beta/agent_output_item.rbi @@ -0,0 +1,38 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # An output item produced by an agent. + module AgentOutputItem + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionAssistantMessage, + OpenAI::Beta::AgentReasoningItem, + OpenAI::Beta::AgentFunctionCallItem, + OpenAI::Beta::AgentMcpCallItem, + OpenAI::Beta::AgentWebSearchCallItem, + OpenAI::Beta::AgentCommandExecutionItem, + OpenAI::Beta::AgentCreateSubagentCallItem, + OpenAI::Beta::AgentSendSubagentInputCallItem, + OpenAI::Beta::AgentResumeSubagentCallItem, + OpenAI::Beta::AgentWaitForSubagentsCallItem, + OpenAI::Beta::AgentInterruptSubagentCallItem, + OpenAI::Beta::AgentCloseSubagentCallItem + ) + end + + sig { override.returns(T::Array[OpenAI::Beta::AgentOutputItem::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_output_item_status.rbi b/rbi/openai/models/beta/agent_output_item_status.rbi new file mode 100644 index 000000000..10b3baa2d --- /dev/null +++ b/rbi/openai/models/beta/agent_output_item_status.rbi @@ -0,0 +1,32 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # The status of an agent output item. + module AgentOutputItemStatus + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentOutputItemStatus) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # The item is in progress. + IN_PROGRESS = T.let(:in_progress, OpenAI::Beta::AgentOutputItemStatus::TaggedSymbol) + + # The item is complete. + COMPLETED = T.let(:completed, OpenAI::Beta::AgentOutputItemStatus::TaggedSymbol) + + # The item stopped before completing. + INCOMPLETE = T.let(:incomplete, OpenAI::Beta::AgentOutputItemStatus::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentOutputItemStatus::TaggedSymbol]) } + def self.values + end + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_reasoning.rbi b/rbi/openai/models/beta/agent_reasoning.rbi new file mode 100644 index 000000000..0aea9f963 --- /dev/null +++ b/rbi/openai/models/beta/agent_reasoning.rbi @@ -0,0 +1,103 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentReasoning < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentReasoning, + OpenAI::Internal::AnyHash + ) + end + + # The amount of reasoning effort used by an agent. + sig { returns(T.nilable(OpenAI::Beta::AgentReasoning::Effort::TaggedSymbol)) } + attr_accessor :effort + + # The reasoning summary format requested from an agent. + sig { returns(T.nilable(OpenAI::Beta::AgentReasoning::Summary::TaggedSymbol)) } + attr_accessor :summary + + # The reasoning configuration used by an agent. + sig do + params( + + effort: T.nilable(OpenAI::Beta::AgentReasoning::Effort::OrSymbol), + + summary: T.nilable(OpenAI::Beta::AgentReasoning::Summary::OrSymbol) + ) + .returns(T.attached_class) + end + def self.new( + + # The amount of reasoning effort used by an agent. + effort:, + + # The reasoning summary format requested from an agent. + + summary: + ) + end + + sig do + override.returns( + { + effort: T.nilable(OpenAI::Beta::AgentReasoning::Effort::TaggedSymbol), + summary: T.nilable(OpenAI::Beta::AgentReasoning::Summary::TaggedSymbol) + } + ) + end + def to_hash + end + + # The amount of reasoning effort used by an agent. + module Effort + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentReasoning::Effort) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + NONE = T.let(:none, OpenAI::Beta::AgentReasoning::Effort::TaggedSymbol) + MINIMAL = T.let(:minimal, OpenAI::Beta::AgentReasoning::Effort::TaggedSymbol) + LOW = T.let(:low, OpenAI::Beta::AgentReasoning::Effort::TaggedSymbol) + MEDIUM = T.let(:medium, OpenAI::Beta::AgentReasoning::Effort::TaggedSymbol) + HIGH = T.let(:high, OpenAI::Beta::AgentReasoning::Effort::TaggedSymbol) + XHIGH = T.let(:xhigh, OpenAI::Beta::AgentReasoning::Effort::TaggedSymbol) + MAX = T.let(:max, OpenAI::Beta::AgentReasoning::Effort::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentReasoning::Effort::TaggedSymbol]) } + def self.values + end + end + + # The reasoning summary format requested from an agent. + module Summary + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentReasoning::Summary) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns a concise reasoning summary when supported. + CONCISE = T.let(:concise, OpenAI::Beta::AgentReasoning::Summary::TaggedSymbol) + + # Returns a detailed reasoning summary when supported. + DETAILED = T.let(:detailed, OpenAI::Beta::AgentReasoning::Summary::TaggedSymbol) + + # Automatically selects the most detailed summary supported by the model. + AUTO = T.let(:auto, OpenAI::Beta::AgentReasoning::Summary::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentReasoning::Summary::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_reasoning_item.rbi b/rbi/openai/models/beta/agent_reasoning_item.rbi new file mode 100644 index 000000000..a8b6d25b9 --- /dev/null +++ b/rbi/openai/models/beta/agent_reasoning_item.rbi @@ -0,0 +1,92 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentReasoningItem < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentReasoningItem, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the reasoning item. + sig { returns(String) } + attr_accessor :id + + # The status of an agent output item. + sig { returns(T.nilable(OpenAI::Beta::AgentOutputItemStatus::TaggedSymbol)) } + attr_accessor :status + + # The reasoning summaries produced by the agent. + sig { returns(T::Array[OpenAI::Beta::SummaryText]) } + attr_accessor :summary + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `reasoning`. + sig { returns(Symbol) } + attr_accessor :type + + # A reasoning item produced by the agent. + sig do + params( + + id: String, + + status: T.nilable(OpenAI::Beta::AgentOutputItemStatus::OrSymbol), + + summary: T::Array[OpenAI::Beta::SummaryText::OrHash], + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the reasoning item. + id:, + + # The status of an agent output item. + status:, + + # The reasoning summaries produced by the agent. + summary:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `reasoning`. + + type: :reasoning + ) + end + + sig do + override.returns( + { + id: String, + status: T.nilable(OpenAI::Beta::AgentOutputItemStatus::TaggedSymbol), + summary: T::Array[OpenAI::Beta::SummaryText], + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_reasoning_param.rbi b/rbi/openai/models/beta/agent_reasoning_param.rbi new file mode 100644 index 000000000..ff2c591e6 --- /dev/null +++ b/rbi/openai/models/beta/agent_reasoning_param.rbi @@ -0,0 +1,103 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentReasoningParam < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentReasoningParam, + OpenAI::Internal::AnyHash + ) + end + + # The amount of reasoning effort the model should use. + sig { returns(T.nilable(OpenAI::Beta::AgentReasoningParam::Effort::OrSymbol)) } + attr_accessor :effort + + # The reasoning summary format requested from the model. + sig { returns(T.nilable(OpenAI::Beta::AgentReasoningParam::Summary::OrSymbol)) } + attr_accessor :summary + + # Reasoning configuration for the agent. + sig do + params( + + effort: T.nilable(OpenAI::Beta::AgentReasoningParam::Effort::OrSymbol), + + summary: T.nilable(OpenAI::Beta::AgentReasoningParam::Summary::OrSymbol) + ) + .returns(T.attached_class) + end + def self.new( + + # The amount of reasoning effort the model should use. + effort: nil, + + # The reasoning summary format requested from the model. + + summary: nil + ) + end + + sig do + override.returns( + { + effort: T.nilable(OpenAI::Beta::AgentReasoningParam::Effort::OrSymbol), + summary: T.nilable(OpenAI::Beta::AgentReasoningParam::Summary::OrSymbol) + } + ) + end + def to_hash + end + + # The amount of reasoning effort the model should use. + module Effort + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentReasoningParam::Effort) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + NONE = T.let(:none, OpenAI::Beta::AgentReasoningParam::Effort::TaggedSymbol) + MINIMAL = T.let(:minimal, OpenAI::Beta::AgentReasoningParam::Effort::TaggedSymbol) + LOW = T.let(:low, OpenAI::Beta::AgentReasoningParam::Effort::TaggedSymbol) + MEDIUM = T.let(:medium, OpenAI::Beta::AgentReasoningParam::Effort::TaggedSymbol) + HIGH = T.let(:high, OpenAI::Beta::AgentReasoningParam::Effort::TaggedSymbol) + XHIGH = T.let(:xhigh, OpenAI::Beta::AgentReasoningParam::Effort::TaggedSymbol) + MAX = T.let(:max, OpenAI::Beta::AgentReasoningParam::Effort::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentReasoningParam::Effort::TaggedSymbol]) } + def self.values + end + end + + # The reasoning summary format requested from the model. + module Summary + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentReasoningParam::Summary) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns a concise reasoning summary when supported. + CONCISE = T.let(:concise, OpenAI::Beta::AgentReasoningParam::Summary::TaggedSymbol) + + # Returns a detailed reasoning summary when supported. + DETAILED = T.let(:detailed, OpenAI::Beta::AgentReasoningParam::Summary::TaggedSymbol) + + # Automatically selects the most detailed summary supported by the model. + AUTO = T.let(:auto, OpenAI::Beta::AgentReasoningParam::Summary::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentReasoningParam::Summary::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_resume_subagent_call_item.rbi b/rbi/openai/models/beta/agent_resume_subagent_call_item.rbi new file mode 100644 index 000000000..13c25bdf7 --- /dev/null +++ b/rbi/openai/models/beta/agent_resume_subagent_call_item.rbi @@ -0,0 +1,102 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentResumeSubagentCallItem < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentResumeSubagentCallItem, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the tool call item. + sig { returns(String) } + attr_accessor :id + + # The ID of the agent to resume. + sig { returns(String) } + attr_accessor :recipient_agent_id + + # The ID of the agent requesting the resume. + sig { returns(String) } + attr_accessor :sender_agent_id + + # The status of the tool call. + sig { returns(OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) } + attr_accessor :status + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `resume_subagent_call`. + sig { returns(Symbol) } + attr_accessor :type + + # A request to resume a subagent. + sig do + params( + + id: String, + + recipient_agent_id: String, + + sender_agent_id: String, + + status: OpenAI::Beta::AgentFunctionCallStatus::OrSymbol, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the tool call item. + id:, + + # The ID of the agent to resume. + recipient_agent_id:, + + # The ID of the agent requesting the resume. + sender_agent_id:, + + # The status of the tool call. + status:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `resume_subagent_call`. + + type: :resume_subagent_call + ) + end + + sig do + override.returns( + { + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_retrieve_params.rbi b/rbi/openai/models/beta/agent_retrieve_params.rbi new file mode 100644 index 000000000..7f742ac71 --- /dev/null +++ b/rbi/openai/models/beta/agent_retrieve_params.rbi @@ -0,0 +1,53 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentRetrieveParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentRetrieveParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :agent_id + + sig do + params( + + agent_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + agent_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {agent_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_send_subagent_input_call_item.rbi b/rbi/openai/models/beta/agent_send_subagent_input_call_item.rbi new file mode 100644 index 000000000..1f9893d4b --- /dev/null +++ b/rbi/openai/models/beta/agent_send_subagent_input_call_item.rbi @@ -0,0 +1,114 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSendSubagentInputCallItem < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSendSubagentInputCallItem, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the tool call item. + sig { returns(String) } + attr_accessor :id + + # The input sent to the receiving agent. + sig { returns(T::Array[OpenAI::Beta::AgentContent::Variants]) } + attr_accessor :content + + # The ID of the agent receiving the input. + sig { returns(String) } + attr_accessor :recipient_agent_id + + # The ID of the agent sending the input. + sig { returns(String) } + attr_accessor :sender_agent_id + + # The status of the tool call. + sig { returns(OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) } + attr_accessor :status + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `send_subagent_input_call`. + sig { returns(Symbol) } + attr_accessor :type + + # A request to send input to another agent. + sig do + params( + + id: String, + + content: T::Array[ + T.any(OpenAI::Beta::OutputText::OrHash, OpenAI::Beta::AgentContent::EncryptedContent::OrHash) + ], + + recipient_agent_id: String, + + sender_agent_id: String, + + status: OpenAI::Beta::AgentFunctionCallStatus::OrSymbol, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the tool call item. + id:, + + # The input sent to the receiving agent. + content:, + + # The ID of the agent receiving the input. + recipient_agent_id:, + + # The ID of the agent sending the input. + sender_agent_id:, + + # The status of the tool call. + status:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `send_subagent_input_call`. + + type: :send_subagent_input_call + ) + end + + sig do + override.returns( + { + id: String, + content: T::Array[OpenAI::Beta::AgentContent::Variants], + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session.rbi b/rbi/openai/models/beta/agent_session.rbi new file mode 100644 index 000000000..825f92c5f --- /dev/null +++ b/rbi/openai/models/beta/agent_session.rbi @@ -0,0 +1,494 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSession < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSession, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the session. + sig { returns(String) } + attr_accessor :id + + # The agent running in the session. + sig { returns(OpenAI::Beta::AgentSession::Agent) } + attr_reader :agent + + sig { params(agent: OpenAI::Beta::AgentSession::Agent::OrHash).void } + attr_writer :agent + + # The Unix timestamp, in seconds, when the session was created. + sig { returns(Integer) } + attr_accessor :created_at + + # The execution environment for the session. + sig { returns(OpenAI::Beta::Environment::Variants) } + attr_accessor :environment + + # The error that caused the session to fail, if any. + sig { returns(T.nilable(String)) } + attr_accessor :error + + # The Unix timestamp, in seconds, when the session was last active. + sig { returns(Integer) } + attr_accessor :last_active_at + + # Custom string key-value pairs attached to the session. + sig { returns(T::Hash[Symbol, String]) } + attr_accessor :metadata + + # The object type. Always `agent.session`. + sig { returns(Symbol) } + attr_accessor :object + + # Actions that must be completed before the session can continue. + sig { returns(T::Array[OpenAI::Beta::AgentSession::RequiredAction::Variants]) } + attr_accessor :required_actions + + # The current status of the session. + sig { returns(OpenAI::Beta::AgentSession::Status::TaggedSymbol) } + attr_accessor :status + + # Recorded token usage for a session or turn. Usage is best effort and may change. + sig { returns(T.nilable(OpenAI::Beta::TokenUsage)) } + attr_reader :usage + + sig { params(usage: T.nilable(OpenAI::Beta::TokenUsage::OrHash)).void } + attr_writer :usage + + # The IDs of vaults made available to the session. + sig { returns(T::Array[String]) } + attr_accessor :vault_ids + + # A Managed Agents session. + sig do + params( + + id: String, + + agent: OpenAI::Beta::AgentSession::Agent::OrHash, + + created_at: Integer, + + environment: T.any( + OpenAI::Beta::Environment::None::OrHash, + OpenAI::Beta::Environment::OpenAIHosted::OrHash, + OpenAI::Beta::Environment::SelfHosted::OrHash + ), + + error: T.nilable(String), + + last_active_at: Integer, + + metadata: T::Hash[Symbol, String], + + required_actions: T::Array[ + T.any( + OpenAI::Beta::AgentSession::RequiredAction::FunctionCall::OrHash, + OpenAI::Beta::AgentSession::RequiredAction::EnvironmentConnection::OrHash + ) + ], + + status: OpenAI::Beta::AgentSession::Status::OrSymbol, + + usage: T.nilable(OpenAI::Beta::TokenUsage::OrHash), + + vault_ids: T::Array[String], + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the session. + id:, + + # The agent running in the session. + agent:, + + # The Unix timestamp, in seconds, when the session was created. + created_at:, + + # The execution environment for the session. + environment:, + + # The error that caused the session to fail, if any. + error:, + + # The Unix timestamp, in seconds, when the session was last active. + last_active_at:, + + # Custom string key-value pairs attached to the session. + metadata:, + + # Actions that must be completed before the session can continue. + required_actions:, + + # The current status of the session. + status:, + + # Recorded token usage for a session or turn. Usage is best effort and may change. + usage:, + + # The IDs of vaults made available to the session. + vault_ids:, + + # The object type. Always `agent.session`. + + object: :"agent.session" + ) + end + + sig do + override.returns( + { + id: String, + agent: OpenAI::Beta::AgentSession::Agent, + created_at: Integer, + environment: OpenAI::Beta::Environment::Variants, + error: T.nilable(String), + last_active_at: Integer, + metadata: T::Hash[Symbol, String], + object: Symbol, + required_actions: T::Array[OpenAI::Beta::AgentSession::RequiredAction::Variants], + status: OpenAI::Beta::AgentSession::Status::TaggedSymbol, + usage: T.nilable(OpenAI::Beta::TokenUsage), + vault_ids: T::Array[String] + } + ) + end + def to_hash + end + + class Agent < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSession::Agent, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the agent. + sig { returns(String) } + attr_accessor :id + + # Custom instructions appended to the agent's default base instructions. + sig { returns(T.nilable(String)) } + attr_accessor :instructions + + # The model used by the agent. + sig { returns(String) } + attr_accessor :model + + # Configuration for creating and coordinating subagents. + sig { returns(OpenAI::Beta::MultiAgentConfig) } + attr_reader :multi_agent + + sig { params(multi_agent: OpenAI::Beta::MultiAgentConfig::OrHash).void } + attr_writer :multi_agent + + # The reusable agent's name when the session was created, or null if no name was + # saved. Later changes to the agent's name do not affect this value. + sig { returns(T.nilable(String)) } + attr_accessor :name + + # The agent's reasoning configuration. + sig { returns(OpenAI::Beta::AgentReasoning) } + attr_reader :reasoning + + sig { params(reasoning: OpenAI::Beta::AgentReasoning::OrHash).void } + attr_writer :reasoning + + # The effective service-tier policy for model requests. Defaults to `auto`. + sig { returns(OpenAI::Beta::AgentSession::Agent::ServiceTier::TaggedSymbol) } + attr_accessor :service_tier + + # Configuration for text generated by the agent. + sig { returns(OpenAI::Beta::AgentText) } + attr_reader :text + + sig { params(text: OpenAI::Beta::AgentText::OrHash).void } + attr_writer :text + + # Tools available to the agent. + sig { returns(T::Array[OpenAI::Beta::AgentTool::Variants]) } + attr_accessor :tools + + # The agent running in the session. + sig do + params( + + id: String, + + instructions: T.nilable(String), + + model: String, + + multi_agent: OpenAI::Beta::MultiAgentConfig::OrHash, + + name: T.nilable(String), + + reasoning: OpenAI::Beta::AgentReasoning::OrHash, + + service_tier: OpenAI::Beta::AgentSession::Agent::ServiceTier::OrSymbol, + + text: OpenAI::Beta::AgentText::OrHash, + + tools: T::Array[ + T.any( + OpenAI::Beta::AgentTool::Function::OrHash, + OpenAI::Beta::AgentTool::ProgrammaticToolCalling::OrHash, + OpenAI::Beta::AgentTool::Mcp::OrHash, + OpenAI::Beta::AgentTool::WebSearch::OrHash + ) + ] + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the agent. + id:, + + # Custom instructions appended to the agent's default base instructions. + instructions:, + + # The model used by the agent. + model:, + + # Configuration for creating and coordinating subagents. + multi_agent:, + + # The reusable agent's name when the session was created, or null if no name was + # saved. Later changes to the agent's name do not affect this value. + name:, + + # The agent's reasoning configuration. + reasoning:, + + # The effective service-tier policy for model requests. Defaults to `auto`. + service_tier:, + + # Configuration for text generated by the agent. + text:, + + # Tools available to the agent. + + tools: + ) + end + + sig do + override.returns( + { + id: String, + instructions: T.nilable(String), + model: String, + multi_agent: OpenAI::Beta::MultiAgentConfig, + name: T.nilable(String), + reasoning: OpenAI::Beta::AgentReasoning, + service_tier: OpenAI::Beta::AgentSession::Agent::ServiceTier::TaggedSymbol, + text: OpenAI::Beta::AgentText, + tools: T::Array[OpenAI::Beta::AgentTool::Variants] + } + ) + end + def to_hash + end + + # The effective service-tier policy for model requests. Defaults to `auto`. + module ServiceTier + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentSession::Agent::ServiceTier) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + AUTO = T.let(:auto, OpenAI::Beta::AgentSession::Agent::ServiceTier::TaggedSymbol) + DEFAULT = T.let(:default, OpenAI::Beta::AgentSession::Agent::ServiceTier::TaggedSymbol) + FLEX = T.let(:flex, OpenAI::Beta::AgentSession::Agent::ServiceTier::TaggedSymbol) + PRIORITY = T.let(:priority, OpenAI::Beta::AgentSession::Agent::ServiceTier::TaggedSymbol) + FAST = T.let(:fast, OpenAI::Beta::AgentSession::Agent::ServiceTier::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentSession::Agent::ServiceTier::TaggedSymbol]) } + def self.values + end + end + end + + # An action that must be completed before a session can continue. + module RequiredAction + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any( + OpenAI::Beta::AgentSession::RequiredAction::FunctionCall, + OpenAI::Beta::AgentSession::RequiredAction::EnvironmentConnection + ) + } + + class FunctionCall < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSession::RequiredAction::FunctionCall, + OpenAI::Internal::AnyHash + ) + end + + # The arguments supplied by the model. + sig { returns(T.anything) } + attr_accessor :arguments + + # The ID to include when submitting the function result. + sig { returns(String) } + attr_accessor :call_id + + # The function name. + sig { returns(String) } + attr_accessor :name + + # The ID of the turn that requested the function call. + sig { returns(String) } + attr_accessor :turn_id + + # The type of the object. Always `function_call`. + sig { returns(Symbol) } + attr_accessor :type + + # Run a function tool and submit its result. + sig do + params( + + arguments: T.anything, + + call_id: String, + + name: String, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The arguments supplied by the model. + arguments:, + + # The ID to include when submitting the function result. + call_id:, + + # The function name. + name:, + + # The ID of the turn that requested the function call. + turn_id:, + + # The type of the object. Always `function_call`. + + type: :function_call + ) + end + + sig do + override.returns( + {arguments: T.anything, call_id: String, name: String, turn_id: String, type: Symbol} + ) + end + def to_hash + end + + end + + class EnvironmentConnection < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSession::RequiredAction::EnvironmentConnection, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the environment to reconnect. + sig { returns(String) } + attr_accessor :environment_id + + # The type of the object. Always `environment_connection`. + sig { returns(Symbol) } + attr_accessor :type + + # Reconnect a session environment. + sig do + params( + + environment_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the environment to reconnect. + environment_id:, + + # The type of the object. Always `environment_connection`. + + type: :environment_connection + ) + end + + sig do + override.returns( + {environment_id: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::AgentSession::RequiredAction::Variants]) } + def self.variants + end + + end + + # The current status of the session. + module Status + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentSession::Status) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # The session has no turn in progress and is ready for input. A hosted environment may still be provisioning. + IDLE = T.let(:idle, OpenAI::Beta::AgentSession::Status::TaggedSymbol) + + # The session is processing a turn. + IN_PROGRESS = T.let(:in_progress, OpenAI::Beta::AgentSession::Status::TaggedSymbol) + + # The session is waiting for one or more required actions. + REQUIRES_ACTION = T.let(:requires_action, OpenAI::Beta::AgentSession::Status::TaggedSymbol) + + # The session failed. + FAILED = T.let(:failed, OpenAI::Beta::AgentSession::Status::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentSession::Status::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_assistant_message.rbi b/rbi/openai/models/beta/agent_session_assistant_message.rbi new file mode 100644 index 000000000..e78ee76f0 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_assistant_message.rbi @@ -0,0 +1,130 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionAssistantMessage < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionAssistantMessage, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the message. + sig { returns(String) } + attr_accessor :id + + # The content of the message. + sig { returns(T::Array[OpenAI::Beta::OutputText]) } + attr_accessor :content + + # The phase of an assistant message. + sig { returns(T.nilable(OpenAI::Beta::AgentSessionAssistantMessage::Phase::TaggedSymbol)) } + attr_accessor :phase + + # The role of the message author. Always `assistant`. + sig { returns(Symbol) } + attr_accessor :role + + # The status of the message. + sig { returns(OpenAI::Beta::AgentOutputItemStatus::TaggedSymbol) } + attr_accessor :status + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `message`. + sig { returns(Symbol) } + attr_accessor :type + + # An assistant message produced by the agent. + sig do + params( + + id: String, + + content: T::Array[OpenAI::Beta::OutputText::OrHash], + + phase: T.nilable(OpenAI::Beta::AgentSessionAssistantMessage::Phase::OrSymbol), + + status: OpenAI::Beta::AgentOutputItemStatus::OrSymbol, + + turn_id: String, + + role: Symbol, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the message. + id:, + + # The content of the message. + content:, + + # The phase of an assistant message. + phase:, + + # The status of the message. + status:, + + # The ID of the turn that contains this item. + turn_id:, + + # The role of the message author. Always `assistant`. + role: :assistant, + + # The item type. Always `message`. + + type: :message + ) + end + + sig do + override.returns( + { + id: String, + content: T::Array[OpenAI::Beta::OutputText], + phase: T.nilable(OpenAI::Beta::AgentSessionAssistantMessage::Phase::TaggedSymbol), + role: Symbol, + status: OpenAI::Beta::AgentOutputItemStatus::TaggedSymbol, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + # The phase of an assistant message. + module Phase + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentSessionAssistantMessage::Phase) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Commentary produced while the agent works. + COMMENTARY = T.let(:commentary, OpenAI::Beta::AgentSessionAssistantMessage::Phase::TaggedSymbol) + + # The agent's final answer. + FINAL_ANSWER = T.let(:final_answer, OpenAI::Beta::AgentSessionAssistantMessage::Phase::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentSessionAssistantMessage::Phase::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_created_event.rbi b/rbi/openai/models/beta/agent_session_created_event.rbi new file mode 100644 index 000000000..c2408db09 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_created_event.rbi @@ -0,0 +1,71 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionCreatedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionCreatedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The session that was created. + sig { returns(OpenAI::Beta::AgentSession) } + attr_reader :session + + sig { params(session: OpenAI::Beta::AgentSession::OrHash).void } + attr_writer :session + + # The type of the object. Always `agent.session.created`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a session is created. + sig do + params( + + event_id: String, + + session: OpenAI::Beta::AgentSession::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The session that was created. + session:, + + # The type of the object. Always `agent.session.created`. + + type: :"agent.session.created" + ) + end + + sig do + override.returns( + {event_id: String, session: OpenAI::Beta::AgentSession, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_deleted.rbi b/rbi/openai/models/beta/agent_session_deleted.rbi new file mode 100644 index 000000000..cb53222f7 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_deleted.rbi @@ -0,0 +1,71 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionDeleted < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionDeleted, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the deleted session. + sig { returns(String) } + attr_accessor :id + + # Whether the session has been removed from the public API. Always `true`. + # Physical cleanup may still be in progress. + sig { returns(T::Boolean) } + attr_accessor :deleted + + # The object type. Always `agent.session.deleted`. + sig { returns(Symbol) } + attr_accessor :object + + # A Managed Agents session removed from the public API. Physical cleanup may + # continue asynchronously. + sig do + params( + + id: String, + + deleted: T::Boolean, + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the deleted session. + id:, + + # Whether the session has been removed from the public API. Always `true`. + # Physical cleanup may still be in progress. + deleted:, + + # The object type. Always `agent.session.deleted`. + + object: :"agent.session.deleted" + ) + end + + sig do + override.returns( + {id: String, deleted: T::Boolean, object: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_environment_connected_event.rbi b/rbi/openai/models/beta/agent_session_environment_connected_event.rbi new file mode 100644 index 000000000..73852458f --- /dev/null +++ b/rbi/openai/models/beta/agent_session_environment_connected_event.rbi @@ -0,0 +1,95 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionEnvironmentConnectedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionEnvironmentConnectedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The current environment state. + sig { returns(OpenAI::Beta::AgentSessionEnvironmentState) } + attr_reader :environment + + sig { params(environment: OpenAI::Beta::AgentSessionEnvironmentState::OrHash).void } + attr_writer :environment + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.environment.connected`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a session environment connects. + sig do + params( + + environment: OpenAI::Beta::AgentSessionEnvironmentState::OrHash, + + event_id: String, + + session_id: String, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The current environment state. + environment:, + + # The unique ID of the event. + event_id:, + + # The ID of the session associated with the event. + session_id:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always `agent.session.environment.connected`. + + type: :"agent.session.environment.connected" + ) + end + + sig do + override.returns( + { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_environment_disconnected_event.rbi b/rbi/openai/models/beta/agent_session_environment_disconnected_event.rbi new file mode 100644 index 000000000..bd44f2cd8 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_environment_disconnected_event.rbi @@ -0,0 +1,95 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionEnvironmentDisconnectedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionEnvironmentDisconnectedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The current environment state. + sig { returns(OpenAI::Beta::AgentSessionEnvironmentState) } + attr_reader :environment + + sig { params(environment: OpenAI::Beta::AgentSessionEnvironmentState::OrHash).void } + attr_writer :environment + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.environment.disconnected`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a session environment disconnects. + sig do + params( + + environment: OpenAI::Beta::AgentSessionEnvironmentState::OrHash, + + event_id: String, + + session_id: String, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The current environment state. + environment:, + + # The unique ID of the event. + event_id:, + + # The ID of the session associated with the event. + session_id:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always `agent.session.environment.disconnected`. + + type: :"agent.session.environment.disconnected" + ) + end + + sig do + override.returns( + { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_environment_failed_event.rbi b/rbi/openai/models/beta/agent_session_environment_failed_event.rbi new file mode 100644 index 000000000..3eee9bd5d --- /dev/null +++ b/rbi/openai/models/beta/agent_session_environment_failed_event.rbi @@ -0,0 +1,95 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionEnvironmentFailedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionEnvironmentFailedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The current environment state. + sig { returns(OpenAI::Beta::AgentSessionEnvironmentState) } + attr_reader :environment + + sig { params(environment: OpenAI::Beta::AgentSessionEnvironmentState::OrHash).void } + attr_writer :environment + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.environment.failed`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a session environment fails. + sig do + params( + + environment: OpenAI::Beta::AgentSessionEnvironmentState::OrHash, + + event_id: String, + + session_id: String, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The current environment state. + environment:, + + # The unique ID of the event. + event_id:, + + # The ID of the session associated with the event. + session_id:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always `agent.session.environment.failed`. + + type: :"agent.session.environment.failed" + ) + end + + sig do + override.returns( + { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_environment_pending_event.rbi b/rbi/openai/models/beta/agent_session_environment_pending_event.rbi new file mode 100644 index 000000000..3f5e88b66 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_environment_pending_event.rbi @@ -0,0 +1,95 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionEnvironmentPendingEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionEnvironmentPendingEvent, + OpenAI::Internal::AnyHash + ) + end + + # The current environment state. + sig { returns(OpenAI::Beta::AgentSessionEnvironmentState) } + attr_reader :environment + + sig { params(environment: OpenAI::Beta::AgentSessionEnvironmentState::OrHash).void } + attr_writer :environment + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.environment.pending`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted while a session environment is being prepared. + sig do + params( + + environment: OpenAI::Beta::AgentSessionEnvironmentState::OrHash, + + event_id: String, + + session_id: String, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The current environment state. + environment:, + + # The unique ID of the event. + event_id:, + + # The ID of the session associated with the event. + session_id:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always `agent.session.environment.pending`. + + type: :"agent.session.environment.pending" + ) + end + + sig do + override.returns( + { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_environment_ready_event.rbi b/rbi/openai/models/beta/agent_session_environment_ready_event.rbi new file mode 100644 index 000000000..fa4602d52 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_environment_ready_event.rbi @@ -0,0 +1,95 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionEnvironmentReadyEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionEnvironmentReadyEvent, + OpenAI::Internal::AnyHash + ) + end + + # The current environment state. + sig { returns(OpenAI::Beta::AgentSessionEnvironmentState) } + attr_reader :environment + + sig { params(environment: OpenAI::Beta::AgentSessionEnvironmentState::OrHash).void } + attr_writer :environment + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.environment.ready`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a hosted session environment is ready to connect. + sig do + params( + + environment: OpenAI::Beta::AgentSessionEnvironmentState::OrHash, + + event_id: String, + + session_id: String, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The current environment state. + environment:, + + # The unique ID of the event. + event_id:, + + # The ID of the session associated with the event. + session_id:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always `agent.session.environment.ready`. + + type: :"agent.session.environment.ready" + ) + end + + sig do + override.returns( + { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_environment_state.rbi b/rbi/openai/models/beta/agent_session_environment_state.rbi new file mode 100644 index 000000000..4e8617a09 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_environment_state.rbi @@ -0,0 +1,168 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionEnvironmentState < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionEnvironmentState, + OpenAI::Internal::AnyHash + ) + end + + # The public ID of the environment. + sig { returns(String) } + attr_accessor :id + + # An error reported while preparing a session environment. + sig { returns(T.nilable(OpenAI::Beta::AgentSessionEnvironmentState::Error)) } + attr_reader :error + + sig { params(error: T.nilable(OpenAI::Beta::AgentSessionEnvironmentState::Error::OrHash)).void } + attr_writer :error + + # The environment's connection status. + sig { returns(OpenAI::Beta::AgentSessionEnvironmentState::Status::TaggedSymbol) } + attr_accessor :status + + # The environment type. + sig { returns(String) } + attr_accessor :type + + # The current state of a session environment. + sig do + params( + + id: String, + + error: T.nilable(OpenAI::Beta::AgentSessionEnvironmentState::Error::OrHash), + + status: OpenAI::Beta::AgentSessionEnvironmentState::Status::OrSymbol, + + type: String + ) + .returns(T.attached_class) + end + def self.new( + + # The public ID of the environment. + id:, + + # An error reported while preparing a session environment. + error:, + + # The environment's connection status. + status:, + + # The environment type. + + type: + ) + end + + sig do + override.returns( + { + id: String, + error: T.nilable(OpenAI::Beta::AgentSessionEnvironmentState::Error), + status: OpenAI::Beta::AgentSessionEnvironmentState::Status::TaggedSymbol, + type: String + } + ) + end + def to_hash + end + + class Error < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionEnvironmentState::Error, + OpenAI::Internal::AnyHash + ) + end + + # A machine-readable error code. + sig { returns(String) } + attr_accessor :code + + # A human-readable error message. + sig { returns(String) } + attr_accessor :message + + # The error type. + sig { returns(String) } + attr_accessor :type + + # An error reported while preparing a session environment. + sig do + params( + + code: String, + + message: String, + + type: String + ) + .returns(T.attached_class) + end + def self.new( + + # A machine-readable error code. + code:, + + # A human-readable error message. + message:, + + # The error type. + + type: + ) + end + + sig do + override.returns( + {code: String, message: String, type: String} + ) + end + def to_hash + end + + end + + # The environment's connection status. + module Status + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentSessionEnvironmentState::Status) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # The environment is being prepared. + PENDING = T.let(:pending, OpenAI::Beta::AgentSessionEnvironmentState::Status::TaggedSymbol) + + # The environment is ready to connect. + READY = T.let(:ready, OpenAI::Beta::AgentSessionEnvironmentState::Status::TaggedSymbol) + + # The environment is connected. + CONNECTED = T.let(:connected, OpenAI::Beta::AgentSessionEnvironmentState::Status::TaggedSymbol) + + # The environment is disconnected. + DISCONNECTED = T.let(:disconnected, OpenAI::Beta::AgentSessionEnvironmentState::Status::TaggedSymbol) + + # The environment failed to connect. + FAILED = T.let(:failed, OpenAI::Beta::AgentSessionEnvironmentState::Status::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentSessionEnvironmentState::Status::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_error_event.rbi b/rbi/openai/models/beta/agent_session_error_event.rbi new file mode 100644 index 000000000..2568c72e7 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_error_event.rbi @@ -0,0 +1,80 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionErrorEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionErrorEvent, + OpenAI::Internal::AnyHash + ) + end + + # The error that occurred. + sig { returns(OpenAI::Beta::SessionError) } + attr_reader :error + + sig { params(error: OpenAI::Beta::SessionError::OrHash).void } + attr_writer :error + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The type of the object. Always `error`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a turn or session fails. + sig do + params( + + error: OpenAI::Beta::SessionError::OrHash, + + event_id: String, + + session_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The error that occurred. + error:, + + # The unique ID of the event. + event_id:, + + # The ID of the session associated with the event. + session_id:, + + # The type of the object. Always `error`. + + type: :error + ) + end + + sig do + override.returns( + {error: OpenAI::Beta::SessionError, event_id: String, session_id: String, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_event.rbi b/rbi/openai/models/beta/agent_session_event.rbi new file mode 100644 index 000000000..abadc3bb1 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_event.rbi @@ -0,0 +1,56 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # An event emitted by a Managed Agents session. + module AgentSessionEvent + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionErrorEvent, + OpenAI::Beta::AgentSessionEnvironmentReadyEvent, + OpenAI::Beta::AgentOutputCommandExecutionOutputDeltaEvent, + OpenAI::Beta::AgentSessionCreatedEvent, + OpenAI::Beta::AgentSessionTurnCreatedEvent, + OpenAI::Beta::AgentSessionTurnInProgressEvent, + OpenAI::Beta::AgentSessionTurnCompletedEvent, + OpenAI::Beta::AgentSessionTurnFailedEvent, + OpenAI::Beta::AgentSessionTurnCancelledEvent, + OpenAI::Beta::AgentSessionTurnItemAddedEvent, + OpenAI::Beta::AgentSessionIdleEvent, + OpenAI::Beta::AgentSessionInProgressEvent, + OpenAI::Beta::AgentSessionRequiresActionEvent, + OpenAI::Beta::AgentSessionFailedEvent, + OpenAI::Beta::AgentSessionEnvironmentPendingEvent, + OpenAI::Beta::AgentSessionEnvironmentConnectedEvent, + OpenAI::Beta::AgentSessionEnvironmentDisconnectedEvent, + OpenAI::Beta::AgentSessionEnvironmentFailedEvent, + OpenAI::Beta::AgentSessionSubagentCreatedEvent, + OpenAI::Beta::AgentSessionSubagentActiveEvent, + OpenAI::Beta::AgentSessionSubagentClosedEvent, + OpenAI::Beta::AgentSessionTurnItemDoneEvent, + OpenAI::Beta::AgentSessionTurnContentPartAddedEvent, + OpenAI::Beta::AgentSessionTurnContentPartDoneEvent, + OpenAI::Beta::AgentSessionTurnOutputTextDeltaEvent, + OpenAI::Beta::AgentSessionTurnOutputTextDoneEvent, + OpenAI::Beta::AgentSessionTurnReasoningSummaryPartAddedEvent, + OpenAI::Beta::AgentSessionTurnReasoningSummaryPartDoneEvent, + OpenAI::Beta::AgentSessionTurnReasoningSummaryTextDeltaEvent, + OpenAI::Beta::AgentSessionTurnReasoningSummaryTextDoneEvent + ) + end + + sig { override.returns(T::Array[OpenAI::Beta::AgentSessionEvent::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_failed_event.rbi b/rbi/openai/models/beta/agent_session_failed_event.rbi new file mode 100644 index 000000000..141afb19a --- /dev/null +++ b/rbi/openai/models/beta/agent_session_failed_event.rbi @@ -0,0 +1,71 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionFailedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionFailedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The failed session. + sig { returns(OpenAI::Beta::AgentSession) } + attr_reader :session + + sig { params(session: OpenAI::Beta::AgentSession::OrHash).void } + attr_writer :session + + # The type of the object. Always `agent.session.failed`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a session fails. + sig do + params( + + event_id: String, + + session: OpenAI::Beta::AgentSession::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The failed session. + session:, + + # The type of the object. Always `agent.session.failed`. + + type: :"agent.session.failed" + ) + end + + sig do + override.returns( + {event_id: String, session: OpenAI::Beta::AgentSession, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_idle_event.rbi b/rbi/openai/models/beta/agent_session_idle_event.rbi new file mode 100644 index 000000000..bf50441cc --- /dev/null +++ b/rbi/openai/models/beta/agent_session_idle_event.rbi @@ -0,0 +1,71 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionIdleEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionIdleEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The session that became idle. + sig { returns(OpenAI::Beta::AgentSession) } + attr_reader :session + + sig { params(session: OpenAI::Beta::AgentSession::OrHash).void } + attr_writer :session + + # The type of the object. Always `agent.session.idle`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a session becomes idle. + sig do + params( + + event_id: String, + + session: OpenAI::Beta::AgentSession::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The session that became idle. + session:, + + # The type of the object. Always `agent.session.idle`. + + type: :"agent.session.idle" + ) + end + + sig do + override.returns( + {event_id: String, session: OpenAI::Beta::AgentSession, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_in_progress_event.rbi b/rbi/openai/models/beta/agent_session_in_progress_event.rbi new file mode 100644 index 000000000..dce073559 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_in_progress_event.rbi @@ -0,0 +1,71 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionInProgressEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionInProgressEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The session that started processing. + sig { returns(OpenAI::Beta::AgentSession) } + attr_reader :session + + sig { params(session: OpenAI::Beta::AgentSession::OrHash).void } + attr_writer :session + + # The type of the object. Always `agent.session.in_progress`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a session starts processing a turn. + sig do + params( + + event_id: String, + + session: OpenAI::Beta::AgentSession::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The session that started processing. + session:, + + # The type of the object. Always `agent.session.in_progress`. + + type: :"agent.session.in_progress" + ) + end + + sig do + override.returns( + {event_id: String, session: OpenAI::Beta::AgentSession, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_input_message_param.rbi b/rbi/openai/models/beta/agent_session_input_message_param.rbi new file mode 100644 index 000000000..6e75eb578 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_input_message_param.rbi @@ -0,0 +1,100 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionInputMessageParam < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionInputMessageParam, + OpenAI::Internal::AnyHash + ) + end + + # The content of the message. + sig { + returns( + T::Array[T.any(OpenAI::Beta::InputContentParam::InputText, OpenAI::Beta::InputContentParam::InputImage)] + ) + } + attr_accessor :content + + # The role of the message author. Always `user`. + sig { returns(Symbol) } + attr_accessor :role + + # The type of the input item. Always `message`. + sig { returns(T.nilable(OpenAI::Beta::AgentSessionInputMessageParam::Type::OrSymbol)) } + attr_reader :type + + sig { params(type: OpenAI::Beta::AgentSessionInputMessageParam::Type::OrSymbol).void } + attr_writer :type + + # A user message submitted to a session. + sig do + params( + + content: T::Array[ + T.any( + OpenAI::Beta::InputContentParam::InputText::OrHash, + OpenAI::Beta::InputContentParam::InputImage::OrHash + ) + ], + + type: OpenAI::Beta::AgentSessionInputMessageParam::Type::OrSymbol, + + role: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The content of the message. + content:, + + # The type of the input item. Always `message`. + type: nil, + + # The role of the message author. Always `user`. + + role: :user + ) + end + + sig do + override.returns( + { + content: T::Array[ + T.any(OpenAI::Beta::InputContentParam::InputText, OpenAI::Beta::InputContentParam::InputImage) + ], + role: Symbol, + type: OpenAI::Beta::AgentSessionInputMessageParam::Type::OrSymbol + } + ) + end + def to_hash + end + + # The type of the input item. Always `message`. + module Type + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentSessionInputMessageParam::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + MESSAGE = T.let(:message, OpenAI::Beta::AgentSessionInputMessageParam::Type::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentSessionInputMessageParam::Type::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_input_param.rbi b/rbi/openai/models/beta/agent_session_input_param.rbi new file mode 100644 index 000000000..5796843d8 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_input_param.rbi @@ -0,0 +1,232 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # Input submitted to an existing session. + module AgentSessionInputParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputMessage, + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputCancel, + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputToolResult + ) + end + + class AgentSessionInputMessage < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputMessage, + OpenAI::Internal::AnyHash + ) + end + + # The user messages to add to the session. + sig { returns(T::Array[OpenAI::Beta::AgentSessionInputMessageParam]) } + attr_accessor :input + + # The type of the object. Always `agent.session.input.message`. + sig { returns(Symbol) } + attr_accessor :type + + # Adds one or more user messages and starts a turn. + sig do + params( + + input: T::Array[OpenAI::Beta::AgentSessionInputMessageParam::OrHash], + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The user messages to add to the session. + input:, + + # The type of the object. Always `agent.session.input.message`. + + type: :"agent.session.input.message" + ) + end + + sig do + override.returns( + {input: T::Array[OpenAI::Beta::AgentSessionInputMessageParam], type: Symbol} + ) + end + def to_hash + end + + end + + class AgentSessionInputCancel < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputCancel, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `agent.session.input.cancel`. + sig { returns(Symbol) } + attr_accessor :type + + # Cancels the session's active turn. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The type of the object. Always `agent.session.input.cancel`. + + type: :"agent.session.input.cancel" + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + class AgentSessionInputToolResult < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputToolResult, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the function call. + sig { returns(String) } + attr_accessor :call_id + + # Whether the function call succeeded. + sig { returns(T::Boolean) } + attr_accessor :success + + # The ID of the turn that requested the function call. + sig { returns(String) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.input.tool_result`. + sig { returns(Symbol) } + attr_accessor :type + + # The error message when the call failed. + sig { returns(T.nilable(String)) } + attr_accessor :error + + # A function result represented as text or supported model-input content. + sig { + returns( + T.nilable( + T.any( + String, + T::Array[ + T.any(OpenAI::Beta::InputContentParam::InputText, OpenAI::Beta::InputContentParam::InputImage) + ] + ) + ) + ) + } + attr_accessor :output + + # Submits the result of a function call. + sig do + params( + + call_id: String, + + success: T::Boolean, + + turn_id: String, + + error: T.nilable(String), + + output: T.nilable( + T.any( + String, + T::Array[ + T.any( + OpenAI::Beta::InputContentParam::InputText::OrHash, + OpenAI::Beta::InputContentParam::InputImage::OrHash + ) + ] + ) + ), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the function call. + call_id:, + + # Whether the function call succeeded. + success:, + + # The ID of the turn that requested the function call. + turn_id:, + + # The error message when the call failed. + error: nil, + + # A function result represented as text or supported model-input content. + output: nil, + + # The type of the object. Always `agent.session.input.tool_result`. + + type: :"agent.session.input.tool_result" + ) + end + + sig do + override.returns( + { + call_id: String, + success: T::Boolean, + turn_id: String, + type: Symbol, + error: T.nilable(String), + output: T.nilable( + T.any( + String, + T::Array[ + T.any(OpenAI::Beta::InputContentParam::InputText, OpenAI::Beta::InputContentParam::InputImage) + ] + ) + ) + } + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::AgentSessionInputParam::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_item.rbi b/rbi/openai/models/beta/agent_session_item.rbi new file mode 100644 index 000000000..2ca284411 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_item.rbi @@ -0,0 +1,239 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # An item associated with a session turn. + module AgentSessionItem + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionMessage, + OpenAI::Beta::AgentReasoningItem, + OpenAI::Beta::AgentFunctionCallItem, + OpenAI::Beta::AgentSessionItem::FunctionCallOutput, + OpenAI::Beta::AgentSessionItem::AgentMessage, + OpenAI::Beta::AgentMcpCallItem, + OpenAI::Beta::AgentWebSearchCallItem, + OpenAI::Beta::AgentCommandExecutionItem, + OpenAI::Beta::AgentCreateSubagentCallItem, + OpenAI::Beta::AgentSendSubagentInputCallItem, + OpenAI::Beta::AgentResumeSubagentCallItem, + OpenAI::Beta::AgentWaitForSubagentsCallItem, + OpenAI::Beta::AgentInterruptSubagentCallItem, + OpenAI::Beta::AgentCloseSubagentCallItem + ) + end + + class FunctionCallOutput < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionItem::FunctionCallOutput, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the function call output item. + sig { returns(String) } + attr_accessor :id + + # The ID of the function call that produced this output. + sig { returns(String) } + attr_accessor :call_id + + # The error message, if the call failed. + sig { returns(T.nilable(String)) } + attr_accessor :error + + # The text or model-input content supplied as a function result. + sig { returns(T.nilable(OpenAI::Beta::AgentFunctionCallOutput::Variants)) } + attr_accessor :output + + # The status of the function call. + sig { returns(OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) } + attr_accessor :status + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `function_call_output`. + sig { returns(Symbol) } + attr_accessor :type + + # The result supplied for a function call. + sig do + params( + + id: String, + + call_id: String, + + error: T.nilable(String), + + output: T.nilable( + T.any( + String, + T::Array[ + T.any(OpenAI::Beta::InputContent::InputText::OrHash, OpenAI::Beta::InputContent::InputImage::OrHash) + ] + ) + ), + + status: OpenAI::Beta::AgentFunctionCallStatus::OrSymbol, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the function call output item. + id:, + + # The ID of the function call that produced this output. + call_id:, + + # The error message, if the call failed. + error:, + + # The text or model-input content supplied as a function result. + output:, + + # The status of the function call. + status:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `function_call_output`. + + type: :function_call_output + ) + end + + sig do + override.returns( + { + id: String, + call_id: String, + error: T.nilable(String), + output: T.nilable(OpenAI::Beta::AgentFunctionCallOutput::Variants), + status: OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + class AgentMessage < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionItem::AgentMessage, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the message. + sig { returns(String) } + attr_accessor :id + + # The content exchanged between the agents. + sig { returns(T::Array[OpenAI::Beta::AgentContent::Variants]) } + attr_accessor :content + + # The ID or name of the receiving agent. + sig { returns(String) } + attr_accessor :recipient_agent_id + + # The ID or name of the sending agent. + sig { returns(String) } + attr_accessor :sender_agent_id + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `agent_message`. + sig { returns(Symbol) } + attr_accessor :type + + # A message exchanged between agent threads. + sig do + params( + + id: String, + + content: T::Array[ + T.any(OpenAI::Beta::OutputText::OrHash, OpenAI::Beta::AgentContent::EncryptedContent::OrHash) + ], + + recipient_agent_id: String, + + sender_agent_id: String, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the message. + id:, + + # The content exchanged between the agents. + content:, + + # The ID or name of the receiving agent. + recipient_agent_id:, + + # The ID or name of the sending agent. + sender_agent_id:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `agent_message`. + + type: :agent_message + ) + end + + sig do + override.returns( + { + id: String, + content: T::Array[OpenAI::Beta::AgentContent::Variants], + recipient_agent_id: String, + sender_agent_id: String, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::AgentSessionItem::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_message.rbi b/rbi/openai/models/beta/agent_session_message.rbi new file mode 100644 index 000000000..d4ff48099 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_message.rbi @@ -0,0 +1,153 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionMessage < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionMessage, + OpenAI::Internal::AnyHash + ) + end + + # The ID of this item, or null for legacy user messages whose ID was not recorded. + sig { returns(T.nilable(String)) } + attr_accessor :id + + # The content of the message. User messages contain input text or images; + # assistant messages contain output text. + sig { returns(T::Array[OpenAI::Beta::AgentSessionMessageContent::Variants]) } + attr_accessor :content + + # The phase of an assistant message. + sig { returns(T.nilable(OpenAI::Beta::AgentSessionMessage::Phase::TaggedSymbol)) } + attr_accessor :phase + + # The role of the message author. + sig { returns(OpenAI::Beta::AgentSessionMessage::Role::TaggedSymbol) } + attr_accessor :role + + # The status of the message. User messages are always `completed`. + sig { returns(OpenAI::Beta::AgentOutputItemStatus::TaggedSymbol) } + attr_accessor :status + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `message`. + sig { returns(Symbol) } + attr_accessor :type + + # A user or assistant message recorded in a session. + sig do + params( + + id: T.nilable(String), + + content: T::Array[ + T.any( + OpenAI::Beta::AgentSessionMessageContent::InputText::OrHash, + OpenAI::Beta::AgentSessionMessageContent::InputImage::OrHash, + OpenAI::Beta::AgentSessionMessageContent::OutputText::OrHash + ) + ], + + phase: T.nilable(OpenAI::Beta::AgentSessionMessage::Phase::OrSymbol), + + role: OpenAI::Beta::AgentSessionMessage::Role::OrSymbol, + + status: OpenAI::Beta::AgentOutputItemStatus::OrSymbol, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of this item, or null for legacy user messages whose ID was not recorded. + id:, + + # The content of the message. User messages contain input text or images; + # assistant messages contain output text. + content:, + + # The phase of an assistant message. + phase:, + + # The role of the message author. + role:, + + # The status of the message. User messages are always `completed`. + status:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `message`. + + type: :message + ) + end + + sig do + override.returns( + { + id: T.nilable(String), + content: T::Array[OpenAI::Beta::AgentSessionMessageContent::Variants], + phase: T.nilable(OpenAI::Beta::AgentSessionMessage::Phase::TaggedSymbol), + role: OpenAI::Beta::AgentSessionMessage::Role::TaggedSymbol, + status: OpenAI::Beta::AgentOutputItemStatus::TaggedSymbol, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + # The phase of an assistant message. + module Phase + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentSessionMessage::Phase) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Commentary produced while the agent works. + COMMENTARY = T.let(:commentary, OpenAI::Beta::AgentSessionMessage::Phase::TaggedSymbol) + + # The agent's final answer. + FINAL_ANSWER = T.let(:final_answer, OpenAI::Beta::AgentSessionMessage::Phase::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentSessionMessage::Phase::TaggedSymbol]) } + def self.values + end + end + + # The role of the message author. + module Role + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentSessionMessage::Role) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + USER = T.let(:user, OpenAI::Beta::AgentSessionMessage::Role::TaggedSymbol) + ASSISTANT = T.let(:assistant, OpenAI::Beta::AgentSessionMessage::Role::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentSessionMessage::Role::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_message_content.rbi b/rbi/openai/models/beta/agent_session_message_content.rbi new file mode 100644 index 000000000..0939d0cc3 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_message_content.rbi @@ -0,0 +1,172 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # A content part in a session message. + module AgentSessionMessageContent + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionMessageContent::InputText, + OpenAI::Beta::AgentSessionMessageContent::InputImage, + OpenAI::Beta::AgentSessionMessageContent::OutputText + ) + end + + class InputText < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionMessageContent::InputText, + OpenAI::Internal::AnyHash + ) + end + + # The text supplied by the user. + sig { returns(String) } + attr_accessor :text + + # The type of the object. Always `input_text`. + sig { returns(Symbol) } + attr_accessor :type + + # Text supplied by the user. + sig do + params( + + text: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The text supplied by the user. + text:, + + # The type of the object. Always `input_text`. + + type: :input_text + ) + end + + sig do + override.returns( + {text: String, type: Symbol} + ) + end + def to_hash + end + + end + + class InputImage < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionMessageContent::InputImage, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the image supplied by the user, which may be a base64-encoded data + # URL. + sig { returns(String) } + attr_accessor :image_url + + # The type of the object. Always `input_image`. + sig { returns(Symbol) } + attr_accessor :type + + # An image supplied by the user. + sig do + params( + + image_url: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The URL of the image supplied by the user, which may be a base64-encoded data + # URL. + image_url:, + + # The type of the object. Always `input_image`. + + type: :input_image + ) + end + + sig do + override.returns( + {image_url: String, type: Symbol} + ) + end + def to_hash + end + + end + + class OutputText < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionMessageContent::OutputText, + OpenAI::Internal::AnyHash + ) + end + + # The text produced by the assistant. + sig { returns(String) } + attr_accessor :text + + # The type of the object. Always `output_text`. + sig { returns(Symbol) } + attr_accessor :type + + # Text produced by the assistant. + sig do + params( + + text: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The text produced by the assistant. + text:, + + # The type of the object. Always `output_text`. + + type: :output_text + ) + end + + sig do + override.returns( + {text: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::AgentSessionMessageContent::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_requires_action_event.rbi b/rbi/openai/models/beta/agent_session_requires_action_event.rbi new file mode 100644 index 000000000..04cedd877 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_requires_action_event.rbi @@ -0,0 +1,71 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionRequiresActionEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionRequiresActionEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The session and its current required actions. + sig { returns(OpenAI::Beta::AgentSession) } + attr_reader :session + + sig { params(session: OpenAI::Beta::AgentSession::OrHash).void } + attr_writer :session + + # The type of the object. Always `agent.session.requires_action`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a session is waiting for one or more required actions. + sig do + params( + + event_id: String, + + session: OpenAI::Beta::AgentSession::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The session and its current required actions. + session:, + + # The type of the object. Always `agent.session.requires_action`. + + type: :"agent.session.requires_action" + ) + end + + sig do + override.returns( + {event_id: String, session: OpenAI::Beta::AgentSession, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_subagent_active_event.rbi b/rbi/openai/models/beta/agent_session_subagent_active_event.rbi new file mode 100644 index 000000000..051f08a22 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_subagent_active_event.rbi @@ -0,0 +1,71 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionSubagentActiveEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionSubagentActiveEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The subagent that resumed. + sig { returns(OpenAI::Beta::Subagent) } + attr_reader :subagent + + sig { params(subagent: OpenAI::Beta::Subagent::OrHash).void } + attr_writer :subagent + + # The type of the object. Always `agent.session.subagent.active`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a closed subagent successfully resumes. + sig do + params( + + event_id: String, + + subagent: OpenAI::Beta::Subagent::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The subagent that resumed. + subagent:, + + # The type of the object. Always `agent.session.subagent.active`. + + type: :"agent.session.subagent.active" + ) + end + + sig do + override.returns( + {event_id: String, subagent: OpenAI::Beta::Subagent, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_subagent_closed_event.rbi b/rbi/openai/models/beta/agent_session_subagent_closed_event.rbi new file mode 100644 index 000000000..1fda43349 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_subagent_closed_event.rbi @@ -0,0 +1,71 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionSubagentClosedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionSubagentClosedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The subagent that was closed. + sig { returns(OpenAI::Beta::Subagent) } + attr_reader :subagent + + sig { params(subagent: OpenAI::Beta::Subagent::OrHash).void } + attr_writer :subagent + + # The type of the object. Always `agent.session.subagent.closed`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a subagent is closed. + sig do + params( + + event_id: String, + + subagent: OpenAI::Beta::Subagent::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The subagent that was closed. + subagent:, + + # The type of the object. Always `agent.session.subagent.closed`. + + type: :"agent.session.subagent.closed" + ) + end + + sig do + override.returns( + {event_id: String, subagent: OpenAI::Beta::Subagent, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_subagent_created_event.rbi b/rbi/openai/models/beta/agent_session_subagent_created_event.rbi new file mode 100644 index 000000000..a1609c7e1 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_subagent_created_event.rbi @@ -0,0 +1,71 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionSubagentCreatedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionSubagentCreatedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The subagent that was created. + sig { returns(OpenAI::Beta::Subagent) } + attr_reader :subagent + + sig { params(subagent: OpenAI::Beta::Subagent::OrHash).void } + attr_writer :subagent + + # The type of the object. Always `agent.session.subagent.created`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a subagent is created. + sig do + params( + + event_id: String, + + subagent: OpenAI::Beta::Subagent::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The subagent that was created. + subagent:, + + # The type of the object. Always `agent.session.subagent.created`. + + type: :"agent.session.subagent.created" + ) + end + + sig do + override.returns( + {event_id: String, subagent: OpenAI::Beta::Subagent, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_cancelled_event.rbi b/rbi/openai/models/beta/agent_session_turn_cancelled_event.rbi new file mode 100644 index 000000000..a2862c412 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_cancelled_event.rbi @@ -0,0 +1,108 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnCancelledEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnCancelledEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The cancelled turn. + sig { returns(OpenAI::Beta::Agents::Sessions::Turn) } + attr_reader :turn + + sig { params(turn: OpenAI::Beta::Agents::Sessions::Turn::OrHash).void } + attr_writer :turn + + # The ID of the turn associated with the event. + sig { returns(String) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.turn.cancelled`. + sig { returns(Symbol) } + attr_accessor :type + + # Recorded token usage for a session or turn. Usage is best effort and may change. + sig { returns(T.nilable(OpenAI::Beta::TokenUsage)) } + attr_reader :usage + + sig { params(usage: T.nilable(OpenAI::Beta::TokenUsage::OrHash)).void } + attr_writer :usage + + # Emitted when a turn is cancelled. + sig do + params( + + event_id: String, + + session_id: String, + + turn: OpenAI::Beta::Agents::Sessions::Turn::OrHash, + + turn_id: String, + + usage: T.nilable(OpenAI::Beta::TokenUsage::OrHash), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The ID of the session associated with the event. + session_id:, + + # The cancelled turn. + turn:, + + # The ID of the turn associated with the event. + turn_id:, + + # Recorded token usage for a session or turn. Usage is best effort and may change. + usage:, + + # The type of the object. Always `agent.session.turn.cancelled`. + + type: :"agent.session.turn.cancelled" + ) + end + + sig do + override.returns( + { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + type: Symbol, + usage: T.nilable(OpenAI::Beta::TokenUsage) + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_completed_event.rbi b/rbi/openai/models/beta/agent_session_turn_completed_event.rbi new file mode 100644 index 000000000..a62b8f715 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_completed_event.rbi @@ -0,0 +1,108 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnCompletedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnCompletedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The completed turn. + sig { returns(OpenAI::Beta::Agents::Sessions::Turn) } + attr_reader :turn + + sig { params(turn: OpenAI::Beta::Agents::Sessions::Turn::OrHash).void } + attr_writer :turn + + # The ID of the turn associated with the event. + sig { returns(String) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.turn.completed`. + sig { returns(Symbol) } + attr_accessor :type + + # Recorded token usage for a session or turn. Usage is best effort and may change. + sig { returns(T.nilable(OpenAI::Beta::TokenUsage)) } + attr_reader :usage + + sig { params(usage: T.nilable(OpenAI::Beta::TokenUsage::OrHash)).void } + attr_writer :usage + + # Emitted when a turn completes. + sig do + params( + + event_id: String, + + session_id: String, + + turn: OpenAI::Beta::Agents::Sessions::Turn::OrHash, + + turn_id: String, + + usage: T.nilable(OpenAI::Beta::TokenUsage::OrHash), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The ID of the session associated with the event. + session_id:, + + # The completed turn. + turn:, + + # The ID of the turn associated with the event. + turn_id:, + + # Recorded token usage for a session or turn. Usage is best effort and may change. + usage:, + + # The type of the object. Always `agent.session.turn.completed`. + + type: :"agent.session.turn.completed" + ) + end + + sig do + override.returns( + { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + type: Symbol, + usage: T.nilable(OpenAI::Beta::TokenUsage) + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_content_part_added_event.rbi b/rbi/openai/models/beta/agent_session_turn_content_part_added_event.rbi new file mode 100644 index 000000000..5a63a5214 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_content_part_added_event.rbi @@ -0,0 +1,125 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnContentPartAddedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnContentPartAddedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The index of the content part in the message. + sig { returns(Integer) } + attr_accessor :content_index + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the message item. + sig { returns(String) } + attr_accessor :item_id + + # The index of the item in the turn output. + sig { returns(Integer) } + attr_accessor :output_index + + # The initial content part. + sig { returns(OpenAI::Beta::OutputText) } + attr_reader :part + + sig { params(part: OpenAI::Beta::OutputText::OrHash).void } + attr_writer :part + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.turn.content_part.added`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when an output text content part is added. + sig do + params( + + content_index: Integer, + + event_id: String, + + item_id: String, + + output_index: Integer, + + part: OpenAI::Beta::OutputText::OrHash, + + session_id: String, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The index of the content part in the message. + content_index:, + + # The unique ID of the event. + event_id:, + + # The ID of the message item. + item_id:, + + # The index of the item in the turn output. + output_index:, + + # The initial content part. + part:, + + # The ID of the session associated with the event. + session_id:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always `agent.session.turn.content_part.added`. + + type: :"agent.session.turn.content_part.added" + ) + end + + sig do + override.returns( + { + content_index: Integer, + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::OutputText, + session_id: String, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_content_part_done_event.rbi b/rbi/openai/models/beta/agent_session_turn_content_part_done_event.rbi new file mode 100644 index 000000000..56e61f2d9 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_content_part_done_event.rbi @@ -0,0 +1,125 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnContentPartDoneEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnContentPartDoneEvent, + OpenAI::Internal::AnyHash + ) + end + + # The index of the content part in the message. + sig { returns(Integer) } + attr_accessor :content_index + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the message item. + sig { returns(String) } + attr_accessor :item_id + + # The index of the item in the turn output. + sig { returns(Integer) } + attr_accessor :output_index + + # The completed content part. + sig { returns(OpenAI::Beta::OutputText) } + attr_reader :part + + sig { params(part: OpenAI::Beta::OutputText::OrHash).void } + attr_writer :part + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.turn.content_part.done`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when an output content part is complete. + sig do + params( + + content_index: Integer, + + event_id: String, + + item_id: String, + + output_index: Integer, + + part: OpenAI::Beta::OutputText::OrHash, + + session_id: String, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The index of the content part in the message. + content_index:, + + # The unique ID of the event. + event_id:, + + # The ID of the message item. + item_id:, + + # The index of the item in the turn output. + output_index:, + + # The completed content part. + part:, + + # The ID of the session associated with the event. + session_id:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always `agent.session.turn.content_part.done`. + + type: :"agent.session.turn.content_part.done" + ) + end + + sig do + override.returns( + { + content_index: Integer, + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::OutputText, + session_id: String, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_created_event.rbi b/rbi/openai/models/beta/agent_session_turn_created_event.rbi new file mode 100644 index 000000000..f5436cff7 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_created_event.rbi @@ -0,0 +1,95 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnCreatedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnCreatedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The turn at the time it was created. + sig { returns(OpenAI::Beta::Agents::Sessions::Turn) } + attr_reader :turn + + sig { params(turn: OpenAI::Beta::Agents::Sessions::Turn::OrHash).void } + attr_writer :turn + + # The ID of the turn associated with the event. + sig { returns(String) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.turn.created`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a turn is created. + sig do + params( + + event_id: String, + + session_id: String, + + turn: OpenAI::Beta::Agents::Sessions::Turn::OrHash, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The ID of the session associated with the event. + session_id:, + + # The turn at the time it was created. + turn:, + + # The ID of the turn associated with the event. + turn_id:, + + # The type of the object. Always `agent.session.turn.created`. + + type: :"agent.session.turn.created" + ) + end + + sig do + override.returns( + { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_failed_event.rbi b/rbi/openai/models/beta/agent_session_turn_failed_event.rbi new file mode 100644 index 000000000..c92f21fc9 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_failed_event.rbi @@ -0,0 +1,108 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnFailedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnFailedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The failed turn. + sig { returns(OpenAI::Beta::Agents::Sessions::Turn) } + attr_reader :turn + + sig { params(turn: OpenAI::Beta::Agents::Sessions::Turn::OrHash).void } + attr_writer :turn + + # The ID of the turn associated with the event. + sig { returns(String) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.turn.failed`. + sig { returns(Symbol) } + attr_accessor :type + + # Recorded token usage for a session or turn. Usage is best effort and may change. + sig { returns(T.nilable(OpenAI::Beta::TokenUsage)) } + attr_reader :usage + + sig { params(usage: T.nilable(OpenAI::Beta::TokenUsage::OrHash)).void } + attr_writer :usage + + # Emitted when a turn fails. + sig do + params( + + event_id: String, + + session_id: String, + + turn: OpenAI::Beta::Agents::Sessions::Turn::OrHash, + + turn_id: String, + + usage: T.nilable(OpenAI::Beta::TokenUsage::OrHash), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The ID of the session associated with the event. + session_id:, + + # The failed turn. + turn:, + + # The ID of the turn associated with the event. + turn_id:, + + # Recorded token usage for a session or turn. Usage is best effort and may change. + usage:, + + # The type of the object. Always `agent.session.turn.failed`. + + type: :"agent.session.turn.failed" + ) + end + + sig do + override.returns( + { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + type: Symbol, + usage: T.nilable(OpenAI::Beta::TokenUsage) + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_in_progress_event.rbi b/rbi/openai/models/beta/agent_session_turn_in_progress_event.rbi new file mode 100644 index 000000000..66a1de45d --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_in_progress_event.rbi @@ -0,0 +1,95 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnInProgressEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnInProgressEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The turn at the time it started running. + sig { returns(OpenAI::Beta::Agents::Sessions::Turn) } + attr_reader :turn + + sig { params(turn: OpenAI::Beta::Agents::Sessions::Turn::OrHash).void } + attr_writer :turn + + # The ID of the turn associated with the event. + sig { returns(String) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.turn.in_progress`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a turn starts running. + sig do + params( + + event_id: String, + + session_id: String, + + turn: OpenAI::Beta::Agents::Sessions::Turn::OrHash, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The ID of the session associated with the event. + session_id:, + + # The turn at the time it started running. + turn:, + + # The ID of the turn associated with the event. + turn_id:, + + # The type of the object. Always `agent.session.turn.in_progress`. + + type: :"agent.session.turn.in_progress" + ) + end + + sig do + override.returns( + { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_item_added_event.rbi b/rbi/openai/models/beta/agent_session_turn_item_added_event.rbi new file mode 100644 index 000000000..4b7696a7c --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_item_added_event.rbi @@ -0,0 +1,117 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnItemAddedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnItemAddedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The item that was added. + sig { returns(OpenAI::Beta::AgentSessionItem::Variants) } + attr_accessor :item + + # The index of the item in the turn output, when the item is agent output. + sig { returns(T.nilable(Integer)) } + attr_accessor :output_index + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.turn.item.added`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when an item is added to a turn. + sig do + params( + + event_id: String, + + item: T.any( + OpenAI::Beta::AgentSessionMessage::OrHash, + OpenAI::Beta::AgentReasoningItem::OrHash, + OpenAI::Beta::AgentFunctionCallItem::OrHash, + OpenAI::Beta::AgentSessionItem::FunctionCallOutput::OrHash, + OpenAI::Beta::AgentSessionItem::AgentMessage::OrHash, + OpenAI::Beta::AgentMcpCallItem::OrHash, + OpenAI::Beta::AgentWebSearchCallItem::OrHash, + OpenAI::Beta::AgentCommandExecutionItem::OrHash, + OpenAI::Beta::AgentCreateSubagentCallItem::OrHash, + OpenAI::Beta::AgentSendSubagentInputCallItem::OrHash, + OpenAI::Beta::AgentResumeSubagentCallItem::OrHash, + OpenAI::Beta::AgentWaitForSubagentsCallItem::OrHash, + OpenAI::Beta::AgentInterruptSubagentCallItem::OrHash, + OpenAI::Beta::AgentCloseSubagentCallItem::OrHash + ), + + output_index: T.nilable(Integer), + + session_id: String, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The item that was added. + item:, + + # The index of the item in the turn output, when the item is agent output. + output_index:, + + # The ID of the session associated with the event. + session_id:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always `agent.session.turn.item.added`. + + type: :"agent.session.turn.item.added" + ) + end + + sig do + override.returns( + { + event_id: String, + item: OpenAI::Beta::AgentSessionItem::Variants, + output_index: T.nilable(Integer), + session_id: String, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_item_done_event.rbi b/rbi/openai/models/beta/agent_session_turn_item_done_event.rbi new file mode 100644 index 000000000..38219b3ab --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_item_done_event.rbi @@ -0,0 +1,115 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnItemDoneEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnItemDoneEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The completed output item. + sig { returns(OpenAI::Beta::AgentOutputItem::Variants) } + attr_accessor :item + + # The index of the output item in the turn output. + sig { returns(Integer) } + attr_accessor :output_index + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.turn.item.done`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when an output item is complete. + sig do + params( + + event_id: String, + + item: T.any( + OpenAI::Beta::AgentSessionAssistantMessage::OrHash, + OpenAI::Beta::AgentReasoningItem::OrHash, + OpenAI::Beta::AgentFunctionCallItem::OrHash, + OpenAI::Beta::AgentMcpCallItem::OrHash, + OpenAI::Beta::AgentWebSearchCallItem::OrHash, + OpenAI::Beta::AgentCommandExecutionItem::OrHash, + OpenAI::Beta::AgentCreateSubagentCallItem::OrHash, + OpenAI::Beta::AgentSendSubagentInputCallItem::OrHash, + OpenAI::Beta::AgentResumeSubagentCallItem::OrHash, + OpenAI::Beta::AgentWaitForSubagentsCallItem::OrHash, + OpenAI::Beta::AgentInterruptSubagentCallItem::OrHash, + OpenAI::Beta::AgentCloseSubagentCallItem::OrHash + ), + + output_index: Integer, + + session_id: String, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The completed output item. + item:, + + # The index of the output item in the turn output. + output_index:, + + # The ID of the session associated with the event. + session_id:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always `agent.session.turn.item.done`. + + type: :"agent.session.turn.item.done" + ) + end + + sig do + override.returns( + { + event_id: String, + item: OpenAI::Beta::AgentOutputItem::Variants, + output_index: Integer, + session_id: String, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_output_text_delta_event.rbi b/rbi/openai/models/beta/agent_session_turn_output_text_delta_event.rbi new file mode 100644 index 000000000..8f4d34279 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_output_text_delta_event.rbi @@ -0,0 +1,122 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnOutputTextDeltaEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnOutputTextDeltaEvent, + OpenAI::Internal::AnyHash + ) + end + + # The index of the content part in the message. + sig { returns(Integer) } + attr_accessor :content_index + + # The text that was appended. + sig { returns(String) } + attr_accessor :delta + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the message item. + sig { returns(String) } + attr_accessor :item_id + + # The index of the item in the turn output. + sig { returns(Integer) } + attr_accessor :output_index + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.turn.output_text.delta`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when text is appended to an output text content part. + sig do + params( + + content_index: Integer, + + delta: String, + + event_id: String, + + item_id: String, + + output_index: Integer, + + session_id: String, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The index of the content part in the message. + content_index:, + + # The text that was appended. + delta:, + + # The unique ID of the event. + event_id:, + + # The ID of the message item. + item_id:, + + # The index of the item in the turn output. + output_index:, + + # The ID of the session associated with the event. + session_id:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always `agent.session.turn.output_text.delta`. + + type: :"agent.session.turn.output_text.delta" + ) + end + + sig do + override.returns( + { + content_index: Integer, + delta: String, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_output_text_done_event.rbi b/rbi/openai/models/beta/agent_session_turn_output_text_done_event.rbi new file mode 100644 index 000000000..ba5e39f98 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_output_text_done_event.rbi @@ -0,0 +1,122 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnOutputTextDoneEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnOutputTextDoneEvent, + OpenAI::Internal::AnyHash + ) + end + + # The index of the content part in the message. + sig { returns(Integer) } + attr_accessor :content_index + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the message item. + sig { returns(String) } + attr_accessor :item_id + + # The index of the item in the turn output. + sig { returns(Integer) } + attr_accessor :output_index + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The complete output text. + sig { returns(String) } + attr_accessor :text + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.turn.output_text.done`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when an output text content part is complete. + sig do + params( + + content_index: Integer, + + event_id: String, + + item_id: String, + + output_index: Integer, + + session_id: String, + + text: String, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The index of the content part in the message. + content_index:, + + # The unique ID of the event. + event_id:, + + # The ID of the message item. + item_id:, + + # The index of the item in the turn output. + output_index:, + + # The ID of the session associated with the event. + session_id:, + + # The complete output text. + text:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always `agent.session.turn.output_text.done`. + + type: :"agent.session.turn.output_text.done" + ) + end + + sig do + override.returns( + { + content_index: Integer, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + text: String, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_reasoning_summary_part_added_event.rbi b/rbi/openai/models/beta/agent_session_turn_reasoning_summary_part_added_event.rbi new file mode 100644 index 000000000..3090f29ef --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_reasoning_summary_part_added_event.rbi @@ -0,0 +1,127 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnReasoningSummaryPartAddedEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnReasoningSummaryPartAddedEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the reasoning item. + sig { returns(String) } + attr_accessor :item_id + + # The index of the item in the turn output. + sig { returns(Integer) } + attr_accessor :output_index + + # The initial summary part. + sig { returns(OpenAI::Beta::SummaryText) } + attr_reader :part + + sig { params(part: OpenAI::Beta::SummaryText::OrHash).void } + attr_writer :part + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The index of the summary content part. + sig { returns(Integer) } + attr_accessor :summary_index + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always + # `agent.session.turn.reasoning_summary_part.added`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a reasoning summary content part is added. + sig do + params( + + event_id: String, + + item_id: String, + + output_index: Integer, + + part: OpenAI::Beta::SummaryText::OrHash, + + session_id: String, + + summary_index: Integer, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The ID of the reasoning item. + item_id:, + + # The index of the item in the turn output. + output_index:, + + # The initial summary part. + part:, + + # The ID of the session associated with the event. + session_id:, + + # The index of the summary content part. + summary_index:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always + # `agent.session.turn.reasoning_summary_part.added`. + + type: :"agent.session.turn.reasoning_summary_part.added" + ) + end + + sig do + override.returns( + { + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::SummaryText, + session_id: String, + summary_index: Integer, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_reasoning_summary_part_done_event.rbi b/rbi/openai/models/beta/agent_session_turn_reasoning_summary_part_done_event.rbi new file mode 100644 index 000000000..b614c4b6e --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_reasoning_summary_part_done_event.rbi @@ -0,0 +1,135 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnReasoningSummaryPartDoneEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnReasoningSummaryPartDoneEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the reasoning item. + sig { returns(String) } + attr_accessor :item_id + + # The index of the item in the turn output. + sig { returns(Integer) } + attr_accessor :output_index + + # The completed summary part. + sig { returns(OpenAI::Beta::SummaryText) } + attr_reader :part + + sig { params(part: OpenAI::Beta::SummaryText::OrHash).void } + attr_writer :part + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # Present as `incomplete` when summary generation was interrupted. + sig { returns(T.nilable(Symbol)) } + attr_accessor :status + + # The index of the summary part. + sig { returns(Integer) } + attr_accessor :summary_index + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.turn.reasoning_summary_part.done`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a reasoning summary part is complete. + sig do + params( + + event_id: String, + + item_id: String, + + output_index: Integer, + + part: OpenAI::Beta::SummaryText::OrHash, + + session_id: String, + + summary_index: Integer, + + turn_id: T.nilable(String), + + status: T.nilable(Symbol), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The ID of the reasoning item. + item_id:, + + # The index of the item in the turn output. + output_index:, + + # The completed summary part. + part:, + + # The ID of the session associated with the event. + session_id:, + + # The index of the summary part. + summary_index:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # Present as `incomplete` when summary generation was interrupted. + status: :incomplete, + + # The type of the object. Always `agent.session.turn.reasoning_summary_part.done`. + + type: :"agent.session.turn.reasoning_summary_part.done" + ) + end + + sig do + override.returns( + { + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::SummaryText, + session_id: String, + status: T.nilable(Symbol), + summary_index: Integer, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_reasoning_summary_text_delta_event.rbi b/rbi/openai/models/beta/agent_session_turn_reasoning_summary_text_delta_event.rbi new file mode 100644 index 000000000..f84da02c0 --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_reasoning_summary_text_delta_event.rbi @@ -0,0 +1,124 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnReasoningSummaryTextDeltaEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnReasoningSummaryTextDeltaEvent, + OpenAI::Internal::AnyHash + ) + end + + # The summary text that was appended. + sig { returns(String) } + attr_accessor :delta + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the reasoning item. + sig { returns(String) } + attr_accessor :item_id + + # The index of the item in the turn output. + sig { returns(Integer) } + attr_accessor :output_index + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The index of the summary content part. + sig { returns(Integer) } + attr_accessor :summary_index + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always + # `agent.session.turn.reasoning_summary_text.delta`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when text is appended to a reasoning summary. + sig do + params( + + delta: String, + + event_id: String, + + item_id: String, + + output_index: Integer, + + session_id: String, + + summary_index: Integer, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The summary text that was appended. + delta:, + + # The unique ID of the event. + event_id:, + + # The ID of the reasoning item. + item_id:, + + # The index of the item in the turn output. + output_index:, + + # The ID of the session associated with the event. + session_id:, + + # The index of the summary content part. + summary_index:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always + # `agent.session.turn.reasoning_summary_text.delta`. + + type: :"agent.session.turn.reasoning_summary_text.delta" + ) + end + + sig do + override.returns( + { + delta: String, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + summary_index: Integer, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_session_turn_reasoning_summary_text_done_event.rbi b/rbi/openai/models/beta/agent_session_turn_reasoning_summary_text_done_event.rbi new file mode 100644 index 000000000..2181d287d --- /dev/null +++ b/rbi/openai/models/beta/agent_session_turn_reasoning_summary_text_done_event.rbi @@ -0,0 +1,122 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentSessionTurnReasoningSummaryTextDoneEvent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentSessionTurnReasoningSummaryTextDoneEvent, + OpenAI::Internal::AnyHash + ) + end + + # The unique ID of the event. + sig { returns(String) } + attr_accessor :event_id + + # The ID of the reasoning item. + sig { returns(String) } + attr_accessor :item_id + + # The index of the item in the turn output. + sig { returns(Integer) } + attr_accessor :output_index + + # The ID of the session associated with the event. + sig { returns(String) } + attr_accessor :session_id + + # The index of the summary content part. + sig { returns(Integer) } + attr_accessor :summary_index + + # The complete reasoning summary text. + sig { returns(String) } + attr_accessor :text + + # The ID of the turn associated with the event, when applicable. + sig { returns(T.nilable(String)) } + attr_accessor :turn_id + + # The type of the object. Always `agent.session.turn.reasoning_summary_text.done`. + sig { returns(Symbol) } + attr_accessor :type + + # Emitted when a reasoning summary content part is complete. + sig do + params( + + event_id: String, + + item_id: String, + + output_index: Integer, + + session_id: String, + + summary_index: Integer, + + text: String, + + turn_id: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The unique ID of the event. + event_id:, + + # The ID of the reasoning item. + item_id:, + + # The index of the item in the turn output. + output_index:, + + # The ID of the session associated with the event. + session_id:, + + # The index of the summary content part. + summary_index:, + + # The complete reasoning summary text. + text:, + + # The ID of the turn associated with the event, when applicable. + turn_id:, + + # The type of the object. Always `agent.session.turn.reasoning_summary_text.done`. + + type: :"agent.session.turn.reasoning_summary_text.done" + ) + end + + sig do + override.returns( + { + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + summary_index: Integer, + text: String, + turn_id: T.nilable(String), + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_text.rbi b/rbi/openai/models/beta/agent_text.rbi new file mode 100644 index 000000000..cc11abaf2 --- /dev/null +++ b/rbi/openai/models/beta/agent_text.rbi @@ -0,0 +1,75 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentText < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentText, + OpenAI::Internal::AnyHash + ) + end + + # The effective output format. Defaults to ordinary text. + sig { returns(OpenAI::Beta::TextFormat::Variants) } + attr_accessor :format_ + + # The amount of text produced by the agent. Defaults to `medium`. + sig { returns(OpenAI::Beta::AgentText::Verbosity::TaggedSymbol) } + attr_accessor :verbosity + + # The text configuration used by an agent. + sig do + params( + + format_: T.any(OpenAI::Beta::TextFormat::Text::OrHash, OpenAI::Beta::TextFormat::JSONSchema::OrHash), + + verbosity: OpenAI::Beta::AgentText::Verbosity::OrSymbol + ) + .returns(T.attached_class) + end + def self.new( + + # The effective output format. Defaults to ordinary text. + format_:, + + # The amount of text produced by the agent. Defaults to `medium`. + + verbosity: + ) + end + + sig do + override.returns( + {format_: OpenAI::Beta::TextFormat::Variants, verbosity: OpenAI::Beta::AgentText::Verbosity::TaggedSymbol} + ) + end + def to_hash + end + + # The amount of text produced by the agent. Defaults to `medium`. + module Verbosity + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentText::Verbosity) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + LOW = T.let(:low, OpenAI::Beta::AgentText::Verbosity::TaggedSymbol) + MEDIUM = T.let(:medium, OpenAI::Beta::AgentText::Verbosity::TaggedSymbol) + HIGH = T.let(:high, OpenAI::Beta::AgentText::Verbosity::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentText::Verbosity::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_text_param.rbi b/rbi/openai/models/beta/agent_text_param.rbi new file mode 100644 index 000000000..82729e42b --- /dev/null +++ b/rbi/openai/models/beta/agent_text_param.rbi @@ -0,0 +1,87 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentTextParam < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentTextParam, + OpenAI::Internal::AnyHash + ) + end + + # The output format for generated text. + sig { + returns(T.nilable(T.any(OpenAI::Beta::TextFormatParam::Text, OpenAI::Beta::TextFormatParam::JSONSchema))) + } + attr_accessor :format_ + + # The amount of text the model should produce. + sig { returns(T.nilable(OpenAI::Beta::AgentTextParam::Verbosity::OrSymbol)) } + attr_accessor :verbosity + + # Configuration for text generated by the agent. + sig do + params( + + format_: T.nilable( + T.any(OpenAI::Beta::TextFormatParam::Text::OrHash, OpenAI::Beta::TextFormatParam::JSONSchema::OrHash) + ), + + verbosity: T.nilable(OpenAI::Beta::AgentTextParam::Verbosity::OrSymbol) + ) + .returns(T.attached_class) + end + def self.new( + + # The output format for generated text. + format_: nil, + + # The amount of text the model should produce. + + verbosity: nil + ) + end + + sig do + override.returns( + { + format_: T.nilable(T.any(OpenAI::Beta::TextFormatParam::Text, OpenAI::Beta::TextFormatParam::JSONSchema)), + verbosity: T.nilable(OpenAI::Beta::AgentTextParam::Verbosity::OrSymbol) + } + ) + end + def to_hash + end + + # The amount of text the model should produce. + module Verbosity + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentTextParam::Verbosity) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Produces less text. + LOW = T.let(:low, OpenAI::Beta::AgentTextParam::Verbosity::TaggedSymbol) + + # Uses the default amount of text. + MEDIUM = T.let(:medium, OpenAI::Beta::AgentTextParam::Verbosity::TaggedSymbol) + + # Produces more text. + HIGH = T.let(:high, OpenAI::Beta::AgentTextParam::Verbosity::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentTextParam::Verbosity::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_tool.rbi b/rbi/openai/models/beta/agent_tool.rbi new file mode 100644 index 000000000..c71c595b1 --- /dev/null +++ b/rbi/openai/models/beta/agent_tool.rbi @@ -0,0 +1,467 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # A tool available to the agent. + module AgentTool + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::AgentTool::Function, + OpenAI::Beta::AgentTool::ProgrammaticToolCalling, + OpenAI::Beta::AgentTool::Mcp, + OpenAI::Beta::AgentTool::WebSearch + ) + end + + class Function < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentTool::Function, + OpenAI::Internal::AnyHash + ) + end + + # Whether the function is deferred and discovered through tool search. + sig { returns(T::Boolean) } + attr_accessor :defer_loading + + # A description of what the function does. + sig { returns(String) } + attr_accessor :description + + # The name of the function. + sig { returns(String) } + attr_accessor :name + + # A JSON Schema object describing the function's arguments. + sig { returns(T::Hash[Symbol, T.anything]) } + attr_accessor :parameters + + # The type of the object. Always `function`. + sig { returns(Symbol) } + attr_accessor :type + + # A function defined by the application. + sig do + params( + + defer_loading: T::Boolean, + + description: String, + + name: String, + + parameters: T::Hash[Symbol, T.anything], + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Whether the function is deferred and discovered through tool search. + defer_loading:, + + # A description of what the function does. + description:, + + # The name of the function. + name:, + + # A JSON Schema object describing the function's arguments. + parameters:, + + # The type of the object. Always `function`. + + type: :function + ) + end + + sig do + override.returns( + { + defer_loading: T::Boolean, + description: String, + name: String, + parameters: T::Hash[Symbol, T.anything], + type: Symbol + } + ) + end + def to_hash + end + + end + + class ProgrammaticToolCalling < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentTool::ProgrammaticToolCalling, + OpenAI::Internal::AnyHash + ) + end + + # Whether tools can be called from model-generated code. + sig { returns(T::Boolean) } + attr_accessor :enabled + + # The type of the object. Always `programmatic_tool_calling`. + sig { returns(Symbol) } + attr_accessor :type + + # Enables calling tools from model-generated code. + sig do + params( + + enabled: T::Boolean, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Whether tools can be called from model-generated code. + enabled:, + + # The type of the object. Always `programmatic_tool_calling`. + + type: :programmatic_tool_calling + ) + end + + sig do + override.returns( + {enabled: T::Boolean, type: Symbol} + ) + end + def to_hash + end + + end + + class Mcp < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentTool::Mcp, + OpenAI::Internal::AnyHash + ) + end + + # The MCP tools the agent may call. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :allowed_tools + + # Where outbound MCP HTTP connections originate. + sig { returns(OpenAI::Beta::AgentTool::Mcp::ConnectionOrigin::TaggedSymbol) } + attr_accessor :connection_origin + + # The attached vault credential selected for this MCP server, if any. Optional + # when exactly one attached credential matches the server URL. + sig { returns(T.nilable(String)) } + attr_accessor :credential_id + + # Metadata included with requests to this MCP server. + sig { returns(T::Hash[Symbol, T.anything]) } + attr_accessor :request_metadata + + # Whether this MCP server must initialize before the first turn. + sig { returns(T::Boolean) } + attr_accessor :required + + # A label used to identify the MCP server in tool calls. + sig { returns(String) } + attr_accessor :server_label + + # The transport used to connect to the MCP server. + sig { returns(OpenAI::Beta::McpTransport::Variants) } + attr_accessor :transport + + # The type of the object. Always `mcp`. + sig { returns(Symbol) } + attr_accessor :type + + # Tools provided by a remote MCP server. + sig do + params( + + allowed_tools: T.nilable(T::Array[String]), + + connection_origin: OpenAI::Beta::AgentTool::Mcp::ConnectionOrigin::OrSymbol, + + credential_id: T.nilable(String), + + request_metadata: T::Hash[Symbol, T.anything], + + required: T::Boolean, + + server_label: String, + + transport: T.any(OpenAI::Beta::McpTransport::HTTP::OrHash, OpenAI::Beta::McpTransport::Stdio::OrHash), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The MCP tools the agent may call. + allowed_tools:, + + # Where outbound MCP HTTP connections originate. + connection_origin:, + + # The attached vault credential selected for this MCP server, if any. Optional + # when exactly one attached credential matches the server URL. + credential_id:, + + # Metadata included with requests to this MCP server. + request_metadata:, + + # Whether this MCP server must initialize before the first turn. + required:, + + # A label used to identify the MCP server in tool calls. + server_label:, + + # The transport used to connect to the MCP server. + transport:, + + # The type of the object. Always `mcp`. + + type: :mcp + ) + end + + sig do + override.returns( + { + allowed_tools: T.nilable(T::Array[String]), + connection_origin: OpenAI::Beta::AgentTool::Mcp::ConnectionOrigin::TaggedSymbol, + credential_id: T.nilable(String), + request_metadata: T::Hash[Symbol, T.anything], + required: T::Boolean, + server_label: String, + transport: OpenAI::Beta::McpTransport::Variants, + type: Symbol + } + ) + end + def to_hash + end + + # Where outbound MCP HTTP connections originate. + module ConnectionOrigin + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentTool::Mcp::ConnectionOrigin) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SERVICE = T.let(:service, OpenAI::Beta::AgentTool::Mcp::ConnectionOrigin::TaggedSymbol) + ENVIRONMENT = T.let(:environment, OpenAI::Beta::AgentTool::Mcp::ConnectionOrigin::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentTool::Mcp::ConnectionOrigin::TaggedSymbol]) } + def self.values + end + end + end + + class WebSearch < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentTool::WebSearch, + OpenAI::Internal::AnyHash + ) + end + + # Allowed search domains, or `null` when the search is unrestricted. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :allowed_domains + + # The amount of search context made available to the model. Defaults to `medium`. + sig { returns(OpenAI::Beta::AgentTool::WebSearch::ContextSize::TaggedSymbol) } + attr_accessor :context_size + + # Approximate user location used to localize web search results. + sig { returns(T.nilable(OpenAI::Beta::AgentTool::WebSearch::Location)) } + attr_reader :location + + sig { params(location: T.nilable(OpenAI::Beta::AgentTool::WebSearch::Location::OrHash)).void } + attr_writer :location + + # The source used for web search results. + sig { returns(OpenAI::Beta::AgentTool::WebSearch::Mode::TaggedSymbol) } + attr_accessor :mode + + # The type of the object. Always `web_search`. + sig { returns(Symbol) } + attr_accessor :type + + # Web search. + sig do + params( + + allowed_domains: T.nilable(T::Array[String]), + + context_size: OpenAI::Beta::AgentTool::WebSearch::ContextSize::OrSymbol, + + location: T.nilable(OpenAI::Beta::AgentTool::WebSearch::Location::OrHash), + + mode: OpenAI::Beta::AgentTool::WebSearch::Mode::OrSymbol, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Allowed search domains, or `null` when the search is unrestricted. + allowed_domains:, + + # The amount of search context made available to the model. Defaults to `medium`. + context_size:, + + # Approximate user location used to localize web search results. + location:, + + # The source used for web search results. + mode:, + + # The type of the object. Always `web_search`. + + type: :web_search + ) + end + + sig do + override.returns( + { + allowed_domains: T.nilable(T::Array[String]), + context_size: OpenAI::Beta::AgentTool::WebSearch::ContextSize::TaggedSymbol, + location: T.nilable(OpenAI::Beta::AgentTool::WebSearch::Location), + mode: OpenAI::Beta::AgentTool::WebSearch::Mode::TaggedSymbol, + type: Symbol + } + ) + end + def to_hash + end + + # The amount of search context made available to the model. Defaults to `medium`. + module ContextSize + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentTool::WebSearch::ContextSize) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + LOW = T.let(:low, OpenAI::Beta::AgentTool::WebSearch::ContextSize::TaggedSymbol) + MEDIUM = T.let(:medium, OpenAI::Beta::AgentTool::WebSearch::ContextSize::TaggedSymbol) + HIGH = T.let(:high, OpenAI::Beta::AgentTool::WebSearch::ContextSize::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentTool::WebSearch::ContextSize::TaggedSymbol]) } + def self.values + end + end + + class Location < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentTool::WebSearch::Location, + OpenAI::Internal::AnyHash + ) + end + + # The city name. + sig { returns(T.nilable(String)) } + attr_accessor :city + + # The two-letter ISO country code, such as `US`. + sig { returns(T.nilable(String)) } + attr_accessor :country + + # The region or state name. + sig { returns(T.nilable(String)) } + attr_accessor :region + + # The IANA timezone, such as `America/Los_Angeles`. + sig { returns(T.nilable(String)) } + attr_accessor :timezone + + # Approximate user location used to localize web search results. + sig do + params( + + city: T.nilable(String), + + country: T.nilable(String), + + region: T.nilable(String), + + timezone: T.nilable(String) + ) + .returns(T.attached_class) + end + def self.new( + + # The city name. + city:, + + # The two-letter ISO country code, such as `US`. + country:, + + # The region or state name. + region:, + + # The IANA timezone, such as `America/Los_Angeles`. + + timezone: + ) + end + + sig do + override.returns( + { + city: T.nilable(String), + country: T.nilable(String), + region: T.nilable(String), + timezone: T.nilable(String) + } + ) + end + def to_hash + end + + end + + # The source used for web search results. + module Mode + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentTool::WebSearch::Mode) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DISABLED = T.let(:disabled, OpenAI::Beta::AgentTool::WebSearch::Mode::TaggedSymbol) + CACHED = T.let(:cached, OpenAI::Beta::AgentTool::WebSearch::Mode::TaggedSymbol) + LIVE = T.let(:live, OpenAI::Beta::AgentTool::WebSearch::Mode::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentTool::WebSearch::Mode::TaggedSymbol]) } + def self.values + end + end + end + + sig { override.returns(T::Array[OpenAI::Beta::AgentTool::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_tool_param.rbi b/rbi/openai/models/beta/agent_tool_param.rbi new file mode 100644 index 000000000..716b1b1ea --- /dev/null +++ b/rbi/openai/models/beta/agent_tool_param.rbi @@ -0,0 +1,530 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # A tool available to the agent. + module AgentToolParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::AgentToolParam::Function, + OpenAI::Beta::AgentToolParam::ToolSearch, + OpenAI::Beta::AgentToolParam::ProgrammaticToolCalling, + OpenAI::Beta::AgentToolParam::Mcp, + OpenAI::Beta::AgentToolParam::WebSearch + ) + end + + class Function < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentToolParam::Function, + OpenAI::Internal::AnyHash + ) + end + + # A description of what the function does. + sig { returns(String) } + attr_accessor :description + + # The name of the function. + sig { returns(String) } + attr_accessor :name + + # A JSON Schema object describing the function's arguments. + sig { returns(T::Hash[Symbol, T.anything]) } + attr_accessor :parameters + + # The type of the object. Always `function`. + sig { returns(Symbol) } + attr_accessor :type + + # Whether this function is deferred and discovered through tool search. Defaults + # to `false`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :defer_loading + + sig { params(defer_loading: T::Boolean).void } + attr_writer :defer_loading + + # A function defined by the application. + sig do + params( + + description: String, + + name: String, + + parameters: T::Hash[Symbol, T.anything], + + defer_loading: T::Boolean, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # A description of what the function does. + description:, + + # The name of the function. + name:, + + # A JSON Schema object describing the function's arguments. + parameters:, + + # Whether this function is deferred and discovered through tool search. Defaults + # to `false`. + defer_loading: nil, + + # The type of the object. Always `function`. + + type: :function + ) + end + + sig do + override.returns( + { + description: String, + name: String, + parameters: T::Hash[Symbol, T.anything], + type: Symbol, + defer_loading: T::Boolean + } + ) + end + def to_hash + end + + end + + class ToolSearch < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentToolParam::ToolSearch, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `tool_search`. + sig { returns(Symbol) } + attr_accessor :type + + # Discovers deferred function tools and loads them into the model context. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The type of the object. Always `tool_search`. + + type: :tool_search + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + class ProgrammaticToolCalling < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentToolParam::ProgrammaticToolCalling, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `programmatic_tool_calling`. + sig { returns(Symbol) } + attr_accessor :type + + # Whether tools can be called from model-generated code. Defaults to `true`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :enabled + + sig { params(enabled: T::Boolean).void } + attr_writer :enabled + + # Enables calling tools from model-generated code. + sig do + params( + + enabled: T::Boolean, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Whether tools can be called from model-generated code. Defaults to `true`. + enabled: nil, + + # The type of the object. Always `programmatic_tool_calling`. + + type: :programmatic_tool_calling + ) + end + + sig do + override.returns( + {type: Symbol, enabled: T::Boolean} + ) + end + def to_hash + end + + end + + class Mcp < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentToolParam::Mcp, + OpenAI::Internal::AnyHash + ) + end + + # A label used to identify the MCP server in tool calls. + sig { returns(String) } + attr_accessor :server_label + + # The transport used to connect to the MCP server. + sig { returns(T.any(OpenAI::Beta::McpTransportParam::HTTP, OpenAI::Beta::McpTransportParam::Stdio)) } + attr_accessor :transport + + # The type of the object. Always `mcp`. + sig { returns(Symbol) } + attr_accessor :type + + # The MCP tools the agent may call. All server tools are allowed when omitted. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :allowed_tools + + # Where outbound MCP HTTP connections originate. + sig { returns(T.nilable(OpenAI::Beta::AgentToolParam::Mcp::ConnectionOrigin::OrSymbol)) } + attr_accessor :connection_origin + + # The attached vault credential used to authenticate this MCP server. Optional + # when exactly one attached credential matches the server URL. + sig { returns(T.nilable(String)) } + attr_accessor :credential_id + + # Metadata included with requests to this MCP server. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :request_metadata + + # Whether this MCP server must initialize before the first turn. Defaults to + # `false`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :required + + sig { params(required: T::Boolean).void } + attr_writer :required + + # Tools provided by a remote MCP server. + sig do + params( + + server_label: String, + + transport: T.any( + OpenAI::Beta::McpTransportParam::HTTP::OrHash, + OpenAI::Beta::McpTransportParam::Stdio::OrHash + ), + + allowed_tools: T.nilable(T::Array[String]), + + connection_origin: T.nilable(OpenAI::Beta::AgentToolParam::Mcp::ConnectionOrigin::OrSymbol), + + credential_id: T.nilable(String), + + request_metadata: T.nilable(T::Hash[Symbol, T.anything]), + + required: T::Boolean, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # A label used to identify the MCP server in tool calls. + server_label:, + + # The transport used to connect to the MCP server. + transport:, + + # The MCP tools the agent may call. All server tools are allowed when omitted. + allowed_tools: nil, + + # Where outbound MCP HTTP connections originate. + connection_origin: nil, + + # The attached vault credential used to authenticate this MCP server. Optional + # when exactly one attached credential matches the server URL. + credential_id: nil, + + # Metadata included with requests to this MCP server. + request_metadata: nil, + + # Whether this MCP server must initialize before the first turn. Defaults to + # `false`. + required: nil, + + # The type of the object. Always `mcp`. + + type: :mcp + ) + end + + sig do + override.returns( + { + server_label: String, + transport: T.any(OpenAI::Beta::McpTransportParam::HTTP, OpenAI::Beta::McpTransportParam::Stdio), + type: Symbol, + allowed_tools: T.nilable(T::Array[String]), + connection_origin: T.nilable(OpenAI::Beta::AgentToolParam::Mcp::ConnectionOrigin::OrSymbol), + credential_id: T.nilable(String), + request_metadata: T.nilable(T::Hash[Symbol, T.anything]), + required: T::Boolean + } + ) + end + def to_hash + end + + # Where outbound MCP HTTP connections originate. + module ConnectionOrigin + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentToolParam::Mcp::ConnectionOrigin) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Uses the Managed Agents service network. + SERVICE = T.let(:service, OpenAI::Beta::AgentToolParam::Mcp::ConnectionOrigin::TaggedSymbol) + + # Uses the session's execution environment. + ENVIRONMENT = T.let(:environment, OpenAI::Beta::AgentToolParam::Mcp::ConnectionOrigin::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentToolParam::Mcp::ConnectionOrigin::TaggedSymbol]) } + def self.values + end + end + end + + class WebSearch < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentToolParam::WebSearch, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `web_search`. + sig { returns(Symbol) } + attr_accessor :type + + # Domains the search may include. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :allowed_domains + + # The amount of web search context made available to the model. + sig { returns(T.nilable(OpenAI::Beta::AgentToolParam::WebSearch::ContextSize::OrSymbol)) } + attr_accessor :context_size + + # Approximate user location used to localize web search results. + sig { returns(T.nilable(OpenAI::Beta::AgentToolParam::WebSearch::Location)) } + attr_reader :location + + sig { params(location: T.nilable(OpenAI::Beta::AgentToolParam::WebSearch::Location::OrHash)).void } + attr_writer :location + + # The source used for web search results. + sig { returns(T.nilable(OpenAI::Beta::AgentToolParam::WebSearch::Mode::OrSymbol)) } + attr_accessor :mode + + # Web search. + sig do + params( + + allowed_domains: T.nilable(T::Array[String]), + + context_size: T.nilable(OpenAI::Beta::AgentToolParam::WebSearch::ContextSize::OrSymbol), + + location: T.nilable(OpenAI::Beta::AgentToolParam::WebSearch::Location::OrHash), + + mode: T.nilable(OpenAI::Beta::AgentToolParam::WebSearch::Mode::OrSymbol), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Domains the search may include. + allowed_domains: nil, + + # The amount of web search context made available to the model. + context_size: nil, + + # Approximate user location used to localize web search results. + location: nil, + + # The source used for web search results. + mode: nil, + + # The type of the object. Always `web_search`. + + type: :web_search + ) + end + + sig do + override.returns( + { + type: Symbol, + allowed_domains: T.nilable(T::Array[String]), + context_size: T.nilable(OpenAI::Beta::AgentToolParam::WebSearch::ContextSize::OrSymbol), + location: T.nilable(OpenAI::Beta::AgentToolParam::WebSearch::Location), + mode: T.nilable(OpenAI::Beta::AgentToolParam::WebSearch::Mode::OrSymbol) + } + ) + end + def to_hash + end + + # The amount of web search context made available to the model. + module ContextSize + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentToolParam::WebSearch::ContextSize) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + LOW = T.let(:low, OpenAI::Beta::AgentToolParam::WebSearch::ContextSize::TaggedSymbol) + MEDIUM = T.let(:medium, OpenAI::Beta::AgentToolParam::WebSearch::ContextSize::TaggedSymbol) + HIGH = T.let(:high, OpenAI::Beta::AgentToolParam::WebSearch::ContextSize::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentToolParam::WebSearch::ContextSize::TaggedSymbol]) } + def self.values + end + end + + class Location < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentToolParam::WebSearch::Location, + OpenAI::Internal::AnyHash + ) + end + + # The city name. + sig { returns(T.nilable(String)) } + attr_accessor :city + + # The two-letter ISO country code, such as `US`. + sig { returns(T.nilable(String)) } + attr_accessor :country + + # The region or state name. + sig { returns(T.nilable(String)) } + attr_accessor :region + + # The IANA timezone, such as `America/Los_Angeles`. + sig { returns(T.nilable(String)) } + attr_accessor :timezone + + # Approximate user location used to localize web search results. + sig do + params( + + city: T.nilable(String), + + country: T.nilable(String), + + region: T.nilable(String), + + timezone: T.nilable(String) + ) + .returns(T.attached_class) + end + def self.new( + + # The city name. + city: nil, + + # The two-letter ISO country code, such as `US`. + country: nil, + + # The region or state name. + region: nil, + + # The IANA timezone, such as `America/Los_Angeles`. + + timezone: nil + ) + end + + sig do + override.returns( + { + city: T.nilable(String), + country: T.nilable(String), + region: T.nilable(String), + timezone: T.nilable(String) + } + ) + end + def to_hash + end + + end + + # The source used for web search results. + module Mode + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentToolParam::WebSearch::Mode) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Disables web search. + DISABLED = T.let(:disabled, OpenAI::Beta::AgentToolParam::WebSearch::Mode::TaggedSymbol) + + # Uses cached search results. + CACHED = T.let(:cached, OpenAI::Beta::AgentToolParam::WebSearch::Mode::TaggedSymbol) + + # Searches the live web. + LIVE = T.let(:live, OpenAI::Beta::AgentToolParam::WebSearch::Mode::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentToolParam::WebSearch::Mode::TaggedSymbol]) } + def self.values + end + end + end + + sig { override.returns(T::Array[OpenAI::Beta::AgentToolParam::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_update_params.rbi b/rbi/openai/models/beta/agent_update_params.rbi new file mode 100644 index 000000000..7e2d657ed --- /dev/null +++ b/rbi/openai/models/beta/agent_update_params.rbi @@ -0,0 +1,225 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentUpdateParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentUpdateParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :agent_id + + # Additional instructions appended to the agent's default base instructions. Omit + # to leave unchanged. + sig { returns(T.nilable(String)) } + attr_accessor :instructions + + # Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :metadata + + # The model to use for the agent. The requested model name is preserved. + sig { returns(T.nilable(String)) } + attr_reader :model + + sig { params(model: String).void } + attr_writer :model + + # Explicit configuration for creating and coordinating subagents. + sig { returns(T.nilable(OpenAI::Beta::MultiAgentConfigParam)) } + attr_reader :multi_agent + + sig { params(multi_agent: T.nilable(OpenAI::Beta::MultiAgentConfigParam::OrHash)).void } + attr_writer :multi_agent + + # A replacement name. Omit to leave unchanged, or pass null to clear it. + sig { returns(T.nilable(String)) } + attr_accessor :name + + # Reasoning configuration for the agent. + sig { returns(T.nilable(OpenAI::Beta::AgentReasoningParam)) } + attr_reader :reasoning + + sig { params(reasoning: T.nilable(OpenAI::Beta::AgentReasoningParam::OrHash)).void } + attr_writer :reasoning + + # The service tier used for model requests. + sig { returns(T.nilable(OpenAI::Beta::AgentUpdateParams::ServiceTier::OrSymbol)) } + attr_accessor :service_tier + + # Configuration for text generated by the agent. + sig { returns(T.nilable(OpenAI::Beta::AgentTextParam)) } + attr_reader :text + + sig { params(text: T.nilable(OpenAI::Beta::AgentTextParam::OrHash)).void } + attr_writer :text + + # Tools available to the agent. + sig { + returns( + T.nilable( + T::Array[ + T.any( + OpenAI::Beta::PersistedAgentToolParam::Function, + OpenAI::Beta::PersistedAgentToolParam::ToolSearch, + OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling, + OpenAI::Beta::PersistedAgentToolParam::Mcp, + OpenAI::Beta::PersistedAgentToolParam::WebSearch + ) + ] + ) + ) + } + attr_accessor :tools + + sig do + params( + + agent_id: String, + + instructions: T.nilable(String), + + metadata: T.nilable(T::Hash[Symbol, String]), + + model: String, + + multi_agent: T.nilable(OpenAI::Beta::MultiAgentConfigParam::OrHash), + + name: T.nilable(String), + + reasoning: T.nilable(OpenAI::Beta::AgentReasoningParam::OrHash), + + service_tier: T.nilable(OpenAI::Beta::AgentUpdateParams::ServiceTier::OrSymbol), + + text: T.nilable(OpenAI::Beta::AgentTextParam::OrHash), + + tools: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::PersistedAgentToolParam::Function::OrHash, + OpenAI::Beta::PersistedAgentToolParam::ToolSearch::OrHash, + OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling::OrHash, + OpenAI::Beta::PersistedAgentToolParam::Mcp::OrHash, + OpenAI::Beta::PersistedAgentToolParam::WebSearch::OrHash + ) + ] + ), + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + agent_id:, + + # Additional instructions appended to the agent's default base instructions. Omit + # to leave unchanged. + instructions: nil, + + # Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. + metadata: nil, + + # The model to use for the agent. The requested model name is preserved. + model: nil, + + # Explicit configuration for creating and coordinating subagents. + multi_agent: nil, + + # A replacement name. Omit to leave unchanged, or pass null to clear it. + name: nil, + + # Reasoning configuration for the agent. + reasoning: nil, + + # The service tier used for model requests. + service_tier: nil, + + # Configuration for text generated by the agent. + text: nil, + + # Tools available to the agent. + tools: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + agent_id: String, + instructions: T.nilable(String), + metadata: T.nilable(T::Hash[Symbol, String]), + model: String, + multi_agent: T.nilable(OpenAI::Beta::MultiAgentConfigParam), + name: T.nilable(String), + reasoning: T.nilable(OpenAI::Beta::AgentReasoningParam), + service_tier: T.nilable(OpenAI::Beta::AgentUpdateParams::ServiceTier::OrSymbol), + text: T.nilable(OpenAI::Beta::AgentTextParam), + tools: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::PersistedAgentToolParam::Function, + OpenAI::Beta::PersistedAgentToolParam::ToolSearch, + OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling, + OpenAI::Beta::PersistedAgentToolParam::Mcp, + OpenAI::Beta::PersistedAgentToolParam::WebSearch + ) + ] + ), + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # The service tier used for model requests. + module ServiceTier + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::AgentUpdateParams::ServiceTier) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Selects the service tier automatically. + AUTO = T.let(:auto, OpenAI::Beta::AgentUpdateParams::ServiceTier::TaggedSymbol) + + # Uses the default service tier. + DEFAULT = T.let(:default, OpenAI::Beta::AgentUpdateParams::ServiceTier::TaggedSymbol) + + # Uses the flex service tier. + FLEX = T.let(:flex, OpenAI::Beta::AgentUpdateParams::ServiceTier::TaggedSymbol) + + # Uses the priority service tier. + PRIORITY = T.let(:priority, OpenAI::Beta::AgentUpdateParams::ServiceTier::TaggedSymbol) + + # Uses the fast service tier. + FAST = T.let(:fast, OpenAI::Beta::AgentUpdateParams::ServiceTier::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::AgentUpdateParams::ServiceTier::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_wait_for_subagents_call_item.rbi b/rbi/openai/models/beta/agent_wait_for_subagents_call_item.rbi new file mode 100644 index 000000000..e7da88323 --- /dev/null +++ b/rbi/openai/models/beta/agent_wait_for_subagents_call_item.rbi @@ -0,0 +1,102 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentWaitForSubagentsCallItem < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentWaitForSubagentsCallItem, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the tool call item. + sig { returns(String) } + attr_accessor :id + + # The IDs of the agents to wait for. + sig { returns(T::Array[String]) } + attr_accessor :recipient_agent_ids + + # The ID of the agent waiting for results. + sig { returns(String) } + attr_accessor :sender_agent_id + + # The status of the tool call. + sig { returns(OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol) } + attr_accessor :status + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `wait_for_subagents_call`. + sig { returns(Symbol) } + attr_accessor :type + + # A request to wait for one or more subagents. + sig do + params( + + id: String, + + recipient_agent_ids: T::Array[String], + + sender_agent_id: String, + + status: OpenAI::Beta::AgentFunctionCallStatus::OrSymbol, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the tool call item. + id:, + + # The IDs of the agents to wait for. + recipient_agent_ids:, + + # The ID of the agent waiting for results. + sender_agent_id:, + + # The status of the tool call. + status:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `wait_for_subagents_call`. + + type: :wait_for_subagents_call + ) + end + + sig do + override.returns( + { + id: String, + recipient_agent_ids: T::Array[String], + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus::TaggedSymbol, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agent_web_search_call_item.rbi b/rbi/openai/models/beta/agent_web_search_call_item.rbi new file mode 100644 index 000000000..f936cf0c0 --- /dev/null +++ b/rbi/openai/models/beta/agent_web_search_call_item.rbi @@ -0,0 +1,99 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class AgentWebSearchCallItem < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::AgentWebSearchCallItem, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the web search call. + sig { returns(String) } + attr_accessor :id + + # An action performed by the web search tool. + sig { returns(T.nilable(OpenAI::Beta::WebSearchAction::Variants)) } + attr_accessor :action + + # The status of the web search call. + sig { returns(OpenAI::Beta::AgentOutputItemStatus::TaggedSymbol) } + attr_accessor :status + + # The ID of the turn that contains this item. + sig { returns(String) } + attr_accessor :turn_id + + # The item type. Always `web_search_call`. + sig { returns(Symbol) } + attr_accessor :type + + # A web search call produced by the agent. + sig do + params( + + id: String, + + action: T.nilable( + T.any( + OpenAI::Beta::WebSearchAction::Search::OrHash, + OpenAI::Beta::WebSearchAction::OpenPage::OrHash, + OpenAI::Beta::WebSearchAction::FindInPage::OrHash, + OpenAI::Beta::WebSearchAction::Other::OrHash + ) + ), + + status: OpenAI::Beta::AgentOutputItemStatus::OrSymbol, + + turn_id: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the web search call. + id:, + + # An action performed by the web search tool. + action:, + + # The status of the web search call. + status:, + + # The ID of the turn that contains this item. + turn_id:, + + # The item type. Always `web_search_call`. + + type: :web_search_call + ) + end + + sig do + override.returns( + { + id: String, + action: T.nilable(OpenAI::Beta::WebSearchAction::Variants), + status: OpenAI::Beta::AgentOutputItemStatus::TaggedSymbol, + turn_id: String, + type: Symbol + } + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/environment_info.rbi b/rbi/openai/models/beta/agents/environment_info.rbi new file mode 100644 index 000000000..d8c152d5c --- /dev/null +++ b/rbi/openai/models/beta/agents/environment_info.rbi @@ -0,0 +1,156 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + class EnvironmentInfo < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::EnvironmentInfo, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the environment. + sig { returns(String) } + attr_accessor :id + + # Files installed in the environment, without their contents. + sig { returns(T::Array[OpenAI::Beta::HostedEnvironmentFile::Variants]) } + attr_accessor :files + + # The object type. Always `agent.environment`. + sig { returns(Symbol) } + attr_accessor :object + + # Plugins installed in the environment, without their archive contents. + sig { returns(T::Array[OpenAI::Beta::HostedPlugin]) } + attr_accessor :plugins + + # Skills installed in the environment, without their archive contents. + sig { returns(T::Array[OpenAI::Beta::HostedSkill::Variants]) } + attr_accessor :skills + + # The current environment connection status. + sig { returns(OpenAI::Beta::Agents::EnvironmentInfo::Status::TaggedSymbol) } + attr_accessor :status + + # Whether the environment is hosted by OpenAI or by the application. + sig { returns(OpenAI::Beta::Agents::EnvironmentInfo::Type::TaggedSymbol) } + attr_accessor :type + + # Safe metadata for a first-class execution environment. + sig do + params( + + id: String, + + files: T::Array[ + T.any( + OpenAI::Beta::HostedEnvironmentFileID::OrHash, + OpenAI::Beta::HostedEnvironmentFile::Inline::OrHash + ) + ], + + plugins: T::Array[OpenAI::Beta::HostedPlugin::OrHash], + + skills: T::Array[ + T.any(OpenAI::Beta::HostedSkillReference::OrHash, OpenAI::Beta::HostedSkill::Inline::OrHash) + ], + + status: OpenAI::Beta::Agents::EnvironmentInfo::Status::OrSymbol, + + type: OpenAI::Beta::Agents::EnvironmentInfo::Type::OrSymbol, + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the environment. + id:, + + # Files installed in the environment, without their contents. + files:, + + # Plugins installed in the environment, without their archive contents. + plugins:, + + # Skills installed in the environment, without their archive contents. + skills:, + + # The current environment connection status. + status:, + + # Whether the environment is hosted by OpenAI or by the application. + type:, + + # The object type. Always `agent.environment`. + + object: :"agent.environment" + ) + end + + sig do + override.returns( + { + id: String, + files: T::Array[OpenAI::Beta::HostedEnvironmentFile::Variants], + object: Symbol, + plugins: T::Array[OpenAI::Beta::HostedPlugin], + skills: T::Array[OpenAI::Beta::HostedSkill::Variants], + status: OpenAI::Beta::Agents::EnvironmentInfo::Status::TaggedSymbol, + type: OpenAI::Beta::Agents::EnvironmentInfo::Type::TaggedSymbol + } + ) + end + def to_hash + end + + # The current environment connection status. + module Status + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Agents::EnvironmentInfo::Status) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + PENDING = T.let(:pending, OpenAI::Beta::Agents::EnvironmentInfo::Status::TaggedSymbol) + CONNECTED = T.let(:connected, OpenAI::Beta::Agents::EnvironmentInfo::Status::TaggedSymbol) + DISCONNECTED = T.let(:disconnected, OpenAI::Beta::Agents::EnvironmentInfo::Status::TaggedSymbol) + EXPIRED = T.let(:expired, OpenAI::Beta::Agents::EnvironmentInfo::Status::TaggedSymbol) + FAILED = T.let(:failed, OpenAI::Beta::Agents::EnvironmentInfo::Status::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::Agents::EnvironmentInfo::Status::TaggedSymbol]) } + def self.values + end + end + + # Whether the environment is hosted by OpenAI or by the application. + module Type + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Agents::EnvironmentInfo::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + OPENAI_HOSTED = T.let(:openai_hosted, OpenAI::Beta::Agents::EnvironmentInfo::Type::TaggedSymbol) + SELF_HOSTED = T.let(:self_hosted, OpenAI::Beta::Agents::EnvironmentInfo::Type::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::Agents::EnvironmentInfo::Type::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/environment_retrieve_params.rbi b/rbi/openai/models/beta/agents/environment_retrieve_params.rbi new file mode 100644 index 000000000..abe8da789 --- /dev/null +++ b/rbi/openai/models/beta/agents/environment_retrieve_params.rbi @@ -0,0 +1,57 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + class EnvironmentRetrieveParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::EnvironmentRetrieveParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :environment_id + + sig do + params( + + environment_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + environment_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {environment_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/environments/environment_file.rbi b/rbi/openai/models/beta/agents/environments/environment_file.rbi new file mode 100644 index 000000000..207885682 --- /dev/null +++ b/rbi/openai/models/beta/agents/environments/environment_file.rbi @@ -0,0 +1,87 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + EnvironmentFile = Environments::EnvironmentFile + + module Environments + + class EnvironmentFile < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::EnvironmentFile, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the environment containing this file. + sig { returns(String) } + attr_accessor :environment_id + + # The object type. Always `agent.environment.file`. + sig { returns(Symbol) } + attr_accessor :object + + # The absolute file path inside the environment's workspace. + sig { returns(String) } + attr_accessor :path + + # The file size in bytes. + sig { returns(Integer) } + attr_accessor :size_bytes + + # A live file in an execution environment. + sig do + params( + + environment_id: String, + + path: String, + + size_bytes: Integer, + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the environment containing this file. + environment_id:, + + # The absolute file path inside the environment's workspace. + path:, + + # The file size in bytes. + size_bytes:, + + # The object type. Always `agent.environment.file`. + + object: :"agent.environment.file" + ) + end + + sig do + override.returns( + {environment_id: String, object: Symbol, path: String, size_bytes: Integer} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/environments/environment_template.rbi b/rbi/openai/models/beta/agents/environments/environment_template.rbi new file mode 100644 index 000000000..2bcc6b43a --- /dev/null +++ b/rbi/openai/models/beta/agents/environments/environment_template.rbi @@ -0,0 +1,582 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + EnvironmentTemplate = Environments::EnvironmentTemplate + + module Environments + + class EnvironmentTemplate < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::EnvironmentTemplate, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the reusable environment template. + sig { returns(String) } + attr_accessor :id + + # Directories that expose capabilities to the agent. + sig { returns(T::Array[String]) } + attr_accessor :capability_directories + + # The Unix timestamp, in seconds, when the template was created. + sig { returns(Integer) } + attr_accessor :created_at + + # Safe file metadata, excluding contents and session-scoped file IDs. + sig { returns(T::Array[OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File::Variants]) } + attr_accessor :files + + # An optional human-readable display name for the template. + sig { returns(T.nilable(String)) } + attr_accessor :name + + # Runtime network access for each OpenAI-hosted environment. + sig { returns(OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network) } + attr_reader :network + + sig { params(network: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network::OrHash).void } + attr_writer :network + + # The object type. Always `agent.environment.template`. + sig { returns(Symbol) } + attr_accessor :object + + # Packages installed in each fresh OpenAI-hosted environment. + sig { returns(OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages) } + attr_reader :packages + + sig { params(packages: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages::OrHash).void } + attr_writer :packages + + # Safe plugin metadata, excluding inline archive contents. + sig { returns(T::Array[OpenAI::Beta::HostedPlugin]) } + attr_accessor :plugins + + # Safe skill metadata, preserving unresolved version selectors. + sig { returns(T::Array[OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill::Variants]) } + attr_accessor :skills + + # The Unix timestamp, in seconds, when the template was last updated. + sig { returns(Integer) } + attr_accessor :updated_at + + # Reusable configuration that provisions a fresh OpenAI-hosted environment for + # each session. + sig do + params( + + id: String, + + capability_directories: T::Array[String], + + created_at: Integer, + + files: T::Array[ + T.any( + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File::FileID::OrHash, + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File::Inline::OrHash + ) + ], + + name: T.nilable(String), + + network: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network::OrHash, + + packages: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages::OrHash, + + plugins: T::Array[OpenAI::Beta::HostedPlugin::OrHash], + + skills: T::Array[ + T.any( + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill::SkillReference::OrHash, + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill::Inline::OrHash + ) + ], + + updated_at: Integer, + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the reusable environment template. + id:, + + # Directories that expose capabilities to the agent. + capability_directories:, + + # The Unix timestamp, in seconds, when the template was created. + created_at:, + + # Safe file metadata, excluding contents and session-scoped file IDs. + files:, + + # An optional human-readable display name for the template. + name:, + + # Runtime network access for each OpenAI-hosted environment. + network:, + + # Packages installed in each fresh OpenAI-hosted environment. + packages:, + + # Safe plugin metadata, excluding inline archive contents. + plugins:, + + # Safe skill metadata, preserving unresolved version selectors. + skills:, + + # The Unix timestamp, in seconds, when the template was last updated. + updated_at:, + + # The object type. Always `agent.environment.template`. + + object: :"agent.environment.template" + ) + end + + sig do + override.returns( + { + id: String, + capability_directories: T::Array[String], + created_at: Integer, + files: T::Array[OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File::Variants], + name: T.nilable(String), + network: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network, + object: Symbol, + packages: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages, + plugins: T::Array[OpenAI::Beta::HostedPlugin], + skills: T::Array[OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill::Variants], + updated_at: Integer + } + ) + end + def to_hash + end + + # Safe metadata for a file configured by an environment template. + module File + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any( + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File::FileID, + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File::Inline + ) + } + + class FileID < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File::FileID, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the uploaded file. + sig { returns(String) } + attr_accessor :file_id + + # The file's absolute path inside the environment. + sig { returns(String) } + attr_accessor :path + + # The type of the object. Always `file_id`. + sig { returns(Symbol) } + attr_accessor :type + + # A project-scoped Files API reference resolved separately for each session. + sig do + params( + + file_id: String, + + path: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the uploaded file. + file_id:, + + # The file's absolute path inside the environment. + path:, + + # The type of the object. Always `file_id`. + + type: :file_id + ) + end + + sig do + override.returns( + {file_id: String, path: String, type: Symbol} + ) + end + def to_hash + end + + end + + class Inline < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File::Inline, + OpenAI::Internal::AnyHash + ) + end + + # The file's absolute path inside the environment. + sig { returns(String) } + attr_accessor :path + + # The decoded size of the inline file in bytes. + sig { returns(Integer) } + attr_accessor :size_bytes + + # The type of the object. Always `inline`. + sig { returns(Symbol) } + attr_accessor :type + + # Metadata for confidential inline file contents. + sig do + params( + + path: String, + + size_bytes: Integer, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The file's absolute path inside the environment. + path:, + + # The decoded size of the inline file in bytes. + size_bytes:, + + # The type of the object. Always `inline`. + + type: :inline + ) + end + + sig do + override.returns( + {path: String, size_bytes: Integer, type: Symbol} + ) + end + def to_hash + end + + end + + sig { + override.returns(T::Array[OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File::Variants]) + } + def self.variants + end + + end + + class Network < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network, + OpenAI::Internal::AnyHash + ) + end + + # The environment's network access mode. + sig { returns(OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network::Access::TaggedSymbol) } + attr_accessor :access + + # Domains the environment may access when network access is restricted. + sig { returns(T::Array[String]) } + attr_accessor :allowed_domains + + # Runtime network access for each OpenAI-hosted environment. + sig do + params( + + access: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network::Access::OrSymbol, + + allowed_domains: T::Array[String] + ) + .returns(T.attached_class) + end + def self.new( + + # The environment's network access mode. + access:, + + # Domains the environment may access when network access is restricted. + + allowed_domains: + ) + end + + sig do + override.returns( + { + access: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network::Access::TaggedSymbol, + allowed_domains: T::Array[String] + } + ) + end + def to_hash + end + + # The environment's network access mode. + module Access + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network::Access) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Allows unrestricted network access. + ENABLED = T.let( + :enabled, + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network::Access::TaggedSymbol + ) + + # Disables network access. + DISABLED = T.let( + :disabled, + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network::Access::TaggedSymbol + ) + + # Allows access only to configured domains. + RESTRICTED = T.let( + :restricted, + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network::Access::TaggedSymbol + ) + + sig { + override.returns( + T::Array[OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network::Access::TaggedSymbol] + ) + } + def self.values + end + end + end + + class Packages < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages, + OpenAI::Internal::AnyHash + ) + end + + # npm packages installed globally in the environment. + sig { returns(T::Array[String]) } + attr_accessor :npm + + # Python packages installed in the environment. + sig { returns(T::Array[String]) } + attr_accessor :python + + # System packages installed in the environment. + sig { returns(T::Array[String]) } + attr_accessor :system_ + + # Packages installed in each fresh OpenAI-hosted environment. + sig do + params( + + npm: T::Array[String], + + python: T::Array[String], + + system_: T::Array[String] + ) + .returns(T.attached_class) + end + def self.new( + + # npm packages installed globally in the environment. + npm:, + + # Python packages installed in the environment. + python:, + + # System packages installed in the environment. + + system_: + ) + end + + sig do + override.returns( + {npm: T::Array[String], python: T::Array[String], system_: T::Array[String]} + ) + end + def to_hash + end + + end + + # Safe metadata for a skill configured by an environment template. + module Skill + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { + T.any( + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill::SkillReference, + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill::Inline + ) + } + + class SkillReference < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill::SkillReference, + OpenAI::Internal::AnyHash + ) + end + + # The referenced skill ID. + sig { returns(String) } + attr_accessor :skill_id + + # The type of the object. Always `skill_reference`. + sig { returns(Symbol) } + attr_accessor :type + + # The requested version selector, including `latest`. + sig { returns(T.nilable(String)) } + attr_accessor :version + + # A skill resolved afresh from the Skills API whenever a session starts. + sig do + params( + + skill_id: String, + + version: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The referenced skill ID. + skill_id:, + + # The requested version selector, including `latest`. + version:, + + # The type of the object. Always `skill_reference`. + + type: :skill_reference + ) + end + + sig do + override.returns( + {skill_id: String, type: Symbol, version: T.nilable(String)} + ) + end + def to_hash + end + + end + + class Inline < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill::Inline, + OpenAI::Internal::AnyHash + ) + end + + # The skill description declared in `SKILL.md`. + sig { returns(String) } + attr_accessor :description + + # The skill name declared in `SKILL.md`. + sig { returns(String) } + attr_accessor :name + + # The type of the object. Always `inline`. + sig { returns(Symbol) } + attr_accessor :type + + # Safe metadata for an inline skill archive. + sig do + params( + + description: String, + + name: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The skill description declared in `SKILL.md`. + description:, + + # The skill name declared in `SKILL.md`. + name:, + + # The type of the object. Always `inline`. + + type: :inline + ) + end + + sig do + override.returns( + {description: String, name: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { + override.returns(T::Array[OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill::Variants]) + } + def self.variants + end + + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/environments/environment_template_deleted.rbi b/rbi/openai/models/beta/agents/environments/environment_template_deleted.rbi new file mode 100644 index 000000000..059634919 --- /dev/null +++ b/rbi/openai/models/beta/agents/environments/environment_template_deleted.rbi @@ -0,0 +1,78 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + EnvironmentTemplateDeleted = Environments::EnvironmentTemplateDeleted + + module Environments + + class EnvironmentTemplateDeleted < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::EnvironmentTemplateDeleted, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the deleted environment template. + sig { returns(String) } + attr_accessor :id + + # Whether the environment template was deleted. Always `true`. + sig { returns(T::Boolean) } + attr_accessor :deleted + + # The object type. Always `agent.environment.template.deleted`. + sig { returns(Symbol) } + attr_accessor :object + + # A deleted reusable environment template. + sig do + params( + + id: String, + + deleted: T::Boolean, + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the deleted environment template. + id:, + + # Whether the environment template was deleted. Always `true`. + deleted:, + + # The object type. Always `agent.environment.template.deleted`. + + object: :"agent.environment.template.deleted" + ) + end + + sig do + override.returns( + {id: String, deleted: T::Boolean, object: Symbol} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/environments/file_create_params.rbi b/rbi/openai/models/beta/agents/environments/file_create_params.rbi new file mode 100644 index 000000000..2c3fb83bc --- /dev/null +++ b/rbi/openai/models/beta/agents/environments/file_create_params.rbi @@ -0,0 +1,61 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Environments + + class FileCreateParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::FileCreateParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :environment_id + + sig do + params( + + environment_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + environment_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {environment_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/environments/file_list_params.rbi b/rbi/openai/models/beta/agents/environments/file_list_params.rbi new file mode 100644 index 000000000..2cfe2cbee --- /dev/null +++ b/rbi/openai/models/beta/agents/environments/file_list_params.rbi @@ -0,0 +1,130 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Environments + + class FileListParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::FileListParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :environment_id + + # The maximum number of files to return, between 1 and 100. + sig { returns(T.nilable(Integer)) } + attr_accessor :limit + + # Sort by case-sensitive path components. Defaults to descending. + sig { returns(T.nilable(OpenAI::Beta::Agents::Environments::FileListParams::Order::OrSymbol)) } + attr_reader :order + + sig { params(order: OpenAI::Beta::Agents::Environments::FileListParams::Order::OrSymbol).void } + attr_writer :order + + # The opaque token from the previous page. Keep the same path, order, and limit. + sig { returns(T.nilable(String)) } + attr_reader :page + + sig { params(page: String).void } + attr_writer :page + + # Restrict the listing to this absolute workspace directory. + sig { returns(T.nilable(String)) } + attr_accessor :path + + sig do + params( + + environment_id: String, + + limit: T.nilable(Integer), + + order: OpenAI::Beta::Agents::Environments::FileListParams::Order::OrSymbol, + + page: String, + + path: T.nilable(String), + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + environment_id:, + + # The maximum number of files to return, between 1 and 100. + limit: nil, + + # Sort by case-sensitive path components. Defaults to descending. + order: nil, + + # The opaque token from the previous page. Keep the same path, order, and limit. + page: nil, + + # Restrict the listing to this absolute workspace directory. + path: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + environment_id: String, + limit: T.nilable(Integer), + order: OpenAI::Beta::Agents::Environments::FileListParams::Order::OrSymbol, + page: String, + path: T.nilable(String), + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # Sort by case-sensitive path components. Defaults to descending. + module Order + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Agents::Environments::FileListParams::Order) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns resources in ascending order. + ASC = T.let(:asc, OpenAI::Beta::Agents::Environments::FileListParams::Order::TaggedSymbol) + + # Returns resources in descending order. + DESC = T.let(:desc, OpenAI::Beta::Agents::Environments::FileListParams::Order::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Beta::Agents::Environments::FileListParams::Order::TaggedSymbol]) + } + def self.values + end + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/environments/template_create_params.rbi b/rbi/openai/models/beta/agents/environments/template_create_params.rbi new file mode 100644 index 000000000..ee57cc206 --- /dev/null +++ b/rbi/openai/models/beta/agents/environments/template_create_params.rbi @@ -0,0 +1,350 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Environments + + class TemplateCreateParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::TemplateCreateParams, + OpenAI::Internal::AnyHash + ) + end + + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :capability_directories + + # Environment variables made available to the agent. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :env + + # Files available before the agent starts. Defaults to an empty list. + sig { + returns( + T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID, + OpenAI::Beta::HostedEnvironmentFileParam::Inline + ) + ] + ) + ) + } + attr_accessor :files + + # An optional human-readable display name for the template. + sig { returns(T.nilable(String)) } + attr_accessor :name + + # Network access for an OpenAI-hosted environment. + sig { returns(T.nilable(OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network)) } + attr_reader :network + + sig { + params(network: T.nilable(OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network::OrHash)).void + } + attr_writer :network + + # Packages to install in an OpenAI-hosted environment. + sig { returns(T.nilable(OpenAI::Beta::Agents::Environments::TemplateCreateParams::Packages)) } + attr_reader :packages + + sig { + params(packages: T.nilable(OpenAI::Beta::Agents::Environments::TemplateCreateParams::Packages::OrHash)) + .void + } + attr_writer :packages + + # Plugins provided as inline ZIP archives. Defaults to an empty list. + sig { returns(T.nilable(T::Array[OpenAI::Beta::HostedPluginParam])) } + attr_accessor :plugins + + # Ordered, confidential setup commands. Command bodies are never returned. + sig { returns(T.nilable(T::Array[OpenAI::Beta::SetupCommandParam])) } + attr_accessor :setup_commands + + # Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty + # list. + sig { + returns( + T.nilable( + T::Array[ + T.any(OpenAI::Beta::HostedSkillParam::SkillReference, OpenAI::Beta::HostedSkillParam::Inline) + ] + ) + ) + } + attr_accessor :skills + + sig do + params( + + capability_directories: T.nilable(T::Array[String]), + + env: T.nilable(T::Hash[Symbol, String]), + + files: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID::OrHash, + OpenAI::Beta::HostedEnvironmentFileParam::Inline::OrHash + ) + ] + ), + + name: T.nilable(String), + + network: T.nilable(OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network::OrHash), + + packages: T.nilable(OpenAI::Beta::Agents::Environments::TemplateCreateParams::Packages::OrHash), + + plugins: T.nilable(T::Array[OpenAI::Beta::HostedPluginParam::OrHash]), + + setup_commands: T.nilable(T::Array[OpenAI::Beta::SetupCommandParam::OrHash]), + + skills: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedSkillParam::SkillReference::OrHash, + OpenAI::Beta::HostedSkillParam::Inline::OrHash + ) + ] + ), + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + capability_directories: nil, + + # Environment variables made available to the agent. + env: nil, + + # Files available before the agent starts. Defaults to an empty list. + files: nil, + + # An optional human-readable display name for the template. + name: nil, + + # Network access for an OpenAI-hosted environment. + network: nil, + + # Packages to install in an OpenAI-hosted environment. + packages: nil, + + # Plugins provided as inline ZIP archives. Defaults to an empty list. + plugins: nil, + + # Ordered, confidential setup commands. Command bodies are never returned. + setup_commands: nil, + + # Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty + # list. + skills: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + capability_directories: T.nilable(T::Array[String]), + env: T.nilable(T::Hash[Symbol, String]), + files: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID, + OpenAI::Beta::HostedEnvironmentFileParam::Inline + ) + ] + ), + name: T.nilable(String), + network: T.nilable(OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network), + packages: T.nilable(OpenAI::Beta::Agents::Environments::TemplateCreateParams::Packages), + plugins: T.nilable(T::Array[OpenAI::Beta::HostedPluginParam]), + setup_commands: T.nilable(T::Array[OpenAI::Beta::SetupCommandParam]), + skills: T.nilable( + T::Array[ + T.any(OpenAI::Beta::HostedSkillParam::SkillReference, OpenAI::Beta::HostedSkillParam::Inline) + ] + ), + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + class Network < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network, + OpenAI::Internal::AnyHash + ) + end + + # The environment's network access mode. + sig { returns(OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network::Access::OrSymbol) } + attr_accessor :access + + # Domains the environment may access when network access is restricted. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :allowed_domains + + # Network access for an OpenAI-hosted environment. + sig do + params( + + access: OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network::Access::OrSymbol, + + allowed_domains: T.nilable(T::Array[String]) + ) + .returns(T.attached_class) + end + def self.new( + + # The environment's network access mode. + access:, + + # Domains the environment may access when network access is restricted. + + allowed_domains: nil + ) + end + + sig do + override.returns( + { + access: OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network::Access::OrSymbol, + allowed_domains: T.nilable(T::Array[String]) + } + ) + end + def to_hash + end + + # The environment's network access mode. + module Access + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network::Access) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Allows unrestricted network access, matching an omitted network policy. + ENABLED = T.let( + :enabled, + OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network::Access::TaggedSymbol + ) + + # Disables network access. + DISABLED = T.let( + :disabled, + OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network::Access::TaggedSymbol + ) + + # Allows access only to configured domains. + RESTRICTED = T.let( + :restricted, + OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network::Access::TaggedSymbol + ) + + sig { + override.returns( + T::Array[OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network::Access::TaggedSymbol] + ) + } + def self.values + end + end + end + + class Packages < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::TemplateCreateParams::Packages, + OpenAI::Internal::AnyHash + ) + end + + # npm packages to install globally. Defaults to an empty list. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :npm + + # Python packages to install. Defaults to an empty list. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :python + + # System packages to install. Defaults to an empty list. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :system_ + + # Packages to install in an OpenAI-hosted environment. + sig do + params( + + npm: T.nilable(T::Array[String]), + + python: T.nilable(T::Array[String]), + + system_: T.nilable(T::Array[String]) + ) + .returns(T.attached_class) + end + def self.new( + + # npm packages to install globally. Defaults to an empty list. + npm: nil, + + # Python packages to install. Defaults to an empty list. + python: nil, + + # System packages to install. Defaults to an empty list. + + system_: nil + ) + end + + sig do + override.returns( + { + npm: T.nilable(T::Array[String]), + python: T.nilable(T::Array[String]), + system_: T.nilable(T::Array[String]) + } + ) + end + def to_hash + end + + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/environments/template_delete_params.rbi b/rbi/openai/models/beta/agents/environments/template_delete_params.rbi new file mode 100644 index 000000000..dba30c01f --- /dev/null +++ b/rbi/openai/models/beta/agents/environments/template_delete_params.rbi @@ -0,0 +1,61 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Environments + + class TemplateDeleteParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::TemplateDeleteParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :environment_template_id + + sig do + params( + + environment_template_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + environment_template_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {environment_template_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/environments/template_list_params.rbi b/rbi/openai/models/beta/agents/environments/template_list_params.rbi new file mode 100644 index 000000000..d19d2ff1c --- /dev/null +++ b/rbi/openai/models/beta/agents/environments/template_list_params.rbi @@ -0,0 +1,117 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Environments + + class TemplateListParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::TemplateListParams, + OpenAI::Internal::AnyHash + ) + end + + # Return resources after this resource ID in the selected order. + sig { returns(T.nilable(String)) } + attr_reader :after + + sig { params(after: String).void } + attr_writer :after + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + sig { returns(T.nilable(Integer)) } + attr_reader :limit + + sig { params(limit: Integer).void } + attr_writer :limit + + # The order in which resources are returned. Defaults to `desc`. + sig { returns(T.nilable(OpenAI::Beta::Agents::Environments::TemplateListParams::Order::OrSymbol)) } + attr_reader :order + + sig { params(order: OpenAI::Beta::Agents::Environments::TemplateListParams::Order::OrSymbol).void } + attr_writer :order + + sig do + params( + + after: String, + + limit: Integer, + + order: OpenAI::Beta::Agents::Environments::TemplateListParams::Order::OrSymbol, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # Return resources after this resource ID in the selected order. + after: nil, + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + limit: nil, + + # The order in which resources are returned. Defaults to `desc`. + order: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Environments::TemplateListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::Agents::Environments::TemplateListParams::Order) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns resources in ascending order. + ASC = T.let(:asc, OpenAI::Beta::Agents::Environments::TemplateListParams::Order::TaggedSymbol) + + # Returns resources in descending order. + DESC = T.let(:desc, OpenAI::Beta::Agents::Environments::TemplateListParams::Order::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Beta::Agents::Environments::TemplateListParams::Order::TaggedSymbol]) + } + def self.values + end + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/environments/template_retrieve_params.rbi b/rbi/openai/models/beta/agents/environments/template_retrieve_params.rbi new file mode 100644 index 000000000..3d18d6b83 --- /dev/null +++ b/rbi/openai/models/beta/agents/environments/template_retrieve_params.rbi @@ -0,0 +1,61 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Environments + + class TemplateRetrieveParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::TemplateRetrieveParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :environment_template_id + + sig do + params( + + environment_template_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + environment_template_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {environment_template_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/environments/template_update_params.rbi b/rbi/openai/models/beta/agents/environments/template_update_params.rbi new file mode 100644 index 000000000..cb5fa6dd4 --- /dev/null +++ b/rbi/openai/models/beta/agents/environments/template_update_params.rbi @@ -0,0 +1,354 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Environments + + class TemplateUpdateParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::TemplateUpdateParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :environment_template_id + + # Directories that expose capabilities to the agent. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :capability_directories + + # Replacement confidential environment values. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :env + + # Replacement file configuration materialized for each new session. + sig { + returns( + T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID, + OpenAI::Beta::HostedEnvironmentFileParam::Inline + ) + ] + ) + ) + } + attr_accessor :files + + # A replacement human-readable display name, or `null` to clear the name. + sig { returns(T.nilable(String)) } + attr_accessor :name + + # Network access for an OpenAI-hosted environment. + sig { returns(T.nilable(OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network)) } + attr_reader :network + + sig { + params(network: T.nilable(OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network::OrHash)).void + } + attr_writer :network + + # Packages to install in an OpenAI-hosted environment. + sig { returns(T.nilable(OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Packages)) } + attr_reader :packages + + sig { + params(packages: T.nilable(OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Packages::OrHash)) + .void + } + attr_writer :packages + + # Replacement plugin configuration installed for each new session. + sig { returns(T.nilable(T::Array[OpenAI::Beta::HostedPluginParam])) } + attr_accessor :plugins + + # Replacement confidential setup commands, never included in returned resources. + sig { returns(T.nilable(T::Array[OpenAI::Beta::SetupCommandParam])) } + attr_accessor :setup_commands + + # Replacement skill configuration installed for each new session. + sig { + returns( + T.nilable( + T::Array[ + T.any(OpenAI::Beta::HostedSkillParam::SkillReference, OpenAI::Beta::HostedSkillParam::Inline) + ] + ) + ) + } + attr_accessor :skills + + sig do + params( + + environment_template_id: String, + + capability_directories: T.nilable(T::Array[String]), + + env: T.nilable(T::Hash[Symbol, String]), + + files: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID::OrHash, + OpenAI::Beta::HostedEnvironmentFileParam::Inline::OrHash + ) + ] + ), + + name: T.nilable(String), + + network: T.nilable(OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network::OrHash), + + packages: T.nilable(OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Packages::OrHash), + + plugins: T.nilable(T::Array[OpenAI::Beta::HostedPluginParam::OrHash]), + + setup_commands: T.nilable(T::Array[OpenAI::Beta::SetupCommandParam::OrHash]), + + skills: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedSkillParam::SkillReference::OrHash, + OpenAI::Beta::HostedSkillParam::Inline::OrHash + ) + ] + ), + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + environment_template_id:, + + # Directories that expose capabilities to the agent. + capability_directories: nil, + + # Replacement confidential environment values. + env: nil, + + # Replacement file configuration materialized for each new session. + files: nil, + + # A replacement human-readable display name, or `null` to clear the name. + name: nil, + + # Network access for an OpenAI-hosted environment. + network: nil, + + # Packages to install in an OpenAI-hosted environment. + packages: nil, + + # Replacement plugin configuration installed for each new session. + plugins: nil, + + # Replacement confidential setup commands, never included in returned resources. + setup_commands: nil, + + # Replacement skill configuration installed for each new session. + skills: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + environment_template_id: String, + capability_directories: T.nilable(T::Array[String]), + env: T.nilable(T::Hash[Symbol, String]), + files: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID, + OpenAI::Beta::HostedEnvironmentFileParam::Inline + ) + ] + ), + name: T.nilable(String), + network: T.nilable(OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network), + packages: T.nilable(OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Packages), + plugins: T.nilable(T::Array[OpenAI::Beta::HostedPluginParam]), + setup_commands: T.nilable(T::Array[OpenAI::Beta::SetupCommandParam]), + skills: T.nilable( + T::Array[ + T.any(OpenAI::Beta::HostedSkillParam::SkillReference, OpenAI::Beta::HostedSkillParam::Inline) + ] + ), + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + class Network < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network, + OpenAI::Internal::AnyHash + ) + end + + # The environment's network access mode. + sig { returns(OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network::Access::OrSymbol) } + attr_accessor :access + + # Domains the environment may access when network access is restricted. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :allowed_domains + + # Network access for an OpenAI-hosted environment. + sig do + params( + + access: OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network::Access::OrSymbol, + + allowed_domains: T.nilable(T::Array[String]) + ) + .returns(T.attached_class) + end + def self.new( + + # The environment's network access mode. + access:, + + # Domains the environment may access when network access is restricted. + + allowed_domains: nil + ) + end + + sig do + override.returns( + { + access: OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network::Access::OrSymbol, + allowed_domains: T.nilable(T::Array[String]) + } + ) + end + def to_hash + end + + # The environment's network access mode. + module Access + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network::Access) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Allows unrestricted network access, matching an omitted network policy. + ENABLED = T.let( + :enabled, + OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network::Access::TaggedSymbol + ) + + # Disables network access. + DISABLED = T.let( + :disabled, + OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network::Access::TaggedSymbol + ) + + # Allows access only to configured domains. + RESTRICTED = T.let( + :restricted, + OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network::Access::TaggedSymbol + ) + + sig { + override.returns( + T::Array[OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network::Access::TaggedSymbol] + ) + } + def self.values + end + end + end + + class Packages < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Packages, + OpenAI::Internal::AnyHash + ) + end + + # npm packages to install globally. Defaults to an empty list. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :npm + + # Python packages to install. Defaults to an empty list. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :python + + # System packages to install. Defaults to an empty list. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :system_ + + # Packages to install in an OpenAI-hosted environment. + sig do + params( + + npm: T.nilable(T::Array[String]), + + python: T.nilable(T::Array[String]), + + system_: T.nilable(T::Array[String]) + ) + .returns(T.attached_class) + end + def self.new( + + # npm packages to install globally. Defaults to an empty list. + npm: nil, + + # Python packages to install. Defaults to an empty list. + python: nil, + + # System packages to install. Defaults to an empty list. + + system_: nil + ) + end + + sig do + override.returns( + { + npm: T.nilable(T::Array[String]), + python: T.nilable(T::Array[String]), + system_: T.nilable(T::Array[String]) + } + ) + end + def to_hash + end + + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/session_create_params.rbi b/rbi/openai/models/beta/agents/session_create_params.rbi new file mode 100644 index 000000000..acb36ac6f --- /dev/null +++ b/rbi/openai/models/beta/agents/session_create_params.rbi @@ -0,0 +1,336 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + class SessionCreateParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::SessionCreateParams, + OpenAI::Internal::AnyHash + ) + end + + # An inline execution environment or a reference to an environment template. + sig { + returns( + T.any( + OpenAI::Beta::EnvironmentParam::None, + OpenAI::Beta::EnvironmentParam::OpenAIHosted, + OpenAI::Beta::EnvironmentParam::SelfHosted + ) + ) + } + attr_accessor :environment + + # Agent configuration. With `agent_id`, supplied fields override the saved agent + # for this session. Without `agent_id`, `model` is required. + sig { returns(T.nilable(OpenAI::Beta::Agents::SessionCreateParams::Agent)) } + attr_reader :agent + + sig { params(agent: OpenAI::Beta::Agents::SessionCreateParams::Agent::OrHash).void } + attr_writer :agent + + # The ID of a saved reusable agent. Omit `agent` to use its configuration + # unchanged. + sig { returns(T.nilable(String)) } + attr_reader :agent_id + + sig { params(agent_id: String).void } + attr_writer :agent_id + + # Initial input submitted when creating a session. + sig { returns(T.nilable(OpenAI::Beta::Agents::SessionCreateParams::Input::Variants)) } + attr_accessor :input + + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :metadata + + # The IDs of vaults made available to the session. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :vault_ids + + sig do + params( + + environment: T.any( + OpenAI::Beta::EnvironmentParam::None::OrHash, + OpenAI::Beta::EnvironmentParam::OpenAIHosted::OrHash, + OpenAI::Beta::EnvironmentParam::SelfHosted::OrHash + ), + + agent: OpenAI::Beta::Agents::SessionCreateParams::Agent::OrHash, + + agent_id: String, + + input: T.nilable(OpenAI::Beta::Agents::SessionCreateParams::Input::Variants), + + metadata: T.nilable(T::Hash[Symbol, String]), + + vault_ids: T.nilable(T::Array[String]), + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # An inline execution environment or a reference to an environment template. + environment:, + + # Agent configuration. With `agent_id`, supplied fields override the saved agent + # for this session. Without `agent_id`, `model` is required. + agent: nil, + + # The ID of a saved reusable agent. Omit `agent` to use its configuration + # unchanged. + agent_id: nil, + + # Initial input submitted when creating a session. + input: nil, + + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + metadata: nil, + + # The IDs of vaults made available to the session. + vault_ids: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + environment: T.any( + OpenAI::Beta::EnvironmentParam::None, + OpenAI::Beta::EnvironmentParam::OpenAIHosted, + OpenAI::Beta::EnvironmentParam::SelfHosted + ), + agent: OpenAI::Beta::Agents::SessionCreateParams::Agent, + agent_id: String, + input: T.nilable(OpenAI::Beta::Agents::SessionCreateParams::Input::Variants), + metadata: T.nilable(T::Hash[Symbol, String]), + vault_ids: T.nilable(T::Array[String]), + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + class Agent < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::SessionCreateParams::Agent, + OpenAI::Internal::AnyHash + ) + end + + # Additional instructions appended to the agent's default base instructions. Omit + # to leave unchanged. + sig { returns(T.nilable(String)) } + attr_accessor :instructions + + # The model to use for the agent. The requested model name is preserved. + sig { returns(T.nilable(String)) } + attr_reader :model + + sig { params(model: String).void } + attr_writer :model + + # Explicit configuration for creating and coordinating subagents. + sig { returns(T.nilable(OpenAI::Beta::MultiAgentConfigParam)) } + attr_reader :multi_agent + + sig { params(multi_agent: T.nilable(OpenAI::Beta::MultiAgentConfigParam::OrHash)).void } + attr_writer :multi_agent + + # Reasoning configuration for the agent. + sig { returns(T.nilable(OpenAI::Beta::AgentReasoningParam)) } + attr_reader :reasoning + + sig { params(reasoning: T.nilable(OpenAI::Beta::AgentReasoningParam::OrHash)).void } + attr_writer :reasoning + + # The service tier used for model requests. + sig { returns(T.nilable(OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier::OrSymbol)) } + attr_accessor :service_tier + + # Configuration for text generated by the agent. + sig { returns(T.nilable(OpenAI::Beta::AgentTextParam)) } + attr_reader :text + + sig { params(text: T.nilable(OpenAI::Beta::AgentTextParam::OrHash)).void } + attr_writer :text + + # Tools available to the agent. Omit to inherit, or pass null to clear them. + sig { + returns( + T.nilable( + T::Array[ + T.any( + OpenAI::Beta::AgentToolParam::Function, + OpenAI::Beta::AgentToolParam::ToolSearch, + OpenAI::Beta::AgentToolParam::ProgrammaticToolCalling, + OpenAI::Beta::AgentToolParam::Mcp, + OpenAI::Beta::AgentToolParam::WebSearch + ) + ] + ) + ) + } + attr_accessor :tools + + # Agent configuration. With `agent_id`, supplied fields override the saved agent + # for this session. Without `agent_id`, `model` is required. + sig do + params( + + instructions: T.nilable(String), + + model: String, + + multi_agent: T.nilable(OpenAI::Beta::MultiAgentConfigParam::OrHash), + + reasoning: T.nilable(OpenAI::Beta::AgentReasoningParam::OrHash), + + service_tier: T.nilable(OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier::OrSymbol), + + text: T.nilable(OpenAI::Beta::AgentTextParam::OrHash), + + tools: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::AgentToolParam::Function::OrHash, + OpenAI::Beta::AgentToolParam::ToolSearch::OrHash, + OpenAI::Beta::AgentToolParam::ProgrammaticToolCalling::OrHash, + OpenAI::Beta::AgentToolParam::Mcp::OrHash, + OpenAI::Beta::AgentToolParam::WebSearch::OrHash + ) + ] + ) + ) + .returns(T.attached_class) + end + def self.new( + + # Additional instructions appended to the agent's default base instructions. Omit + # to leave unchanged. + instructions: nil, + + # The model to use for the agent. The requested model name is preserved. + model: nil, + + # Explicit configuration for creating and coordinating subagents. + multi_agent: nil, + + # Reasoning configuration for the agent. + reasoning: nil, + + # The service tier used for model requests. + service_tier: nil, + + # Configuration for text generated by the agent. + text: nil, + + # Tools available to the agent. Omit to inherit, or pass null to clear them. + + tools: nil + ) + end + + sig do + override.returns( + { + instructions: T.nilable(String), + model: String, + multi_agent: T.nilable(OpenAI::Beta::MultiAgentConfigParam), + reasoning: T.nilable(OpenAI::Beta::AgentReasoningParam), + service_tier: T.nilable(OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier::OrSymbol), + text: T.nilable(OpenAI::Beta::AgentTextParam), + tools: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::AgentToolParam::Function, + OpenAI::Beta::AgentToolParam::ToolSearch, + OpenAI::Beta::AgentToolParam::ProgrammaticToolCalling, + OpenAI::Beta::AgentToolParam::Mcp, + OpenAI::Beta::AgentToolParam::WebSearch + ) + ] + ) + } + ) + end + def to_hash + end + + # The service tier used for model requests. + module ServiceTier + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Selects the service tier automatically. + AUTO = T.let(:auto, OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier::TaggedSymbol) + + # Uses the default service tier. + DEFAULT = T.let(:default, OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier::TaggedSymbol) + + # Uses the flex service tier. + FLEX = T.let(:flex, OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier::TaggedSymbol) + + # Uses the priority service tier. + PRIORITY = T.let(:priority, OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier::TaggedSymbol) + + # Uses the fast service tier. + FAST = T.let(:fast, OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Beta::Agents::SessionCreateParams::Agent::ServiceTier::TaggedSymbol]) + } + def self.values + end + end + end + + # Initial input submitted when creating a session. + module Input + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias { T.any(String, T::Array[OpenAI::Beta::AgentSessionInputMessageParam]) } + + sig { override.returns(T::Array[OpenAI::Beta::Agents::SessionCreateParams::Input::Variants]) } + def self.variants + end + + AgentSessionInputMessageParamArray = T.let( + OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::AgentSessionInputMessageParam], + OpenAI::Internal::Type::Converter + ) + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/session_delete_params.rbi b/rbi/openai/models/beta/agents/session_delete_params.rbi new file mode 100644 index 000000000..62038e65c --- /dev/null +++ b/rbi/openai/models/beta/agents/session_delete_params.rbi @@ -0,0 +1,57 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + class SessionDeleteParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::SessionDeleteParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + sig do + params( + + session_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {session_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/session_list_params.rbi b/rbi/openai/models/beta/agents/session_list_params.rbi new file mode 100644 index 000000000..52f182b0c --- /dev/null +++ b/rbi/openai/models/beta/agents/session_list_params.rbi @@ -0,0 +1,124 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + class SessionListParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::SessionListParams, + OpenAI::Internal::AnyHash + ) + end + + # Return resources after this resource ID in the selected order. + sig { returns(T.nilable(String)) } + attr_reader :after + + sig { params(after: String).void } + attr_writer :after + + # Only return sessions whose root agent has this ID. Omit to return sessions for + # all agents. + sig { returns(T.nilable(String)) } + attr_reader :agent_id + + sig { params(agent_id: String).void } + attr_writer :agent_id + + # The maximum number of resources to return. + sig { returns(T.nilable(Integer)) } + attr_accessor :limit + + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + sig { returns(T.nilable(OpenAI::Beta::Agents::SessionListParams::Order::OrSymbol)) } + attr_reader :order + + sig { params(order: OpenAI::Beta::Agents::SessionListParams::Order::OrSymbol).void } + attr_writer :order + + sig do + params( + + after: String, + + agent_id: String, + + limit: T.nilable(Integer), + + order: OpenAI::Beta::Agents::SessionListParams::Order::OrSymbol, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # Return resources after this resource ID in the selected order. + after: nil, + + # Only return sessions whose root agent has this ID. Omit to return sessions for + # all agents. + agent_id: nil, + + # The maximum number of resources to return. + limit: nil, + + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + order: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + after: String, + agent_id: String, + limit: T.nilable(Integer), + order: OpenAI::Beta::Agents::SessionListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Agents::SessionListParams::Order) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns resources in ascending order. + ASC = T.let(:asc, OpenAI::Beta::Agents::SessionListParams::Order::TaggedSymbol) + + # Returns resources in descending order. + DESC = T.let(:desc, OpenAI::Beta::Agents::SessionListParams::Order::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::Agents::SessionListParams::Order::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/session_retrieve_params.rbi b/rbi/openai/models/beta/agents/session_retrieve_params.rbi new file mode 100644 index 000000000..ca62457a4 --- /dev/null +++ b/rbi/openai/models/beta/agents/session_retrieve_params.rbi @@ -0,0 +1,57 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + class SessionRetrieveParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::SessionRetrieveParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + sig do + params( + + session_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {session_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/session_update_params.rbi b/rbi/openai/models/beta/agents/session_update_params.rbi new file mode 100644 index 000000000..698eabee7 --- /dev/null +++ b/rbi/openai/models/beta/agents/session_update_params.rbi @@ -0,0 +1,74 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + class SessionUpdateParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::SessionUpdateParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + # Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :metadata + + sig do + params( + + session_id: String, + + metadata: T.nilable(T::Hash[Symbol, String]), + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + # Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. + metadata: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + session_id: String, + metadata: T.nilable(T::Hash[Symbol, String]), + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/artifact_content_params.rbi b/rbi/openai/models/beta/agents/sessions/artifact_content_params.rbi new file mode 100644 index 000000000..55b87c213 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/artifact_content_params.rbi @@ -0,0 +1,68 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + class ArtifactContentParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::ArtifactContentParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + sig { returns(String) } + attr_accessor :artifact_id + + sig do + params( + + session_id: String, + + artifact_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + artifact_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {session_id: String, artifact_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/artifact_delete_params.rbi b/rbi/openai/models/beta/agents/sessions/artifact_delete_params.rbi new file mode 100644 index 000000000..1ab239246 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/artifact_delete_params.rbi @@ -0,0 +1,68 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + class ArtifactDeleteParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::ArtifactDeleteParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + sig { returns(String) } + attr_accessor :artifact_id + + sig do + params( + + session_id: String, + + artifact_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + artifact_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {session_id: String, artifact_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/artifact_list_params.rbi b/rbi/openai/models/beta/agents/sessions/artifact_list_params.rbi new file mode 100644 index 000000000..ffccd0344 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/artifact_list_params.rbi @@ -0,0 +1,127 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + class ArtifactListParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::ArtifactListParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + # Return artifacts after this immutable artifact ID. + sig { returns(T.nilable(String)) } + attr_accessor :after + + # Restrict the listing to artifacts produced by this environment. + sig { returns(T.nilable(String)) } + attr_accessor :environment_id + + # The maximum number of artifacts to return, between 1 and 100. + sig { returns(T.nilable(Integer)) } + attr_accessor :limit + + # Sort by creation time and ID. Defaults to descending. + sig { returns(T.nilable(OpenAI::Beta::Agents::Sessions::ArtifactListParams::Order::OrSymbol)) } + attr_reader :order + + sig { params(order: OpenAI::Beta::Agents::Sessions::ArtifactListParams::Order::OrSymbol).void } + attr_writer :order + + sig do + params( + + session_id: String, + + after: T.nilable(String), + + environment_id: T.nilable(String), + + limit: T.nilable(Integer), + + order: OpenAI::Beta::Agents::Sessions::ArtifactListParams::Order::OrSymbol, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + # Return artifacts after this immutable artifact ID. + after: nil, + + # Restrict the listing to artifacts produced by this environment. + environment_id: nil, + + # The maximum number of artifacts to return, between 1 and 100. + limit: nil, + + # Sort by creation time and ID. Defaults to descending. + order: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + session_id: String, + after: T.nilable(String), + environment_id: T.nilable(String), + limit: T.nilable(Integer), + order: OpenAI::Beta::Agents::Sessions::ArtifactListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # Sort by creation time and ID. Defaults to descending. + module Order + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Agents::Sessions::ArtifactListParams::Order) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns resources in ascending order. + ASC = T.let(:asc, OpenAI::Beta::Agents::Sessions::ArtifactListParams::Order::TaggedSymbol) + + # Returns resources in descending order. + DESC = T.let(:desc, OpenAI::Beta::Agents::Sessions::ArtifactListParams::Order::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Beta::Agents::Sessions::ArtifactListParams::Order::TaggedSymbol]) + } + def self.values + end + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/artifact_retrieve_params.rbi b/rbi/openai/models/beta/agents/sessions/artifact_retrieve_params.rbi new file mode 100644 index 000000000..024484525 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/artifact_retrieve_params.rbi @@ -0,0 +1,68 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + class ArtifactRetrieveParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::ArtifactRetrieveParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + sig { returns(String) } + attr_accessor :artifact_id + + sig do + params( + + session_id: String, + + artifact_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + artifact_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {session_id: String, artifact_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/event_create_params.rbi b/rbi/openai/models/beta/agents/sessions/event_create_params.rbi new file mode 100644 index 000000000..40e1ecb03 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/event_create_params.rbi @@ -0,0 +1,107 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + class EventCreateParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::EventCreateParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + # The input events to submit to the session. + sig { + returns( + T::Array[ + T.any( + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputMessage, + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputCancel, + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputToolResult + ) + ] + ) + } + attr_accessor :events + + sig { returns(T.nilable(String)) } + attr_reader :idempotency_key + + sig { params(idempotency_key: String).void } + attr_writer :idempotency_key + + sig do + params( + + session_id: String, + + events: T::Array[ + T.any( + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputMessage::OrHash, + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputCancel::OrHash, + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputToolResult::OrHash + ) + ], + + idempotency_key: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + # The input events to submit to the session. + events:, + + idempotency_key: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + session_id: String, + events: T::Array[ + T.any( + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputMessage, + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputCancel, + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputToolResult + ) + ], + idempotency_key: String, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/event_stream_params.rbi b/rbi/openai/models/beta/agents/sessions/event_stream_params.rbi new file mode 100644 index 000000000..12e83b75d --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/event_stream_params.rbi @@ -0,0 +1,61 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + class EventStreamParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::EventStreamParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + sig do + params( + + session_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {session_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/item_list_params.rbi b/rbi/openai/models/beta/agents/sessions/item_list_params.rbi new file mode 100644 index 000000000..6359f0464 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/item_list_params.rbi @@ -0,0 +1,121 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + class ItemListParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::ItemListParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + # Return resources after this resource ID in the selected order. + sig { returns(T.nilable(String)) } + attr_reader :after + + sig { params(after: String).void } + attr_writer :after + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + sig { returns(T.nilable(Integer)) } + attr_reader :limit + + sig { params(limit: Integer).void } + attr_writer :limit + + # The order in which resources are returned. Defaults to `desc`. + sig { returns(T.nilable(OpenAI::Beta::Agents::Sessions::ItemListParams::Order::OrSymbol)) } + attr_reader :order + + sig { params(order: OpenAI::Beta::Agents::Sessions::ItemListParams::Order::OrSymbol).void } + attr_writer :order + + sig do + params( + + session_id: String, + + after: String, + + limit: Integer, + + order: OpenAI::Beta::Agents::Sessions::ItemListParams::Order::OrSymbol, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + # Return resources after this resource ID in the selected order. + after: nil, + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + limit: nil, + + # The order in which resources are returned. Defaults to `desc`. + order: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + session_id: String, + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Sessions::ItemListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Agents::Sessions::ItemListParams::Order) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns resources in ascending order. + ASC = T.let(:asc, OpenAI::Beta::Agents::Sessions::ItemListParams::Order::TaggedSymbol) + + # Returns resources in descending order. + DESC = T.let(:desc, OpenAI::Beta::Agents::Sessions::ItemListParams::Order::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::Agents::Sessions::ItemListParams::Order::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/session_artifact.rbi b/rbi/openai/models/beta/agents/sessions/session_artifact.rbi new file mode 100644 index 000000000..51ad269a3 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/session_artifact.rbi @@ -0,0 +1,132 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + SessionArtifact = Sessions::SessionArtifact + + module Sessions + + class SessionArtifact < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::SessionArtifact, + OpenAI::Internal::AnyHash + ) + end + + # The immutable artifact ID. + sig { returns(String) } + attr_accessor :id + + # The Unix timestamp, in seconds, when the artifact was published. + sig { returns(Integer) } + attr_accessor :created_at + + # The ID of the environment that produced the artifact. + sig { returns(String) } + attr_accessor :environment_id + + # The object type. Always `agent.session.artifact`. + sig { returns(Symbol) } + attr_accessor :object + + # The original absolute file path in the execution environment. + sig { returns(String) } + attr_accessor :path + + # The ID of the session that owns the artifact. + sig { returns(String) } + attr_accessor :session_id + + # The immutable artifact size in bytes. + sig { returns(Integer) } + attr_accessor :size_bytes + + # The ID of the completed turn that published the artifact. + sig { returns(String) } + attr_accessor :turn_id + + # An immutable file published by a completed hosted session turn. + sig do + params( + + id: String, + + created_at: Integer, + + environment_id: String, + + path: String, + + session_id: String, + + size_bytes: Integer, + + turn_id: String, + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The immutable artifact ID. + id:, + + # The Unix timestamp, in seconds, when the artifact was published. + created_at:, + + # The ID of the environment that produced the artifact. + environment_id:, + + # The original absolute file path in the execution environment. + path:, + + # The ID of the session that owns the artifact. + session_id:, + + # The immutable artifact size in bytes. + size_bytes:, + + # The ID of the completed turn that published the artifact. + turn_id:, + + # The object type. Always `agent.session.artifact`. + + object: :"agent.session.artifact" + ) + end + + sig do + override.returns( + { + id: String, + created_at: Integer, + environment_id: String, + object: Symbol, + path: String, + session_id: String, + size_bytes: Integer, + turn_id: String + } + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/session_artifact_deleted.rbi b/rbi/openai/models/beta/agents/sessions/session_artifact_deleted.rbi new file mode 100644 index 000000000..d10f239d7 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/session_artifact_deleted.rbi @@ -0,0 +1,78 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + SessionArtifactDeleted = Sessions::SessionArtifactDeleted + + module Sessions + + class SessionArtifactDeleted < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::SessionArtifactDeleted, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the deleted session artifact. + sig { returns(String) } + attr_accessor :id + + # Whether the session artifact was deleted. Always `true`. + sig { returns(T::Boolean) } + attr_accessor :deleted + + # The object type. Always `agent.session.artifact.deleted`. + sig { returns(Symbol) } + attr_accessor :object + + # Confirmation that an immutable session artifact was deleted. + sig do + params( + + id: String, + + deleted: T::Boolean, + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the deleted session artifact. + id:, + + # Whether the session artifact was deleted. Always `true`. + deleted:, + + # The object type. Always `agent.session.artifact.deleted`. + + object: :"agent.session.artifact.deleted" + ) + end + + sig do + override.returns( + {id: String, deleted: T::Boolean, object: Symbol} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/subagent_list_params.rbi b/rbi/openai/models/beta/agents/sessions/subagent_list_params.rbi new file mode 100644 index 000000000..956f0393d --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/subagent_list_params.rbi @@ -0,0 +1,123 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + class SubagentListParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::SubagentListParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + # Return resources after this resource ID in the selected order. + sig { returns(T.nilable(String)) } + attr_reader :after + + sig { params(after: String).void } + attr_writer :after + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + sig { returns(T.nilable(Integer)) } + attr_reader :limit + + sig { params(limit: Integer).void } + attr_writer :limit + + # The order in which resources are returned. Defaults to `desc`. + sig { returns(T.nilable(OpenAI::Beta::Agents::Sessions::SubagentListParams::Order::OrSymbol)) } + attr_reader :order + + sig { params(order: OpenAI::Beta::Agents::Sessions::SubagentListParams::Order::OrSymbol).void } + attr_writer :order + + sig do + params( + + session_id: String, + + after: String, + + limit: Integer, + + order: OpenAI::Beta::Agents::Sessions::SubagentListParams::Order::OrSymbol, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + # Return resources after this resource ID in the selected order. + after: nil, + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + limit: nil, + + # The order in which resources are returned. Defaults to `desc`. + order: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + session_id: String, + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Sessions::SubagentListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Agents::Sessions::SubagentListParams::Order) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns resources in ascending order. + ASC = T.let(:asc, OpenAI::Beta::Agents::Sessions::SubagentListParams::Order::TaggedSymbol) + + # Returns resources in descending order. + DESC = T.let(:desc, OpenAI::Beta::Agents::Sessions::SubagentListParams::Order::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Beta::Agents::Sessions::SubagentListParams::Order::TaggedSymbol]) + } + def self.values + end + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/subagent_retrieve_params.rbi b/rbi/openai/models/beta/agents/sessions/subagent_retrieve_params.rbi new file mode 100644 index 000000000..b3710763e --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/subagent_retrieve_params.rbi @@ -0,0 +1,68 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + class SubagentRetrieveParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::SubagentRetrieveParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + sig { returns(String) } + attr_accessor :subagent_id + + sig do + params( + + session_id: String, + + subagent_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + subagent_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {session_id: String, subagent_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/subagents/item_list_params.rbi b/rbi/openai/models/beta/agents/sessions/subagents/item_list_params.rbi new file mode 100644 index 000000000..741fa8331 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/subagents/item_list_params.rbi @@ -0,0 +1,139 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + module Subagents + + class ItemListParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::Subagents::ItemListParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + sig { returns(String) } + attr_accessor :subagent_id + + # Return resources after this resource ID in the selected order. + sig { returns(T.nilable(String)) } + attr_reader :after + + sig { params(after: String).void } + attr_writer :after + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + sig { returns(T.nilable(Integer)) } + attr_reader :limit + + sig { params(limit: Integer).void } + attr_writer :limit + + # The order in which resources are returned. Defaults to `desc`. + sig { returns(T.nilable(OpenAI::Beta::Agents::Sessions::Subagents::ItemListParams::Order::OrSymbol)) } + attr_reader :order + + sig { params(order: OpenAI::Beta::Agents::Sessions::Subagents::ItemListParams::Order::OrSymbol).void } + attr_writer :order + + sig do + params( + + session_id: String, + + subagent_id: String, + + after: String, + + limit: Integer, + + order: OpenAI::Beta::Agents::Sessions::Subagents::ItemListParams::Order::OrSymbol, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + subagent_id:, + + # Return resources after this resource ID in the selected order. + after: nil, + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + limit: nil, + + # The order in which resources are returned. Defaults to `desc`. + order: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + session_id: String, + subagent_id: String, + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Sessions::Subagents::ItemListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::Agents::Sessions::Subagents::ItemListParams::Order) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns resources in ascending order. + ASC = T.let(:asc, OpenAI::Beta::Agents::Sessions::Subagents::ItemListParams::Order::TaggedSymbol) + + # Returns resources in descending order. + DESC = T.let(:desc, OpenAI::Beta::Agents::Sessions::Subagents::ItemListParams::Order::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Beta::Agents::Sessions::Subagents::ItemListParams::Order::TaggedSymbol] + ) + } + def self.values + end + end + + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/subagents/turn_list_params.rbi b/rbi/openai/models/beta/agents/sessions/subagents/turn_list_params.rbi new file mode 100644 index 000000000..640a08fb9 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/subagents/turn_list_params.rbi @@ -0,0 +1,139 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + module Subagents + + class TurnListParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::Subagents::TurnListParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + sig { returns(String) } + attr_accessor :subagent_id + + # Return resources after this resource ID in the selected order. + sig { returns(T.nilable(String)) } + attr_reader :after + + sig { params(after: String).void } + attr_writer :after + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + sig { returns(T.nilable(Integer)) } + attr_reader :limit + + sig { params(limit: Integer).void } + attr_writer :limit + + # The order in which resources are returned. Defaults to `desc`. + sig { returns(T.nilable(OpenAI::Beta::Agents::Sessions::Subagents::TurnListParams::Order::OrSymbol)) } + attr_reader :order + + sig { params(order: OpenAI::Beta::Agents::Sessions::Subagents::TurnListParams::Order::OrSymbol).void } + attr_writer :order + + sig do + params( + + session_id: String, + + subagent_id: String, + + after: String, + + limit: Integer, + + order: OpenAI::Beta::Agents::Sessions::Subagents::TurnListParams::Order::OrSymbol, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + subagent_id:, + + # Return resources after this resource ID in the selected order. + after: nil, + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + limit: nil, + + # The order in which resources are returned. Defaults to `desc`. + order: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + session_id: String, + subagent_id: String, + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Sessions::Subagents::TurnListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::Agents::Sessions::Subagents::TurnListParams::Order) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns resources in ascending order. + ASC = T.let(:asc, OpenAI::Beta::Agents::Sessions::Subagents::TurnListParams::Order::TaggedSymbol) + + # Returns resources in descending order. + DESC = T.let(:desc, OpenAI::Beta::Agents::Sessions::Subagents::TurnListParams::Order::TaggedSymbol) + + sig { + override.returns( + T::Array[OpenAI::Beta::Agents::Sessions::Subagents::TurnListParams::Order::TaggedSymbol] + ) + } + def self.values + end + end + + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/subagents/turn_retrieve_params.rbi b/rbi/openai/models/beta/agents/sessions/subagents/turn_retrieve_params.rbi new file mode 100644 index 000000000..4f16a5bf5 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/subagents/turn_retrieve_params.rbi @@ -0,0 +1,79 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + module Subagents + + class TurnRetrieveParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::Subagents::TurnRetrieveParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + sig { returns(String) } + attr_accessor :subagent_id + + sig { returns(String) } + attr_accessor :turn_id + + sig do + params( + + session_id: String, + + subagent_id: String, + + turn_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + subagent_id:, + + turn_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {session_id: String, subagent_id: String, turn_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/subagents/turns/item_list_params.rbi b/rbi/openai/models/beta/agents/sessions/subagents/turns/item_list_params.rbi new file mode 100644 index 000000000..bfb654451 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/subagents/turns/item_list_params.rbi @@ -0,0 +1,161 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + module Subagents + + module Turns + + class ItemListParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::Subagents::Turns::ItemListParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + sig { returns(String) } + attr_accessor :subagent_id + + sig { returns(String) } + attr_accessor :turn_id + + # Return resources after this resource ID in the selected order. + sig { returns(T.nilable(String)) } + attr_reader :after + + sig { params(after: String).void } + attr_writer :after + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + sig { returns(T.nilable(Integer)) } + attr_reader :limit + + sig { params(limit: Integer).void } + attr_writer :limit + + # The order in which resources are returned. Defaults to `desc`. + sig { + returns(T.nilable(OpenAI::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::Order::OrSymbol)) + } + attr_reader :order + + sig { + params(order: OpenAI::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::Order::OrSymbol).void + } + attr_writer :order + + sig do + params( + + session_id: String, + + subagent_id: String, + + turn_id: String, + + after: String, + + limit: Integer, + + order: OpenAI::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::Order::OrSymbol, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + subagent_id:, + + turn_id:, + + # Return resources after this resource ID in the selected order. + after: nil, + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + limit: nil, + + # The order in which resources are returned. Defaults to `desc`. + order: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + session_id: String, + subagent_id: String, + turn_id: String, + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::Order) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns resources in ascending order. + ASC = T.let( + :asc, + OpenAI::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::Order::TaggedSymbol + ) + + # Returns resources in descending order. + DESC = T.let( + :desc, + OpenAI::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::Order::TaggedSymbol + ) + + sig { + override.returns( + T::Array[OpenAI::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::Order::TaggedSymbol] + ) + } + def self.values + end + end + + end + + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/turn.rbi b/rbi/openai/models/beta/agents/sessions/turn.rbi new file mode 100644 index 000000000..bfabbc2ca --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/turn.rbi @@ -0,0 +1,200 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + class Turn < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::Turn, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the turn. + sig { returns(String) } + attr_accessor :id + + # The ID of the agent that ran the turn. + sig { returns(String) } + attr_accessor :agent_id + + # The Unix timestamp, in seconds, when the turn reached a terminal state. + sig { returns(T.nilable(Integer)) } + attr_accessor :completed_at + + # The Unix timestamp, in seconds, used to order the turn by creation time. + # Subagent turns use their start time, falling back to completion time or the + # subagent opening time when the preceding timestamps are unavailable. + sig { returns(Integer) } + attr_accessor :created_at + + # A customer-safe error describing why a session request failed. + sig { returns(T.nilable(OpenAI::Beta::SessionTurnError)) } + attr_reader :error + + sig { params(error: T.nilable(OpenAI::Beta::SessionTurnError::OrHash)).void } + attr_writer :error + + # The object type. Always `agent.session.turn`. + sig { returns(Symbol) } + attr_accessor :object + + # The ID of the session that owns the turn. + sig { returns(String) } + attr_accessor :session_id + + # The Unix timestamp, in seconds, when the turn started. + sig { returns(T.nilable(Integer)) } + attr_accessor :started_at + + # The current status of the turn. + sig { returns(OpenAI::Beta::Agents::Sessions::Turn::Status::TaggedSymbol) } + attr_accessor :status + + # The ID of the subagent that ran the turn, if applicable. + sig { returns(T.nilable(String)) } + attr_accessor :subagent_id + + # Recorded token usage for a session or turn. Usage is best effort and may change. + sig { returns(T.nilable(OpenAI::Beta::TokenUsage)) } + attr_reader :usage + + sig { params(usage: T.nilable(OpenAI::Beta::TokenUsage::OrHash)).void } + attr_writer :usage + + # The canonical public representation of a session turn. + sig do + params( + + id: String, + + agent_id: String, + + completed_at: T.nilable(Integer), + + created_at: Integer, + + error: T.nilable(OpenAI::Beta::SessionTurnError::OrHash), + + session_id: String, + + started_at: T.nilable(Integer), + + status: OpenAI::Beta::Agents::Sessions::Turn::Status::OrSymbol, + + subagent_id: T.nilable(String), + + usage: T.nilable(OpenAI::Beta::TokenUsage::OrHash), + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the turn. + id:, + + # The ID of the agent that ran the turn. + agent_id:, + + # The Unix timestamp, in seconds, when the turn reached a terminal state. + completed_at:, + + # The Unix timestamp, in seconds, used to order the turn by creation time. + # Subagent turns use their start time, falling back to completion time or the + # subagent opening time when the preceding timestamps are unavailable. + created_at:, + + # A customer-safe error describing why a session request failed. + error:, + + # The ID of the session that owns the turn. + session_id:, + + # The Unix timestamp, in seconds, when the turn started. + started_at:, + + # The current status of the turn. + status:, + + # The ID of the subagent that ran the turn, if applicable. + subagent_id:, + + # Recorded token usage for a session or turn. Usage is best effort and may change. + usage:, + + # The object type. Always `agent.session.turn`. + + object: :"agent.session.turn" + ) + end + + sig do + override.returns( + { + id: String, + agent_id: String, + completed_at: T.nilable(Integer), + created_at: Integer, + error: T.nilable(OpenAI::Beta::SessionTurnError), + object: Symbol, + session_id: String, + started_at: T.nilable(Integer), + status: OpenAI::Beta::Agents::Sessions::Turn::Status::TaggedSymbol, + subagent_id: T.nilable(String), + usage: T.nilable(OpenAI::Beta::TokenUsage) + } + ) + end + def to_hash + end + + # The current status of the turn. + module Status + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Agents::Sessions::Turn::Status) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # The turn is waiting to start. + QUEUED = T.let(:queued, OpenAI::Beta::Agents::Sessions::Turn::Status::TaggedSymbol) + + # The turn is in progress. + IN_PROGRESS = T.let(:in_progress, OpenAI::Beta::Agents::Sessions::Turn::Status::TaggedSymbol) + + # The turn is waiting for external input. + WAITING = T.let(:waiting, OpenAI::Beta::Agents::Sessions::Turn::Status::TaggedSymbol) + + # The turn completed successfully. + COMPLETED = T.let(:completed, OpenAI::Beta::Agents::Sessions::Turn::Status::TaggedSymbol) + + # The turn failed. + FAILED = T.let(:failed, OpenAI::Beta::Agents::Sessions::Turn::Status::TaggedSymbol) + + # The turn was cancelled. + CANCELLED = T.let(:cancelled, OpenAI::Beta::Agents::Sessions::Turn::Status::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::Agents::Sessions::Turn::Status::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/turn_list_params.rbi b/rbi/openai/models/beta/agents/sessions/turn_list_params.rbi new file mode 100644 index 000000000..3b5923b39 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/turn_list_params.rbi @@ -0,0 +1,121 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + class TurnListParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::TurnListParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + # Return resources after this resource ID in the selected order. + sig { returns(T.nilable(String)) } + attr_reader :after + + sig { params(after: String).void } + attr_writer :after + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + sig { returns(T.nilable(Integer)) } + attr_reader :limit + + sig { params(limit: Integer).void } + attr_writer :limit + + # The order in which resources are returned. Defaults to `desc`. + sig { returns(T.nilable(OpenAI::Beta::Agents::Sessions::TurnListParams::Order::OrSymbol)) } + attr_reader :order + + sig { params(order: OpenAI::Beta::Agents::Sessions::TurnListParams::Order::OrSymbol).void } + attr_writer :order + + sig do + params( + + session_id: String, + + after: String, + + limit: Integer, + + order: OpenAI::Beta::Agents::Sessions::TurnListParams::Order::OrSymbol, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + # Return resources after this resource ID in the selected order. + after: nil, + + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + limit: nil, + + # The order in which resources are returned. Defaults to `desc`. + order: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + session_id: String, + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Sessions::TurnListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # The order in which resources are returned. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Agents::Sessions::TurnListParams::Order) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns resources in ascending order. + ASC = T.let(:asc, OpenAI::Beta::Agents::Sessions::TurnListParams::Order::TaggedSymbol) + + # Returns resources in descending order. + DESC = T.let(:desc, OpenAI::Beta::Agents::Sessions::TurnListParams::Order::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::Agents::Sessions::TurnListParams::Order::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/sessions/turn_retrieve_params.rbi b/rbi/openai/models/beta/agents/sessions/turn_retrieve_params.rbi new file mode 100644 index 000000000..c98fa2b15 --- /dev/null +++ b/rbi/openai/models/beta/agents/sessions/turn_retrieve_params.rbi @@ -0,0 +1,68 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Sessions + + class TurnRetrieveParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Sessions::TurnRetrieveParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :session_id + + sig { returns(String) } + attr_accessor :turn_id + + sig do + params( + + session_id: String, + + turn_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + session_id:, + + turn_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {session_id: String, turn_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vault.rbi b/rbi/openai/models/beta/agents/vault.rbi new file mode 100644 index 000000000..5a90cb428 --- /dev/null +++ b/rbi/openai/models/beta/agents/vault.rbi @@ -0,0 +1,99 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + class Vault < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vault, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the vault. + sig { returns(String) } + attr_accessor :id + + # The Unix timestamp, in seconds, when the vault was created. + sig { returns(Integer) } + attr_accessor :created_at + + # Key-value pairs associated with the vault, such as an application or team + # identifier. + sig { returns(T::Hash[Symbol, String]) } + attr_accessor :metadata + + # The human-readable name of the vault, if set. + sig { returns(T.nilable(String)) } + attr_accessor :name + + # The object type. Always `vault`. + sig { returns(Symbol) } + attr_accessor :object + + # A collection of credentials that agent tools can use to authenticate to MCP + # servers. + sig do + params( + + id: String, + + created_at: Integer, + + metadata: T::Hash[Symbol, String], + + name: T.nilable(String), + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the vault. + id:, + + # The Unix timestamp, in seconds, when the vault was created. + created_at:, + + # Key-value pairs associated with the vault, such as an application or team + # identifier. + metadata:, + + # The human-readable name of the vault, if set. + name:, + + # The object type. Always `vault`. + + object: :vault + ) + end + + sig do + override.returns( + { + id: String, + created_at: Integer, + metadata: T::Hash[Symbol, String], + name: T.nilable(String), + object: Symbol + } + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vault_create_params.rbi b/rbi/openai/models/beta/agents/vault_create_params.rbi new file mode 100644 index 000000000..730dfa3fb --- /dev/null +++ b/rbi/openai/models/beta/agents/vault_create_params.rbi @@ -0,0 +1,75 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + class VaultCreateParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::VaultCreateParams, + OpenAI::Internal::AnyHash + ) + end + + # Key-value pairs to associate with the vault, such as an application or team + # identifier. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :metadata + + # The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after + # trimming. + sig { returns(T.nilable(String)) } + attr_reader :name + + sig { params(name: String).void } + attr_writer :name + + sig do + params( + + metadata: T.nilable(T::Hash[Symbol, String]), + + name: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # Key-value pairs to associate with the vault, such as an application or team + # identifier. + metadata: nil, + + # The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after + # trimming. + name: nil, + + request_options: {} + ) + end + + sig do + override.returns( + {metadata: T.nilable(T::Hash[Symbol, String]), name: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vault_delete_params.rbi b/rbi/openai/models/beta/agents/vault_delete_params.rbi new file mode 100644 index 000000000..b995b0bfa --- /dev/null +++ b/rbi/openai/models/beta/agents/vault_delete_params.rbi @@ -0,0 +1,57 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + class VaultDeleteParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::VaultDeleteParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :vault_id + + sig do + params( + + vault_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + vault_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {vault_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vault_deleted.rbi b/rbi/openai/models/beta/agents/vault_deleted.rbi new file mode 100644 index 000000000..730f196bb --- /dev/null +++ b/rbi/openai/models/beta/agents/vault_deleted.rbi @@ -0,0 +1,72 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + class VaultDeleted < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::VaultDeleted, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the deleted vault. + sig { returns(String) } + attr_accessor :id + + # Whether the resource was deleted. Always `true`. + sig { returns(T::Boolean) } + attr_accessor :deleted + + # The object type. Always `vault.deleted`. + sig { returns(Symbol) } + attr_accessor :object + + # Confirmation that a vault was deleted. + sig do + params( + + id: String, + + deleted: T::Boolean, + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the deleted vault. + id:, + + # Whether the resource was deleted. Always `true`. + deleted:, + + # The object type. Always `vault.deleted`. + + object: :"vault.deleted" + ) + end + + sig do + override.returns( + {id: String, deleted: T::Boolean, object: Symbol} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vault_list_params.rbi b/rbi/openai/models/beta/agents/vault_list_params.rbi new file mode 100644 index 000000000..3f5fbf2d9 --- /dev/null +++ b/rbi/openai/models/beta/agents/vault_list_params.rbi @@ -0,0 +1,149 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + class VaultListParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::VaultListParams, + OpenAI::Internal::AnyHash + ) + end + + # Return resources after this resource ID in the selected order. + sig { returns(T.nilable(String)) } + attr_reader :after + + sig { params(after: String).void } + attr_writer :after + + # The maximum number of resources to return. Defaults to 20. Values are clamped + # between 1 and 100. + sig { returns(T.nilable(Integer)) } + attr_accessor :limit + + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + sig { returns(T.nilable(OpenAI::Beta::Agents::VaultListParams::Order::OrSymbol)) } + attr_reader :order + + sig { params(order: OpenAI::Beta::Agents::VaultListParams::Order::OrSymbol).void } + attr_writer :order + + # Filter by one status or a list, such as `status=active` or + # `status[]=active&status[]=archived`. Both statuses are included by default. + sig { + returns( + T.nilable( + T.any( + OpenAI::Beta::Agents::VaultStatus::OrSymbol, + T::Array[OpenAI::Beta::Agents::VaultStatus::OrSymbol] + ) + ) + ) + } + attr_reader :status + + sig { + params( + status: T.any( + OpenAI::Beta::Agents::VaultStatus::OrSymbol, + T::Array[OpenAI::Beta::Agents::VaultStatus::OrSymbol] + ) + ) + .void + } + attr_writer :status + + sig do + params( + + after: String, + + limit: T.nilable(Integer), + + order: OpenAI::Beta::Agents::VaultListParams::Order::OrSymbol, + + status: T.any( + OpenAI::Beta::Agents::VaultStatus::OrSymbol, + T::Array[OpenAI::Beta::Agents::VaultStatus::OrSymbol] + ), + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + # Return resources after this resource ID in the selected order. + after: nil, + + # The maximum number of resources to return. Defaults to 20. Values are clamped + # between 1 and 100. + limit: nil, + + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + order: nil, + + # Filter by one status or a list, such as `status=active` or + # `status[]=active&status[]=archived`. Both statuses are included by default. + status: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + after: String, + limit: T.nilable(Integer), + order: OpenAI::Beta::Agents::VaultListParams::Order::OrSymbol, + status: T.any( + OpenAI::Beta::Agents::VaultStatus::OrSymbol, + T::Array[OpenAI::Beta::Agents::VaultStatus::OrSymbol] + ), + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Agents::VaultListParams::Order) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns resources in ascending order. + ASC = T.let(:asc, OpenAI::Beta::Agents::VaultListParams::Order::TaggedSymbol) + + # Returns resources in descending order. + DESC = T.let(:desc, OpenAI::Beta::Agents::VaultListParams::Order::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::Agents::VaultListParams::Order::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vault_retrieve_params.rbi b/rbi/openai/models/beta/agents/vault_retrieve_params.rbi new file mode 100644 index 000000000..2a3aa00e4 --- /dev/null +++ b/rbi/openai/models/beta/agents/vault_retrieve_params.rbi @@ -0,0 +1,57 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + class VaultRetrieveParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::VaultRetrieveParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :vault_id + + sig do + params( + + vault_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + vault_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {vault_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vault_status.rbi b/rbi/openai/models/beta/agents/vault_status.rbi new file mode 100644 index 000000000..1c314daf4 --- /dev/null +++ b/rbi/openai/models/beta/agents/vault_status.rbi @@ -0,0 +1,30 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + # Whether a vault or credential is active or archived. + module VaultStatus + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Agents::VaultStatus) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + ACTIVE = T.let(:active, OpenAI::Beta::Agents::VaultStatus::TaggedSymbol) + ARCHIVED = T.let(:archived, OpenAI::Beta::Agents::VaultStatus::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::Agents::VaultStatus::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vault_status_filter.rbi b/rbi/openai/models/beta/agents/vault_status_filter.rbi new file mode 100644 index 000000000..389aff176 --- /dev/null +++ b/rbi/openai/models/beta/agents/vault_status_filter.rbi @@ -0,0 +1,39 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + # One or more lifecycle statuses to include when listing vaults or credentials. + module VaultStatusFilter + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::Agents::VaultStatus::TaggedSymbol, + T::Array[OpenAI::Beta::Agents::VaultStatus::TaggedSymbol] + ) + end + + sig { override.returns(T::Array[OpenAI::Beta::Agents::VaultStatusFilter::Variants]) } + def self.variants + end + + VaultStatusArray = T.let( + OpenAI::Internal::Type::ArrayOf[ + enum: -> { OpenAI::Models::Beta::Agents::VaultStatus } + ], + OpenAI::Internal::Type::Converter + ) + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vaults/credential.rbi b/rbi/openai/models/beta/agents/vaults/credential.rbi new file mode 100644 index 000000000..9b7cce51e --- /dev/null +++ b/rbi/openai/models/beta/agents/vaults/credential.rbi @@ -0,0 +1,123 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Vaults + + class Credential < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::Credential, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the credential. + sig { returns(String) } + attr_accessor :id + + # The authentication method and non-secret configuration for the MCP server. + sig { returns(OpenAI::Beta::Agents::Vaults::CredentialAuth::Variants) } + attr_accessor :auth + + # The Unix timestamp, in seconds, when the credential was created. + sig { returns(Integer) } + attr_accessor :created_at + + # The human-readable name of the credential. + sig { returns(String) } + attr_accessor :name + + # The object type. Always `vault.credential`. + sig { returns(Symbol) } + attr_accessor :object + + # The Unix timestamp, in seconds, when the credential was last updated. + sig { returns(Integer) } + attr_accessor :updated_at + + # The ID of the vault containing this credential. + sig { returns(String) } + attr_accessor :vault_id + + # Metadata for a stored MCP server credential. Secret values are never returned. + sig do + params( + + id: String, + + auth: T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth::OrHash, + OpenAI::Beta::Agents::Vaults::CredentialAuth::StaticBearer::OrHash + ), + + created_at: Integer, + + name: String, + + updated_at: Integer, + + vault_id: String, + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the credential. + id:, + + # The authentication method and non-secret configuration for the MCP server. + auth:, + + # The Unix timestamp, in seconds, when the credential was created. + created_at:, + + # The human-readable name of the credential. + name:, + + # The Unix timestamp, in seconds, when the credential was last updated. + updated_at:, + + # The ID of the vault containing this credential. + vault_id:, + + # The object type. Always `vault.credential`. + + object: :"vault.credential" + ) + end + + sig do + override.returns( + { + id: String, + auth: OpenAI::Beta::Agents::Vaults::CredentialAuth::Variants, + created_at: Integer, + name: String, + object: Symbol, + updated_at: Integer, + vault_id: String + } + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vaults/credential_auth.rbi b/rbi/openai/models/beta/agents/vaults/credential_auth.rbi new file mode 100644 index 000000000..d4ffe5a80 --- /dev/null +++ b/rbi/openai/models/beta/agents/vaults/credential_auth.rbi @@ -0,0 +1,248 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Vaults + + # The MCP server and authentication configuration of a vault credential, excluding + # secrets. + module CredentialAuth + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth, + OpenAI::Beta::Agents::Vaults::CredentialAuth::StaticBearer + ) + end + + class McpOauth < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth, + OpenAI::Internal::AnyHash + ) + end + + # When the OAuth access token expires, as an RFC 3339 timestamp, if known. + sig { returns(T.nilable(String)) } + attr_accessor :expires_at + + # The HTTPS MCP server URL authorized by this credential. + sig { returns(String) } + attr_accessor :mcp_server_url + + # Configuration used to refresh an MCP OAuth access token, excluding secret + # values. + sig { returns(T.nilable(OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth::Refresh)) } + attr_reader :refresh + + sig { + params(refresh: T.nilable(OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth::Refresh::OrHash)).void + } + attr_writer :refresh + + # The type of the object. Always `mcp_oauth`. + sig { returns(Symbol) } + attr_accessor :type + + # Public metadata for an OAuth credential; tokens and client secrets are never + # returned. + sig do + params( + + expires_at: T.nilable(String), + + mcp_server_url: String, + + refresh: T.nilable(OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth::Refresh::OrHash), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # When the OAuth access token expires, as an RFC 3339 timestamp, if known. + expires_at:, + + # The HTTPS MCP server URL authorized by this credential. + mcp_server_url:, + + # Configuration used to refresh an MCP OAuth access token, excluding secret + # values. + refresh:, + + # The type of the object. Always `mcp_oauth`. + + type: :mcp_oauth + ) + end + + sig do + override.returns( + { + expires_at: T.nilable(String), + mcp_server_url: String, + refresh: T.nilable(OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth::Refresh), + type: Symbol + } + ) + end + def to_hash + end + + class Refresh < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth::Refresh, + OpenAI::Internal::AnyHash + ) + end + + # The OAuth client ID used when requesting a new access token. + sig { returns(String) } + attr_accessor :client_id + + # The resource URI sent to the OAuth token endpoint during refresh, if configured. + sig { returns(T.nilable(String)) } + attr_accessor :resource + + # Space-separated OAuth scopes requested during refresh, if configured. + sig { returns(T.nilable(String)) } + attr_accessor :scope + + # The HTTPS OAuth token endpoint used for refresh. + sig { returns(String) } + attr_accessor :token_endpoint + + # How the OAuth client authenticates to the token endpoint, excluding its client + # secret. + sig { returns(OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::Variants) } + attr_accessor :token_endpoint_auth + + # Configuration used to refresh an MCP OAuth access token, excluding secret + # values. + sig do + params( + + client_id: String, + + resource: T.nilable(String), + + scope: T.nilable(String), + + token_endpoint: String, + + token_endpoint_auth: T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::None::OrHash, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretBasic::OrHash, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretPost::OrHash + ) + ) + .returns(T.attached_class) + end + def self.new( + + # The OAuth client ID used when requesting a new access token. + client_id:, + + # The resource URI sent to the OAuth token endpoint during refresh, if configured. + resource:, + + # Space-separated OAuth scopes requested during refresh, if configured. + scope:, + + # The HTTPS OAuth token endpoint used for refresh. + token_endpoint:, + + # How the OAuth client authenticates to the token endpoint, excluding its client + # secret. + + token_endpoint_auth: + ) + end + + sig do + override.returns( + { + client_id: String, + resource: T.nilable(String), + scope: T.nilable(String), + token_endpoint: String, + token_endpoint_auth: OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::Variants + } + ) + end + def to_hash + end + + end + end + + class StaticBearer < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuth::StaticBearer, + OpenAI::Internal::AnyHash + ) + end + + # The HTTPS MCP server URL authorized by this credential. + sig { returns(String) } + attr_accessor :mcp_server_url + + # The type of the object. Always `static_bearer`. + sig { returns(Symbol) } + attr_accessor :type + + # Metadata for a bearer-token credential, without automatic OAuth refresh. + sig do + params( + + mcp_server_url: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The HTTPS MCP server URL authorized by this credential. + mcp_server_url:, + + # The type of the object. Always `static_bearer`. + + type: :static_bearer + ) + end + + sig do + override.returns( + {mcp_server_url: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::Agents::Vaults::CredentialAuth::Variants]) } + def self.variants + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vaults/credential_auth_create_param.rbi b/rbi/openai/models/beta/agents/vaults/credential_auth_create_param.rbi new file mode 100644 index 000000000..b5d4cdbb6 --- /dev/null +++ b/rbi/openai/models/beta/agents/vaults/credential_auth_create_param.rbi @@ -0,0 +1,293 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Vaults + + # Authentication credentials for an MCP server used by agent tools. + module CredentialAuthCreateParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth, + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::StaticBearer + ) + end + + class McpOauth < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth, + OpenAI::Internal::AnyHash + ) + end + + # A write-only OAuth access token; never returned by credential resources. + sig { returns(String) } + attr_accessor :access_token + + # The HTTPS MCP server URL authorized by this credential. + sig { returns(String) } + attr_accessor :mcp_server_url + + # The type of the object. Always `mcp_oauth`. + sig { returns(Symbol) } + attr_accessor :type + + # When the OAuth access token expires, as an RFC 3339 timestamp, if known. + sig { returns(T.nilable(String)) } + attr_accessor :expires_at + + # Configuration for refreshing the access token of an MCP OAuth credential. + sig { returns(T.nilable(OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::Refresh)) } + attr_reader :refresh + + sig { + params( + refresh: T.nilable(OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::Refresh::OrHash) + ) + .void + } + attr_writer :refresh + + # An OAuth credential for an HTTPS MCP destination. + sig do + params( + + access_token: String, + + mcp_server_url: String, + + expires_at: T.nilable(String), + + refresh: T.nilable(OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::Refresh::OrHash), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # A write-only OAuth access token; never returned by credential resources. + access_token:, + + # The HTTPS MCP server URL authorized by this credential. + mcp_server_url:, + + # When the OAuth access token expires, as an RFC 3339 timestamp, if known. + expires_at: nil, + + # Configuration for refreshing the access token of an MCP OAuth credential. + refresh: nil, + + # The type of the object. Always `mcp_oauth`. + + type: :mcp_oauth + ) + end + + sig do + override.returns( + { + access_token: String, + mcp_server_url: String, + type: Symbol, + expires_at: T.nilable(String), + refresh: T.nilable(OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::Refresh) + } + ) + end + def to_hash + end + + class Refresh < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::Refresh, + OpenAI::Internal::AnyHash + ) + end + + # The OAuth client ID used when requesting a new access token. + sig { returns(String) } + attr_accessor :client_id + + # The refresh token to store. This secret is never returned in credential + # resources. + sig { returns(String) } + attr_accessor :refresh_token + + # The HTTPS OAuth token endpoint used to exchange the refresh token for a new + # access token. + sig { returns(String) } + attr_accessor :token_endpoint + + # How the OAuth client authenticates to the token endpoint. + sig { + returns( + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::None, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretBasic, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretPost + ) + ) + } + attr_accessor :token_endpoint_auth + + # The resource URI to send to the OAuth token endpoint during refresh, if + # required. + sig { returns(T.nilable(String)) } + attr_accessor :resource + + # Space-separated OAuth scopes to request during refresh, if required. + sig { returns(T.nilable(String)) } + attr_accessor :scope + + # Configuration for refreshing the access token of an MCP OAuth credential. + sig do + params( + + client_id: String, + + refresh_token: String, + + token_endpoint: String, + + token_endpoint_auth: T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::None::OrHash, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretBasic::OrHash, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretPost::OrHash + ), + + resource: T.nilable(String), + + scope: T.nilable(String) + ) + .returns(T.attached_class) + end + def self.new( + + # The OAuth client ID used when requesting a new access token. + client_id:, + + # The refresh token to store. This secret is never returned in credential + # resources. + refresh_token:, + + # The HTTPS OAuth token endpoint used to exchange the refresh token for a new + # access token. + token_endpoint:, + + # How the OAuth client authenticates to the token endpoint. + token_endpoint_auth:, + + # The resource URI to send to the OAuth token endpoint during refresh, if + # required. + resource: nil, + + # Space-separated OAuth scopes to request during refresh, if required. + + scope: nil + ) + end + + sig do + override.returns( + { + client_id: String, + refresh_token: String, + token_endpoint: String, + token_endpoint_auth: T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::None, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretBasic, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretPost + ), + resource: T.nilable(String), + scope: T.nilable(String) + } + ) + end + def to_hash + end + + end + end + + class StaticBearer < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::StaticBearer, + OpenAI::Internal::AnyHash + ) + end + + # The bearer token to store. This secret is never returned in credential + # resources. + sig { returns(String) } + attr_accessor :token + + # The HTTPS MCP server URL authorized by this credential. + sig { returns(String) } + attr_accessor :mcp_server_url + + # The type of the object. Always `static_bearer`. + sig { returns(Symbol) } + attr_accessor :type + + # A bearer token for an MCP server, without automatic OAuth refresh. + sig do + params( + + token: String, + + mcp_server_url: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The bearer token to store. This secret is never returned in credential + # resources. + token:, + + # The HTTPS MCP server URL authorized by this credential. + mcp_server_url:, + + # The type of the object. Always `static_bearer`. + + type: :static_bearer + ) + end + + sig do + override.returns( + {token: String, mcp_server_url: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::Variants]) } + def self.variants + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vaults/credential_auth_rotate_param.rbi b/rbi/openai/models/beta/agents/vaults/credential_auth_rotate_param.rbi new file mode 100644 index 000000000..ed247fa55 --- /dev/null +++ b/rbi/openai/models/beta/agents/vaults/credential_auth_rotate_param.rbi @@ -0,0 +1,252 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Vaults + + # Updates to a vault credential without changing its authentication method or MCP + # server. + module CredentialAuthRotateParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth, + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::StaticBearer + ) + end + + class McpOauth < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `mcp_oauth`. + sig { returns(Symbol) } + attr_accessor :type + + # A write-only replacement OAuth access token. + sig { returns(T.nilable(String)) } + attr_accessor :access_token + + # The replacement expiry as an RFC 3339 timestamp, or `null` to clear it. Omitting + # this field preserves the expiry unless a new access token is supplied, in which + # case the expiry is cleared. + sig { returns(T.nilable(String)) } + attr_accessor :expires_at + + # Updates to an MCP credential's existing OAuth refresh configuration. + sig { returns(T.nilable(OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::Refresh)) } + attr_reader :refresh + + sig { + params( + refresh: T.nilable(OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::Refresh::OrHash) + ) + .void + } + attr_writer :refresh + + # Rotate an OAuth credential for an HTTPS MCP destination. + sig do + params( + + access_token: T.nilable(String), + + expires_at: T.nilable(String), + + refresh: T.nilable(OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::Refresh::OrHash), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # A write-only replacement OAuth access token. + access_token: nil, + + # The replacement expiry as an RFC 3339 timestamp, or `null` to clear it. Omitting + # this field preserves the expiry unless a new access token is supplied, in which + # case the expiry is cleared. + expires_at: nil, + + # Updates to an MCP credential's existing OAuth refresh configuration. + refresh: nil, + + # The type of the object. Always `mcp_oauth`. + + type: :mcp_oauth + ) + end + + sig do + override.returns( + { + type: Symbol, + access_token: T.nilable(String), + expires_at: T.nilable(String), + refresh: T.nilable(OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::Refresh) + } + ) + end + def to_hash + end + + class Refresh < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::Refresh, + OpenAI::Internal::AnyHash + ) + end + + # The replacement refresh token. Omit or pass `null` to keep the stored token. + # This secret is never returned in resources. + sig { returns(T.nilable(String)) } + attr_accessor :refresh_token + + # Replacement space-separated OAuth scopes for refresh requests. Omit to keep the + # scopes, or pass `null` to stop sending a scope parameter. + sig { returns(T.nilable(String)) } + attr_accessor :scope + + # Client-secret updates that preserve the credential's OAuth authentication + # method. + sig { + returns( + T.nilable( + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretBasic, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretPost + ) + ) + ) + } + attr_accessor :token_endpoint_auth + + # Updates to an MCP credential's existing OAuth refresh configuration. + sig do + params( + + refresh_token: T.nilable(String), + + scope: T.nilable(String), + + token_endpoint_auth: T.nilable( + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretBasic::OrHash, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretPost::OrHash + ) + ) + ) + .returns(T.attached_class) + end + def self.new( + + # The replacement refresh token. Omit or pass `null` to keep the stored token. + # This secret is never returned in resources. + refresh_token: nil, + + # Replacement space-separated OAuth scopes for refresh requests. Omit to keep the + # scopes, or pass `null` to stop sending a scope parameter. + scope: nil, + + # Client-secret updates that preserve the credential's OAuth authentication + # method. + + token_endpoint_auth: nil + ) + end + + sig do + override.returns( + { + refresh_token: T.nilable(String), + scope: T.nilable(String), + token_endpoint_auth: T.nilable( + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretBasic, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretPost + ) + ) + } + ) + end + def to_hash + end + + end + end + + class StaticBearer < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::StaticBearer, + OpenAI::Internal::AnyHash + ) + end + + # The replacement bearer token. This secret is never returned in credential + # resources. + sig { returns(String) } + attr_accessor :token + + # The type of the object. Always `static_bearer`. + sig { returns(Symbol) } + attr_accessor :type + + # Replace the bearer token for the credential's MCP server. + sig do + params( + + token: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The replacement bearer token. This secret is never returned in credential + # resources. + token:, + + # The type of the object. Always `static_bearer`. + + type: :static_bearer + ) + end + + sig do + override.returns( + {token: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::Variants]) } + def self.variants + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vaults/credential_create_params.rbi b/rbi/openai/models/beta/agents/vaults/credential_create_params.rbi new file mode 100644 index 000000000..d6ae1fb65 --- /dev/null +++ b/rbi/openai/models/beta/agents/vaults/credential_create_params.rbi @@ -0,0 +1,99 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Vaults + + class CredentialCreateParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialCreateParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :vault_id + + # The authentication method and secret values to store for the MCP server. + sig { + returns( + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth, + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::StaticBearer + ) + ) + } + attr_accessor :auth + + # The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after + # trimming. + sig { returns(String) } + attr_accessor :name + + sig do + params( + + vault_id: String, + + auth: T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::OrHash, + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::StaticBearer::OrHash + ), + + name: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + vault_id:, + + # The authentication method and secret values to store for the MCP server. + auth:, + + # The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after + # trimming. + name:, + + request_options: {} + ) + end + + sig do + override.returns( + { + vault_id: String, + auth: T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth, + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::StaticBearer + ), + name: String, + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vaults/credential_delete_params.rbi b/rbi/openai/models/beta/agents/vaults/credential_delete_params.rbi new file mode 100644 index 000000000..d5a06b026 --- /dev/null +++ b/rbi/openai/models/beta/agents/vaults/credential_delete_params.rbi @@ -0,0 +1,68 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Vaults + + class CredentialDeleteParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialDeleteParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :vault_id + + sig { returns(String) } + attr_accessor :credential_id + + sig do + params( + + vault_id: String, + + credential_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + vault_id:, + + credential_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {vault_id: String, credential_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vaults/credential_deleted.rbi b/rbi/openai/models/beta/agents/vaults/credential_deleted.rbi new file mode 100644 index 000000000..f4204ff68 --- /dev/null +++ b/rbi/openai/models/beta/agents/vaults/credential_deleted.rbi @@ -0,0 +1,76 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Vaults + + class CredentialDeleted < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialDeleted, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the deleted credential. + sig { returns(String) } + attr_accessor :id + + # Whether the resource was deleted. Always `true`. + sig { returns(T::Boolean) } + attr_accessor :deleted + + # The object type. Always `vault.credential.deleted`. + sig { returns(Symbol) } + attr_accessor :object + + # Confirmation that a vault credential was deleted. + sig do + params( + + id: String, + + deleted: T::Boolean, + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the deleted credential. + id:, + + # Whether the resource was deleted. Always `true`. + deleted:, + + # The object type. Always `vault.credential.deleted`. + + object: :"vault.credential.deleted" + ) + end + + sig do + override.returns( + {id: String, deleted: T::Boolean, object: Symbol} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vaults/credential_list_params.rbi b/rbi/openai/models/beta/agents/vaults/credential_list_params.rbi new file mode 100644 index 000000000..4258b66d9 --- /dev/null +++ b/rbi/openai/models/beta/agents/vaults/credential_list_params.rbi @@ -0,0 +1,163 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Vaults + + class CredentialListParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialListParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :vault_id + + # Return resources after this resource ID in the selected order. + sig { returns(T.nilable(String)) } + attr_reader :after + + sig { params(after: String).void } + attr_writer :after + + # The maximum number of resources to return. Defaults to 20. Values are clamped + # between 1 and 100. + sig { returns(T.nilable(Integer)) } + attr_accessor :limit + + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + sig { returns(T.nilable(OpenAI::Beta::Agents::Vaults::CredentialListParams::Order::OrSymbol)) } + attr_reader :order + + sig { params(order: OpenAI::Beta::Agents::Vaults::CredentialListParams::Order::OrSymbol).void } + attr_writer :order + + # Filter by one status or a list, such as `status=active` or + # `status[]=active&status[]=archived`. Both statuses are included by default. + sig { + returns( + T.nilable( + T.any( + OpenAI::Beta::Agents::VaultStatus::OrSymbol, + T::Array[OpenAI::Beta::Agents::VaultStatus::OrSymbol] + ) + ) + ) + } + attr_reader :status + + sig { + params( + status: T.any( + OpenAI::Beta::Agents::VaultStatus::OrSymbol, + T::Array[OpenAI::Beta::Agents::VaultStatus::OrSymbol] + ) + ) + .void + } + attr_writer :status + + sig do + params( + + vault_id: String, + + after: String, + + limit: T.nilable(Integer), + + order: OpenAI::Beta::Agents::Vaults::CredentialListParams::Order::OrSymbol, + + status: T.any( + OpenAI::Beta::Agents::VaultStatus::OrSymbol, + T::Array[OpenAI::Beta::Agents::VaultStatus::OrSymbol] + ), + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + vault_id:, + + # Return resources after this resource ID in the selected order. + after: nil, + + # The maximum number of resources to return. Defaults to 20. Values are clamped + # between 1 and 100. + limit: nil, + + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + order: nil, + + # Filter by one status or a list, such as `status=active` or + # `status[]=active&status[]=archived`. Both statuses are included by default. + status: nil, + + request_options: {} + ) + end + + sig do + override.returns( + { + vault_id: String, + after: String, + limit: T.nilable(Integer), + order: OpenAI::Beta::Agents::Vaults::CredentialListParams::Order::OrSymbol, + status: T.any( + OpenAI::Beta::Agents::VaultStatus::OrSymbol, + T::Array[OpenAI::Beta::Agents::VaultStatus::OrSymbol] + ), + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + module Order + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Agents::Vaults::CredentialListParams::Order) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Returns resources in ascending order. + ASC = T.let(:asc, OpenAI::Beta::Agents::Vaults::CredentialListParams::Order::TaggedSymbol) + + # Returns resources in descending order. + DESC = T.let(:desc, OpenAI::Beta::Agents::Vaults::CredentialListParams::Order::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Beta::Agents::Vaults::CredentialListParams::Order::TaggedSymbol]) + } + def self.values + end + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vaults/credential_retrieve_params.rbi b/rbi/openai/models/beta/agents/vaults/credential_retrieve_params.rbi new file mode 100644 index 000000000..89963ed0a --- /dev/null +++ b/rbi/openai/models/beta/agents/vaults/credential_retrieve_params.rbi @@ -0,0 +1,68 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Vaults + + class CredentialRetrieveParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialRetrieveParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :vault_id + + sig { returns(String) } + attr_accessor :credential_id + + sig do + params( + + vault_id: String, + + credential_id: String, + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + vault_id:, + + credential_id:, + + request_options: {} + ) + end + + sig do + override.returns( + {vault_id: String, credential_id: String, request_options: OpenAI::RequestOptions} + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vaults/credential_update_params.rbi b/rbi/openai/models/beta/agents/vaults/credential_update_params.rbi new file mode 100644 index 000000000..1eb2cbe71 --- /dev/null +++ b/rbi/openai/models/beta/agents/vaults/credential_update_params.rbi @@ -0,0 +1,95 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Vaults + + class CredentialUpdateParams < OpenAI::Internal::Type::BaseModel + + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::CredentialUpdateParams, + OpenAI::Internal::AnyHash + ) + end + + sig { returns(String) } + attr_accessor :vault_id + + sig { returns(String) } + attr_accessor :credential_id + + # Replacement values for the credential's existing authentication method. + sig { + returns( + T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth, + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::StaticBearer + ) + ) + } + attr_accessor :auth + + sig do + params( + + vault_id: String, + + credential_id: String, + + auth: T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::OrHash, + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::StaticBearer::OrHash + ), + + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(T.attached_class) + end + def self.new( + + vault_id:, + + credential_id:, + + # Replacement values for the credential's existing authentication method. + auth:, + + request_options: {} + ) + end + + sig do + override.returns( + { + vault_id: String, + credential_id: String, + auth: T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth, + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::StaticBearer + ), + request_options: OpenAI::RequestOptions + } + ) + end + def to_hash + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth.rbi b/rbi/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth.rbi new file mode 100644 index 000000000..05f5b6282 --- /dev/null +++ b/rbi/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth.rbi @@ -0,0 +1,151 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Vaults + + # The client authentication method used for OAuth token refresh. + module McpOauthTokenEndpointAuth + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::None, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretBasic, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretPost + ) + end + + class None < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::None, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `none`. + sig { returns(Symbol) } + attr_accessor :type + + # Sends the client ID without a client secret. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The type of the object. Always `none`. + + type: :none + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + class ClientSecretBasic < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretBasic, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `client_secret_basic`. + sig { returns(Symbol) } + attr_accessor :type + + # Sends the client ID and secret using HTTP Basic authentication. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The type of the object. Always `client_secret_basic`. + + type: :client_secret_basic + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + class ClientSecretPost < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretPost, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `client_secret_post`. + sig { returns(Symbol) } + attr_accessor :type + + # Sends the client ID and secret in the token request body. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The type of the object. Always `client_secret_post`. + + type: :client_secret_post + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::Variants]) } + def self.variants + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_create_param.rbi b/rbi/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_create_param.rbi new file mode 100644 index 000000000..1b482256f --- /dev/null +++ b/rbi/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_create_param.rbi @@ -0,0 +1,171 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Vaults + + # Client authentication credentials for OAuth token refresh. + module McpOauthTokenEndpointAuthCreateParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::None, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretBasic, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretPost + ) + end + + class None < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::None, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `none`. + sig { returns(Symbol) } + attr_accessor :type + + # Sends the client ID without a client secret. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The type of the object. Always `none`. + + type: :none + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + class ClientSecretBasic < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretBasic, + OpenAI::Internal::AnyHash + ) + end + + # The OAuth client secret to store. Never returned in credential resources. + sig { returns(String) } + attr_accessor :client_secret + + # The type of the object. Always `client_secret_basic`. + sig { returns(Symbol) } + attr_accessor :type + + # Sends the client ID and secret using HTTP Basic authentication. + sig do + params( + + client_secret: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The OAuth client secret to store. Never returned in credential resources. + client_secret:, + + # The type of the object. Always `client_secret_basic`. + + type: :client_secret_basic + ) + end + + sig do + override.returns( + {client_secret: String, type: Symbol} + ) + end + def to_hash + end + + end + + class ClientSecretPost < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretPost, + OpenAI::Internal::AnyHash + ) + end + + # The OAuth client secret to store. Never returned in credential resources. + sig { returns(String) } + attr_accessor :client_secret + + # The type of the object. Always `client_secret_post`. + sig { returns(Symbol) } + attr_accessor :type + + # Sends the client ID and secret in the token request body. + sig do + params( + + client_secret: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The OAuth client secret to store. Never returned in credential resources. + client_secret:, + + # The type of the object. Always `client_secret_post`. + + type: :client_secret_post + ) + end + + sig do + override.returns( + {client_secret: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { + override.returns(T::Array[OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::Variants]) + } + def self.variants + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_rotate_param.rbi b/rbi/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_rotate_param.rbi new file mode 100644 index 000000000..f29ab8a71 --- /dev/null +++ b/rbi/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_rotate_param.rbi @@ -0,0 +1,137 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + module Agents + + module Vaults + + # Client-secret updates that preserve the credential's OAuth authentication + # method. + module McpOauthTokenEndpointAuthRotateParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretBasic, + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretPost + ) + end + + class ClientSecretBasic < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretBasic, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `client_secret_basic`. + sig { returns(Symbol) } + attr_accessor :type + + # The replacement OAuth client secret. Omit or pass `null` to keep the stored + # secret. This secret is never returned in resources. + sig { returns(T.nilable(String)) } + attr_accessor :client_secret + + # Updates credentials sent using HTTP Basic authentication. + sig do + params( + + client_secret: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The replacement OAuth client secret. Omit or pass `null` to keep the stored + # secret. This secret is never returned in resources. + client_secret: nil, + + # The type of the object. Always `client_secret_basic`. + + type: :client_secret_basic + ) + end + + sig do + override.returns( + {type: Symbol, client_secret: T.nilable(String)} + ) + end + def to_hash + end + + end + + class ClientSecretPost < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretPost, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `client_secret_post`. + sig { returns(Symbol) } + attr_accessor :type + + # The replacement OAuth client secret. Omit or pass `null` to keep the stored + # secret. This secret is never returned in resources. + sig { returns(T.nilable(String)) } + attr_accessor :client_secret + + # Updates credentials sent in the token request body. + sig do + params( + + client_secret: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The replacement OAuth client secret. Omit or pass `null` to keep the stored + # secret. This secret is never returned in resources. + client_secret: nil, + + # The type of the object. Always `client_secret_post`. + + type: :client_secret_post + ) + end + + sig do + override.returns( + {type: Symbol, client_secret: T.nilable(String)} + ) + end + def to_hash + end + + end + + sig { + override.returns(T::Array[OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::Variants]) + } + def self.variants + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/environment.rbi b/rbi/openai/models/beta/environment.rbi new file mode 100644 index 000000000..16736a375 --- /dev/null +++ b/rbi/openai/models/beta/environment.rbi @@ -0,0 +1,400 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # The execution environment for a session. + module Environment + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::Environment::None, + OpenAI::Beta::Environment::OpenAIHosted, + OpenAI::Beta::Environment::SelfHosted + ) + end + + class None < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Environment::None, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `none`. + sig { returns(Symbol) } + attr_accessor :type + + # The session talks to CCA without selecting or provisioning an execution + # environment. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The type of the object. Always `none`. + + type: :none + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + class OpenAIHosted < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Environment::OpenAIHosted, + OpenAI::Internal::AnyHash + ) + end + + # The public ID of the environment. + sig { returns(String) } + attr_accessor :id + + # Directories that contain capabilities exposed to the agent. + sig { returns(T::Array[String]) } + attr_accessor :capability_directories + + # Files available in the environment, excluding their contents. + sig { returns(T::Array[OpenAI::Beta::HostedEnvironmentFile::Variants]) } + attr_accessor :files + + # The effective network access policy for the environment. + sig { returns(OpenAI::Beta::Environment::OpenAIHosted::Network) } + attr_reader :network + + sig { params(network: OpenAI::Beta::Environment::OpenAIHosted::Network::OrHash).void } + attr_writer :network + + # Packages installed in the environment. + sig { returns(OpenAI::Beta::Environment::OpenAIHosted::Packages) } + attr_reader :packages + + sig { params(packages: OpenAI::Beta::Environment::OpenAIHosted::Packages::OrHash).void } + attr_writer :packages + + # Plugins installed in the environment, excluding their archive contents. + sig { returns(T::Array[OpenAI::Beta::HostedPlugin]) } + attr_accessor :plugins + + # Skills installed in the environment, excluding their archive contents. + sig { returns(T::Array[OpenAI::Beta::HostedSkill::Variants]) } + attr_accessor :skills + + # The type of the object. Always `openai_hosted`. + sig { returns(Symbol) } + attr_accessor :type + + # An environment hosted by OpenAI. + sig do + params( + + id: String, + + capability_directories: T::Array[String], + + files: T::Array[ + T.any( + OpenAI::Beta::HostedEnvironmentFileID::OrHash, + OpenAI::Beta::HostedEnvironmentFile::Inline::OrHash + ) + ], + + network: OpenAI::Beta::Environment::OpenAIHosted::Network::OrHash, + + packages: OpenAI::Beta::Environment::OpenAIHosted::Packages::OrHash, + + plugins: T::Array[OpenAI::Beta::HostedPlugin::OrHash], + + skills: T::Array[ + T.any(OpenAI::Beta::HostedSkillReference::OrHash, OpenAI::Beta::HostedSkill::Inline::OrHash) + ], + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The public ID of the environment. + id:, + + # Directories that contain capabilities exposed to the agent. + capability_directories:, + + # Files available in the environment, excluding their contents. + files:, + + # The effective network access policy for the environment. + network:, + + # Packages installed in the environment. + packages:, + + # Plugins installed in the environment, excluding their archive contents. + plugins:, + + # Skills installed in the environment, excluding their archive contents. + skills:, + + # The type of the object. Always `openai_hosted`. + + type: :openai_hosted + ) + end + + sig do + override.returns( + { + id: String, + capability_directories: T::Array[String], + files: T::Array[OpenAI::Beta::HostedEnvironmentFile::Variants], + network: OpenAI::Beta::Environment::OpenAIHosted::Network, + packages: OpenAI::Beta::Environment::OpenAIHosted::Packages, + plugins: T::Array[OpenAI::Beta::HostedPlugin], + skills: T::Array[OpenAI::Beta::HostedSkill::Variants], + type: Symbol + } + ) + end + def to_hash + end + + class Network < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Environment::OpenAIHosted::Network, + OpenAI::Internal::AnyHash + ) + end + + # The environment's network access mode. + sig { returns(OpenAI::Beta::Environment::OpenAIHosted::Network::Access::TaggedSymbol) } + attr_accessor :access + + # Domains the environment may access when network access is restricted. + sig { returns(T::Array[String]) } + attr_accessor :allowed_domains + + # The effective network access policy for the environment. + sig do + params( + + access: OpenAI::Beta::Environment::OpenAIHosted::Network::Access::OrSymbol, + + allowed_domains: T::Array[String] + ) + .returns(T.attached_class) + end + def self.new( + + # The environment's network access mode. + access:, + + # Domains the environment may access when network access is restricted. + + allowed_domains: + ) + end + + sig do + override.returns( + { + access: OpenAI::Beta::Environment::OpenAIHosted::Network::Access::TaggedSymbol, + allowed_domains: T::Array[String] + } + ) + end + def to_hash + end + + # The environment's network access mode. + module Access + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Environment::OpenAIHosted::Network::Access) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Allows unrestricted network access. + ENABLED = T.let(:enabled, OpenAI::Beta::Environment::OpenAIHosted::Network::Access::TaggedSymbol) + + # Disables network access. + DISABLED = T.let(:disabled, OpenAI::Beta::Environment::OpenAIHosted::Network::Access::TaggedSymbol) + + # Allows access only to configured domains. + RESTRICTED = T.let(:restricted, OpenAI::Beta::Environment::OpenAIHosted::Network::Access::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Beta::Environment::OpenAIHosted::Network::Access::TaggedSymbol]) + } + def self.values + end + end + end + + class Packages < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Environment::OpenAIHosted::Packages, + OpenAI::Internal::AnyHash + ) + end + + # npm packages installed globally in the environment. + sig { returns(T::Array[String]) } + attr_accessor :npm + + # Python packages installed in the environment. + sig { returns(T::Array[String]) } + attr_accessor :python + + # System packages installed in the environment. + sig { returns(T::Array[String]) } + attr_accessor :system_ + + # Packages installed in the environment. + sig do + params( + + npm: T::Array[String], + + python: T::Array[String], + + system_: T::Array[String] + ) + .returns(T.attached_class) + end + def self.new( + + # npm packages installed globally in the environment. + npm:, + + # Python packages installed in the environment. + python:, + + # System packages installed in the environment. + + system_: + ) + end + + sig do + override.returns( + {npm: T::Array[String], python: T::Array[String], system_: T::Array[String]} + ) + end + def to_hash + end + + end + end + + class SelfHosted < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Environment::SelfHosted, + OpenAI::Internal::AnyHash + ) + end + + # The public ID of the environment. + sig { returns(String) } + attr_accessor :id + + # Directories that contain capabilities exposed to the agent. + sig { returns(T::Array[String]) } + attr_accessor :capability_directories + + # Pass this URL unchanged to `codex exec-server --remote` when connecting this + # environment. + sig { returns(String) } + attr_accessor :remote_url + + # The type of the object. Always `self_hosted`. + sig { returns(Symbol) } + attr_accessor :type + + # The absolute project directory inside the environment. Defaults to `/workspace`. + sig { returns(String) } + attr_accessor :workspace_directory + + # An environment hosted by the application. + sig do + params( + + id: String, + + capability_directories: T::Array[String], + + remote_url: String, + + workspace_directory: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The public ID of the environment. + id:, + + # Directories that contain capabilities exposed to the agent. + capability_directories:, + + # Pass this URL unchanged to `codex exec-server --remote` when connecting this + # environment. + remote_url:, + + # The absolute project directory inside the environment. Defaults to `/workspace`. + workspace_directory:, + + # The type of the object. Always `self_hosted`. + + type: :self_hosted + ) + end + + sig do + override.returns( + { + id: String, + capability_directories: T::Array[String], + remote_url: String, + type: Symbol, + workspace_directory: String + } + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::Environment::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/environment_param.rbi b/rbi/openai/models/beta/environment_param.rbi new file mode 100644 index 000000000..02c22567e --- /dev/null +++ b/rbi/openai/models/beta/environment_param.rbi @@ -0,0 +1,448 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # The execution environment and optional reusable template for a session. + module EnvironmentParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::EnvironmentParam::None, + OpenAI::Beta::EnvironmentParam::OpenAIHosted, + OpenAI::Beta::EnvironmentParam::SelfHosted + ) + end + + class None < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::EnvironmentParam::None, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `none`. + sig { returns(Symbol) } + attr_accessor :type + + # Runs the agent without an execution environment. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The type of the object. Always `none`. + + type: :none + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + class OpenAIHosted < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::EnvironmentParam::OpenAIHosted, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `openai_hosted`. + sig { returns(Symbol) } + attr_accessor :type + + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :capability_directories + + # Environment variables made available to the agent. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :env + + # A reusable hosted template applied before inline session configuration. Omitted + # fields inherit the template; network overrides cannot broaden its policy. + sig { returns(T.nilable(String)) } + attr_reader :environment_template_id + + sig { params(environment_template_id: String).void } + attr_writer :environment_template_id + + # Files available before the agent starts. Defaults to an empty list. + sig { + returns( + T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID, + OpenAI::Beta::HostedEnvironmentFileParam::Inline + ) + ] + ) + ) + } + attr_accessor :files + + # Network access for an OpenAI-hosted environment. + sig { returns(T.nilable(OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network)) } + attr_reader :network + + sig { params(network: T.nilable(OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network::OrHash)).void } + attr_writer :network + + # Packages to install in an OpenAI-hosted environment. + sig { returns(T.nilable(OpenAI::Beta::EnvironmentParam::OpenAIHosted::Packages)) } + attr_reader :packages + + sig { params(packages: T.nilable(OpenAI::Beta::EnvironmentParam::OpenAIHosted::Packages::OrHash)).void } + attr_writer :packages + + # Plugins provided as inline ZIP archives. Defaults to an empty list. + sig { returns(T.nilable(T::Array[OpenAI::Beta::HostedPluginParam])) } + attr_accessor :plugins + + # Ordered, confidential setup commands. Command bodies are never returned. + sig { returns(T.nilable(T::Array[OpenAI::Beta::SetupCommandParam])) } + attr_accessor :setup_commands + + # Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty + # list. + sig { + returns( + T.nilable( + T::Array[T.any(OpenAI::Beta::HostedSkillParam::SkillReference, OpenAI::Beta::HostedSkillParam::Inline)] + ) + ) + } + attr_accessor :skills + + # An OpenAI-hosted environment, optionally based on a reusable template. + sig do + params( + + capability_directories: T.nilable(T::Array[String]), + + env: T.nilable(T::Hash[Symbol, String]), + + environment_template_id: String, + + files: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID::OrHash, + OpenAI::Beta::HostedEnvironmentFileParam::Inline::OrHash + ) + ] + ), + + network: T.nilable(OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network::OrHash), + + packages: T.nilable(OpenAI::Beta::EnvironmentParam::OpenAIHosted::Packages::OrHash), + + plugins: T.nilable(T::Array[OpenAI::Beta::HostedPluginParam::OrHash]), + + setup_commands: T.nilable(T::Array[OpenAI::Beta::SetupCommandParam::OrHash]), + + skills: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedSkillParam::SkillReference::OrHash, + OpenAI::Beta::HostedSkillParam::Inline::OrHash + ) + ] + ), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + capability_directories: nil, + + # Environment variables made available to the agent. + env: nil, + + # A reusable hosted template applied before inline session configuration. Omitted + # fields inherit the template; network overrides cannot broaden its policy. + environment_template_id: nil, + + # Files available before the agent starts. Defaults to an empty list. + files: nil, + + # Network access for an OpenAI-hosted environment. + network: nil, + + # Packages to install in an OpenAI-hosted environment. + packages: nil, + + # Plugins provided as inline ZIP archives. Defaults to an empty list. + plugins: nil, + + # Ordered, confidential setup commands. Command bodies are never returned. + setup_commands: nil, + + # Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty + # list. + skills: nil, + + # The type of the object. Always `openai_hosted`. + + type: :openai_hosted + ) + end + + sig do + override.returns( + { + type: Symbol, + capability_directories: T.nilable(T::Array[String]), + env: T.nilable(T::Hash[Symbol, String]), + environment_template_id: String, + files: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID, + OpenAI::Beta::HostedEnvironmentFileParam::Inline + ) + ] + ), + network: T.nilable(OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network), + packages: T.nilable(OpenAI::Beta::EnvironmentParam::OpenAIHosted::Packages), + plugins: T.nilable(T::Array[OpenAI::Beta::HostedPluginParam]), + setup_commands: T.nilable(T::Array[OpenAI::Beta::SetupCommandParam]), + skills: T.nilable( + T::Array[ + T.any(OpenAI::Beta::HostedSkillParam::SkillReference, OpenAI::Beta::HostedSkillParam::Inline) + ] + ) + } + ) + end + def to_hash + end + + class Network < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network, + OpenAI::Internal::AnyHash + ) + end + + # The environment's network access mode. + sig { returns(OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network::Access::OrSymbol) } + attr_accessor :access + + # Domains the environment may access when network access is restricted. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :allowed_domains + + # Network access for an OpenAI-hosted environment. + sig do + params( + + access: OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network::Access::OrSymbol, + + allowed_domains: T.nilable(T::Array[String]) + ) + .returns(T.attached_class) + end + def self.new( + + # The environment's network access mode. + access:, + + # Domains the environment may access when network access is restricted. + + allowed_domains: nil + ) + end + + sig do + override.returns( + { + access: OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network::Access::OrSymbol, + allowed_domains: T.nilable(T::Array[String]) + } + ) + end + def to_hash + end + + # The environment's network access mode. + module Access + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network::Access) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Allows unrestricted network access, matching an omitted network policy. + ENABLED = T.let(:enabled, OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network::Access::TaggedSymbol) + + # Disables network access. + DISABLED = T.let(:disabled, OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network::Access::TaggedSymbol) + + # Allows access only to configured domains. + RESTRICTED = T.let( + :restricted, + OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network::Access::TaggedSymbol + ) + + sig { + override.returns(T::Array[OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network::Access::TaggedSymbol]) + } + def self.values + end + end + end + + class Packages < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::EnvironmentParam::OpenAIHosted::Packages, + OpenAI::Internal::AnyHash + ) + end + + # npm packages to install globally. Defaults to an empty list. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :npm + + # Python packages to install. Defaults to an empty list. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :python + + # System packages to install. Defaults to an empty list. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :system_ + + # Packages to install in an OpenAI-hosted environment. + sig do + params( + + npm: T.nilable(T::Array[String]), + + python: T.nilable(T::Array[String]), + + system_: T.nilable(T::Array[String]) + ) + .returns(T.attached_class) + end + def self.new( + + # npm packages to install globally. Defaults to an empty list. + npm: nil, + + # Python packages to install. Defaults to an empty list. + python: nil, + + # System packages to install. Defaults to an empty list. + + system_: nil + ) + end + + sig do + override.returns( + { + npm: T.nilable(T::Array[String]), + python: T.nilable(T::Array[String]), + system_: T.nilable(T::Array[String]) + } + ) + end + def to_hash + end + + end + end + + class SelfHosted < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::EnvironmentParam::SelfHosted, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `self_hosted`. + sig { returns(Symbol) } + attr_accessor :type + + # Absolute project directory inside the self-hosted environment. + sig { returns(String) } + attr_accessor :workspace_directory + + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :capability_directories + + # An application-hosted environment configured inline. + sig do + params( + + workspace_directory: String, + + capability_directories: T.nilable(T::Array[String]), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Absolute project directory inside the self-hosted environment. + workspace_directory:, + + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + capability_directories: nil, + + # The type of the object. Always `self_hosted`. + + type: :self_hosted + ) + end + + sig do + override.returns( + {type: Symbol, workspace_directory: String, capability_directories: T.nilable(T::Array[String])} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::EnvironmentParam::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/hosted_environment_file.rbi b/rbi/openai/models/beta/hosted_environment_file.rbi new file mode 100644 index 000000000..009368380 --- /dev/null +++ b/rbi/openai/models/beta/hosted_environment_file.rbi @@ -0,0 +1,93 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # Metadata for a file materialized in an OpenAI-hosted execution environment. + module HostedEnvironmentFile + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::HostedEnvironmentFileID, + OpenAI::Beta::HostedEnvironmentFile::Inline + ) + end + + class Inline < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::HostedEnvironmentFile::Inline, + OpenAI::Internal::AnyHash + ) + end + + # The session-scoped ID of the file in the execution environment. + sig { returns(String) } + attr_accessor :id + + # The file's absolute path inside the environment. + sig { returns(String) } + attr_accessor :path + + # The decoded file size in bytes. + sig { returns(Integer) } + attr_accessor :size_bytes + + # The type of the object. Always `inline`. + sig { returns(Symbol) } + attr_accessor :type + + # A file supplied inline when the session was created. + sig do + params( + + id: String, + + path: String, + + size_bytes: Integer, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The session-scoped ID of the file in the execution environment. + id:, + + # The file's absolute path inside the environment. + path:, + + # The decoded file size in bytes. + size_bytes:, + + # The type of the object. Always `inline`. + + type: :inline + ) + end + + sig do + override.returns( + {id: String, path: String, size_bytes: Integer, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::HostedEnvironmentFile::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/hosted_environment_file_id.rbi b/rbi/openai/models/beta/hosted_environment_file_id.rbi new file mode 100644 index 000000000..1d63000c6 --- /dev/null +++ b/rbi/openai/models/beta/hosted_environment_file_id.rbi @@ -0,0 +1,86 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class HostedEnvironmentFileID < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::HostedEnvironmentFileID, + OpenAI::Internal::AnyHash + ) + end + + # The session-scoped ID of the file in the execution environment. + sig { returns(String) } + attr_accessor :id + + # The ID of the uploaded file. + sig { returns(String) } + attr_accessor :file_id + + # The file's absolute path inside the environment. + sig { returns(String) } + attr_accessor :path + + # The decoded file size in bytes. + sig { returns(Integer) } + attr_accessor :size_bytes + + # The type of the object. Always `file_id`. + sig { returns(Symbol) } + attr_accessor :type + + # A file copied from the OpenAI Files API. + sig do + params( + + id: String, + + file_id: String, + + path: String, + + size_bytes: Integer, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The session-scoped ID of the file in the execution environment. + id:, + + # The ID of the uploaded file. + file_id:, + + # The file's absolute path inside the environment. + path:, + + # The decoded file size in bytes. + size_bytes:, + + # The type of the object. Always `file_id`. + + type: :file_id + ) + end + + sig do + override.returns( + {id: String, file_id: String, path: String, size_bytes: Integer, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/hosted_environment_file_param.rbi b/rbi/openai/models/beta/hosted_environment_file_param.rbi new file mode 100644 index 000000000..063c16a93 --- /dev/null +++ b/rbi/openai/models/beta/hosted_environment_file_param.rbi @@ -0,0 +1,140 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # A file materialized in an OpenAI-hosted execution environment. + module HostedEnvironmentFileParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID, + OpenAI::Beta::HostedEnvironmentFileParam::Inline + ) + end + + class FileID < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the uploaded file. + sig { returns(String) } + attr_accessor :file_id + + # The absolute destination path inside `/workspace`. + sig { returns(String) } + attr_accessor :path + + # The type of the object. Always `file_id`. + sig { returns(Symbol) } + attr_accessor :type + + # A file previously uploaded through the OpenAI Files API. + sig do + params( + + file_id: String, + + path: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the uploaded file. + file_id:, + + # The absolute destination path inside `/workspace`. + path:, + + # The type of the object. Always `file_id`. + + type: :file_id + ) + end + + sig do + override.returns( + {file_id: String, path: String, type: Symbol} + ) + end + def to_hash + end + + end + + class Inline < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::Inline, + OpenAI::Internal::AnyHash + ) + end + + # The standard-base64-encoded file contents. + sig { returns(String) } + attr_accessor :data + + # The absolute destination path inside `/workspace`. + sig { returns(String) } + attr_accessor :path + + # The type of the object. Always `inline`. + sig { returns(Symbol) } + attr_accessor :type + + # A file supplied directly as standard-base64 data. + sig do + params( + + data: String, + + path: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The standard-base64-encoded file contents. + data:, + + # The absolute destination path inside `/workspace`. + path:, + + # The type of the object. Always `inline`. + + type: :inline + ) + end + + sig do + override.returns( + {data: String, path: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::HostedEnvironmentFileParam::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/hosted_plugin.rbi b/rbi/openai/models/beta/hosted_plugin.rbi new file mode 100644 index 000000000..2d119f3d9 --- /dev/null +++ b/rbi/openai/models/beta/hosted_plugin.rbi @@ -0,0 +1,68 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class HostedPlugin < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::HostedPlugin, + OpenAI::Internal::AnyHash + ) + end + + # The installed plugin description. + sig { returns(String) } + attr_accessor :description + + # The installed plugin name. + sig { returns(String) } + attr_accessor :name + + # The type of the object. Always `inline`. + sig { returns(Symbol) } + attr_accessor :type + + # A plugin installed from an inline ZIP archive. + sig do + params( + + description: String, + + name: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The installed plugin description. + description:, + + # The installed plugin name. + name:, + + # The type of the object. Always `inline`. + + type: :inline + ) + end + + sig do + override.returns( + {description: String, name: String, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/hosted_plugin_param.rbi b/rbi/openai/models/beta/hosted_plugin_param.rbi new file mode 100644 index 000000000..3b1fb6609 --- /dev/null +++ b/rbi/openai/models/beta/hosted_plugin_param.rbi @@ -0,0 +1,80 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class HostedPluginParam < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::HostedPluginParam, + OpenAI::Internal::AnyHash + ) + end + + # The plugin description declared in `.codex-plugin/plugin.json`. + sig { returns(String) } + attr_accessor :description + + # The plugin name declared in `.codex-plugin/plugin.json`. + sig { returns(String) } + attr_accessor :name + + # Provides ZIP bytes encoded with standard base64. + sig { returns(OpenAI::Beta::InlineCapabilitySourceParam) } + attr_reader :source + + sig { params(source: OpenAI::Beta::InlineCapabilitySourceParam::OrHash).void } + attr_writer :source + + # The type of the object. Always `inline`. + sig { returns(Symbol) } + attr_accessor :type + + # Supplies a plugin ZIP directly in the session request. + sig do + params( + + description: String, + + name: String, + + source: OpenAI::Beta::InlineCapabilitySourceParam::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The plugin description declared in `.codex-plugin/plugin.json`. + description:, + + # The plugin name declared in `.codex-plugin/plugin.json`. + name:, + + # Provides ZIP bytes encoded with standard base64. + source:, + + # The type of the object. Always `inline`. + + type: :inline + ) + end + + sig do + override.returns( + {description: String, name: String, source: OpenAI::Beta::InlineCapabilitySourceParam, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/hosted_skill.rbi b/rbi/openai/models/beta/hosted_skill.rbi new file mode 100644 index 000000000..6d9180f4c --- /dev/null +++ b/rbi/openai/models/beta/hosted_skill.rbi @@ -0,0 +1,84 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # A skill installed in an OpenAI-hosted environment. + module HostedSkill + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::HostedSkillReference, + OpenAI::Beta::HostedSkill::Inline + ) + end + + class Inline < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::HostedSkill::Inline, + OpenAI::Internal::AnyHash + ) + end + + # The installed skill description. + sig { returns(String) } + attr_accessor :description + + # The installed skill name. + sig { returns(String) } + attr_accessor :name + + # The type of the object. Always `inline`. + sig { returns(Symbol) } + attr_accessor :type + + # A skill installed from an inline ZIP archive. + sig do + params( + + description: String, + + name: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The installed skill description. + description:, + + # The installed skill name. + name:, + + # The type of the object. Always `inline`. + + type: :inline + ) + end + + sig do + override.returns( + {description: String, name: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::HostedSkill::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/hosted_skill_param.rbi b/rbi/openai/models/beta/hosted_skill_param.rbi new file mode 100644 index 000000000..6d553a0fa --- /dev/null +++ b/rbi/openai/models/beta/hosted_skill_param.rbi @@ -0,0 +1,152 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # A skill installed in an OpenAI-hosted environment. + module HostedSkillParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::HostedSkillParam::SkillReference, + OpenAI::Beta::HostedSkillParam::Inline + ) + end + + class SkillReference < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::HostedSkillParam::SkillReference, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the skill created through `/v1/skills`. + sig { returns(String) } + attr_accessor :skill_id + + # The type of the object. Always `skill_reference`. + sig { returns(Symbol) } + attr_accessor :type + + # The skill version, a positive integer or `latest`; omission selects the default. + sig { returns(T.nilable(String)) } + attr_accessor :version + + # References a skill uploaded through the Skills API. + sig do + params( + + skill_id: String, + + version: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the skill created through `/v1/skills`. + skill_id:, + + # The skill version, a positive integer or `latest`; omission selects the default. + version: nil, + + # The type of the object. Always `skill_reference`. + + type: :skill_reference + ) + end + + sig do + override.returns( + {skill_id: String, type: Symbol, version: T.nilable(String)} + ) + end + def to_hash + end + + end + + class Inline < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::HostedSkillParam::Inline, + OpenAI::Internal::AnyHash + ) + end + + # The skill description declared in `SKILL.md`. + sig { returns(String) } + attr_accessor :description + + # The skill name declared in `SKILL.md`. + sig { returns(String) } + attr_accessor :name + + # Provides ZIP bytes encoded with standard base64. + sig { returns(OpenAI::Beta::InlineCapabilitySourceParam) } + attr_reader :source + + sig { params(source: OpenAI::Beta::InlineCapabilitySourceParam::OrHash).void } + attr_writer :source + + # The type of the object. Always `inline`. + sig { returns(Symbol) } + attr_accessor :type + + # Supplies a skill ZIP directly in the session request. + sig do + params( + + description: String, + + name: String, + + source: OpenAI::Beta::InlineCapabilitySourceParam::OrHash, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The skill description declared in `SKILL.md`. + description:, + + # The skill name declared in `SKILL.md`. + name:, + + # Provides ZIP bytes encoded with standard base64. + source:, + + # The type of the object. Always `inline`. + + type: :inline + ) + end + + sig do + override.returns( + {description: String, name: String, source: OpenAI::Beta::InlineCapabilitySourceParam, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::HostedSkillParam::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/hosted_skill_reference.rbi b/rbi/openai/models/beta/hosted_skill_reference.rbi new file mode 100644 index 000000000..5eb19a4ee --- /dev/null +++ b/rbi/openai/models/beta/hosted_skill_reference.rbi @@ -0,0 +1,86 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class HostedSkillReference < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::HostedSkillReference, + OpenAI::Internal::AnyHash + ) + end + + # The installed skill description. + sig { returns(String) } + attr_accessor :description + + # The installed skill name. + sig { returns(String) } + attr_accessor :name + + # The referenced skill ID. + sig { returns(String) } + attr_accessor :skill_id + + # The type of the object. Always `skill_reference`. + sig { returns(Symbol) } + attr_accessor :type + + # The concrete skill version installed for this session. + sig { returns(String) } + attr_accessor :version + + # A skill installed from the Skills API. + sig do + params( + + description: String, + + name: String, + + skill_id: String, + + version: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The installed skill description. + description:, + + # The installed skill name. + name:, + + # The referenced skill ID. + skill_id:, + + # The concrete skill version installed for this session. + version:, + + # The type of the object. Always `skill_reference`. + + type: :skill_reference + ) + end + + sig do + override.returns( + {description: String, name: String, skill_id: String, type: Symbol, version: String} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/inline_capability_source_param.rbi b/rbi/openai/models/beta/inline_capability_source_param.rbi new file mode 100644 index 000000000..431a93a22 --- /dev/null +++ b/rbi/openai/models/beta/inline_capability_source_param.rbi @@ -0,0 +1,68 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class InlineCapabilitySourceParam < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::InlineCapabilitySourceParam, + OpenAI::Internal::AnyHash + ) + end + + # Standard-base64 encoded ZIP archive bytes. + sig { returns(String) } + attr_accessor :data + + # The archive media type, always `application/zip`. + sig { returns(Symbol) } + attr_accessor :media_type + + # The type of the object. Always `base64`. + sig { returns(Symbol) } + attr_accessor :type + + # Provides ZIP bytes encoded with standard base64. + sig do + params( + + data: String, + + media_type: Symbol, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Standard-base64 encoded ZIP archive bytes. + data:, + + # The archive media type, always `application/zip`. + media_type: :"application/zip", + + # The type of the object. Always `base64`. + + type: :base64 + ) + end + + sig do + override.returns( + {data: String, media_type: Symbol, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/input_content.rbi b/rbi/openai/models/beta/input_content.rbi new file mode 100644 index 000000000..ffbdd56c0 --- /dev/null +++ b/rbi/openai/models/beta/input_content.rbi @@ -0,0 +1,124 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # User-provided content recorded in a session item. + module InputContent + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::InputContent::InputText, + OpenAI::Beta::InputContent::InputImage + ) + end + + class InputText < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::InputContent::InputText, + OpenAI::Internal::AnyHash + ) + end + + # The text supplied to the agent. + sig { returns(String) } + attr_accessor :text + + # The type of the object. Always `input_text`. + sig { returns(Symbol) } + attr_accessor :type + + # Text input recorded in a session item. + sig do + params( + + text: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The text supplied to the agent. + text:, + + # The type of the object. Always `input_text`. + + type: :input_text + ) + end + + sig do + override.returns( + {text: String, type: Symbol} + ) + end + def to_hash + end + + end + + class InputImage < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::InputContent::InputImage, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the image supplied to the agent, which may be a base64-encoded data + # URL. + sig { returns(String) } + attr_accessor :image_url + + # The type of the object. Always `input_image`. + sig { returns(Symbol) } + attr_accessor :type + + # Image input recorded in a session item. + sig do + params( + + image_url: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The URL of the image supplied to the agent, which may be a base64-encoded data + # URL. + image_url:, + + # The type of the object. Always `input_image`. + + type: :input_image + ) + end + + sig do + override.returns( + {image_url: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::InputContent::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/input_content_param.rbi b/rbi/openai/models/beta/input_content_param.rbi new file mode 100644 index 000000000..2dd9b92cf --- /dev/null +++ b/rbi/openai/models/beta/input_content_param.rbi @@ -0,0 +1,122 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # Content included in an input message. + module InputContentParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::InputContentParam::InputText, + OpenAI::Beta::InputContentParam::InputImage + ) + end + + class InputText < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::InputContentParam::InputText, + OpenAI::Internal::AnyHash + ) + end + + # The text sent to the model. + sig { returns(String) } + attr_accessor :text + + # The type of the object. Always `input_text`. + sig { returns(Symbol) } + attr_accessor :type + + # Text input to the model. + sig do + params( + + text: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The text sent to the model. + text:, + + # The type of the object. Always `input_text`. + + type: :input_text + ) + end + + sig do + override.returns( + {text: String, type: Symbol} + ) + end + def to_hash + end + + end + + class InputImage < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::InputContentParam::InputImage, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the image sent to the model. + sig { returns(String) } + attr_accessor :image_url + + # The type of the object. Always `input_image`. + sig { returns(Symbol) } + attr_accessor :type + + # Image input to the model. + sig do + params( + + image_url: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The URL of the image sent to the model. + image_url:, + + # The type of the object. Always `input_image`. + + type: :input_image + ) + end + + sig do + override.returns( + {image_url: String, type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::InputContentParam::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/mcp_transport.rbi b/rbi/openai/models/beta/mcp_transport.rbi new file mode 100644 index 000000000..222978229 --- /dev/null +++ b/rbi/openai/models/beta/mcp_transport.rbi @@ -0,0 +1,149 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # The transport used to connect to an MCP server. + module McpTransport + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::McpTransport::HTTP, + OpenAI::Beta::McpTransport::Stdio + ) + end + + class HTTP < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::McpTransport::HTTP, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the MCP server. + sig { returns(String) } + attr_accessor :server_url + + # The type of the object. Always `http`. + sig { returns(Symbol) } + attr_accessor :type + + # Connects to an MCP server over HTTP. + sig do + params( + + server_url: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The URL of the MCP server. + server_url:, + + # The type of the object. Always `http`. + + type: :http + ) + end + + sig do + override.returns( + {server_url: String, type: Symbol} + ) + end + def to_hash + end + + end + + class Stdio < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::McpTransport::Stdio, + OpenAI::Internal::AnyHash + ) + end + + # Arguments passed to the MCP server command. + sig { returns(T::Array[String]) } + attr_accessor :args + + # The command used to start the MCP server. + sig { returns(String) } + attr_accessor :command + + # The working directory used to start the MCP server. + sig { returns(String) } + attr_accessor :cwd + + # Environment variable names inherited from the execution environment. + sig { returns(T::Array[String]) } + attr_accessor :env_vars + + # The type of the object. Always `stdio`. + sig { returns(Symbol) } + attr_accessor :type + + # Starts an MCP server as a local process. + sig do + params( + + args: T::Array[String], + + command: String, + + cwd: String, + + env_vars: T::Array[String], + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Arguments passed to the MCP server command. + args:, + + # The command used to start the MCP server. + command:, + + # The working directory used to start the MCP server. + cwd:, + + # Environment variable names inherited from the execution environment. + env_vars:, + + # The type of the object. Always `stdio`. + + type: :stdio + ) + end + + sig do + override.returns( + {args: T::Array[String], command: String, cwd: String, env_vars: T::Array[String], type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::McpTransport::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/mcp_transport_param.rbi b/rbi/openai/models/beta/mcp_transport_param.rbi new file mode 100644 index 000000000..2af4f6aaa --- /dev/null +++ b/rbi/openai/models/beta/mcp_transport_param.rbi @@ -0,0 +1,188 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # The transport used to connect to an MCP server. + module McpTransportParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::McpTransportParam::HTTP, + OpenAI::Beta::McpTransportParam::Stdio + ) + end + + class HTTP < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::McpTransportParam::HTTP, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the MCP server. + sig { returns(String) } + attr_accessor :server_url + + # The type of the object. Always `http`. + sig { returns(Symbol) } + attr_accessor :type + + # The authorization value sent to the MCP server, if any. + sig { returns(T.nilable(String)) } + attr_accessor :authorization + + # Additional HTTP headers sent to the MCP server. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :headers + + # Connects to an MCP server over HTTP. + sig do + params( + + server_url: String, + + authorization: T.nilable(String), + + headers: T.nilable(T::Hash[Symbol, String]), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The URL of the MCP server. + server_url:, + + # The authorization value sent to the MCP server, if any. + authorization: nil, + + # Additional HTTP headers sent to the MCP server. + headers: nil, + + # The type of the object. Always `http`. + + type: :http + ) + end + + sig do + override.returns( + { + server_url: String, + type: Symbol, + authorization: T.nilable(String), + headers: T.nilable(T::Hash[Symbol, String]) + } + ) + end + def to_hash + end + + end + + class Stdio < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::McpTransportParam::Stdio, + OpenAI::Internal::AnyHash + ) + end + + # The command used to start the MCP server. + sig { returns(String) } + attr_accessor :command + + # The working directory used to start the MCP server. + sig { returns(String) } + attr_accessor :cwd + + # The type of the object. Always `stdio`. + sig { returns(Symbol) } + attr_accessor :type + + # Arguments passed to the MCP server command. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :args + + # Environment variables set for the MCP server process. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :env + + # Environment variable names to inherit from the selected execution environment. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :env_vars + + # Starts an MCP server as a local process. + sig do + params( + + command: String, + + cwd: String, + + args: T.nilable(T::Array[String]), + + env: T.nilable(T::Hash[Symbol, String]), + + env_vars: T.nilable(T::Array[String]), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The command used to start the MCP server. + command:, + + # The working directory used to start the MCP server. + cwd:, + + # Arguments passed to the MCP server command. + args: nil, + + # Environment variables set for the MCP server process. + env: nil, + + # Environment variable names to inherit from the selected execution environment. + env_vars: nil, + + # The type of the object. Always `stdio`. + + type: :stdio + ) + end + + sig do + override.returns( + { + command: String, + cwd: String, + type: Symbol, + args: T.nilable(T::Array[String]), + env: T.nilable(T::Hash[Symbol, String]), + env_vars: T.nilable(T::Array[String]) + } + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::McpTransportParam::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/multi_agent_config.rbi b/rbi/openai/models/beta/multi_agent_config.rbi new file mode 100644 index 000000000..294edcede --- /dev/null +++ b/rbi/openai/models/beta/multi_agent_config.rbi @@ -0,0 +1,61 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class MultiAgentConfig < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::MultiAgentConfig, + OpenAI::Internal::AnyHash + ) + end + + # Whether subagent tools are enabled. Defaults to false. + sig { returns(T::Boolean) } + attr_accessor :enabled + + # Maximum number of subagents that may run concurrently, or null when disabled. + # Defaults to 6 when enabled. + sig { returns(T.nilable(Integer)) } + attr_accessor :max_concurrent_subagents + + # The resolved configuration for creating and coordinating subagents. + sig do + params( + + enabled: T::Boolean, + + max_concurrent_subagents: T.nilable(Integer) + ) + .returns(T.attached_class) + end + def self.new( + + # Whether subagent tools are enabled. Defaults to false. + enabled:, + + # Maximum number of subagents that may run concurrently, or null when disabled. + # Defaults to 6 when enabled. + + max_concurrent_subagents: + ) + end + + sig do + override.returns( + {enabled: T::Boolean, max_concurrent_subagents: T.nilable(Integer)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/multi_agent_config_param.rbi b/rbi/openai/models/beta/multi_agent_config_param.rbi new file mode 100644 index 000000000..e111fd354 --- /dev/null +++ b/rbi/openai/models/beta/multi_agent_config_param.rbi @@ -0,0 +1,62 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class MultiAgentConfigParam < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::MultiAgentConfigParam, + OpenAI::Internal::AnyHash + ) + end + + # Whether subagent tools are enabled. + sig { returns(T::Boolean) } + attr_accessor :enabled + + # Maximum number of subagents that may run concurrently. Defaults to 6. + sig { returns(T.nilable(Integer)) } + attr_reader :max_concurrent_subagents + + sig { params(max_concurrent_subagents: Integer).void } + attr_writer :max_concurrent_subagents + + # Explicit configuration for creating and coordinating subagents. + sig do + params( + + enabled: T::Boolean, + + max_concurrent_subagents: Integer + ) + .returns(T.attached_class) + end + def self.new( + + # Whether subagent tools are enabled. + enabled:, + + # Maximum number of subagents that may run concurrently. Defaults to 6. + + max_concurrent_subagents: nil + ) + end + + sig do + override.returns( + {enabled: T::Boolean, max_concurrent_subagents: Integer} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/output_text.rbi b/rbi/openai/models/beta/output_text.rbi new file mode 100644 index 000000000..755e61a4d --- /dev/null +++ b/rbi/openai/models/beta/output_text.rbi @@ -0,0 +1,59 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class OutputText < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::OutputText, + OpenAI::Internal::AnyHash + ) + end + + # The text produced by the agent. + sig { returns(String) } + attr_accessor :text + + # The content type. Always `output_text`. + sig { returns(Symbol) } + attr_accessor :type + + # A text content part produced by the agent. + sig do + params( + + text: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The text produced by the agent. + text:, + + # The content type. Always `output_text`. + + type: :output_text + ) + end + + sig do + override.returns( + {text: String, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/persisted_agent_tool.rbi b/rbi/openai/models/beta/persisted_agent_tool.rbi new file mode 100644 index 000000000..9ea5ccfb8 --- /dev/null +++ b/rbi/openai/models/beta/persisted_agent_tool.rbi @@ -0,0 +1,507 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # A credential-free tool available to a reusable agent. + module PersistedAgentTool + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentTool::Function, + OpenAI::Beta::PersistedAgentTool::ToolSearch, + OpenAI::Beta::PersistedAgentTool::ProgrammaticToolCalling, + OpenAI::Beta::PersistedAgentTool::Mcp, + OpenAI::Beta::PersistedAgentTool::WebSearch + ) + end + + class Function < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentTool::Function, + OpenAI::Internal::AnyHash + ) + end + + # Whether the function is deferred and discovered through tool search. + sig { returns(T::Boolean) } + attr_accessor :defer_loading + + # A description of what the function does. + sig { returns(String) } + attr_accessor :description + + # The name of the function. + sig { returns(String) } + attr_accessor :name + + # A JSON Schema object describing the function's arguments. + sig { returns(T::Hash[Symbol, T.anything]) } + attr_accessor :parameters + + # The type of the object. Always `function`. + sig { returns(Symbol) } + attr_accessor :type + + # A function defined by the application. + sig do + params( + + defer_loading: T::Boolean, + + description: String, + + name: String, + + parameters: T::Hash[Symbol, T.anything], + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Whether the function is deferred and discovered through tool search. + defer_loading:, + + # A description of what the function does. + description:, + + # The name of the function. + name:, + + # A JSON Schema object describing the function's arguments. + parameters:, + + # The type of the object. Always `function`. + + type: :function + ) + end + + sig do + override.returns( + { + defer_loading: T::Boolean, + description: String, + name: String, + parameters: T::Hash[Symbol, T.anything], + type: Symbol + } + ) + end + def to_hash + end + + end + + class ToolSearch < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentTool::ToolSearch, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `tool_search`. + sig { returns(Symbol) } + attr_accessor :type + + # Discovers deferred function tools and loads them into the model context. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The type of the object. Always `tool_search`. + + type: :tool_search + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + class ProgrammaticToolCalling < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentTool::ProgrammaticToolCalling, + OpenAI::Internal::AnyHash + ) + end + + # Whether tools can be called from model-generated code. + sig { returns(T::Boolean) } + attr_accessor :enabled + + # The type of the object. Always `programmatic_tool_calling`. + sig { returns(Symbol) } + attr_accessor :type + + # Enables calling tools from model-generated code. + sig do + params( + + enabled: T::Boolean, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Whether tools can be called from model-generated code. + enabled:, + + # The type of the object. Always `programmatic_tool_calling`. + + type: :programmatic_tool_calling + ) + end + + sig do + override.returns( + {enabled: T::Boolean, type: Symbol} + ) + end + def to_hash + end + + end + + class Mcp < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentTool::Mcp, + OpenAI::Internal::AnyHash + ) + end + + # The MCP tools the agent may call, or null when all server tools are allowed. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :allowed_tools + + # Where outbound MCP HTTP connections originate. + sig { returns(OpenAI::Beta::PersistedAgentTool::Mcp::ConnectionOrigin::TaggedSymbol) } + attr_accessor :connection_origin + + # The vault credential selected for this MCP server, if any. + sig { returns(T.nilable(String)) } + attr_accessor :credential_id + + # Metadata included with requests to this MCP server. + sig { returns(T::Hash[Symbol, T.anything]) } + attr_accessor :request_metadata + + # Whether this MCP server must initialize before the first turn. + sig { returns(T::Boolean) } + attr_accessor :required + + # A label used to identify the MCP server in tool calls. + sig { returns(String) } + attr_accessor :server_label + + # The credential-free transport used to connect to the MCP server. + sig { returns(OpenAI::Beta::PersistedMcpTransport::Variants) } + attr_accessor :transport + + # The type of the object. Always `mcp`. + sig { returns(Symbol) } + attr_accessor :type + + # Tools provided by a remote MCP server without stored credentials. + sig do + params( + + allowed_tools: T.nilable(T::Array[String]), + + connection_origin: OpenAI::Beta::PersistedAgentTool::Mcp::ConnectionOrigin::OrSymbol, + + credential_id: T.nilable(String), + + request_metadata: T::Hash[Symbol, T.anything], + + required: T::Boolean, + + server_label: String, + + transport: T.any( + OpenAI::Beta::PersistedMcpTransport::HTTP::OrHash, + OpenAI::Beta::PersistedMcpTransport::Stdio::OrHash + ), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The MCP tools the agent may call, or null when all server tools are allowed. + allowed_tools:, + + # Where outbound MCP HTTP connections originate. + connection_origin:, + + # The vault credential selected for this MCP server, if any. + credential_id:, + + # Metadata included with requests to this MCP server. + request_metadata:, + + # Whether this MCP server must initialize before the first turn. + required:, + + # A label used to identify the MCP server in tool calls. + server_label:, + + # The credential-free transport used to connect to the MCP server. + transport:, + + # The type of the object. Always `mcp`. + + type: :mcp + ) + end + + sig do + override.returns( + { + allowed_tools: T.nilable(T::Array[String]), + connection_origin: OpenAI::Beta::PersistedAgentTool::Mcp::ConnectionOrigin::TaggedSymbol, + credential_id: T.nilable(String), + request_metadata: T::Hash[Symbol, T.anything], + required: T::Boolean, + server_label: String, + transport: OpenAI::Beta::PersistedMcpTransport::Variants, + type: Symbol + } + ) + end + def to_hash + end + + # Where outbound MCP HTTP connections originate. + module ConnectionOrigin + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::PersistedAgentTool::Mcp::ConnectionOrigin) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + SERVICE = T.let(:service, OpenAI::Beta::PersistedAgentTool::Mcp::ConnectionOrigin::TaggedSymbol) + ENVIRONMENT = T.let(:environment, OpenAI::Beta::PersistedAgentTool::Mcp::ConnectionOrigin::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::PersistedAgentTool::Mcp::ConnectionOrigin::TaggedSymbol]) } + def self.values + end + end + end + + class WebSearch < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentTool::WebSearch, + OpenAI::Internal::AnyHash + ) + end + + # Allowed search domains, or `null` when the search is unrestricted. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :allowed_domains + + # The amount of search context made available to the model. Defaults to `medium`. + sig { returns(OpenAI::Beta::PersistedAgentTool::WebSearch::ContextSize::TaggedSymbol) } + attr_accessor :context_size + + # Approximate user location used to localize web search results. + sig { returns(T.nilable(OpenAI::Beta::PersistedAgentTool::WebSearch::Location)) } + attr_reader :location + + sig { params(location: T.nilable(OpenAI::Beta::PersistedAgentTool::WebSearch::Location::OrHash)).void } + attr_writer :location + + # The source used for web search results. + sig { returns(OpenAI::Beta::PersistedAgentTool::WebSearch::Mode::TaggedSymbol) } + attr_accessor :mode + + # The type of the object. Always `web_search`. + sig { returns(Symbol) } + attr_accessor :type + + # Web search. + sig do + params( + + allowed_domains: T.nilable(T::Array[String]), + + context_size: OpenAI::Beta::PersistedAgentTool::WebSearch::ContextSize::OrSymbol, + + location: T.nilable(OpenAI::Beta::PersistedAgentTool::WebSearch::Location::OrHash), + + mode: OpenAI::Beta::PersistedAgentTool::WebSearch::Mode::OrSymbol, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Allowed search domains, or `null` when the search is unrestricted. + allowed_domains:, + + # The amount of search context made available to the model. Defaults to `medium`. + context_size:, + + # Approximate user location used to localize web search results. + location:, + + # The source used for web search results. + mode:, + + # The type of the object. Always `web_search`. + + type: :web_search + ) + end + + sig do + override.returns( + { + allowed_domains: T.nilable(T::Array[String]), + context_size: OpenAI::Beta::PersistedAgentTool::WebSearch::ContextSize::TaggedSymbol, + location: T.nilable(OpenAI::Beta::PersistedAgentTool::WebSearch::Location), + mode: OpenAI::Beta::PersistedAgentTool::WebSearch::Mode::TaggedSymbol, + type: Symbol + } + ) + end + def to_hash + end + + # The amount of search context made available to the model. Defaults to `medium`. + module ContextSize + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::PersistedAgentTool::WebSearch::ContextSize) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + LOW = T.let(:low, OpenAI::Beta::PersistedAgentTool::WebSearch::ContextSize::TaggedSymbol) + MEDIUM = T.let(:medium, OpenAI::Beta::PersistedAgentTool::WebSearch::ContextSize::TaggedSymbol) + HIGH = T.let(:high, OpenAI::Beta::PersistedAgentTool::WebSearch::ContextSize::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::PersistedAgentTool::WebSearch::ContextSize::TaggedSymbol]) } + def self.values + end + end + + class Location < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentTool::WebSearch::Location, + OpenAI::Internal::AnyHash + ) + end + + # The city name. + sig { returns(T.nilable(String)) } + attr_accessor :city + + # The two-letter ISO country code, such as `US`. + sig { returns(T.nilable(String)) } + attr_accessor :country + + # The region or state name. + sig { returns(T.nilable(String)) } + attr_accessor :region + + # The IANA timezone, such as `America/Los_Angeles`. + sig { returns(T.nilable(String)) } + attr_accessor :timezone + + # Approximate user location used to localize web search results. + sig do + params( + + city: T.nilable(String), + + country: T.nilable(String), + + region: T.nilable(String), + + timezone: T.nilable(String) + ) + .returns(T.attached_class) + end + def self.new( + + # The city name. + city:, + + # The two-letter ISO country code, such as `US`. + country:, + + # The region or state name. + region:, + + # The IANA timezone, such as `America/Los_Angeles`. + + timezone: + ) + end + + sig do + override.returns( + { + city: T.nilable(String), + country: T.nilable(String), + region: T.nilable(String), + timezone: T.nilable(String) + } + ) + end + def to_hash + end + + end + + # The source used for web search results. + module Mode + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::PersistedAgentTool::WebSearch::Mode) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + DISABLED = T.let(:disabled, OpenAI::Beta::PersistedAgentTool::WebSearch::Mode::TaggedSymbol) + CACHED = T.let(:cached, OpenAI::Beta::PersistedAgentTool::WebSearch::Mode::TaggedSymbol) + LIVE = T.let(:live, OpenAI::Beta::PersistedAgentTool::WebSearch::Mode::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::PersistedAgentTool::WebSearch::Mode::TaggedSymbol]) } + def self.values + end + end + end + + sig { override.returns(T::Array[OpenAI::Beta::PersistedAgentTool::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/persisted_agent_tool_param.rbi b/rbi/openai/models/beta/persisted_agent_tool_param.rbi new file mode 100644 index 000000000..e820402ee --- /dev/null +++ b/rbi/openai/models/beta/persisted_agent_tool_param.rbi @@ -0,0 +1,546 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # A tool that can be stored on a reusable agent without session credentials. + module PersistedAgentToolParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentToolParam::Function, + OpenAI::Beta::PersistedAgentToolParam::ToolSearch, + OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling, + OpenAI::Beta::PersistedAgentToolParam::Mcp, + OpenAI::Beta::PersistedAgentToolParam::WebSearch + ) + end + + class Function < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentToolParam::Function, + OpenAI::Internal::AnyHash + ) + end + + # A description of what the function does. + sig { returns(String) } + attr_accessor :description + + # The name of the function. + sig { returns(String) } + attr_accessor :name + + # A JSON Schema object describing the function's arguments. + sig { returns(T::Hash[Symbol, T.anything]) } + attr_accessor :parameters + + # The type of the object. Always `function`. + sig { returns(Symbol) } + attr_accessor :type + + # Whether this function is deferred and discovered through tool search. Defaults + # to `false`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :defer_loading + + sig { params(defer_loading: T::Boolean).void } + attr_writer :defer_loading + + # A function defined by the application. + sig do + params( + + description: String, + + name: String, + + parameters: T::Hash[Symbol, T.anything], + + defer_loading: T::Boolean, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # A description of what the function does. + description:, + + # The name of the function. + name:, + + # A JSON Schema object describing the function's arguments. + parameters:, + + # Whether this function is deferred and discovered through tool search. Defaults + # to `false`. + defer_loading: nil, + + # The type of the object. Always `function`. + + type: :function + ) + end + + sig do + override.returns( + { + description: String, + name: String, + parameters: T::Hash[Symbol, T.anything], + type: Symbol, + defer_loading: T::Boolean + } + ) + end + def to_hash + end + + end + + class ToolSearch < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentToolParam::ToolSearch, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `tool_search`. + sig { returns(Symbol) } + attr_accessor :type + + # Discovers deferred function tools and loads them into the model context. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The type of the object. Always `tool_search`. + + type: :tool_search + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + class ProgrammaticToolCalling < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `programmatic_tool_calling`. + sig { returns(Symbol) } + attr_accessor :type + + # Whether tools can be called from model-generated code. Defaults to `true`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :enabled + + sig { params(enabled: T::Boolean).void } + attr_writer :enabled + + # Enables calling tools from model-generated code. + sig do + params( + + enabled: T::Boolean, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Whether tools can be called from model-generated code. Defaults to `true`. + enabled: nil, + + # The type of the object. Always `programmatic_tool_calling`. + + type: :programmatic_tool_calling + ) + end + + sig do + override.returns( + {type: Symbol, enabled: T::Boolean} + ) + end + def to_hash + end + + end + + class Mcp < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentToolParam::Mcp, + OpenAI::Internal::AnyHash + ) + end + + # A label used to identify the MCP server in tool calls. + sig { returns(String) } + attr_accessor :server_label + + # The credential-free transport used to connect to the MCP server. + sig { + returns( + T.any(OpenAI::Beta::PersistedMcpTransportParam::HTTP, OpenAI::Beta::PersistedMcpTransportParam::Stdio) + ) + } + attr_accessor :transport + + # The type of the object. Always `mcp`. + sig { returns(Symbol) } + attr_accessor :type + + # The MCP tools the agent may call. All server tools are allowed when omitted. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :allowed_tools + + # Where outbound MCP HTTP connections originate. + sig { returns(T.nilable(OpenAI::Beta::PersistedAgentToolParam::Mcp::ConnectionOrigin::OrSymbol)) } + attr_accessor :connection_origin + + # The vault credential selected for this MCP server. Optional when exactly one + # attached credential matches the server URL. + sig { returns(T.nilable(String)) } + attr_accessor :credential_id + + # Metadata included with requests to this MCP server. + sig { returns(T.nilable(T::Hash[Symbol, T.anything])) } + attr_accessor :request_metadata + + # Whether this MCP server must initialize before the first turn. Defaults to + # `false`. + sig { returns(T.nilable(T::Boolean)) } + attr_reader :required + + sig { params(required: T::Boolean).void } + attr_writer :required + + # Tools provided by a remote MCP server without stored credentials. + sig do + params( + + server_label: String, + + transport: T.any( + OpenAI::Beta::PersistedMcpTransportParam::HTTP::OrHash, + OpenAI::Beta::PersistedMcpTransportParam::Stdio::OrHash + ), + + allowed_tools: T.nilable(T::Array[String]), + + connection_origin: T.nilable(OpenAI::Beta::PersistedAgentToolParam::Mcp::ConnectionOrigin::OrSymbol), + + credential_id: T.nilable(String), + + request_metadata: T.nilable(T::Hash[Symbol, T.anything]), + + required: T::Boolean, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # A label used to identify the MCP server in tool calls. + server_label:, + + # The credential-free transport used to connect to the MCP server. + transport:, + + # The MCP tools the agent may call. All server tools are allowed when omitted. + allowed_tools: nil, + + # Where outbound MCP HTTP connections originate. + connection_origin: nil, + + # The vault credential selected for this MCP server. Optional when exactly one + # attached credential matches the server URL. + credential_id: nil, + + # Metadata included with requests to this MCP server. + request_metadata: nil, + + # Whether this MCP server must initialize before the first turn. Defaults to + # `false`. + required: nil, + + # The type of the object. Always `mcp`. + + type: :mcp + ) + end + + sig do + override.returns( + { + server_label: String, + transport: T.any( + OpenAI::Beta::PersistedMcpTransportParam::HTTP, + OpenAI::Beta::PersistedMcpTransportParam::Stdio + ), + type: Symbol, + allowed_tools: T.nilable(T::Array[String]), + connection_origin: T.nilable(OpenAI::Beta::PersistedAgentToolParam::Mcp::ConnectionOrigin::OrSymbol), + credential_id: T.nilable(String), + request_metadata: T.nilable(T::Hash[Symbol, T.anything]), + required: T::Boolean + } + ) + end + def to_hash + end + + # Where outbound MCP HTTP connections originate. + module ConnectionOrigin + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::PersistedAgentToolParam::Mcp::ConnectionOrigin) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Uses the Managed Agents service network. + SERVICE = T.let(:service, OpenAI::Beta::PersistedAgentToolParam::Mcp::ConnectionOrigin::TaggedSymbol) + + # Uses the session's execution environment. + ENVIRONMENT = T.let( + :environment, + OpenAI::Beta::PersistedAgentToolParam::Mcp::ConnectionOrigin::TaggedSymbol + ) + + sig { + override.returns(T::Array[OpenAI::Beta::PersistedAgentToolParam::Mcp::ConnectionOrigin::TaggedSymbol]) + } + def self.values + end + end + end + + class WebSearch < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentToolParam::WebSearch, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `web_search`. + sig { returns(Symbol) } + attr_accessor :type + + # Domains the search may include. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :allowed_domains + + # The amount of web search context made available to the model. + sig { returns(T.nilable(OpenAI::Beta::PersistedAgentToolParam::WebSearch::ContextSize::OrSymbol)) } + attr_accessor :context_size + + # Approximate user location used to localize web search results. + sig { returns(T.nilable(OpenAI::Beta::PersistedAgentToolParam::WebSearch::Location)) } + attr_reader :location + + sig { params(location: T.nilable(OpenAI::Beta::PersistedAgentToolParam::WebSearch::Location::OrHash)).void } + attr_writer :location + + # The source used for web search results. + sig { returns(T.nilable(OpenAI::Beta::PersistedAgentToolParam::WebSearch::Mode::OrSymbol)) } + attr_accessor :mode + + # Web search. + sig do + params( + + allowed_domains: T.nilable(T::Array[String]), + + context_size: T.nilable(OpenAI::Beta::PersistedAgentToolParam::WebSearch::ContextSize::OrSymbol), + + location: T.nilable(OpenAI::Beta::PersistedAgentToolParam::WebSearch::Location::OrHash), + + mode: T.nilable(OpenAI::Beta::PersistedAgentToolParam::WebSearch::Mode::OrSymbol), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Domains the search may include. + allowed_domains: nil, + + # The amount of web search context made available to the model. + context_size: nil, + + # Approximate user location used to localize web search results. + location: nil, + + # The source used for web search results. + mode: nil, + + # The type of the object. Always `web_search`. + + type: :web_search + ) + end + + sig do + override.returns( + { + type: Symbol, + allowed_domains: T.nilable(T::Array[String]), + context_size: T.nilable(OpenAI::Beta::PersistedAgentToolParam::WebSearch::ContextSize::OrSymbol), + location: T.nilable(OpenAI::Beta::PersistedAgentToolParam::WebSearch::Location), + mode: T.nilable(OpenAI::Beta::PersistedAgentToolParam::WebSearch::Mode::OrSymbol) + } + ) + end + def to_hash + end + + # The amount of web search context made available to the model. + module ContextSize + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { + T.all(Symbol, OpenAI::Beta::PersistedAgentToolParam::WebSearch::ContextSize) + } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + LOW = T.let(:low, OpenAI::Beta::PersistedAgentToolParam::WebSearch::ContextSize::TaggedSymbol) + MEDIUM = T.let(:medium, OpenAI::Beta::PersistedAgentToolParam::WebSearch::ContextSize::TaggedSymbol) + HIGH = T.let(:high, OpenAI::Beta::PersistedAgentToolParam::WebSearch::ContextSize::TaggedSymbol) + + sig { + override.returns(T::Array[OpenAI::Beta::PersistedAgentToolParam::WebSearch::ContextSize::TaggedSymbol]) + } + def self.values + end + end + + class Location < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedAgentToolParam::WebSearch::Location, + OpenAI::Internal::AnyHash + ) + end + + # The city name. + sig { returns(T.nilable(String)) } + attr_accessor :city + + # The two-letter ISO country code, such as `US`. + sig { returns(T.nilable(String)) } + attr_accessor :country + + # The region or state name. + sig { returns(T.nilable(String)) } + attr_accessor :region + + # The IANA timezone, such as `America/Los_Angeles`. + sig { returns(T.nilable(String)) } + attr_accessor :timezone + + # Approximate user location used to localize web search results. + sig do + params( + + city: T.nilable(String), + + country: T.nilable(String), + + region: T.nilable(String), + + timezone: T.nilable(String) + ) + .returns(T.attached_class) + end + def self.new( + + # The city name. + city: nil, + + # The two-letter ISO country code, such as `US`. + country: nil, + + # The region or state name. + region: nil, + + # The IANA timezone, such as `America/Los_Angeles`. + + timezone: nil + ) + end + + sig do + override.returns( + { + city: T.nilable(String), + country: T.nilable(String), + region: T.nilable(String), + timezone: T.nilable(String) + } + ) + end + def to_hash + end + + end + + # The source used for web search results. + module Mode + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::PersistedAgentToolParam::WebSearch::Mode) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # Disables web search. + DISABLED = T.let(:disabled, OpenAI::Beta::PersistedAgentToolParam::WebSearch::Mode::TaggedSymbol) + + # Uses cached search results. + CACHED = T.let(:cached, OpenAI::Beta::PersistedAgentToolParam::WebSearch::Mode::TaggedSymbol) + + # Searches the live web. + LIVE = T.let(:live, OpenAI::Beta::PersistedAgentToolParam::WebSearch::Mode::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::PersistedAgentToolParam::WebSearch::Mode::TaggedSymbol]) } + def self.values + end + end + end + + sig { override.returns(T::Array[OpenAI::Beta::PersistedAgentToolParam::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/persisted_mcp_transport.rbi b/rbi/openai/models/beta/persisted_mcp_transport.rbi new file mode 100644 index 000000000..c1216fc14 --- /dev/null +++ b/rbi/openai/models/beta/persisted_mcp_transport.rbi @@ -0,0 +1,158 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # A credential-free transport used to connect to an MCP server. + module PersistedMcpTransport + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::PersistedMcpTransport::HTTP, + OpenAI::Beta::PersistedMcpTransport::Stdio + ) + end + + class HTTP < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedMcpTransport::HTTP, + OpenAI::Internal::AnyHash + ) + end + + # Non-secret HTTP headers sent to the MCP server. + sig { returns(T::Hash[Symbol, String]) } + attr_accessor :headers + + # The URL of the MCP server. + sig { returns(String) } + attr_accessor :server_url + + # The type of the object. Always `http`. + sig { returns(Symbol) } + attr_accessor :type + + # Connects to an MCP server over HTTP. + sig do + params( + + headers: T::Hash[Symbol, String], + + server_url: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Non-secret HTTP headers sent to the MCP server. + headers:, + + # The URL of the MCP server. + server_url:, + + # The type of the object. Always `http`. + + type: :http + ) + end + + sig do + override.returns( + {headers: T::Hash[Symbol, String], server_url: String, type: Symbol} + ) + end + def to_hash + end + + end + + class Stdio < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedMcpTransport::Stdio, + OpenAI::Internal::AnyHash + ) + end + + # Arguments passed to the MCP server command. + sig { returns(T::Array[String]) } + attr_accessor :args + + # The command used to start the MCP server. + sig { returns(String) } + attr_accessor :command + + # The working directory used to start the MCP server. + sig { returns(String) } + attr_accessor :cwd + + # Environment variable names inherited from the execution environment. + sig { returns(T::Array[String]) } + attr_accessor :env_vars + + # The type of the object. Always `stdio`. + sig { returns(Symbol) } + attr_accessor :type + + # Starts an MCP server as a local process. + sig do + params( + + args: T::Array[String], + + command: String, + + cwd: String, + + env_vars: T::Array[String], + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # Arguments passed to the MCP server command. + args:, + + # The command used to start the MCP server. + command:, + + # The working directory used to start the MCP server. + cwd:, + + # Environment variable names inherited from the execution environment. + env_vars:, + + # The type of the object. Always `stdio`. + + type: :stdio + ) + end + + sig do + override.returns( + {args: T::Array[String], command: String, cwd: String, env_vars: T::Array[String], type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::PersistedMcpTransport::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/persisted_mcp_transport_param.rbi b/rbi/openai/models/beta/persisted_mcp_transport_param.rbi new file mode 100644 index 000000000..3e22a6c96 --- /dev/null +++ b/rbi/openai/models/beta/persisted_mcp_transport_param.rbi @@ -0,0 +1,164 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # A credential-free transport used to connect to an MCP server. + module PersistedMcpTransportParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::PersistedMcpTransportParam::HTTP, + OpenAI::Beta::PersistedMcpTransportParam::Stdio + ) + end + + class HTTP < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedMcpTransportParam::HTTP, + OpenAI::Internal::AnyHash + ) + end + + # The URL of the MCP server. + sig { returns(String) } + attr_accessor :server_url + + # The type of the object. Always `http`. + sig { returns(Symbol) } + attr_accessor :type + + # Non-secret HTTP headers sent to the MCP server. + sig { returns(T.nilable(T::Hash[Symbol, String])) } + attr_accessor :headers + + # Connects to an MCP server over HTTP. + sig do + params( + + server_url: String, + + headers: T.nilable(T::Hash[Symbol, String]), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The URL of the MCP server. + server_url:, + + # Non-secret HTTP headers sent to the MCP server. + headers: nil, + + # The type of the object. Always `http`. + + type: :http + ) + end + + sig do + override.returns( + {server_url: String, type: Symbol, headers: T.nilable(T::Hash[Symbol, String])} + ) + end + def to_hash + end + + end + + class Stdio < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::PersistedMcpTransportParam::Stdio, + OpenAI::Internal::AnyHash + ) + end + + # The command used to start the MCP server. + sig { returns(String) } + attr_accessor :command + + # The working directory used to start the MCP server. + sig { returns(String) } + attr_accessor :cwd + + # The type of the object. Always `stdio`. + sig { returns(Symbol) } + attr_accessor :type + + # Arguments passed to the MCP server command. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :args + + # Environment variable names to inherit from the selected execution environment. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :env_vars + + # Starts an MCP server as a local process. + sig do + params( + + command: String, + + cwd: String, + + args: T.nilable(T::Array[String]), + + env_vars: T.nilable(T::Array[String]), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The command used to start the MCP server. + command:, + + # The working directory used to start the MCP server. + cwd:, + + # Arguments passed to the MCP server command. + args: nil, + + # Environment variable names to inherit from the selected execution environment. + env_vars: nil, + + # The type of the object. Always `stdio`. + + type: :stdio + ) + end + + sig do + override.returns( + { + command: String, + cwd: String, + type: Symbol, + args: T.nilable(T::Array[String]), + env_vars: T.nilable(T::Array[String]) + } + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::PersistedMcpTransportParam::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/session_error.rbi b/rbi/openai/models/beta/session_error.rbi new file mode 100644 index 000000000..cdc831a07 --- /dev/null +++ b/rbi/openai/models/beta/session_error.rbi @@ -0,0 +1,77 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class SessionError < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::SessionError, + OpenAI::Internal::AnyHash + ) + end + + # The machine-readable error code, if any. + sig { returns(T.nilable(String)) } + attr_accessor :code + + # A customer-safe explanation of the error. + sig { returns(String) } + attr_accessor :message + + # The request parameter associated with the error, if any. + sig { returns(T.nilable(String)) } + attr_accessor :param + + # The error type. + sig { returns(String) } + attr_accessor :type + + # An error payload with the same public fields as Responses API streaming errors. + sig do + params( + + code: T.nilable(String), + + message: String, + + param: T.nilable(String), + + type: String + ) + .returns(T.attached_class) + end + def self.new( + + # The machine-readable error code, if any. + code:, + + # A customer-safe explanation of the error. + message:, + + # The request parameter associated with the error, if any. + param:, + + # The error type. + + type: + ) + end + + sig do + override.returns( + {code: T.nilable(String), message: String, param: T.nilable(String), type: String} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/session_turn_error.rbi b/rbi/openai/models/beta/session_turn_error.rbi new file mode 100644 index 000000000..0ffb09f83 --- /dev/null +++ b/rbi/openai/models/beta/session_turn_error.rbi @@ -0,0 +1,125 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class SessionTurnError < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::SessionTurnError, + OpenAI::Internal::AnyHash + ) + end + + # A stable, machine-readable failure category. + sig { returns(OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) } + attr_accessor :code + + # A customer-safe explanation of the failure. + sig { returns(String) } + attr_accessor :message + + # A customer-safe error describing why a session request failed. + sig do + params( + + code: OpenAI::Beta::SessionTurnError::Code::OrSymbol, + + message: String + ) + .returns(T.attached_class) + end + def self.new( + + # A stable, machine-readable failure category. + code:, + + # A customer-safe explanation of the failure. + + message: + ) + end + + sig do + override.returns( + {code: OpenAI::Beta::SessionTurnError::Code::TaggedSymbol, message: String} + ) + end + def to_hash + end + + # A stable, machine-readable failure category. + module Code + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::SessionTurnError::Code) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # The request exceeds the model's context window. + CONTEXT_LENGTH_EXCEEDED = T.let(:context_length_exceeded, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + # The session has reached its usage budget. + SESSION_BUDGET_EXCEEDED = T.let(:session_budget_exceeded, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + # The organization has reached a usage, plan, or billing limit. + USAGE_LIMIT_EXCEEDED = T.let(:usage_limit_exceeded, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + # The request exceeds the available rate limit. + RATE_LIMIT_EXCEEDED = T.let(:rate_limit_exceeded, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + # The model service is temporarily overloaded. + SERVER_OVERLOADED = T.let(:server_overloaded, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + # The request was rejected by a safety policy. + CYBER_POLICY = T.let(:cyber_policy, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + # The request could not connect to the model service. + CONNECTION_FAILED = T.let(:connection_failed, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + # The model service encountered an unexpected error. + SERVER_ERROR = T.let(:server_error, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + # The API credentials are invalid or lack the required access. + AUTHENTICATION_ERROR = T.let(:authentication_error, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + # The request contains invalid input or configuration. + INVALID_REQUEST = T.let(:invalid_request, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + # The requested model or resource is unavailable. + RESOURCE_NOT_FOUND = T.let(:resource_not_found, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + # The request could not complete in its execution environment. + SANDBOX_ERROR = T.let(:sandbox_error, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + # The executor must be upgraded before it can run this turn. + EXECUTOR_VERSION_INCOMPATIBLE = T.let( + :executor_version_incompatible, + OpenAI::Beta::SessionTurnError::Code::TaggedSymbol + ) + + # The session cannot accept additional input while a request is running. + ACTIVE_TURN_NOT_STEERABLE = T.let( + :active_turn_not_steerable, + OpenAI::Beta::SessionTurnError::Code::TaggedSymbol + ) + + # The request timed out before the model service responded. + REQUEST_TIMEOUT = T.let(:request_timeout, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + # An unexpected internal error prevented the session request from completing. + INTERNAL_ERROR = T.let(:internal_error, OpenAI::Beta::SessionTurnError::Code::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::SessionTurnError::Code::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/setup_command_param.rbi b/rbi/openai/models/beta/setup_command_param.rbi new file mode 100644 index 000000000..360a1536e --- /dev/null +++ b/rbi/openai/models/beta/setup_command_param.rbi @@ -0,0 +1,59 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class SetupCommandParam < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::SetupCommandParam, + OpenAI::Internal::AnyHash + ) + end + + # The shell command to execute. + sig { returns(String) } + attr_accessor :command + + # The absolute working directory. Defaults to `/workspace`. + sig { returns(T.nilable(String)) } + attr_accessor :cwd + + # A confidential setup command executed before the hosted agent starts. + sig do + params( + + command: String, + + cwd: T.nilable(String) + ) + .returns(T.attached_class) + end + def self.new( + + # The shell command to execute. + command:, + + # The absolute working directory. Defaults to `/workspace`. + + cwd: nil + ) + end + + sig do + override.returns( + {command: String, cwd: T.nilable(String)} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/subagent.rbi b/rbi/openai/models/beta/subagent.rbi new file mode 100644 index 000000000..8398b862d --- /dev/null +++ b/rbi/openai/models/beta/subagent.rbi @@ -0,0 +1,158 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class Subagent < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::Subagent, + OpenAI::Internal::AnyHash + ) + end + + # The ID of the subagent. + sig { returns(String) } + attr_accessor :id + + # The Unix timestamp, in seconds, when the subagent was closed. Null while active, + # including after resume. + sig { returns(T.nilable(Integer)) } + attr_accessor :closed_at + + # Initial task content, or null when unavailable. Text may contain placeholders + # for images or audio when only a preview is available. + sig { returns(T.nilable(T::Array[OpenAI::Beta::AgentContent::Variants])) } + attr_accessor :instructions + + # The runner-assigned nickname, or null when unavailable. + sig { returns(T.nilable(String)) } + attr_accessor :name + + # The object type. Always `agent.session.subagent`. + sig { returns(Symbol) } + attr_accessor :object + + # The Unix timestamp, in seconds, when the subagent was first opened. Resuming + # does not change it. + sig { returns(Integer) } + attr_accessor :opened_at + + # The ID of the agent that created this subagent. + sig { returns(String) } + attr_accessor :parent_agent_id + + # The ID of the session that owns the subagent. + sig { returns(String) } + attr_accessor :session_id + + # The current status of the subagent. + sig { returns(OpenAI::Beta::Subagent::Status::TaggedSymbol) } + attr_accessor :status + + # A subagent created within a session. + sig do + params( + + id: String, + + closed_at: T.nilable(Integer), + + instructions: T.nilable( + T::Array[T.any(OpenAI::Beta::OutputText::OrHash, OpenAI::Beta::AgentContent::EncryptedContent::OrHash)] + ), + + name: T.nilable(String), + + opened_at: Integer, + + parent_agent_id: String, + + session_id: String, + + status: OpenAI::Beta::Subagent::Status::OrSymbol, + + object: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The ID of the subagent. + id:, + + # The Unix timestamp, in seconds, when the subagent was closed. Null while active, + # including after resume. + closed_at:, + + # Initial task content, or null when unavailable. Text may contain placeholders + # for images or audio when only a preview is available. + instructions:, + + # The runner-assigned nickname, or null when unavailable. + name:, + + # The Unix timestamp, in seconds, when the subagent was first opened. Resuming + # does not change it. + opened_at:, + + # The ID of the agent that created this subagent. + parent_agent_id:, + + # The ID of the session that owns the subagent. + session_id:, + + # The current status of the subagent. + status:, + + # The object type. Always `agent.session.subagent`. + + object: :"agent.session.subagent" + ) + end + + sig do + override.returns( + { + id: String, + closed_at: T.nilable(Integer), + instructions: T.nilable(T::Array[OpenAI::Beta::AgentContent::Variants]), + name: T.nilable(String), + object: Symbol, + opened_at: Integer, + parent_agent_id: String, + session_id: String, + status: OpenAI::Beta::Subagent::Status::TaggedSymbol + } + ) + end + def to_hash + end + + # The current status of the subagent. + module Status + extend OpenAI::Internal::Type::Enum + + TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Beta::Subagent::Status) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + # The subagent remains available, including while idle between turns. + ACTIVE = T.let(:active, OpenAI::Beta::Subagent::Status::TaggedSymbol) + + # The subagent is closed. + CLOSED = T.let(:closed, OpenAI::Beta::Subagent::Status::TaggedSymbol) + + sig { override.returns(T::Array[OpenAI::Beta::Subagent::Status::TaggedSymbol]) } + def self.values + end + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/summary_text.rbi b/rbi/openai/models/beta/summary_text.rbi new file mode 100644 index 000000000..8e1a3a20e --- /dev/null +++ b/rbi/openai/models/beta/summary_text.rbi @@ -0,0 +1,59 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class SummaryText < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::SummaryText, + OpenAI::Internal::AnyHash + ) + end + + # The reasoning summary text. + sig { returns(String) } + attr_accessor :text + + # The content type. Always `summary_text`. + sig { returns(Symbol) } + attr_accessor :type + + # A reasoning summary content part. + sig do + params( + + text: String, + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The reasoning summary text. + text:, + + # The content type. Always `summary_text`. + + type: :summary_text + ) + end + + sig do + override.returns( + {text: String, type: Symbol} + ) + end + def to_hash + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/text_format.rbi b/rbi/openai/models/beta/text_format.rbi new file mode 100644 index 000000000..357f29590 --- /dev/null +++ b/rbi/openai/models/beta/text_format.rbi @@ -0,0 +1,113 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # The effective output format for generated text. + module TextFormat + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::TextFormat::Text, + OpenAI::Beta::TextFormat::JSONSchema + ) + end + + class Text < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::TextFormat::Text, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `text`. + sig { returns(Symbol) } + attr_accessor :type + + # Generates ordinary text without a structured-output constraint. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The type of the object. Always `text`. + + type: :text + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + class JSONSchema < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::TextFormat::JSONSchema, + OpenAI::Internal::AnyHash + ) + end + + # The JSON Schema that generated text must match. + sig { returns(T::Hash[Symbol, T.anything]) } + attr_accessor :schema + + # The type of the object. Always `json_schema`. + sig { returns(Symbol) } + attr_accessor :type + + # Constrains generated text to a JSON Schema. + sig do + params( + + schema: T::Hash[Symbol, T.anything], + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The JSON Schema that generated text must match. + schema:, + + # The type of the object. Always `json_schema`. + + type: :json_schema + ) + end + + sig do + override.returns( + {schema: T::Hash[Symbol, T.anything], type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::TextFormat::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/text_format_param.rbi b/rbi/openai/models/beta/text_format_param.rbi new file mode 100644 index 000000000..64ee44e38 --- /dev/null +++ b/rbi/openai/models/beta/text_format_param.rbi @@ -0,0 +1,113 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # The output format for generated text. + module TextFormatParam + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::TextFormatParam::Text, + OpenAI::Beta::TextFormatParam::JSONSchema + ) + end + + class Text < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::TextFormatParam::Text, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `text`. + sig { returns(Symbol) } + attr_accessor :type + + # Generates ordinary text without a structured-output constraint. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The type of the object. Always `text`. + + type: :text + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + class JSONSchema < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::TextFormatParam::JSONSchema, + OpenAI::Internal::AnyHash + ) + end + + # The JSON Schema that generated text must match. + sig { returns(T::Hash[Symbol, T.anything]) } + attr_accessor :schema + + # The type of the object. Always `json_schema`. + sig { returns(Symbol) } + attr_accessor :type + + # Constrains generated text to a JSON Schema. + sig do + params( + + schema: T::Hash[Symbol, T.anything], + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The JSON Schema that generated text must match. + schema:, + + # The type of the object. Always `json_schema`. + + type: :json_schema + ) + end + + sig do + override.returns( + {schema: T::Hash[Symbol, T.anything], type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::TextFormatParam::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/token_usage.rbi b/rbi/openai/models/beta/token_usage.rbi new file mode 100644 index 000000000..c82b8b0f1 --- /dev/null +++ b/rbi/openai/models/beta/token_usage.rbi @@ -0,0 +1,174 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + class TokenUsage < OpenAI::Internal::Type::BaseModel + + OrHash = T.type_alias do + T.any( + OpenAI::Beta::TokenUsage, + OpenAI::Internal::AnyHash + ) + end + + # The number of input tokens used by the agent. + sig { returns(Integer) } + attr_accessor :input_tokens + + # A breakdown of the agent's input token usage. + sig { returns(OpenAI::Beta::TokenUsage::InputTokensDetails) } + attr_reader :input_tokens_details + + sig { params(input_tokens_details: OpenAI::Beta::TokenUsage::InputTokensDetails::OrHash).void } + attr_writer :input_tokens_details + + # The number of output tokens generated by the agent. + sig { returns(Integer) } + attr_accessor :output_tokens + + # A breakdown of the agent's output token usage. + sig { returns(OpenAI::Beta::TokenUsage::OutputTokensDetails) } + attr_reader :output_tokens_details + + sig { params(output_tokens_details: OpenAI::Beta::TokenUsage::OutputTokensDetails::OrHash).void } + attr_writer :output_tokens_details + + # The total number of input and output tokens used by the agent. + sig { returns(Integer) } + attr_accessor :total_tokens + + # Recorded token usage for a session or turn. Usage is best effort and may change. + sig do + params( + + input_tokens: Integer, + + input_tokens_details: OpenAI::Beta::TokenUsage::InputTokensDetails::OrHash, + + output_tokens: Integer, + + output_tokens_details: OpenAI::Beta::TokenUsage::OutputTokensDetails::OrHash, + + total_tokens: Integer + ) + .returns(T.attached_class) + end + def self.new( + + # The number of input tokens used by the agent. + input_tokens:, + + # A breakdown of the agent's input token usage. + input_tokens_details:, + + # The number of output tokens generated by the agent. + output_tokens:, + + # A breakdown of the agent's output token usage. + output_tokens_details:, + + # The total number of input and output tokens used by the agent. + + total_tokens: + ) + end + + sig do + override.returns( + { + input_tokens: Integer, + input_tokens_details: OpenAI::Beta::TokenUsage::InputTokensDetails, + output_tokens: Integer, + output_tokens_details: OpenAI::Beta::TokenUsage::OutputTokensDetails, + total_tokens: Integer + } + ) + end + def to_hash + end + + class InputTokensDetails < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::TokenUsage::InputTokensDetails, + OpenAI::Internal::AnyHash + ) + end + + # The number of input tokens retrieved from the prompt cache. + sig { returns(Integer) } + attr_accessor :cached_tokens + + # A breakdown of the agent's input token usage. + sig do + params( + + cached_tokens: Integer + ) + .returns(T.attached_class) + end + def self.new( + + # The number of input tokens retrieved from the prompt cache. + + cached_tokens: + ) + end + + sig do + override.returns( + {cached_tokens: Integer} + ) + end + def to_hash + end + + end + + class OutputTokensDetails < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::TokenUsage::OutputTokensDetails, + OpenAI::Internal::AnyHash + ) + end + + # The number of output tokens used for reasoning. + sig { returns(Integer) } + attr_accessor :reasoning_tokens + + # A breakdown of the agent's output token usage. + sig do + params( + + reasoning_tokens: Integer + ) + .returns(T.attached_class) + end + def self.new( + + # The number of output tokens used for reasoning. + + reasoning_tokens: + ) + end + + sig do + override.returns( + {reasoning_tokens: Integer} + ) + end + def to_hash + end + + end + + end + + end + + end +end diff --git a/rbi/openai/models/beta/web_search_action.rbi b/rbi/openai/models/beta/web_search_action.rbi new file mode 100644 index 000000000..f688f215f --- /dev/null +++ b/rbi/openai/models/beta/web_search_action.rbi @@ -0,0 +1,227 @@ +# typed: strong + +module OpenAI + module Models + + module Beta + + # An action performed by the web search tool. + module WebSearchAction + extend OpenAI::Internal::Type::Union + + Variants = T.type_alias do + T.any( + OpenAI::Beta::WebSearchAction::Search, + OpenAI::Beta::WebSearchAction::OpenPage, + OpenAI::Beta::WebSearchAction::FindInPage, + OpenAI::Beta::WebSearchAction::Other + ) + end + + class Search < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::WebSearchAction::Search, + OpenAI::Internal::AnyHash + ) + end + + # The search queries, when multiple queries were used. + sig { returns(T.nilable(T::Array[String])) } + attr_accessor :queries + + # The search query, when a single query was used. + sig { returns(T.nilable(String)) } + attr_accessor :query + + # The type of the object. Always `search`. + sig { returns(Symbol) } + attr_accessor :type + + # A search query or group of search queries. + sig do + params( + + queries: T.nilable(T::Array[String]), + + query: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The search queries, when multiple queries were used. + queries:, + + # The search query, when a single query was used. + query:, + + # The type of the object. Always `search`. + + type: :search + ) + end + + sig do + override.returns( + {queries: T.nilable(T::Array[String]), query: T.nilable(String), type: Symbol} + ) + end + def to_hash + end + + end + + class OpenPage < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::WebSearchAction::OpenPage, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `open_page`. + sig { returns(Symbol) } + attr_accessor :type + + # The URL of the page that was opened. + sig { returns(T.nilable(String)) } + attr_accessor :url + + # Opens a web page. + sig do + params( + + url: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The URL of the page that was opened. + url:, + + # The type of the object. Always `open_page`. + + type: :open_page + ) + end + + sig do + override.returns( + {type: Symbol, url: T.nilable(String)} + ) + end + def to_hash + end + + end + + class FindInPage < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::WebSearchAction::FindInPage, + OpenAI::Internal::AnyHash + ) + end + + # The text pattern that was searched for. + sig { returns(T.nilable(String)) } + attr_accessor :pattern + + # The type of the object. Always `find_in_page`. + sig { returns(Symbol) } + attr_accessor :type + + # The URL of the page that was searched. + sig { returns(T.nilable(String)) } + attr_accessor :url + + # Finds text within a web page. + sig do + params( + + pattern: T.nilable(String), + + url: T.nilable(String), + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The text pattern that was searched for. + pattern:, + + # The URL of the page that was searched. + url:, + + # The type of the object. Always `find_in_page`. + + type: :find_in_page + ) + end + + sig do + override.returns( + {pattern: T.nilable(String), type: Symbol, url: T.nilable(String)} + ) + end + def to_hash + end + + end + + class Other < OpenAI::Internal::Type::BaseModel + OrHash = T.type_alias do + T.any( + OpenAI::Beta::WebSearchAction::Other, + OpenAI::Internal::AnyHash + ) + end + + # The type of the object. Always `other`. + sig { returns(Symbol) } + attr_accessor :type + + # Another web search action. + sig do + params( + + type: Symbol + ) + .returns(T.attached_class) + end + def self.new( + + # The type of the object. Always `other`. + + type: :other + ) + end + + sig do + override.returns( + {type: Symbol} + ) + end + def to_hash + end + + end + + sig { override.returns(T::Array[OpenAI::Beta::WebSearchAction::Variants]) } + def self.variants + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta.rbi b/rbi/openai/resources/beta.rbi index 393ea4e57..d88efcdd3 100644 --- a/rbi/openai/resources/beta.rbi +++ b/rbi/openai/resources/beta.rbi @@ -5,6 +5,9 @@ module OpenAI class Beta + sig { returns(OpenAI::Resources::Beta::Agents) } + attr_reader :agents + sig { returns(OpenAI::Resources::Beta::Responses) } attr_reader :responses diff --git a/rbi/openai/resources/beta/agents.rbi b/rbi/openai/resources/beta/agents.rbi new file mode 100644 index 000000000..6b513bcf6 --- /dev/null +++ b/rbi/openai/resources/beta/agents.rbi @@ -0,0 +1,180 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + sig { returns(OpenAI::Resources::Beta::Agents::Environments) } + attr_reader :environments + + sig { returns(OpenAI::Resources::Beta::Agents::Vaults) } + attr_reader :vaults + + sig { returns(OpenAI::Resources::Beta::Agents::Sessions) } + attr_reader :sessions + + # Creates a reusable agent without storing credentials. See + # [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + sig { + params( + model: String, + instructions: T.nilable(String), + metadata: T.nilable(T::Hash[Symbol, String]), + multi_agent: T.nilable(OpenAI::Beta::MultiAgentConfigParam::OrHash), + name: T.nilable(String), + reasoning: T.nilable(OpenAI::Beta::AgentReasoningParam::OrHash), + service_tier: T.nilable(OpenAI::Beta::AgentCreateParams::ServiceTier::OrSymbol), + text: T.nilable(OpenAI::Beta::AgentTextParam::OrHash), + tools: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::PersistedAgentToolParam::Function::OrHash, + OpenAI::Beta::PersistedAgentToolParam::ToolSearch::OrHash, + OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling::OrHash, + OpenAI::Beta::PersistedAgentToolParam::Mcp::OrHash, + OpenAI::Beta::PersistedAgentToolParam::WebSearch::OrHash + ) + ] + ), + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Beta::Agent) + } + def create( + # The model to use for the agent. The requested model name is preserved. + model:, + # Additional instructions appended to the agent's default base instructions. Omit + # or set to null to add no custom instructions. + instructions: nil, + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + metadata: nil, + # Explicit configuration for creating and coordinating subagents. + multi_agent: nil, + # A human-readable name for the agent. Omission or null leaves the agent unnamed. + name: nil, + # Reasoning configuration for the agent. + reasoning: nil, + # The service tier used for model requests. + service_tier: nil, + # Configuration for text generated by the agent. + text: nil, + # Tools available to the agent. Defaults to an empty list. + tools: nil, + request_options: {} + ) + end + + # Retrieves a reusable agent by ID. See + # [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + sig { params(agent_id: String, request_options: OpenAI::RequestOptions::OrHash).returns(OpenAI::Beta::Agent) } + def retrieve( + # The ID of the reusable agent. + agent_id, + request_options: {} + ) + end + + # Updates a reusable agent. See + # [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + sig { + params( + agent_id: String, + instructions: T.nilable(String), + metadata: T.nilable(T::Hash[Symbol, String]), + model: String, + multi_agent: T.nilable(OpenAI::Beta::MultiAgentConfigParam::OrHash), + name: T.nilable(String), + reasoning: T.nilable(OpenAI::Beta::AgentReasoningParam::OrHash), + service_tier: T.nilable(OpenAI::Beta::AgentUpdateParams::ServiceTier::OrSymbol), + text: T.nilable(OpenAI::Beta::AgentTextParam::OrHash), + tools: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::PersistedAgentToolParam::Function::OrHash, + OpenAI::Beta::PersistedAgentToolParam::ToolSearch::OrHash, + OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling::OrHash, + OpenAI::Beta::PersistedAgentToolParam::Mcp::OrHash, + OpenAI::Beta::PersistedAgentToolParam::WebSearch::OrHash + ) + ] + ), + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Beta::Agent) + } + def update( + # The ID of the reusable agent. + agent_id, + # Additional instructions appended to the agent's default base instructions. Omit + # to leave unchanged. + instructions: nil, + # Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. + metadata: nil, + # The model to use for the agent. The requested model name is preserved. + model: nil, + # Explicit configuration for creating and coordinating subagents. + multi_agent: nil, + # A replacement name. Omit to leave unchanged, or pass null to clear it. + name: nil, + # Reasoning configuration for the agent. + reasoning: nil, + # The service tier used for model requests. + service_tier: nil, + # Configuration for text generated by the agent. + text: nil, + # Tools available to the agent. + tools: nil, + request_options: {} + ) + end + + # Lists reusable agents in the current project. See + # [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + sig { + params( + after: String, + limit: T.nilable(Integer), + order: OpenAI::Beta::AgentListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::CursorPage[OpenAI::Beta::Agent]) + } + def list( + # Return resources after this resource ID in the selected order. + after: nil, + # The maximum number of resources to return. + limit: nil, + # The order in which resources are returned. Defaults to `desc`. + order: nil, + request_options: {} + ) + end + + # Deletes a reusable agent. See + # [agent configuration](https://developers.openai.com/api/docs/guides/agents-api/configuration). + sig { + params(agent_id: String, request_options: OpenAI::RequestOptions::OrHash).returns(OpenAI::Beta::AgentDeleted) + } + def delete( + # The ID of the reusable agent. + agent_id, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/environments.rbi b/rbi/openai/resources/beta/agents/environments.rbi new file mode 100644 index 000000000..538ce0e46 --- /dev/null +++ b/rbi/openai/resources/beta/agents/environments.rbi @@ -0,0 +1,44 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Environments + + sig { returns(OpenAI::Resources::Beta::Agents::Environments::Files) } + attr_reader :files + + sig { returns(OpenAI::Resources::Beta::Agents::Environments::Templates) } + attr_reader :templates + + # Retrieves an execution environment's connection status and safe installed + # metadata. See + # [environment lifecycle](https://developers.openai.com/api/docs/guides/agents-api/environments/lifecycle). + sig { + params(environment_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Beta::Agents::EnvironmentInfo + ) + } + def retrieve( + # The ID of the environment. + environment_id, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/environments/files.rbi b/rbi/openai/resources/beta/agents/environments/files.rbi new file mode 100644 index 000000000..3218efbbd --- /dev/null +++ b/rbi/openai/resources/beta/agents/environments/files.rbi @@ -0,0 +1,79 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Environments + + class Files + + # Copies inline bytes or a Files API file into a connected execution environment. + # See + # [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files). + sig { + params( + environment_id: String, + hosted_environment_file_param: T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID::OrHash, + OpenAI::Beta::HostedEnvironmentFileParam::Inline::OrHash + ), + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Beta::Agents::Environments::EnvironmentFile) + } + def create( + # The ID of the environment. + environment_id, + # A file materialized in an OpenAI-hosted execution environment. + hosted_environment_file_param:, + request_options: {} + ) + end + + # Lists live files on a connected execution environment with optional directory + # filtering and opaque cursor pagination. See + # [environment files](https://developers.openai.com/api/docs/guides/agents-api/environments/files). + sig { + params( + environment_id: String, + limit: T.nilable(Integer), + order: OpenAI::Beta::Agents::Environments::FileListParams::Order::OrSymbol, + page: String, + path: T.nilable(String), + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::TokenPage[OpenAI::Beta::Agents::Environments::EnvironmentFile]) + } + def list( + # The ID of the environment. + environment_id, + # The maximum number of files to return, between 1 and 100. + limit: nil, + # Sort by case-sensitive path components. Defaults to descending. + order: nil, + # The opaque token from the previous page. Keep the same path, order, and limit. + page: nil, + # Restrict the listing to this absolute workspace directory. + path: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/environments/templates.rbi b/rbi/openai/resources/beta/agents/environments/templates.rbi new file mode 100644 index 000000000..c411a5a76 --- /dev/null +++ b/rbi/openai/resources/beta/agents/environments/templates.rbi @@ -0,0 +1,194 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Environments + + class Templates + + # Creates reusable environment configuration without returning confidential setup + # commands or environment values. See + # [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + sig { + params( + capability_directories: T.nilable(T::Array[String]), + env: T.nilable(T::Hash[Symbol, String]), + files: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID::OrHash, + OpenAI::Beta::HostedEnvironmentFileParam::Inline::OrHash + ) + ] + ), + name: T.nilable(String), + network: T.nilable(OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network::OrHash), + packages: T.nilable(OpenAI::Beta::Agents::Environments::TemplateCreateParams::Packages::OrHash), + plugins: T.nilable(T::Array[OpenAI::Beta::HostedPluginParam::OrHash]), + setup_commands: T.nilable(T::Array[OpenAI::Beta::SetupCommandParam::OrHash]), + skills: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedSkillParam::SkillReference::OrHash, + OpenAI::Beta::HostedSkillParam::Inline::OrHash + ) + ] + ), + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Beta::Agents::Environments::EnvironmentTemplate) + } + def create( + # Directories that contain capabilities exposed to the agent. Defaults to an empty + # list. + capability_directories: nil, + # Environment variables made available to the agent. + env: nil, + # Files available before the agent starts. Defaults to an empty list. + files: nil, + # An optional human-readable display name for the template. + name: nil, + # Network access for an OpenAI-hosted environment. + network: nil, + # Packages to install in an OpenAI-hosted environment. + packages: nil, + # Plugins provided as inline ZIP archives. Defaults to an empty list. + plugins: nil, + # Ordered, confidential setup commands. Command bodies are never returned. + setup_commands: nil, + # Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty + # list. + skills: nil, + request_options: {} + ) + end + + # Retrieves reusable environment configuration without returning confidential + # values. See + # [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + sig { + params(environment_template_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Beta::Agents::Environments::EnvironmentTemplate + ) + } + def retrieve( + # The ID of the reusable environment template. + environment_template_id, + request_options: {} + ) + end + + # Updates reusable environment configuration without returning confidential + # values. See + # [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + sig { + params( + environment_template_id: String, + capability_directories: T.nilable(T::Array[String]), + env: T.nilable(T::Hash[Symbol, String]), + files: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedEnvironmentFileParam::FileID::OrHash, + OpenAI::Beta::HostedEnvironmentFileParam::Inline::OrHash + ) + ] + ), + name: T.nilable(String), + network: T.nilable(OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network::OrHash), + packages: T.nilable(OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Packages::OrHash), + plugins: T.nilable(T::Array[OpenAI::Beta::HostedPluginParam::OrHash]), + setup_commands: T.nilable(T::Array[OpenAI::Beta::SetupCommandParam::OrHash]), + skills: T.nilable( + T::Array[ + T.any( + OpenAI::Beta::HostedSkillParam::SkillReference::OrHash, + OpenAI::Beta::HostedSkillParam::Inline::OrHash + ) + ] + ), + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Beta::Agents::Environments::EnvironmentTemplate) + } + def update( + # The ID of the reusable environment template. + environment_template_id, + # Directories that expose capabilities to the agent. + capability_directories: nil, + # Replacement confidential environment values. + env: nil, + # Replacement file configuration materialized for each new session. + files: nil, + # A replacement human-readable display name, or `null` to clear the name. + name: nil, + # Network access for an OpenAI-hosted environment. + network: nil, + # Packages to install in an OpenAI-hosted environment. + packages: nil, + # Replacement plugin configuration installed for each new session. + plugins: nil, + # Replacement confidential setup commands, never included in returned resources. + setup_commands: nil, + # Replacement skill configuration installed for each new session. + skills: nil, + request_options: {} + ) + end + + # Lists reusable environment templates without returning confidential values. See + # [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + sig { + params( + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Environments::TemplateListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::CursorPage[OpenAI::Beta::Agents::Environments::EnvironmentTemplate]) + } + def list( + # Return resources after this resource ID in the selected order. + after: nil, + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + limit: nil, + # The order in which resources are returned. Defaults to `desc`. + order: nil, + request_options: {} + ) + end + + # Deletes reusable environment configuration and all confidential template inputs. + # See + # [reusing a hosted setup](https://developers.openai.com/api/docs/guides/agents-api/tools#reuse-a-hosted-plugin-setup). + sig { + params(environment_template_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Beta::Agents::Environments::EnvironmentTemplateDeleted + ) + } + def delete( + # The ID of the reusable environment template. + environment_template_id, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/sessions.rbi b/rbi/openai/resources/beta/agents/sessions.rbi new file mode 100644 index 000000000..0ac7036b7 --- /dev/null +++ b/rbi/openai/resources/beta/agents/sessions.rbi @@ -0,0 +1,208 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Sessions + + sig { returns(OpenAI::Resources::Beta::Agents::Sessions::Subagents) } + attr_reader :subagents + + sig { returns(OpenAI::Resources::Beta::Agents::Sessions::Artifacts) } + attr_reader :artifacts + + sig { returns(OpenAI::Resources::Beta::Agents::Sessions::Items) } + attr_reader :items + + sig { returns(OpenAI::Resources::Beta::Agents::Sessions::Events) } + attr_reader :events + + sig { returns(OpenAI::Resources::Beta::Agents::Sessions::Turns) } + attr_reader :turns + + # See {OpenAI::Resources::Beta::Agents::Sessions#create_streaming} for streaming + # counterpart. + # + # Creates a managed agent session, optionally submits initial input, and returns + # the session or streams its events when stream is true. See + # [running sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions). + sig { + params( + environment: T.any( + OpenAI::Beta::EnvironmentParam::None::OrHash, + OpenAI::Beta::EnvironmentParam::OpenAIHosted::OrHash, + OpenAI::Beta::EnvironmentParam::SelfHosted::OrHash + ), + agent: OpenAI::Beta::Agents::SessionCreateParams::Agent::OrHash, + agent_id: String, + input: T.nilable(OpenAI::Beta::Agents::SessionCreateParams::Input::Variants), + metadata: T.nilable(T::Hash[Symbol, String]), + vault_ids: T.nilable(T::Array[String]), + stream: T.noreturn, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Beta::AgentSession) + } + def create( + # An inline execution environment or a reference to an environment template. + environment:, + # Agent configuration. With `agent_id`, supplied fields override the saved agent + # for this session. Without `agent_id`, `model` is required. + agent: nil, + # The ID of a saved reusable agent. Omit `agent` to use its configuration + # unchanged. + agent_id: nil, + # Initial input submitted when creating a session. + input: nil, + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + metadata: nil, + # The IDs of vaults made available to the session. + vault_ids: nil, + # There is no need to provide `stream:`. Instead, use `#create_streaming` or + # `#create` for streaming and non-streaming use cases, respectively. + stream: false, + request_options: {} + ) + end + + # See {OpenAI::Resources::Beta::Agents::Sessions#create} for non-streaming + # counterpart. + # + # Creates a managed agent session, optionally submits initial input, and returns + # the session or streams its events when stream is true. See + # [running sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions). + sig { + params( + environment: T.any( + OpenAI::Beta::EnvironmentParam::None::OrHash, + OpenAI::Beta::EnvironmentParam::OpenAIHosted::OrHash, + OpenAI::Beta::EnvironmentParam::SelfHosted::OrHash + ), + agent: OpenAI::Beta::Agents::SessionCreateParams::Agent::OrHash, + agent_id: String, + input: T.nilable(OpenAI::Beta::Agents::SessionCreateParams::Input::Variants), + metadata: T.nilable(T::Hash[Symbol, String]), + vault_ids: T.nilable(T::Array[String]), + stream: T.noreturn, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::Stream[OpenAI::Beta::AgentSessionEvent::Variants]) + } + def create_streaming( + # An inline execution environment or a reference to an environment template. + environment:, + # Agent configuration. With `agent_id`, supplied fields override the saved agent + # for this session. Without `agent_id`, `model` is required. + agent: nil, + # The ID of a saved reusable agent. Omit `agent` to use its configuration + # unchanged. + agent_id: nil, + # Initial input submitted when creating a session. + input: nil, + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. Omission or null defaults to an empty map. + metadata: nil, + # The IDs of vaults made available to the session. + vault_ids: nil, + # There is no need to provide `stream:`. Instead, use `#create_streaming` or + # `#create` for streaming and non-streaming use cases, respectively. + stream: true, + request_options: {} + ) + end + + # Retrieves the current state of a managed agent session. See + # [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + sig { + params(session_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Beta::AgentSession + ) + } + def retrieve( + # The ID of the session. + session_id, + request_options: {} + ) + end + + # Updates session metadata. Omitted fields are unchanged. See + # [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + sig { + params( + session_id: String, + metadata: T.nilable(T::Hash[Symbol, String]), + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Beta::AgentSession) + } + def update( + # The ID of the session. + session_id, + # Replaces all metadata. Omit to leave unchanged, or pass null or {} to clear it. + # Up to 16 string key-value pairs, with keys up to 64 and values up to 512 + # characters. + metadata: nil, + request_options: {} + ) + end + + # Lists managed agent sessions using ID-based pagination and the requested sort + # order. See + # [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + sig { + params( + after: String, + agent_id: String, + limit: T.nilable(Integer), + order: OpenAI::Beta::Agents::SessionListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::CursorPage[OpenAI::Beta::AgentSession]) + } + def list( + # Return resources after this resource ID in the selected order. + after: nil, + # Only return sessions whose root agent has this ID. Omit to return sessions for + # all agents. + agent_id: nil, + # The maximum number of resources to return. + limit: nil, + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + order: nil, + request_options: {} + ) + end + + # Removes a managed agent session from the public API and returns a deletion + # confirmation. Physical cleanup may continue asynchronously. See + # [managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage). + sig { + params(session_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Beta::AgentSessionDeleted + ) + } + def delete( + # The ID of the session. + session_id, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/sessions/artifacts.rbi b/rbi/openai/resources/beta/agents/sessions/artifacts.rbi new file mode 100644 index 000000000..1b7d865e5 --- /dev/null +++ b/rbi/openai/resources/beta/agents/sessions/artifacts.rbi @@ -0,0 +1,105 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Sessions + + class Artifacts + + # Retrieves immutable metadata for one durable session artifact. See + # [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + sig { + params(artifact_id: String, session_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Beta::Agents::Sessions::SessionArtifact + ) + } + def retrieve( + # The immutable session artifact ID. + artifact_id, + # The ID of the session that owns the artifact. + session_id:, + request_options: {} + ) + end + + # Lists immutable artifacts published by completed hosted session turns. See + # [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + sig { + params( + session_id: String, + after: T.nilable(String), + environment_id: T.nilable(String), + limit: T.nilable(Integer), + order: OpenAI::Beta::Agents::Sessions::ArtifactListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::CursorPage[OpenAI::Beta::Agents::Sessions::SessionArtifact]) + } + def list( + # The ID of the session. + session_id, + # Return artifacts after this immutable artifact ID. + after: nil, + # Restrict the listing to artifacts produced by this environment. + environment_id: nil, + # The maximum number of artifacts to return, between 1 and 100. + limit: nil, + # Sort by creation time and ID. Defaults to descending. + order: nil, + request_options: {} + ) + end + + # Deletes an immutable session artifact without deleting its live environment file + # or original Files API object. See + # [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + sig { + params(artifact_id: String, session_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Beta::Agents::Sessions::SessionArtifactDeleted + ) + } + def delete( + # The immutable session artifact ID. + artifact_id, + # The ID of the session that owns the artifact. + session_id:, + request_options: {} + ) + end + + # Downloads immutable session artifact bytes after the execution environment + # expires. See + # [session artifacts](https://developers.openai.com/api/docs/guides/agents-api/environments/files#openai-hosted-artifacts). + sig { + params(artifact_id: String, session_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + T.all(StringIO, OpenAI::ResponseCarrier) + ) + } + def content( + # The immutable session artifact ID. + artifact_id, + # The ID of the session that owns the artifact. + session_id:, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/sessions/events.rbi b/rbi/openai/resources/beta/agents/sessions/events.rbi new file mode 100644 index 000000000..b7b8ecc55 --- /dev/null +++ b/rbi/openai/resources/beta/agents/sessions/events.rbi @@ -0,0 +1,71 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Sessions + + class Events + + # Submits message, cancellation, or tool-result events to a managed agent session. + # See + # [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events). + sig { + params( + session_id: String, + events: T::Array[ + T.any( + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputMessage::OrHash, + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputCancel::OrHash, + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputToolResult::OrHash + ) + ], + idempotency_key: String, + request_options: OpenAI::RequestOptions::OrHash + ) + .void + } + def create( + # Path param: The ID of the session. + session_id, + # Body param: The input events to submit to the session. + events:, + # Header param: An optional client-generated key that makes retries of submitted + # messages idempotent. + idempotency_key: nil, + request_options: {} + ) + end + + # Streams live events for an agent session. See + # [session events](https://developers.openai.com/api/docs/guides/agents-api/sessions/events). + sig { + params(session_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Internal::Stream[OpenAI::Beta::AgentSessionEvent::Variants] + ) + } + def stream_streaming( + # The ID of the session. + session_id, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/sessions/items.rbi b/rbi/openai/resources/beta/agents/sessions/items.rbi new file mode 100644 index 000000000..f22bd0e6a --- /dev/null +++ b/rbi/openai/resources/beta/agents/sessions/items.rbi @@ -0,0 +1,53 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Sessions + + class Items + + # Lists items produced by the session's root agent, including its interactions + # with subagents. Each subagent has its own item history. See + # [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability). + sig { + params( + session_id: String, + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Sessions::ItemListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::CursorPage[OpenAI::Beta::AgentSessionItem::Variants]) + } + def list( + # The ID of the session. + session_id, + # Return resources after this resource ID in the selected order. + after: nil, + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + limit: nil, + # The order in which resources are returned. Defaults to `desc`. + order: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/sessions/subagents.rbi b/rbi/openai/resources/beta/agents/sessions/subagents.rbi new file mode 100644 index 000000000..a1aa0046d --- /dev/null +++ b/rbi/openai/resources/beta/agents/sessions/subagents.rbi @@ -0,0 +1,74 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Sessions + + class Subagents + + sig { returns(OpenAI::Resources::Beta::Agents::Sessions::Subagents::Items) } + attr_reader :items + + sig { returns(OpenAI::Resources::Beta::Agents::Sessions::Subagents::Turns) } + attr_reader :turns + + # Retrieves a subagent belonging to this session. See + # [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + sig { + params(subagent_id: String, session_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Beta::Subagent + ) + } + def retrieve( + # The ID of the subagent in this session. + subagent_id, + # The ID of the session. + session_id:, + request_options: {} + ) + end + + # Lists subagents in a session, including nested and closed subagents. See + # [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + sig { + params( + session_id: String, + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Sessions::SubagentListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::CursorPage[OpenAI::Beta::Subagent]) + } + def list( + # The ID of the session. + session_id, + # Return resources after this resource ID in the selected order. + after: nil, + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + limit: nil, + # The order in which resources are returned. Defaults to `desc`. + order: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/sessions/subagents/items.rbi b/rbi/openai/resources/beta/agents/sessions/subagents/items.rbi new file mode 100644 index 000000000..a19371419 --- /dev/null +++ b/rbi/openai/resources/beta/agents/sessions/subagents/items.rbi @@ -0,0 +1,60 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Sessions + + class Subagents + + class Items + + # Lists this subagent's own items across all of its turns. See + # [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + sig { + params( + subagent_id: String, + session_id: String, + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Sessions::Subagents::ItemListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::CursorPage[OpenAI::Beta::AgentSessionItem::Variants]) + } + def list( + # Path param: The ID of the subagent in this session. + subagent_id, + # Path param: The ID of the session. + session_id:, + # Query param: Return resources after this resource ID in the selected order. + after: nil, + # Query param: The maximum number of resources to return, between 1 and 100. + # Defaults to 20. + limit: nil, + # Query param: The order in which resources are returned. Defaults to `desc`. + order: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/sessions/subagents/turns.rbi b/rbi/openai/resources/beta/agents/sessions/subagents/turns.rbi new file mode 100644 index 000000000..87aef532f --- /dev/null +++ b/rbi/openai/resources/beta/agents/sessions/subagents/turns.rbi @@ -0,0 +1,85 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Sessions + + class Subagents + + class Turns + + sig { returns(OpenAI::Resources::Beta::Agents::Sessions::Subagents::Turns::Items) } + attr_reader :items + + # Retrieves a turn belonging to this subagent. See + # [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + sig { + params( + turn_id: String, + session_id: String, + subagent_id: String, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Beta::Agents::Sessions::Turn) + } + def retrieve( + # The ID of a turn belonging to this subagent. + turn_id, + # The ID of the session. + session_id:, + # The ID of the subagent in this session. + subagent_id:, + request_options: {} + ) + end + + # Lists all turns of this subagent, including turns after a resume. See + # [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + sig { + params( + subagent_id: String, + session_id: String, + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Sessions::Subagents::TurnListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::CursorPage[OpenAI::Beta::Agents::Sessions::Turn]) + } + def list( + # Path param: The ID of the subagent in this session. + subagent_id, + # Path param: The ID of the session. + session_id:, + # Query param: Return resources after this resource ID in the selected order. + after: nil, + # Query param: The maximum number of resources to return, between 1 and 100. + # Defaults to 20. + limit: nil, + # Query param: The order in which resources are returned. Defaults to `desc`. + order: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/sessions/subagents/turns/items.rbi b/rbi/openai/resources/beta/agents/sessions/subagents/turns/items.rbi new file mode 100644 index 000000000..183f178f9 --- /dev/null +++ b/rbi/openai/resources/beta/agents/sessions/subagents/turns/items.rbi @@ -0,0 +1,67 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Sessions + + class Subagents + + class Turns + + class Items + + # Lists items belonging to one turn of this subagent. See + # [subagent workflows](https://developers.openai.com/api/docs/guides/agents-api/multi-agent). + sig { + params( + turn_id: String, + session_id: String, + subagent_id: String, + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::CursorPage[OpenAI::Beta::AgentSessionItem::Variants]) + } + def list( + # Path param: The ID of a turn belonging to this subagent. + turn_id, + # Path param: The ID of the session. + session_id:, + # Path param: The ID of the subagent in this session. + subagent_id:, + # Query param: Return resources after this resource ID in the selected order. + after: nil, + # Query param: The maximum number of resources to return, between 1 and 100. + # Defaults to 20. + limit: nil, + # Query param: The order in which resources are returned. Defaults to `desc`. + order: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/sessions/turns.rbi b/rbi/openai/resources/beta/agents/sessions/turns.rbi new file mode 100644 index 000000000..f23d3c025 --- /dev/null +++ b/rbi/openai/resources/beta/agents/sessions/turns.rbi @@ -0,0 +1,70 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Sessions + + class Turns + + # Retrieves a turn's current status, timestamps, usage, and error. Returns 404 if + # the turn does not belong to the session. See + # [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns). + sig { + params(turn_id: String, session_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Beta::Agents::Sessions::Turn + ) + } + def retrieve( + # The ID of the turn. + turn_id, + # The ID of the session that owns the turn. + session_id:, + request_options: {} + ) + end + + # Lists turns by creation time and turn ID. The after cursor is exclusive in the + # selected order. See + # [session turns](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage#inspect-session-turns). + sig { + params( + session_id: String, + after: String, + limit: Integer, + order: OpenAI::Beta::Agents::Sessions::TurnListParams::Order::OrSymbol, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::CursorPage[OpenAI::Beta::Agents::Sessions::Turn]) + } + def list( + # The ID of the session. + session_id, + # Return resources after this resource ID in the selected order. + after: nil, + # The maximum number of resources to return, between 1 and 100. Defaults to 20. + limit: nil, + # The order in which resources are returned. Defaults to `desc`. + order: nil, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/vaults.rbi b/rbi/openai/resources/beta/agents/vaults.rbi new file mode 100644 index 000000000..c244ea6fb --- /dev/null +++ b/rbi/openai/resources/beta/agents/vaults.rbi @@ -0,0 +1,106 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Vaults + + sig { returns(OpenAI::Resources::Beta::Agents::Vaults::Credentials) } + attr_reader :credentials + + # Creates a vault for the current project. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + sig { + params( + metadata: T.nilable(T::Hash[Symbol, String]), + name: String, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Beta::Agents::Vault) + } + def create( + # Key-value pairs to associate with the vault, such as an application or team + # identifier. + metadata: nil, + # The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after + # trimming. + name: nil, + request_options: {} + ) + end + + # Retrieves a vault by its ID. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + sig { + params(vault_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Beta::Agents::Vault + ) + } + def retrieve( + # The ID of the vault. + vault_id, + request_options: {} + ) + end + + # Lists vaults using ID-based pagination. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + sig { + params( + after: String, + limit: T.nilable(Integer), + order: OpenAI::Beta::Agents::VaultListParams::Order::OrSymbol, + status: T.any( + OpenAI::Beta::Agents::VaultStatus::OrSymbol, + T::Array[OpenAI::Beta::Agents::VaultStatus::OrSymbol] + ), + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::CursorPage[OpenAI::Beta::Agents::Vault]) + } + def list( + # Return resources after this resource ID in the selected order. + after: nil, + # The maximum number of resources to return. Defaults to 20. Values are clamped + # between 1 and 100. + limit: nil, + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + order: nil, + # Filter by one status or a list, such as `status=active` or + # `status[]=active&status[]=archived`. Both statuses are included by default. + status: nil, + request_options: {} + ) + end + + # Deletes a vault and all its credentials. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + sig { + params(vault_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Beta::Agents::VaultDeleted + ) + } + def delete( + # The ID of the vault. + vault_id, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end +end diff --git a/rbi/openai/resources/beta/agents/vaults/credentials.rbi b/rbi/openai/resources/beta/agents/vaults/credentials.rbi new file mode 100644 index 000000000..d6eb23a83 --- /dev/null +++ b/rbi/openai/resources/beta/agents/vaults/credentials.rbi @@ -0,0 +1,148 @@ +# typed: strong + +module OpenAI + module Resources + + class Beta + + class Agents + + class Vaults + + class Credentials + + # Creates a vault credential. Secret values are write-only and are never returned. + # See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + sig { + params( + vault_id: String, + auth: T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::OrHash, + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::StaticBearer::OrHash + ), + name: String, + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Beta::Agents::Vaults::Credential) + } + def create( + # The ID of the vault. + vault_id, + # The authentication method and secret values to store for the MCP server. + auth:, + # The name is trimmed before storage. It must contain 1 to 256 UTF-8 bytes after + # trimming. + name:, + request_options: {} + ) + end + + # Retrieves vault credential metadata without returning secret values. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + sig { + params(credential_id: String, vault_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Beta::Agents::Vaults::Credential + ) + } + def retrieve( + # The ID of the vault credential. + credential_id, + # The ID of the vault. + vault_id:, + request_options: {} + ) + end + + # Rotates a vault credential's write-only secret and returns only credential + # metadata. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + sig { + params( + credential_id: String, + vault_id: String, + auth: T.any( + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::OrHash, + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::StaticBearer::OrHash + ), + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Beta::Agents::Vaults::Credential) + } + def update( + # Path param: The ID of the vault credential. + credential_id, + # Path param: The ID of the vault. + vault_id:, + # Body param: Replacement values for the credential's existing authentication + # method. + auth:, + request_options: {} + ) + end + + # Lists a vault's credentials using ID-based pagination without returning secret + # values. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + sig { + params( + vault_id: String, + after: String, + limit: T.nilable(Integer), + order: OpenAI::Beta::Agents::Vaults::CredentialListParams::Order::OrSymbol, + status: T.any( + OpenAI::Beta::Agents::VaultStatus::OrSymbol, + T::Array[OpenAI::Beta::Agents::VaultStatus::OrSymbol] + ), + request_options: OpenAI::RequestOptions::OrHash + ) + .returns(OpenAI::Internal::CursorPage[OpenAI::Beta::Agents::Vaults::Credential]) + } + def list( + # The ID of the vault. + vault_id, + # Return resources after this resource ID in the selected order. + after: nil, + # The maximum number of resources to return. Defaults to 20. Values are clamped + # between 1 and 100. + limit: nil, + # Sort order by the `created_at` timestamp. Use `asc` for ascending order or + # `desc` for descending order. Defaults to `desc`. + order: nil, + # Filter by one status or a list, such as `status=active` or + # `status[]=active&status[]=archived`. Both statuses are included by default. + status: nil, + request_options: {} + ) + end + + # Deletes a vault credential. See + # [vaults](https://developers.openai.com/api/docs/guides/agents-api/tools/vaults). + sig { + params(credential_id: String, vault_id: String, request_options: OpenAI::RequestOptions::OrHash).returns( + OpenAI::Beta::Agents::Vaults::CredentialDeleted + ) + } + def delete( + # The ID of the vault credential. + credential_id, + # The ID of the vault. + vault_id:, + request_options: {} + ) + end + + # @api private + sig { params(client: OpenAI::Client).returns(T.attached_class) } + def self.new(client:) + end + end + + end + + end + + end + + end +end diff --git a/rbi/openai/resources/live/sessions.rbi b/rbi/openai/resources/live/sessions.rbi index 3663ecc61..32bb727e9 100644 --- a/rbi/openai/resources/live/sessions.rbi +++ b/rbi/openai/resources/live/sessions.rbi @@ -7,7 +7,11 @@ module OpenAI class Sessions - # Accept an incoming SIP call with Live startup configuration. + # Accept an incoming SIP call. Supply session with type live, the model, and + # startup configuration. Before accepting calls, follow the + # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting) + # to write frontend conversation instructions and a separate backend prompt. SIP + # media format is negotiated; omit audio.format. sig { params( session_id: String, @@ -63,7 +67,7 @@ module OpenAI ) end - # Hang up a Live session. + # End a SIP call identified by session_id. sig { params(session_id: String, request_options: OpenAI::RequestOptions::OrHash).void } def hangup( # Opaque Live session identifier from the creation response or incoming-call @@ -73,7 +77,8 @@ module OpenAI ) end - # Transfer a Live SIP call to another destination. + # Transfer a SIP call to another destination. Supply a nonblank target_uri for the + # SIP Refer-To header. sig { params(session_id: String, target_uri: String, request_options: OpenAI::RequestOptions::OrHash).void } def refer( # Opaque Live session identifier from the creation response or incoming-call @@ -86,7 +91,8 @@ module OpenAI ) end - # Reject an incoming SIP call. + # Reject an incoming SIP call. Send a required SIP rejection status_code between + # 300 and 699. sig { params(session_id: String, status_code: Integer, request_options: OpenAI::RequestOptions::OrHash).void } def reject( # Opaque Live session identifier from the creation response or incoming-call diff --git a/rbi/openai/resources/responses.rbi b/rbi/openai/resources/responses.rbi index b18daeac7..7cc29d83b 100644 --- a/rbi/openai/resources/responses.rbi +++ b/rbi/openai/resources/responses.rbi @@ -630,15 +630,15 @@ module OpenAI # See {OpenAI::Resources::Responses#create} for non-streaming counterpart. # # Creates a model response. Provide - # [text](https://platform.openai.com/docs/guides/text) or - # [image](https://platform.openai.com/docs/guides/images) inputs to generate - # [text](https://platform.openai.com/docs/guides/text) or - # [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have + # [text](https://developers.openai.com/api/docs/guides/text) or + # [image](https://developers.openai.com/api/docs/guides/images-vision) inputs to generate + # [text](https://developers.openai.com/api/docs/guides/text) or + # [JSON](https://developers.openai.com/api/docs/guides/structured-outputs) outputs. Have # the model call your own - # [custom code](https://platform.openai.com/docs/guides/function-calling) or use - # built-in [tools](https://platform.openai.com/docs/guides/tools) like - # [web search](https://platform.openai.com/docs/guides/tools-web-search) or - # [file search](https://platform.openai.com/docs/guides/tools-file-search) to use + # [custom code](https://developers.openai.com/api/docs/guides/function-calling) or use + # built-in [tools](https://developers.openai.com/api/docs/guides/tools) like + # [web search](https://developers.openai.com/api/docs/guides/tools-web-search) or + # [file search](https://developers.openai.com/api/docs/guides/tools-file-search) to use # your own data as input for the model's response. sig do params( diff --git a/scripts/castiron/test_custom_code_report.py b/scripts/castiron/test_custom_code_report.py index 98ee110f1..766e1dee5 100644 --- a/scripts/castiron/test_custom_code_report.py +++ b/scripts/castiron/test_custom_code_report.py @@ -11,9 +11,9 @@ import tempfile import textwrap import unittest +import unittest.mock as mock from pathlib import Path from typing import Any -from unittest import mock import custom_code_report as report diff --git a/sig/openai/helpers/agents.rbs b/sig/openai/helpers/agents.rbs new file mode 100644 index 000000000..bc0899997 --- /dev/null +++ b/sig/openai/helpers/agents.rbs @@ -0,0 +1,50 @@ +module OpenAI + module Helpers + module Agents + type tool_output = + String + | Hash[String | Symbol, untyped] + | Array[OpenAI::Models::Beta::input_content_param + | Hash[Symbol, untyped]] + | nil + type tool_handler = ^(Hash[String, untyped]) -> tool_output + class SessionStream + include Enumerable[OpenAI::Models::Beta::agent_session_event] + + def each: + { (OpenAI::Models::Beta::agent_session_event) -> void } -> self + | -> Enumerator[OpenAI::Models::Beta::agent_session_event, self] + def close: -> void + def until_done: -> self + end + end + end + module Resources + class Beta + class Agents + class Sessions + def stream: ( + String session_id, + input: String + | Array[OpenAI::Beta::AgentSessionInputMessageParam + | Hash[Symbol, untyped]], + ?tool_handlers: Hash[String, OpenAI::Helpers::Agents::tool_handler], + ?idempotency_key: String?, + ?request_options: OpenAI::RequestOptions + | Hash[Symbol, untyped] + | nil + ) ?{ + (OpenAI::Helpers::Agents::SessionStream) -> void + } -> OpenAI::Helpers::Agents::SessionStream + end + end + end + end + module Models + module Beta + class AgentSessionMessage + def output_text: -> String + end + end + end +end diff --git a/sig/openai/internal/token_page.rbs b/sig/openai/internal/token_page.rbs new file mode 100644 index 000000000..0e17c8cb9 --- /dev/null +++ b/sig/openai/internal/token_page.rbs @@ -0,0 +1,15 @@ +module OpenAI + module Internal + class TokenPage[Elem] + include OpenAI::Internal::Type::BasePage[Elem] + + attr_accessor data: ::Array[Elem]? + + attr_accessor has_more: bool + + attr_accessor next_: String? + + def inspect: -> String + end + end +end diff --git a/sig/openai/models/beta/agent.rbs b/sig/openai/models/beta/agent.rbs new file mode 100644 index 000000000..49d24ab0c --- /dev/null +++ b/sig/openai/models/beta/agent.rbs @@ -0,0 +1,96 @@ +module OpenAI + module Models + module Beta + type agent = + { + id: String, + created_at: Integer, + instructions: String?, + metadata: ::Hash[Symbol, String], + model: String, + multi_agent: OpenAI::Beta::MultiAgentConfig, + name: String?, + ?object: :agent, + reasoning: OpenAI::Beta::AgentReasoning, + service_tier: OpenAI::Models::Beta::Agent::service_tier, + text: OpenAI::Beta::AgentText, + tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool], + updated_at: Integer + } + + class Agent < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created_at: Integer + + attr_accessor instructions: String? + + attr_accessor metadata: ::Hash[Symbol, String] + + attr_accessor model: String + + attr_accessor multi_agent: OpenAI::Beta::MultiAgentConfig + + attr_accessor name: String? + + attr_accessor object: :agent + + attr_accessor reasoning: OpenAI::Beta::AgentReasoning + + attr_accessor service_tier: OpenAI::Models::Beta::Agent::service_tier + + attr_accessor text: OpenAI::Beta::AgentText + + attr_accessor tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool] + + attr_accessor updated_at: Integer + + def initialize: ( + id: String, + created_at: Integer, + instructions: String?, + metadata: ::Hash[Symbol, String], + model: String, + multi_agent: OpenAI::Beta::MultiAgentConfig, + name: String?, + reasoning: OpenAI::Beta::AgentReasoning, + service_tier: OpenAI::Models::Beta::Agent::service_tier, + text: OpenAI::Beta::AgentText, + tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool], + updated_at: Integer, + ?object: :agent + ) -> void + + def to_hash: -> { + id: String, + created_at: Integer, + instructions: String?, + metadata: ::Hash[Symbol, String], + model: String, + multi_agent: OpenAI::Beta::MultiAgentConfig, + name: String?, + ?object: :agent, + reasoning: OpenAI::Beta::AgentReasoning, + service_tier: OpenAI::Models::Beta::Agent::service_tier, + text: OpenAI::Beta::AgentText, + tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool], + updated_at: Integer + } + + type service_tier = :auto | :default | :flex | :priority | :fast + + module ServiceTier + extend OpenAI::Internal::Type::Enum + + AUTO: :auto + DEFAULT: :default + FLEX: :flex + PRIORITY: :priority + FAST: :fast + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agent::service_tier] + end + end + end + end +end diff --git a/sig/openai/models/beta/agent_close_subagent_call_item.rbs b/sig/openai/models/beta/agent_close_subagent_call_item.rbs new file mode 100644 index 000000000..b5e723f5d --- /dev/null +++ b/sig/openai/models/beta/agent_close_subagent_call_item.rbs @@ -0,0 +1,47 @@ +module OpenAI + module Models + module Beta + type agent_close_subagent_call_item = + { + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :close_subagent_call + } + + class AgentCloseSubagentCallItem < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor recipient_agent_id: String + + attr_accessor sender_agent_id: String + + attr_accessor status: OpenAI::Models::Beta::agent_function_call_status + + attr_accessor turn_id: String + + attr_accessor type: :close_subagent_call + + def initialize: ( + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :close_subagent_call + ) -> void + + def to_hash: -> { + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :close_subagent_call + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_command_execution_item.rbs b/sig/openai/models/beta/agent_command_execution_item.rbs new file mode 100644 index 000000000..8911d8de2 --- /dev/null +++ b/sig/openai/models/beta/agent_command_execution_item.rbs @@ -0,0 +1,62 @@ +module OpenAI + module Models + module Beta + type agent_command_execution_item = + { + id: String, + command: String, + cwd: String?, + duration_ms: Integer?, + exit_code: Integer?, + output: String?, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :command_execution + } + + class AgentCommandExecutionItem < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor command: String + + attr_accessor cwd: String? + + attr_accessor duration_ms: Integer? + + attr_accessor exit_code: Integer? + + attr_accessor output: String? + + attr_accessor status: OpenAI::Models::Beta::agent_function_call_status + + attr_accessor turn_id: String + + attr_accessor type: :command_execution + + def initialize: ( + id: String, + command: String, + cwd: String?, + duration_ms: Integer?, + exit_code: Integer?, + output: String?, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :command_execution + ) -> void + + def to_hash: -> { + id: String, + command: String, + cwd: String?, + duration_ms: Integer?, + exit_code: Integer?, + output: String?, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :command_execution + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_content.rbs b/sig/openai/models/beta/agent_content.rbs new file mode 100644 index 000000000..dbcec909a --- /dev/null +++ b/sig/openai/models/beta/agent_content.rbs @@ -0,0 +1,33 @@ +module OpenAI + module Models + module Beta + type agent_content = + OpenAI::Beta::OutputText | OpenAI::Beta::AgentContent::EncryptedContent + + module AgentContent + extend OpenAI::Internal::Type::Union + + type encrypted_content = + { encrypted_content: String, ?type: :encrypted_content } + + class EncryptedContent < OpenAI::Internal::Type::BaseModel + attr_accessor encrypted_content: String + + attr_accessor type: :encrypted_content + + def initialize: ( + encrypted_content: String, + ?type: :encrypted_content + ) -> void + + def to_hash: -> { + encrypted_content: String, + ?type: :encrypted_content + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::agent_content] + end + end + end +end diff --git a/sig/openai/models/beta/agent_create_params.rbs b/sig/openai/models/beta/agent_create_params.rbs new file mode 100644 index 000000000..3bea15f50 --- /dev/null +++ b/sig/openai/models/beta/agent_create_params.rbs @@ -0,0 +1,91 @@ +module OpenAI + module Models + module Beta + type agent_create_params = + { + model: String, + ?instructions: String?, + ?metadata: ::Hash[Symbol, String]?, + ?multi_agent: OpenAI::Beta::MultiAgentConfigParam?, + ?name: String?, + ?reasoning: OpenAI::Beta::AgentReasoningParam?, + ?service_tier: OpenAI::Models::Beta::AgentCreateParams::service_tier?, + ?text: OpenAI::Beta::AgentTextParam?, + ?tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool_param]?, + ?request_options: OpenAI::request_opts + } + + class AgentCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor model: String + + attr_accessor instructions: String? + + attr_accessor metadata: ::Hash[Symbol, String]? + + attr_accessor multi_agent: OpenAI::Beta::MultiAgentConfigParam? + + attr_accessor name: String? + + attr_accessor reasoning: OpenAI::Beta::AgentReasoningParam? + + attr_accessor service_tier: OpenAI::Models::Beta::AgentCreateParams::service_tier? + + attr_accessor text: OpenAI::Beta::AgentTextParam? + + attr_accessor tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool_param]? + + def initialize: ( + model: String, + ?instructions: String?, + ?metadata: ::Hash[Symbol, String]?, + ?multi_agent: OpenAI::Beta::MultiAgentConfigParam?, + ?name: String?, + ?reasoning: OpenAI::Beta::AgentReasoningParam?, + ?service_tier: OpenAI::Models::Beta::AgentCreateParams::service_tier?, + ?text: OpenAI::Beta::AgentTextParam?, + ?tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool_param]?, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + model: String, + ?instructions: String?, + ?metadata: ::Hash[Symbol, String]?, + ?multi_agent: OpenAI::Beta::MultiAgentConfigParam?, + ?name: String?, + ?reasoning: OpenAI::Beta::AgentReasoningParam?, + ?service_tier: OpenAI::Models::Beta::AgentCreateParams::service_tier?, + ?text: OpenAI::Beta::AgentTextParam?, + ?tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool_param]?, + ?request_options: OpenAI::RequestOptions + } + + type service_tier = :auto | :default | :flex | :priority | :fast + + module ServiceTier + extend OpenAI::Internal::Type::Enum + + # Selects the service tier automatically. + AUTO: :auto + + # Uses the default service tier. + DEFAULT: :default + + # Uses the flex service tier. + FLEX: :flex + + # Uses the priority service tier. + PRIORITY: :priority + + # Uses the fast service tier. + FAST: :fast + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentCreateParams::service_tier] + end + end + end + end +end diff --git a/sig/openai/models/beta/agent_create_subagent_call_item.rbs b/sig/openai/models/beta/agent_create_subagent_call_item.rbs new file mode 100644 index 000000000..363e8d0c2 --- /dev/null +++ b/sig/openai/models/beta/agent_create_subagent_call_item.rbs @@ -0,0 +1,57 @@ +module OpenAI + module Models + module Beta + type agent_create_subagent_call_item = + { + id: String, + agent_id: String, + content: ::Array[OpenAI::Models::Beta::agent_content], + model: String?, + reasoning_effort: String?, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :create_subagent_call + } + + class AgentCreateSubagentCallItem < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor agent_id: String + + attr_accessor content: ::Array[OpenAI::Models::Beta::agent_content] + + attr_accessor model: String? + + attr_accessor reasoning_effort: String? + + attr_accessor status: OpenAI::Models::Beta::agent_function_call_status + + attr_accessor turn_id: String + + attr_accessor type: :create_subagent_call + + def initialize: ( + id: String, + agent_id: String, + content: ::Array[OpenAI::Models::Beta::agent_content], + model: String?, + reasoning_effort: String?, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :create_subagent_call + ) -> void + + def to_hash: -> { + id: String, + agent_id: String, + content: ::Array[OpenAI::Models::Beta::agent_content], + model: String?, + reasoning_effort: String?, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :create_subagent_call + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_delete_params.rbs b/sig/openai/models/beta/agent_delete_params.rbs new file mode 100644 index 000000000..9804a5d1d --- /dev/null +++ b/sig/openai/models/beta/agent_delete_params.rbs @@ -0,0 +1,25 @@ +module OpenAI + module Models + module Beta + type agent_delete_params = + { agent_id: String, ?request_options: OpenAI::request_opts } + + class AgentDeleteParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor agent_id: String + + def initialize: ( + agent_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + agent_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_deleted.rbs b/sig/openai/models/beta/agent_deleted.rbs new file mode 100644 index 000000000..dddf64740 --- /dev/null +++ b/sig/openai/models/beta/agent_deleted.rbs @@ -0,0 +1,24 @@ +module OpenAI + module Models + module Beta + type agent_deleted = + { id: String, deleted: bool, ?object: :"agent.deleted" } + + class AgentDeleted < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor deleted: bool + + attr_accessor object: :"agent.deleted" + + def initialize: ( + id: String, + deleted: bool, + ?object: :"agent.deleted" + ) -> void + + def to_hash: -> { id: String, deleted: bool, ?object: :"agent.deleted" } + end + end + end +end diff --git a/sig/openai/models/beta/agent_function_call_item.rbs b/sig/openai/models/beta/agent_function_call_item.rbs new file mode 100644 index 000000000..33a66c29d --- /dev/null +++ b/sig/openai/models/beta/agent_function_call_item.rbs @@ -0,0 +1,52 @@ +module OpenAI + module Models + module Beta + type agent_function_call_item = + { + id: String, + arguments: top, + call_id: String, + name: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :function_call + } + + class AgentFunctionCallItem < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor arguments: top + + attr_accessor call_id: String + + attr_accessor name: String + + attr_accessor status: OpenAI::Models::Beta::agent_function_call_status + + attr_accessor turn_id: String + + attr_accessor type: :function_call + + def initialize: ( + id: String, + arguments: top, + call_id: String, + name: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :function_call + ) -> void + + def to_hash: -> { + id: String, + arguments: top, + call_id: String, + name: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :function_call + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_function_call_output.rbs b/sig/openai/models/beta/agent_function_call_output.rbs new file mode 100644 index 000000000..fb61cf97d --- /dev/null +++ b/sig/openai/models/beta/agent_function_call_output.rbs @@ -0,0 +1,16 @@ +module OpenAI + module Models + module Beta + type agent_function_call_output = + String | ::Array[OpenAI::Models::Beta::input_content] + + module AgentFunctionCallOutput + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Beta::agent_function_call_output] + + InputContentArray: OpenAI::Internal::Type::Converter + end + end + end +end diff --git a/sig/openai/models/beta/agent_function_call_output_param.rbs b/sig/openai/models/beta/agent_function_call_output_param.rbs new file mode 100644 index 000000000..5f89cd8f7 --- /dev/null +++ b/sig/openai/models/beta/agent_function_call_output_param.rbs @@ -0,0 +1,16 @@ +module OpenAI + module Models + module Beta + type agent_function_call_output_param = + String | ::Array[OpenAI::Models::Beta::input_content_param] + + module AgentFunctionCallOutputParam + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Beta::agent_function_call_output_param] + + InputContentParamArray: OpenAI::Internal::Type::Converter + end + end + end +end diff --git a/sig/openai/models/beta/agent_function_call_status.rbs b/sig/openai/models/beta/agent_function_call_status.rbs new file mode 100644 index 000000000..aac9e3f8a --- /dev/null +++ b/sig/openai/models/beta/agent_function_call_status.rbs @@ -0,0 +1,26 @@ +module OpenAI + module Models + module Beta + type agent_function_call_status = + :in_progress | :completed | :failed | :incomplete + + module AgentFunctionCallStatus + extend OpenAI::Internal::Type::Enum + + # The call is in progress. + IN_PROGRESS: :in_progress + + # The call completed successfully. + COMPLETED: :completed + + # The call failed. + FAILED: :failed + + # The call stopped before completing. + INCOMPLETE: :incomplete + + def self?.values: -> ::Array[OpenAI::Models::Beta::agent_function_call_status] + end + end + end +end diff --git a/sig/openai/models/beta/agent_interrupt_subagent_call_item.rbs b/sig/openai/models/beta/agent_interrupt_subagent_call_item.rbs new file mode 100644 index 000000000..5a53fb770 --- /dev/null +++ b/sig/openai/models/beta/agent_interrupt_subagent_call_item.rbs @@ -0,0 +1,47 @@ +module OpenAI + module Models + module Beta + type agent_interrupt_subagent_call_item = + { + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :interrupt_subagent_call + } + + class AgentInterruptSubagentCallItem < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor recipient_agent_id: String + + attr_accessor sender_agent_id: String + + attr_accessor status: OpenAI::Models::Beta::agent_function_call_status + + attr_accessor turn_id: String + + attr_accessor type: :interrupt_subagent_call + + def initialize: ( + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :interrupt_subagent_call + ) -> void + + def to_hash: -> { + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :interrupt_subagent_call + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_list_params.rbs b/sig/openai/models/beta/agent_list_params.rbs new file mode 100644 index 000000000..bd813d5e8 --- /dev/null +++ b/sig/openai/models/beta/agent_list_params.rbs @@ -0,0 +1,58 @@ +module OpenAI + module Models + module Beta + type agent_list_params = + { + ?after: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::AgentListParams::order, + ?request_options: OpenAI::request_opts + } + + class AgentListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_reader after: String? + + def after=: (String) -> String + + attr_accessor limit: Integer? + + attr_reader order: OpenAI::Models::Beta::AgentListParams::order? + + def order=: ( + OpenAI::Models::Beta::AgentListParams::order + ) -> OpenAI::Models::Beta::AgentListParams::order + + def initialize: ( + ?after: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::AgentListParams::order, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + ?after: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::AgentListParams::order, + ?request_options: OpenAI::RequestOptions + } + + type order = :asc | :desc + + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC: :asc + + # Returns resources in descending order. + DESC: :desc + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentListParams::order] + end + end + end + end +end diff --git a/sig/openai/models/beta/agent_mcp_call_item.rbs b/sig/openai/models/beta/agent_mcp_call_item.rbs new file mode 100644 index 000000000..95f76df73 --- /dev/null +++ b/sig/openai/models/beta/agent_mcp_call_item.rbs @@ -0,0 +1,62 @@ +module OpenAI + module Models + module Beta + type agent_mcp_call_item = + { + id: String, + arguments: top, + error: top, + name: String, + output: top, + server_label: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :mcp_call + } + + class AgentMcpCallItem < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor arguments: top + + attr_accessor error: top + + attr_accessor name: String + + attr_accessor output: top + + attr_accessor server_label: String + + attr_accessor status: OpenAI::Models::Beta::agent_function_call_status + + attr_accessor turn_id: String + + attr_accessor type: :mcp_call + + def initialize: ( + id: String, + arguments: top, + error: top, + name: String, + output: top, + server_label: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :mcp_call + ) -> void + + def to_hash: -> { + id: String, + arguments: top, + error: top, + name: String, + output: top, + server_label: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :mcp_call + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_output_command_execution_output_delta_event.rbs b/sig/openai/models/beta/agent_output_command_execution_output_delta_event.rbs new file mode 100644 index 000000000..c7f4419b6 --- /dev/null +++ b/sig/openai/models/beta/agent_output_command_execution_output_delta_event.rbs @@ -0,0 +1,52 @@ +module OpenAI + module Models + module Beta + type agent_output_command_execution_output_delta_event = + { + delta: String, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + turn_id: String?, + ?type: :"agent.output.command_execution_output.delta" + } + + class AgentOutputCommandExecutionOutputDeltaEvent < OpenAI::Internal::Type::BaseModel + attr_accessor delta: String + + attr_accessor event_id: String + + attr_accessor item_id: String + + attr_accessor output_index: Integer + + attr_accessor session_id: String + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.output.command_execution_output.delta" + + def initialize: ( + delta: String, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + turn_id: String?, + ?type: :"agent.output.command_execution_output.delta" + ) -> void + + def to_hash: -> { + delta: String, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + turn_id: String?, + ?type: :"agent.output.command_execution_output.delta" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_output_item.rbs b/sig/openai/models/beta/agent_output_item.rbs new file mode 100644 index 000000000..49e91d0c1 --- /dev/null +++ b/sig/openai/models/beta/agent_output_item.rbs @@ -0,0 +1,25 @@ +module OpenAI + module Models + module Beta + type agent_output_item = + OpenAI::Beta::AgentSessionAssistantMessage + | OpenAI::Beta::AgentReasoningItem + | OpenAI::Beta::AgentFunctionCallItem + | OpenAI::Beta::AgentMcpCallItem + | OpenAI::Beta::AgentWebSearchCallItem + | OpenAI::Beta::AgentCommandExecutionItem + | OpenAI::Beta::AgentCreateSubagentCallItem + | OpenAI::Beta::AgentSendSubagentInputCallItem + | OpenAI::Beta::AgentResumeSubagentCallItem + | OpenAI::Beta::AgentWaitForSubagentsCallItem + | OpenAI::Beta::AgentInterruptSubagentCallItem + | OpenAI::Beta::AgentCloseSubagentCallItem + + module AgentOutputItem + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Beta::agent_output_item] + end + end + end +end diff --git a/sig/openai/models/beta/agent_output_item_status.rbs b/sig/openai/models/beta/agent_output_item_status.rbs new file mode 100644 index 000000000..24663d2be --- /dev/null +++ b/sig/openai/models/beta/agent_output_item_status.rbs @@ -0,0 +1,22 @@ +module OpenAI + module Models + module Beta + type agent_output_item_status = :in_progress | :completed | :incomplete + + module AgentOutputItemStatus + extend OpenAI::Internal::Type::Enum + + # The item is in progress. + IN_PROGRESS: :in_progress + + # The item is complete. + COMPLETED: :completed + + # The item stopped before completing. + INCOMPLETE: :incomplete + + def self?.values: -> ::Array[OpenAI::Models::Beta::agent_output_item_status] + end + end + end +end diff --git a/sig/openai/models/beta/agent_reasoning.rbs b/sig/openai/models/beta/agent_reasoning.rbs new file mode 100644 index 000000000..7cc1cdfea --- /dev/null +++ b/sig/openai/models/beta/agent_reasoning.rbs @@ -0,0 +1,60 @@ +module OpenAI + module Models + module Beta + type agent_reasoning = + { + effort: OpenAI::Models::Beta::AgentReasoning::effort?, + summary: OpenAI::Models::Beta::AgentReasoning::summary? + } + + class AgentReasoning < OpenAI::Internal::Type::BaseModel + attr_accessor effort: OpenAI::Models::Beta::AgentReasoning::effort? + + attr_accessor summary: OpenAI::Models::Beta::AgentReasoning::summary? + + def initialize: ( + effort: OpenAI::Models::Beta::AgentReasoning::effort?, + summary: OpenAI::Models::Beta::AgentReasoning::summary? + ) -> void + + def to_hash: -> { + effort: OpenAI::Models::Beta::AgentReasoning::effort?, + summary: OpenAI::Models::Beta::AgentReasoning::summary? + } + + type effort = :none | :minimal | :low | :medium | :high | :xhigh | :max + + module Effort + extend OpenAI::Internal::Type::Enum + + NONE: :none + MINIMAL: :minimal + LOW: :low + MEDIUM: :medium + HIGH: :high + XHIGH: :xhigh + MAX: :max + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentReasoning::effort] + end + + type summary = :concise | :detailed | :auto + + module Summary + extend OpenAI::Internal::Type::Enum + + # Returns a concise reasoning summary when supported. + CONCISE: :concise + + # Returns a detailed reasoning summary when supported. + DETAILED: :detailed + + # Automatically selects the most detailed summary supported by the model. + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentReasoning::summary] + end + end + end + end +end diff --git a/sig/openai/models/beta/agent_reasoning_item.rbs b/sig/openai/models/beta/agent_reasoning_item.rbs new file mode 100644 index 000000000..3835a87f7 --- /dev/null +++ b/sig/openai/models/beta/agent_reasoning_item.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + type agent_reasoning_item = + { + id: String, + status: OpenAI::Models::Beta::agent_output_item_status?, + summary: ::Array[OpenAI::Beta::SummaryText], + turn_id: String, + ?type: :reasoning + } + + class AgentReasoningItem < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor status: OpenAI::Models::Beta::agent_output_item_status? + + attr_accessor summary: ::Array[OpenAI::Beta::SummaryText] + + attr_accessor turn_id: String + + attr_accessor type: :reasoning + + def initialize: ( + id: String, + status: OpenAI::Models::Beta::agent_output_item_status?, + summary: ::Array[OpenAI::Beta::SummaryText], + turn_id: String, + ?type: :reasoning + ) -> void + + def to_hash: -> { + id: String, + status: OpenAI::Models::Beta::agent_output_item_status?, + summary: ::Array[OpenAI::Beta::SummaryText], + turn_id: String, + ?type: :reasoning + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_reasoning_param.rbs b/sig/openai/models/beta/agent_reasoning_param.rbs new file mode 100644 index 000000000..b155d3dd3 --- /dev/null +++ b/sig/openai/models/beta/agent_reasoning_param.rbs @@ -0,0 +1,60 @@ +module OpenAI + module Models + module Beta + type agent_reasoning_param = + { + ?effort: OpenAI::Models::Beta::AgentReasoningParam::effort?, + ?summary: OpenAI::Models::Beta::AgentReasoningParam::summary? + } + + class AgentReasoningParam < OpenAI::Internal::Type::BaseModel + attr_accessor effort: OpenAI::Models::Beta::AgentReasoningParam::effort? + + attr_accessor summary: OpenAI::Models::Beta::AgentReasoningParam::summary? + + def initialize: ( + ?effort: OpenAI::Models::Beta::AgentReasoningParam::effort?, + ?summary: OpenAI::Models::Beta::AgentReasoningParam::summary? + ) -> void + + def to_hash: -> { + ?effort: OpenAI::Models::Beta::AgentReasoningParam::effort?, + ?summary: OpenAI::Models::Beta::AgentReasoningParam::summary? + } + + type effort = :none | :minimal | :low | :medium | :high | :xhigh | :max + + module Effort + extend OpenAI::Internal::Type::Enum + + NONE: :none + MINIMAL: :minimal + LOW: :low + MEDIUM: :medium + HIGH: :high + XHIGH: :xhigh + MAX: :max + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentReasoningParam::effort] + end + + type summary = :concise | :detailed | :auto + + module Summary + extend OpenAI::Internal::Type::Enum + + # Returns a concise reasoning summary when supported. + CONCISE: :concise + + # Returns a detailed reasoning summary when supported. + DETAILED: :detailed + + # Automatically selects the most detailed summary supported by the model. + AUTO: :auto + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentReasoningParam::summary] + end + end + end + end +end diff --git a/sig/openai/models/beta/agent_resume_subagent_call_item.rbs b/sig/openai/models/beta/agent_resume_subagent_call_item.rbs new file mode 100644 index 000000000..197099581 --- /dev/null +++ b/sig/openai/models/beta/agent_resume_subagent_call_item.rbs @@ -0,0 +1,47 @@ +module OpenAI + module Models + module Beta + type agent_resume_subagent_call_item = + { + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :resume_subagent_call + } + + class AgentResumeSubagentCallItem < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor recipient_agent_id: String + + attr_accessor sender_agent_id: String + + attr_accessor status: OpenAI::Models::Beta::agent_function_call_status + + attr_accessor turn_id: String + + attr_accessor type: :resume_subagent_call + + def initialize: ( + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :resume_subagent_call + ) -> void + + def to_hash: -> { + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :resume_subagent_call + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_retrieve_params.rbs b/sig/openai/models/beta/agent_retrieve_params.rbs new file mode 100644 index 000000000..fdf05c008 --- /dev/null +++ b/sig/openai/models/beta/agent_retrieve_params.rbs @@ -0,0 +1,25 @@ +module OpenAI + module Models + module Beta + type agent_retrieve_params = + { agent_id: String, ?request_options: OpenAI::request_opts } + + class AgentRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor agent_id: String + + def initialize: ( + agent_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + agent_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_send_subagent_input_call_item.rbs b/sig/openai/models/beta/agent_send_subagent_input_call_item.rbs new file mode 100644 index 000000000..a856f882a --- /dev/null +++ b/sig/openai/models/beta/agent_send_subagent_input_call_item.rbs @@ -0,0 +1,52 @@ +module OpenAI + module Models + module Beta + type agent_send_subagent_input_call_item = + { + id: String, + content: ::Array[OpenAI::Models::Beta::agent_content], + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :send_subagent_input_call + } + + class AgentSendSubagentInputCallItem < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor content: ::Array[OpenAI::Models::Beta::agent_content] + + attr_accessor recipient_agent_id: String + + attr_accessor sender_agent_id: String + + attr_accessor status: OpenAI::Models::Beta::agent_function_call_status + + attr_accessor turn_id: String + + attr_accessor type: :send_subagent_input_call + + def initialize: ( + id: String, + content: ::Array[OpenAI::Models::Beta::agent_content], + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :send_subagent_input_call + ) -> void + + def to_hash: -> { + id: String, + content: ::Array[OpenAI::Models::Beta::agent_content], + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :send_subagent_input_call + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session.rbs b/sig/openai/models/beta/agent_session.rbs new file mode 100644 index 000000000..266b0b6a3 --- /dev/null +++ b/sig/openai/models/beta/agent_session.rbs @@ -0,0 +1,234 @@ +module OpenAI + module Models + module Beta + type agent_session = + { + id: String, + agent: OpenAI::Beta::AgentSession::Agent, + created_at: Integer, + environment: OpenAI::Models::Beta::environment, + error: String?, + last_active_at: Integer, + metadata: ::Hash[Symbol, String], + ?object: :"agent.session", + required_actions: ::Array[OpenAI::Models::Beta::AgentSession::required_action], + status: OpenAI::Models::Beta::AgentSession::status, + usage: OpenAI::Beta::TokenUsage?, + vault_ids: ::Array[String] + } + + class AgentSession < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor agent: OpenAI::Beta::AgentSession::Agent + + attr_accessor created_at: Integer + + attr_accessor environment: OpenAI::Models::Beta::environment + + attr_accessor error: String? + + attr_accessor last_active_at: Integer + + attr_accessor metadata: ::Hash[Symbol, String] + + attr_accessor object: :"agent.session" + + attr_accessor required_actions: ::Array[OpenAI::Models::Beta::AgentSession::required_action] + + attr_accessor status: OpenAI::Models::Beta::AgentSession::status + + attr_accessor usage: OpenAI::Beta::TokenUsage? + + attr_accessor vault_ids: ::Array[String] + + def initialize: ( + id: String, + agent: OpenAI::Beta::AgentSession::Agent, + created_at: Integer, + environment: OpenAI::Models::Beta::environment, + error: String?, + last_active_at: Integer, + metadata: ::Hash[Symbol, String], + required_actions: ::Array[OpenAI::Models::Beta::AgentSession::required_action], + status: OpenAI::Models::Beta::AgentSession::status, + usage: OpenAI::Beta::TokenUsage?, + vault_ids: ::Array[String], + ?object: :"agent.session" + ) -> void + + def to_hash: -> { + id: String, + agent: OpenAI::Beta::AgentSession::Agent, + created_at: Integer, + environment: OpenAI::Models::Beta::environment, + error: String?, + last_active_at: Integer, + metadata: ::Hash[Symbol, String], + ?object: :"agent.session", + required_actions: ::Array[OpenAI::Models::Beta::AgentSession::required_action], + status: OpenAI::Models::Beta::AgentSession::status, + usage: OpenAI::Beta::TokenUsage?, + vault_ids: ::Array[String] + } + + type agent = + { + id: String, + instructions: String?, + model: String, + multi_agent: OpenAI::Beta::MultiAgentConfig, + name: String?, + reasoning: OpenAI::Beta::AgentReasoning, + service_tier: OpenAI::Models::Beta::AgentSession::Agent::service_tier, + text: OpenAI::Beta::AgentText, + tools: ::Array[OpenAI::Models::Beta::agent_tool] + } + + class Agent < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor instructions: String? + + attr_accessor model: String + + attr_accessor multi_agent: OpenAI::Beta::MultiAgentConfig + + attr_accessor name: String? + + attr_accessor reasoning: OpenAI::Beta::AgentReasoning + + attr_accessor service_tier: OpenAI::Models::Beta::AgentSession::Agent::service_tier + + attr_accessor text: OpenAI::Beta::AgentText + + attr_accessor tools: ::Array[OpenAI::Models::Beta::agent_tool] + + def initialize: ( + id: String, + instructions: String?, + model: String, + multi_agent: OpenAI::Beta::MultiAgentConfig, + name: String?, + reasoning: OpenAI::Beta::AgentReasoning, + service_tier: OpenAI::Models::Beta::AgentSession::Agent::service_tier, + text: OpenAI::Beta::AgentText, + tools: ::Array[OpenAI::Models::Beta::agent_tool] + ) -> void + + def to_hash: -> { + id: String, + instructions: String?, + model: String, + multi_agent: OpenAI::Beta::MultiAgentConfig, + name: String?, + reasoning: OpenAI::Beta::AgentReasoning, + service_tier: OpenAI::Models::Beta::AgentSession::Agent::service_tier, + text: OpenAI::Beta::AgentText, + tools: ::Array[OpenAI::Models::Beta::agent_tool] + } + + type service_tier = :auto | :default | :flex | :priority | :fast + + module ServiceTier + extend OpenAI::Internal::Type::Enum + + AUTO: :auto + DEFAULT: :default + FLEX: :flex + PRIORITY: :priority + FAST: :fast + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentSession::Agent::service_tier] + end + end + + type required_action = + OpenAI::Beta::AgentSession::RequiredAction::FunctionCall + | OpenAI::Beta::AgentSession::RequiredAction::EnvironmentConnection + + module RequiredAction + extend OpenAI::Internal::Type::Union + + type function_call = + { + arguments: top, + call_id: String, + name: String, + turn_id: String, + ?type: :function_call + } + + class FunctionCall < OpenAI::Internal::Type::BaseModel + attr_accessor arguments: top + + attr_accessor call_id: String + + attr_accessor name: String + + attr_accessor turn_id: String + + attr_accessor type: :function_call + + def initialize: ( + arguments: top, + call_id: String, + name: String, + turn_id: String, + ?type: :function_call + ) -> void + + def to_hash: -> { + arguments: top, + call_id: String, + name: String, + turn_id: String, + ?type: :function_call + } + end + + type environment_connection = + { environment_id: String, ?type: :environment_connection } + + class EnvironmentConnection < OpenAI::Internal::Type::BaseModel + attr_accessor environment_id: String + + attr_accessor type: :environment_connection + + def initialize: ( + environment_id: String, + ?type: :environment_connection + ) -> void + + def to_hash: -> { + environment_id: String, + ?type: :environment_connection + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::AgentSession::required_action] + end + + type status = :idle | :in_progress | :requires_action | :failed + + module Status + extend OpenAI::Internal::Type::Enum + + # The session has no turn in progress and is ready for input. A hosted environment may still be provisioning. + IDLE: :idle + + # The session is processing a turn. + IN_PROGRESS: :in_progress + + # The session is waiting for one or more required actions. + REQUIRES_ACTION: :requires_action + + # The session failed. + FAILED: :failed + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentSession::status] + end + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_assistant_message.rbs b/sig/openai/models/beta/agent_session_assistant_message.rbs new file mode 100644 index 000000000..0a7a14a7f --- /dev/null +++ b/sig/openai/models/beta/agent_session_assistant_message.rbs @@ -0,0 +1,66 @@ +module OpenAI + module Models + module Beta + type agent_session_assistant_message = + { + id: String, + content: ::Array[OpenAI::Beta::OutputText], + phase: OpenAI::Models::Beta::AgentSessionAssistantMessage::phase?, + ?role: :assistant, + status: OpenAI::Models::Beta::agent_output_item_status, + turn_id: String, + ?type: :message + } + + class AgentSessionAssistantMessage < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor content: ::Array[OpenAI::Beta::OutputText] + + attr_accessor phase: OpenAI::Models::Beta::AgentSessionAssistantMessage::phase? + + attr_accessor role: :assistant + + attr_accessor status: OpenAI::Models::Beta::agent_output_item_status + + attr_accessor turn_id: String + + attr_accessor type: :message + + def initialize: ( + id: String, + content: ::Array[OpenAI::Beta::OutputText], + phase: OpenAI::Models::Beta::AgentSessionAssistantMessage::phase?, + status: OpenAI::Models::Beta::agent_output_item_status, + turn_id: String, + ?role: :assistant, + ?type: :message + ) -> void + + def to_hash: -> { + id: String, + content: ::Array[OpenAI::Beta::OutputText], + phase: OpenAI::Models::Beta::AgentSessionAssistantMessage::phase?, + ?role: :assistant, + status: OpenAI::Models::Beta::agent_output_item_status, + turn_id: String, + ?type: :message + } + + type phase = :commentary | :final_answer + + module Phase + extend OpenAI::Internal::Type::Enum + + # Commentary produced while the agent works. + COMMENTARY: :commentary + + # The agent's final answer. + FINAL_ANSWER: :final_answer + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentSessionAssistantMessage::phase] + end + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_created_event.rbs b/sig/openai/models/beta/agent_session_created_event.rbs new file mode 100644 index 000000000..b343c32f6 --- /dev/null +++ b/sig/openai/models/beta/agent_session_created_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Beta + type agent_session_created_event = + { + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.created" + } + + class AgentSessionCreatedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session: OpenAI::Beta::AgentSession + + attr_accessor type: :"agent.session.created" + + def initialize: ( + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.created" + ) -> void + + def to_hash: -> { + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.created" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_deleted.rbs b/sig/openai/models/beta/agent_session_deleted.rbs new file mode 100644 index 000000000..4de3df47c --- /dev/null +++ b/sig/openai/models/beta/agent_session_deleted.rbs @@ -0,0 +1,28 @@ +module OpenAI + module Models + module Beta + type agent_session_deleted = + { id: String, deleted: bool, ?object: :"agent.session.deleted" } + + class AgentSessionDeleted < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor deleted: bool + + attr_accessor object: :"agent.session.deleted" + + def initialize: ( + id: String, + deleted: bool, + ?object: :"agent.session.deleted" + ) -> void + + def to_hash: -> { + id: String, + deleted: bool, + ?object: :"agent.session.deleted" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_environment_connected_event.rbs b/sig/openai/models/beta/agent_session_environment_connected_event.rbs new file mode 100644 index 000000000..b7b041abc --- /dev/null +++ b/sig/openai/models/beta/agent_session_environment_connected_event.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + type agent_session_environment_connected_event = + { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.connected" + } + + class AgentSessionEnvironmentConnectedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor environment: OpenAI::Beta::AgentSessionEnvironmentState + + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.environment.connected" + + def initialize: ( + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.connected" + ) -> void + + def to_hash: -> { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.connected" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_environment_disconnected_event.rbs b/sig/openai/models/beta/agent_session_environment_disconnected_event.rbs new file mode 100644 index 000000000..ae26ed327 --- /dev/null +++ b/sig/openai/models/beta/agent_session_environment_disconnected_event.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + type agent_session_environment_disconnected_event = + { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.disconnected" + } + + class AgentSessionEnvironmentDisconnectedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor environment: OpenAI::Beta::AgentSessionEnvironmentState + + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.environment.disconnected" + + def initialize: ( + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.disconnected" + ) -> void + + def to_hash: -> { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.disconnected" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_environment_failed_event.rbs b/sig/openai/models/beta/agent_session_environment_failed_event.rbs new file mode 100644 index 000000000..cc68e2b2e --- /dev/null +++ b/sig/openai/models/beta/agent_session_environment_failed_event.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + type agent_session_environment_failed_event = + { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.failed" + } + + class AgentSessionEnvironmentFailedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor environment: OpenAI::Beta::AgentSessionEnvironmentState + + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.environment.failed" + + def initialize: ( + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.failed" + ) -> void + + def to_hash: -> { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.failed" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_environment_pending_event.rbs b/sig/openai/models/beta/agent_session_environment_pending_event.rbs new file mode 100644 index 000000000..e8428319a --- /dev/null +++ b/sig/openai/models/beta/agent_session_environment_pending_event.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + type agent_session_environment_pending_event = + { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.pending" + } + + class AgentSessionEnvironmentPendingEvent < OpenAI::Internal::Type::BaseModel + attr_accessor environment: OpenAI::Beta::AgentSessionEnvironmentState + + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.environment.pending" + + def initialize: ( + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.pending" + ) -> void + + def to_hash: -> { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.pending" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_environment_ready_event.rbs b/sig/openai/models/beta/agent_session_environment_ready_event.rbs new file mode 100644 index 000000000..eff8d9636 --- /dev/null +++ b/sig/openai/models/beta/agent_session_environment_ready_event.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + type agent_session_environment_ready_event = + { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.ready" + } + + class AgentSessionEnvironmentReadyEvent < OpenAI::Internal::Type::BaseModel + attr_accessor environment: OpenAI::Beta::AgentSessionEnvironmentState + + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.environment.ready" + + def initialize: ( + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.ready" + ) -> void + + def to_hash: -> { + environment: OpenAI::Beta::AgentSessionEnvironmentState, + event_id: String, + session_id: String, + turn_id: String?, + ?type: :"agent.session.environment.ready" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_environment_state.rbs b/sig/openai/models/beta/agent_session_environment_state.rbs new file mode 100644 index 000000000..58f3a7d9a --- /dev/null +++ b/sig/openai/models/beta/agent_session_environment_state.rbs @@ -0,0 +1,74 @@ +module OpenAI + module Models + module Beta + type agent_session_environment_state = + { + id: String, + error: OpenAI::Beta::AgentSessionEnvironmentState::Error?, + status: OpenAI::Models::Beta::AgentSessionEnvironmentState::status, + type: String + } + + class AgentSessionEnvironmentState < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor error: OpenAI::Beta::AgentSessionEnvironmentState::Error? + + attr_accessor status: OpenAI::Models::Beta::AgentSessionEnvironmentState::status + + attr_accessor type: String + + def initialize: ( + id: String, + error: OpenAI::Beta::AgentSessionEnvironmentState::Error?, + status: OpenAI::Models::Beta::AgentSessionEnvironmentState::status, + type: String + ) -> void + + def to_hash: -> { + id: String, + error: OpenAI::Beta::AgentSessionEnvironmentState::Error?, + status: OpenAI::Models::Beta::AgentSessionEnvironmentState::status, + type: String + } + + type error = { code: String, message: String, type: String } + + class Error < OpenAI::Internal::Type::BaseModel + attr_accessor code: String + + attr_accessor message: String + + attr_accessor type: String + + def initialize: (code: String, message: String, type: String) -> void + + def to_hash: -> { code: String, message: String, type: String } + end + + type status = :pending | :ready | :connected | :disconnected | :failed + + module Status + extend OpenAI::Internal::Type::Enum + + # The environment is being prepared. + PENDING: :pending + + # The environment is ready to connect. + READY: :ready + + # The environment is connected. + CONNECTED: :connected + + # The environment is disconnected. + DISCONNECTED: :disconnected + + # The environment failed to connect. + FAILED: :failed + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentSessionEnvironmentState::status] + end + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_error_event.rbs b/sig/openai/models/beta/agent_session_error_event.rbs new file mode 100644 index 000000000..ecea270ed --- /dev/null +++ b/sig/openai/models/beta/agent_session_error_event.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Beta + type agent_session_error_event = + { + error: OpenAI::Beta::SessionError, + event_id: String, + session_id: String, + ?type: :error + } + + class AgentSessionErrorEvent < OpenAI::Internal::Type::BaseModel + attr_accessor error: OpenAI::Beta::SessionError + + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor type: :error + + def initialize: ( + error: OpenAI::Beta::SessionError, + event_id: String, + session_id: String, + ?type: :error + ) -> void + + def to_hash: -> { + error: OpenAI::Beta::SessionError, + event_id: String, + session_id: String, + ?type: :error + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_event.rbs b/sig/openai/models/beta/agent_session_event.rbs new file mode 100644 index 000000000..ad97a5d03 --- /dev/null +++ b/sig/openai/models/beta/agent_session_event.rbs @@ -0,0 +1,43 @@ +module OpenAI + module Models + module Beta + type agent_session_event = + OpenAI::Beta::AgentSessionErrorEvent + | OpenAI::Beta::AgentSessionEnvironmentReadyEvent + | OpenAI::Beta::AgentOutputCommandExecutionOutputDeltaEvent + | OpenAI::Beta::AgentSessionCreatedEvent + | OpenAI::Beta::AgentSessionTurnCreatedEvent + | OpenAI::Beta::AgentSessionTurnInProgressEvent + | OpenAI::Beta::AgentSessionTurnCompletedEvent + | OpenAI::Beta::AgentSessionTurnFailedEvent + | OpenAI::Beta::AgentSessionTurnCancelledEvent + | OpenAI::Beta::AgentSessionTurnItemAddedEvent + | OpenAI::Beta::AgentSessionIdleEvent + | OpenAI::Beta::AgentSessionInProgressEvent + | OpenAI::Beta::AgentSessionRequiresActionEvent + | OpenAI::Beta::AgentSessionFailedEvent + | OpenAI::Beta::AgentSessionEnvironmentPendingEvent + | OpenAI::Beta::AgentSessionEnvironmentConnectedEvent + | OpenAI::Beta::AgentSessionEnvironmentDisconnectedEvent + | OpenAI::Beta::AgentSessionEnvironmentFailedEvent + | OpenAI::Beta::AgentSessionSubagentCreatedEvent + | OpenAI::Beta::AgentSessionSubagentActiveEvent + | OpenAI::Beta::AgentSessionSubagentClosedEvent + | OpenAI::Beta::AgentSessionTurnItemDoneEvent + | OpenAI::Beta::AgentSessionTurnContentPartAddedEvent + | OpenAI::Beta::AgentSessionTurnContentPartDoneEvent + | OpenAI::Beta::AgentSessionTurnOutputTextDeltaEvent + | OpenAI::Beta::AgentSessionTurnOutputTextDoneEvent + | OpenAI::Beta::AgentSessionTurnReasoningSummaryPartAddedEvent + | OpenAI::Beta::AgentSessionTurnReasoningSummaryPartDoneEvent + | OpenAI::Beta::AgentSessionTurnReasoningSummaryTextDeltaEvent + | OpenAI::Beta::AgentSessionTurnReasoningSummaryTextDoneEvent + + module AgentSessionEvent + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Beta::agent_session_event] + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_failed_event.rbs b/sig/openai/models/beta/agent_session_failed_event.rbs new file mode 100644 index 000000000..023e1fc65 --- /dev/null +++ b/sig/openai/models/beta/agent_session_failed_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Beta + type agent_session_failed_event = + { + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.failed" + } + + class AgentSessionFailedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session: OpenAI::Beta::AgentSession + + attr_accessor type: :"agent.session.failed" + + def initialize: ( + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.failed" + ) -> void + + def to_hash: -> { + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.failed" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_idle_event.rbs b/sig/openai/models/beta/agent_session_idle_event.rbs new file mode 100644 index 000000000..6dd530284 --- /dev/null +++ b/sig/openai/models/beta/agent_session_idle_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Beta + type agent_session_idle_event = + { + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.idle" + } + + class AgentSessionIdleEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session: OpenAI::Beta::AgentSession + + attr_accessor type: :"agent.session.idle" + + def initialize: ( + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.idle" + ) -> void + + def to_hash: -> { + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.idle" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_in_progress_event.rbs b/sig/openai/models/beta/agent_session_in_progress_event.rbs new file mode 100644 index 000000000..e7b281713 --- /dev/null +++ b/sig/openai/models/beta/agent_session_in_progress_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Beta + type agent_session_in_progress_event = + { + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.in_progress" + } + + class AgentSessionInProgressEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session: OpenAI::Beta::AgentSession + + attr_accessor type: :"agent.session.in_progress" + + def initialize: ( + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.in_progress" + ) -> void + + def to_hash: -> { + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.in_progress" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_input_message_param.rbs b/sig/openai/models/beta/agent_session_input_message_param.rbs new file mode 100644 index 000000000..0b522833d --- /dev/null +++ b/sig/openai/models/beta/agent_session_input_message_param.rbs @@ -0,0 +1,46 @@ +module OpenAI + module Models + module Beta + type agent_session_input_message_param = + { + content: ::Array[OpenAI::Models::Beta::input_content_param], + ?role: :user, + ?type: OpenAI::Models::Beta::AgentSessionInputMessageParam::type_ + } + + class AgentSessionInputMessageParam < OpenAI::Internal::Type::BaseModel + attr_accessor content: ::Array[OpenAI::Models::Beta::input_content_param] + + attr_accessor role: :user + + attr_reader type: OpenAI::Models::Beta::AgentSessionInputMessageParam::type_? + + def type=: ( + OpenAI::Models::Beta::AgentSessionInputMessageParam::type_ + ) -> OpenAI::Models::Beta::AgentSessionInputMessageParam::type_ + + def initialize: ( + content: ::Array[OpenAI::Models::Beta::input_content_param], + ?type: OpenAI::Models::Beta::AgentSessionInputMessageParam::type_, + ?role: :user + ) -> void + + def to_hash: -> { + content: ::Array[OpenAI::Models::Beta::input_content_param], + ?role: :user, + ?type: OpenAI::Models::Beta::AgentSessionInputMessageParam::type_ + } + + type type_ = :message + + module Type + extend OpenAI::Internal::Type::Enum + + MESSAGE: :message + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentSessionInputMessageParam::type_] + end + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_input_param.rbs b/sig/openai/models/beta/agent_session_input_param.rbs new file mode 100644 index 000000000..bf5e800ca --- /dev/null +++ b/sig/openai/models/beta/agent_session_input_param.rbs @@ -0,0 +1,91 @@ +module OpenAI + module Models + module Beta + type agent_session_input_param = + OpenAI::Beta::AgentSessionInputParam::AgentSessionInputMessage + | OpenAI::Beta::AgentSessionInputParam::AgentSessionInputCancel + | OpenAI::Beta::AgentSessionInputParam::AgentSessionInputToolResult + + module AgentSessionInputParam + extend OpenAI::Internal::Type::Union + + type agent_session_input_message = + { + input: ::Array[OpenAI::Beta::AgentSessionInputMessageParam], + ?type: :"agent.session.input.message" + } + + class AgentSessionInputMessage < OpenAI::Internal::Type::BaseModel + attr_accessor input: ::Array[OpenAI::Beta::AgentSessionInputMessageParam] + + attr_accessor type: :"agent.session.input.message" + + def initialize: ( + input: ::Array[OpenAI::Beta::AgentSessionInputMessageParam], + ?type: :"agent.session.input.message" + ) -> void + + def to_hash: -> { + input: ::Array[OpenAI::Beta::AgentSessionInputMessageParam], + ?type: :"agent.session.input.message" + } + end + + type agent_session_input_cancel = + { ?type: :"agent.session.input.cancel" } + + class AgentSessionInputCancel < OpenAI::Internal::Type::BaseModel + attr_accessor type: :"agent.session.input.cancel" + + def initialize: (?type: :"agent.session.input.cancel") -> void + + def to_hash: -> { ?type: :"agent.session.input.cancel" } + end + + type agent_session_input_tool_result = + { + call_id: String, + success: bool, + turn_id: String, + ?type: :"agent.session.input.tool_result", + ?error: String?, + ?output: OpenAI::Models::Beta::agent_function_call_output_param? + } + + class AgentSessionInputToolResult < OpenAI::Internal::Type::BaseModel + attr_accessor call_id: String + + attr_accessor success: bool + + attr_accessor turn_id: String + + attr_accessor type: :"agent.session.input.tool_result" + + attr_accessor error: String? + + attr_accessor output: OpenAI::Models::Beta::agent_function_call_output_param? + + def initialize: ( + call_id: String, + success: bool, + turn_id: String, + ?error: String?, + ?output: OpenAI::Models::Beta::agent_function_call_output_param?, + ?type: :"agent.session.input.tool_result" + ) -> void + + def to_hash: -> { + call_id: String, + success: bool, + turn_id: String, + ?type: :"agent.session.input.tool_result", + ?error: String?, + ?output: OpenAI::Models::Beta::agent_function_call_output_param? + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::agent_session_input_param] + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_item.rbs b/sig/openai/models/beta/agent_session_item.rbs new file mode 100644 index 000000000..c1e56f7a8 --- /dev/null +++ b/sig/openai/models/beta/agent_session_item.rbs @@ -0,0 +1,116 @@ +module OpenAI + module Models + module Beta + type agent_session_item = + OpenAI::Beta::AgentSessionMessage + | OpenAI::Beta::AgentReasoningItem + | OpenAI::Beta::AgentFunctionCallItem + | OpenAI::Beta::AgentSessionItem::FunctionCallOutput + | OpenAI::Beta::AgentSessionItem::AgentMessage + | OpenAI::Beta::AgentMcpCallItem + | OpenAI::Beta::AgentWebSearchCallItem + | OpenAI::Beta::AgentCommandExecutionItem + | OpenAI::Beta::AgentCreateSubagentCallItem + | OpenAI::Beta::AgentSendSubagentInputCallItem + | OpenAI::Beta::AgentResumeSubagentCallItem + | OpenAI::Beta::AgentWaitForSubagentsCallItem + | OpenAI::Beta::AgentInterruptSubagentCallItem + | OpenAI::Beta::AgentCloseSubagentCallItem + + module AgentSessionItem + extend OpenAI::Internal::Type::Union + + type function_call_output = + { + id: String, + call_id: String, + error: String?, + output: OpenAI::Models::Beta::agent_function_call_output?, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :function_call_output + } + + class FunctionCallOutput < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor call_id: String + + attr_accessor error: String? + + attr_accessor output: OpenAI::Models::Beta::agent_function_call_output? + + attr_accessor status: OpenAI::Models::Beta::agent_function_call_status + + attr_accessor turn_id: String + + attr_accessor type: :function_call_output + + def initialize: ( + id: String, + call_id: String, + error: String?, + output: OpenAI::Models::Beta::agent_function_call_output?, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :function_call_output + ) -> void + + def to_hash: -> { + id: String, + call_id: String, + error: String?, + output: OpenAI::Models::Beta::agent_function_call_output?, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :function_call_output + } + end + + type agent_message = + { + id: String, + content: ::Array[OpenAI::Models::Beta::agent_content], + recipient_agent_id: String, + sender_agent_id: String, + turn_id: String, + ?type: :agent_message + } + + class AgentMessage < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor content: ::Array[OpenAI::Models::Beta::agent_content] + + attr_accessor recipient_agent_id: String + + attr_accessor sender_agent_id: String + + attr_accessor turn_id: String + + attr_accessor type: :agent_message + + def initialize: ( + id: String, + content: ::Array[OpenAI::Models::Beta::agent_content], + recipient_agent_id: String, + sender_agent_id: String, + turn_id: String, + ?type: :agent_message + ) -> void + + def to_hash: -> { + id: String, + content: ::Array[OpenAI::Models::Beta::agent_content], + recipient_agent_id: String, + sender_agent_id: String, + turn_id: String, + ?type: :agent_message + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::agent_session_item] + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_message.rbs b/sig/openai/models/beta/agent_session_message.rbs new file mode 100644 index 000000000..e771b422a --- /dev/null +++ b/sig/openai/models/beta/agent_session_message.rbs @@ -0,0 +1,77 @@ +module OpenAI + module Models + module Beta + type agent_session_message = + { + id: String?, + content: ::Array[OpenAI::Models::Beta::agent_session_message_content], + phase: OpenAI::Models::Beta::AgentSessionMessage::phase?, + role: OpenAI::Models::Beta::AgentSessionMessage::role, + status: OpenAI::Models::Beta::agent_output_item_status, + turn_id: String, + ?type: :message + } + + class AgentSessionMessage < OpenAI::Internal::Type::BaseModel + attr_accessor id: String? + + attr_accessor content: ::Array[OpenAI::Models::Beta::agent_session_message_content] + + attr_accessor phase: OpenAI::Models::Beta::AgentSessionMessage::phase? + + attr_accessor role: OpenAI::Models::Beta::AgentSessionMessage::role + + attr_accessor status: OpenAI::Models::Beta::agent_output_item_status + + attr_accessor turn_id: String + + attr_accessor type: :message + + def initialize: ( + id: String?, + content: ::Array[OpenAI::Models::Beta::agent_session_message_content], + phase: OpenAI::Models::Beta::AgentSessionMessage::phase?, + role: OpenAI::Models::Beta::AgentSessionMessage::role, + status: OpenAI::Models::Beta::agent_output_item_status, + turn_id: String, + ?type: :message + ) -> void + + def to_hash: -> { + id: String?, + content: ::Array[OpenAI::Models::Beta::agent_session_message_content], + phase: OpenAI::Models::Beta::AgentSessionMessage::phase?, + role: OpenAI::Models::Beta::AgentSessionMessage::role, + status: OpenAI::Models::Beta::agent_output_item_status, + turn_id: String, + ?type: :message + } + + type phase = :commentary | :final_answer + + module Phase + extend OpenAI::Internal::Type::Enum + + # Commentary produced while the agent works. + COMMENTARY: :commentary + + # The agent's final answer. + FINAL_ANSWER: :final_answer + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentSessionMessage::phase] + end + + type role = :user | :assistant + + module Role + extend OpenAI::Internal::Type::Enum + + USER: :user + ASSISTANT: :assistant + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentSessionMessage::role] + end + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_message_content.rbs b/sig/openai/models/beta/agent_session_message_content.rbs new file mode 100644 index 000000000..23b3fb449 --- /dev/null +++ b/sig/openai/models/beta/agent_session_message_content.rbs @@ -0,0 +1,52 @@ +module OpenAI + module Models + module Beta + type agent_session_message_content = + OpenAI::Beta::AgentSessionMessageContent::InputText + | OpenAI::Beta::AgentSessionMessageContent::InputImage + | OpenAI::Beta::AgentSessionMessageContent::OutputText + + module AgentSessionMessageContent + extend OpenAI::Internal::Type::Union + + type input_text = { text: String, ?type: :input_text } + + class InputText < OpenAI::Internal::Type::BaseModel + attr_accessor text: String + + attr_accessor type: :input_text + + def initialize: (text: String, ?type: :input_text) -> void + + def to_hash: -> { text: String, ?type: :input_text } + end + + type input_image = { image_url: String, ?type: :input_image } + + class InputImage < OpenAI::Internal::Type::BaseModel + attr_accessor image_url: String + + attr_accessor type: :input_image + + def initialize: (image_url: String, ?type: :input_image) -> void + + def to_hash: -> { image_url: String, ?type: :input_image } + end + + type output_text = { text: String, ?type: :output_text } + + class OutputText < OpenAI::Internal::Type::BaseModel + attr_accessor text: String + + attr_accessor type: :output_text + + def initialize: (text: String, ?type: :output_text) -> void + + def to_hash: -> { text: String, ?type: :output_text } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::agent_session_message_content] + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_requires_action_event.rbs b/sig/openai/models/beta/agent_session_requires_action_event.rbs new file mode 100644 index 000000000..53ef845db --- /dev/null +++ b/sig/openai/models/beta/agent_session_requires_action_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Beta + type agent_session_requires_action_event = + { + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.requires_action" + } + + class AgentSessionRequiresActionEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session: OpenAI::Beta::AgentSession + + attr_accessor type: :"agent.session.requires_action" + + def initialize: ( + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.requires_action" + ) -> void + + def to_hash: -> { + event_id: String, + session: OpenAI::Beta::AgentSession, + ?type: :"agent.session.requires_action" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_subagent_active_event.rbs b/sig/openai/models/beta/agent_session_subagent_active_event.rbs new file mode 100644 index 000000000..d10867b3f --- /dev/null +++ b/sig/openai/models/beta/agent_session_subagent_active_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Beta + type agent_session_subagent_active_event = + { + event_id: String, + subagent: OpenAI::Beta::Subagent, + ?type: :"agent.session.subagent.active" + } + + class AgentSessionSubagentActiveEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor subagent: OpenAI::Beta::Subagent + + attr_accessor type: :"agent.session.subagent.active" + + def initialize: ( + event_id: String, + subagent: OpenAI::Beta::Subagent, + ?type: :"agent.session.subagent.active" + ) -> void + + def to_hash: -> { + event_id: String, + subagent: OpenAI::Beta::Subagent, + ?type: :"agent.session.subagent.active" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_subagent_closed_event.rbs b/sig/openai/models/beta/agent_session_subagent_closed_event.rbs new file mode 100644 index 000000000..20ef5b65a --- /dev/null +++ b/sig/openai/models/beta/agent_session_subagent_closed_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Beta + type agent_session_subagent_closed_event = + { + event_id: String, + subagent: OpenAI::Beta::Subagent, + ?type: :"agent.session.subagent.closed" + } + + class AgentSessionSubagentClosedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor subagent: OpenAI::Beta::Subagent + + attr_accessor type: :"agent.session.subagent.closed" + + def initialize: ( + event_id: String, + subagent: OpenAI::Beta::Subagent, + ?type: :"agent.session.subagent.closed" + ) -> void + + def to_hash: -> { + event_id: String, + subagent: OpenAI::Beta::Subagent, + ?type: :"agent.session.subagent.closed" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_subagent_created_event.rbs b/sig/openai/models/beta/agent_session_subagent_created_event.rbs new file mode 100644 index 000000000..f42f4120f --- /dev/null +++ b/sig/openai/models/beta/agent_session_subagent_created_event.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Beta + type agent_session_subagent_created_event = + { + event_id: String, + subagent: OpenAI::Beta::Subagent, + ?type: :"agent.session.subagent.created" + } + + class AgentSessionSubagentCreatedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor subagent: OpenAI::Beta::Subagent + + attr_accessor type: :"agent.session.subagent.created" + + def initialize: ( + event_id: String, + subagent: OpenAI::Beta::Subagent, + ?type: :"agent.session.subagent.created" + ) -> void + + def to_hash: -> { + event_id: String, + subagent: OpenAI::Beta::Subagent, + ?type: :"agent.session.subagent.created" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_cancelled_event.rbs b/sig/openai/models/beta/agent_session_turn_cancelled_event.rbs new file mode 100644 index 000000000..efef2828c --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_cancelled_event.rbs @@ -0,0 +1,47 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_cancelled_event = + { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + ?type: :"agent.session.turn.cancelled", + usage: OpenAI::Beta::TokenUsage? + } + + class AgentSessionTurnCancelledEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor turn: OpenAI::Beta::Agents::Sessions::Turn + + attr_accessor turn_id: String + + attr_accessor type: :"agent.session.turn.cancelled" + + attr_accessor usage: OpenAI::Beta::TokenUsage? + + def initialize: ( + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + usage: OpenAI::Beta::TokenUsage?, + ?type: :"agent.session.turn.cancelled" + ) -> void + + def to_hash: -> { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + ?type: :"agent.session.turn.cancelled", + usage: OpenAI::Beta::TokenUsage? + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_completed_event.rbs b/sig/openai/models/beta/agent_session_turn_completed_event.rbs new file mode 100644 index 000000000..c408562dc --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_completed_event.rbs @@ -0,0 +1,47 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_completed_event = + { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + ?type: :"agent.session.turn.completed", + usage: OpenAI::Beta::TokenUsage? + } + + class AgentSessionTurnCompletedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor turn: OpenAI::Beta::Agents::Sessions::Turn + + attr_accessor turn_id: String + + attr_accessor type: :"agent.session.turn.completed" + + attr_accessor usage: OpenAI::Beta::TokenUsage? + + def initialize: ( + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + usage: OpenAI::Beta::TokenUsage?, + ?type: :"agent.session.turn.completed" + ) -> void + + def to_hash: -> { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + ?type: :"agent.session.turn.completed", + usage: OpenAI::Beta::TokenUsage? + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_content_part_added_event.rbs b/sig/openai/models/beta/agent_session_turn_content_part_added_event.rbs new file mode 100644 index 000000000..4fcedf623 --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_content_part_added_event.rbs @@ -0,0 +1,57 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_content_part_added_event = + { + content_index: Integer, + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::OutputText, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.content_part.added" + } + + class AgentSessionTurnContentPartAddedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor content_index: Integer + + attr_accessor event_id: String + + attr_accessor item_id: String + + attr_accessor output_index: Integer + + attr_accessor part: OpenAI::Beta::OutputText + + attr_accessor session_id: String + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.turn.content_part.added" + + def initialize: ( + content_index: Integer, + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::OutputText, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.content_part.added" + ) -> void + + def to_hash: -> { + content_index: Integer, + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::OutputText, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.content_part.added" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_content_part_done_event.rbs b/sig/openai/models/beta/agent_session_turn_content_part_done_event.rbs new file mode 100644 index 000000000..f13bb9656 --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_content_part_done_event.rbs @@ -0,0 +1,57 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_content_part_done_event = + { + content_index: Integer, + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::OutputText, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.content_part.done" + } + + class AgentSessionTurnContentPartDoneEvent < OpenAI::Internal::Type::BaseModel + attr_accessor content_index: Integer + + attr_accessor event_id: String + + attr_accessor item_id: String + + attr_accessor output_index: Integer + + attr_accessor part: OpenAI::Beta::OutputText + + attr_accessor session_id: String + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.turn.content_part.done" + + def initialize: ( + content_index: Integer, + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::OutputText, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.content_part.done" + ) -> void + + def to_hash: -> { + content_index: Integer, + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::OutputText, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.content_part.done" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_created_event.rbs b/sig/openai/models/beta/agent_session_turn_created_event.rbs new file mode 100644 index 000000000..717511555 --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_created_event.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_created_event = + { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + ?type: :"agent.session.turn.created" + } + + class AgentSessionTurnCreatedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor turn: OpenAI::Beta::Agents::Sessions::Turn + + attr_accessor turn_id: String + + attr_accessor type: :"agent.session.turn.created" + + def initialize: ( + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + ?type: :"agent.session.turn.created" + ) -> void + + def to_hash: -> { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + ?type: :"agent.session.turn.created" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_failed_event.rbs b/sig/openai/models/beta/agent_session_turn_failed_event.rbs new file mode 100644 index 000000000..289c701db --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_failed_event.rbs @@ -0,0 +1,47 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_failed_event = + { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + ?type: :"agent.session.turn.failed", + usage: OpenAI::Beta::TokenUsage? + } + + class AgentSessionTurnFailedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor turn: OpenAI::Beta::Agents::Sessions::Turn + + attr_accessor turn_id: String + + attr_accessor type: :"agent.session.turn.failed" + + attr_accessor usage: OpenAI::Beta::TokenUsage? + + def initialize: ( + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + usage: OpenAI::Beta::TokenUsage?, + ?type: :"agent.session.turn.failed" + ) -> void + + def to_hash: -> { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + ?type: :"agent.session.turn.failed", + usage: OpenAI::Beta::TokenUsage? + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_in_progress_event.rbs b/sig/openai/models/beta/agent_session_turn_in_progress_event.rbs new file mode 100644 index 000000000..c86840609 --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_in_progress_event.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_in_progress_event = + { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + ?type: :"agent.session.turn.in_progress" + } + + class AgentSessionTurnInProgressEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor session_id: String + + attr_accessor turn: OpenAI::Beta::Agents::Sessions::Turn + + attr_accessor turn_id: String + + attr_accessor type: :"agent.session.turn.in_progress" + + def initialize: ( + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + ?type: :"agent.session.turn.in_progress" + ) -> void + + def to_hash: -> { + event_id: String, + session_id: String, + turn: OpenAI::Beta::Agents::Sessions::Turn, + turn_id: String, + ?type: :"agent.session.turn.in_progress" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_item_added_event.rbs b/sig/openai/models/beta/agent_session_turn_item_added_event.rbs new file mode 100644 index 000000000..a2d633174 --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_item_added_event.rbs @@ -0,0 +1,47 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_item_added_event = + { + event_id: String, + item: OpenAI::Models::Beta::agent_session_item, + output_index: Integer?, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.item.added" + } + + class AgentSessionTurnItemAddedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor item: OpenAI::Models::Beta::agent_session_item + + attr_accessor output_index: Integer? + + attr_accessor session_id: String + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.turn.item.added" + + def initialize: ( + event_id: String, + item: OpenAI::Models::Beta::agent_session_item, + output_index: Integer?, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.item.added" + ) -> void + + def to_hash: -> { + event_id: String, + item: OpenAI::Models::Beta::agent_session_item, + output_index: Integer?, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.item.added" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_item_done_event.rbs b/sig/openai/models/beta/agent_session_turn_item_done_event.rbs new file mode 100644 index 000000000..e02e53917 --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_item_done_event.rbs @@ -0,0 +1,47 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_item_done_event = + { + event_id: String, + item: OpenAI::Models::Beta::agent_output_item, + output_index: Integer, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.item.done" + } + + class AgentSessionTurnItemDoneEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor item: OpenAI::Models::Beta::agent_output_item + + attr_accessor output_index: Integer + + attr_accessor session_id: String + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.turn.item.done" + + def initialize: ( + event_id: String, + item: OpenAI::Models::Beta::agent_output_item, + output_index: Integer, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.item.done" + ) -> void + + def to_hash: -> { + event_id: String, + item: OpenAI::Models::Beta::agent_output_item, + output_index: Integer, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.item.done" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_output_text_delta_event.rbs b/sig/openai/models/beta/agent_session_turn_output_text_delta_event.rbs new file mode 100644 index 000000000..d83269160 --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_output_text_delta_event.rbs @@ -0,0 +1,57 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_output_text_delta_event = + { + content_index: Integer, + delta: String, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.output_text.delta" + } + + class AgentSessionTurnOutputTextDeltaEvent < OpenAI::Internal::Type::BaseModel + attr_accessor content_index: Integer + + attr_accessor delta: String + + attr_accessor event_id: String + + attr_accessor item_id: String + + attr_accessor output_index: Integer + + attr_accessor session_id: String + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.turn.output_text.delta" + + def initialize: ( + content_index: Integer, + delta: String, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.output_text.delta" + ) -> void + + def to_hash: -> { + content_index: Integer, + delta: String, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + turn_id: String?, + ?type: :"agent.session.turn.output_text.delta" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_output_text_done_event.rbs b/sig/openai/models/beta/agent_session_turn_output_text_done_event.rbs new file mode 100644 index 000000000..ee98cccea --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_output_text_done_event.rbs @@ -0,0 +1,57 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_output_text_done_event = + { + content_index: Integer, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + text: String, + turn_id: String?, + ?type: :"agent.session.turn.output_text.done" + } + + class AgentSessionTurnOutputTextDoneEvent < OpenAI::Internal::Type::BaseModel + attr_accessor content_index: Integer + + attr_accessor event_id: String + + attr_accessor item_id: String + + attr_accessor output_index: Integer + + attr_accessor session_id: String + + attr_accessor text: String + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.turn.output_text.done" + + def initialize: ( + content_index: Integer, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + text: String, + turn_id: String?, + ?type: :"agent.session.turn.output_text.done" + ) -> void + + def to_hash: -> { + content_index: Integer, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + text: String, + turn_id: String?, + ?type: :"agent.session.turn.output_text.done" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_reasoning_summary_part_added_event.rbs b/sig/openai/models/beta/agent_session_turn_reasoning_summary_part_added_event.rbs new file mode 100644 index 000000000..a50174bbd --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_reasoning_summary_part_added_event.rbs @@ -0,0 +1,57 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_reasoning_summary_part_added_event = + { + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::SummaryText, + session_id: String, + summary_index: Integer, + turn_id: String?, + ?type: :"agent.session.turn.reasoning_summary_part.added" + } + + class AgentSessionTurnReasoningSummaryPartAddedEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor item_id: String + + attr_accessor output_index: Integer + + attr_accessor part: OpenAI::Beta::SummaryText + + attr_accessor session_id: String + + attr_accessor summary_index: Integer + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.turn.reasoning_summary_part.added" + + def initialize: ( + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::SummaryText, + session_id: String, + summary_index: Integer, + turn_id: String?, + ?type: :"agent.session.turn.reasoning_summary_part.added" + ) -> void + + def to_hash: -> { + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::SummaryText, + session_id: String, + summary_index: Integer, + turn_id: String?, + ?type: :"agent.session.turn.reasoning_summary_part.added" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_reasoning_summary_part_done_event.rbs b/sig/openai/models/beta/agent_session_turn_reasoning_summary_part_done_event.rbs new file mode 100644 index 000000000..27e400e00 --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_reasoning_summary_part_done_event.rbs @@ -0,0 +1,64 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_reasoning_summary_part_done_event = + { + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::SummaryText, + session_id: String, + ?status: :incomplete?, + summary_index: Integer, + turn_id: String?, + ?type: :"agent.session.turn.reasoning_summary_part.done" + } + + class AgentSessionTurnReasoningSummaryPartDoneEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor item_id: String + + attr_accessor output_index: Integer + + attr_accessor part: OpenAI::Beta::SummaryText + + attr_accessor session_id: String + + attr_reader status: :incomplete + + def status=: (:incomplete?) -> :incomplete? + + attr_accessor summary_index: Integer + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.turn.reasoning_summary_part.done" + + def initialize: ( + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::SummaryText, + session_id: String, + summary_index: Integer, + turn_id: String?, + ?status: :incomplete?, + ?type: :"agent.session.turn.reasoning_summary_part.done" + ) -> void + + def to_hash: -> { + event_id: String, + item_id: String, + output_index: Integer, + part: OpenAI::Beta::SummaryText, + session_id: String, + ?status: :incomplete?, + summary_index: Integer, + turn_id: String?, + ?type: :"agent.session.turn.reasoning_summary_part.done" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_reasoning_summary_text_delta_event.rbs b/sig/openai/models/beta/agent_session_turn_reasoning_summary_text_delta_event.rbs new file mode 100644 index 000000000..72da88715 --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_reasoning_summary_text_delta_event.rbs @@ -0,0 +1,57 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_reasoning_summary_text_delta_event = + { + delta: String, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + summary_index: Integer, + turn_id: String?, + ?type: :"agent.session.turn.reasoning_summary_text.delta" + } + + class AgentSessionTurnReasoningSummaryTextDeltaEvent < OpenAI::Internal::Type::BaseModel + attr_accessor delta: String + + attr_accessor event_id: String + + attr_accessor item_id: String + + attr_accessor output_index: Integer + + attr_accessor session_id: String + + attr_accessor summary_index: Integer + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.turn.reasoning_summary_text.delta" + + def initialize: ( + delta: String, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + summary_index: Integer, + turn_id: String?, + ?type: :"agent.session.turn.reasoning_summary_text.delta" + ) -> void + + def to_hash: -> { + delta: String, + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + summary_index: Integer, + turn_id: String?, + ?type: :"agent.session.turn.reasoning_summary_text.delta" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_session_turn_reasoning_summary_text_done_event.rbs b/sig/openai/models/beta/agent_session_turn_reasoning_summary_text_done_event.rbs new file mode 100644 index 000000000..935e5ad36 --- /dev/null +++ b/sig/openai/models/beta/agent_session_turn_reasoning_summary_text_done_event.rbs @@ -0,0 +1,57 @@ +module OpenAI + module Models + module Beta + type agent_session_turn_reasoning_summary_text_done_event = + { + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + summary_index: Integer, + text: String, + turn_id: String?, + ?type: :"agent.session.turn.reasoning_summary_text.done" + } + + class AgentSessionTurnReasoningSummaryTextDoneEvent < OpenAI::Internal::Type::BaseModel + attr_accessor event_id: String + + attr_accessor item_id: String + + attr_accessor output_index: Integer + + attr_accessor session_id: String + + attr_accessor summary_index: Integer + + attr_accessor text: String + + attr_accessor turn_id: String? + + attr_accessor type: :"agent.session.turn.reasoning_summary_text.done" + + def initialize: ( + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + summary_index: Integer, + text: String, + turn_id: String?, + ?type: :"agent.session.turn.reasoning_summary_text.done" + ) -> void + + def to_hash: -> { + event_id: String, + item_id: String, + output_index: Integer, + session_id: String, + summary_index: Integer, + text: String, + turn_id: String?, + ?type: :"agent.session.turn.reasoning_summary_text.done" + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_text.rbs b/sig/openai/models/beta/agent_text.rbs new file mode 100644 index 000000000..8c1d451e0 --- /dev/null +++ b/sig/openai/models/beta/agent_text.rbs @@ -0,0 +1,39 @@ +module OpenAI + module Models + module Beta + type agent_text = + { + format_: OpenAI::Models::Beta::text_format, + verbosity: OpenAI::Models::Beta::AgentText::verbosity + } + + class AgentText < OpenAI::Internal::Type::BaseModel + attr_accessor format_: OpenAI::Models::Beta::text_format + + attr_accessor verbosity: OpenAI::Models::Beta::AgentText::verbosity + + def initialize: ( + format_: OpenAI::Models::Beta::text_format, + verbosity: OpenAI::Models::Beta::AgentText::verbosity + ) -> void + + def to_hash: -> { + format_: OpenAI::Models::Beta::text_format, + verbosity: OpenAI::Models::Beta::AgentText::verbosity + } + + type verbosity = :low | :medium | :high + + module Verbosity + extend OpenAI::Internal::Type::Enum + + LOW: :low + MEDIUM: :medium + HIGH: :high + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentText::verbosity] + end + end + end + end +end diff --git a/sig/openai/models/beta/agent_text_param.rbs b/sig/openai/models/beta/agent_text_param.rbs new file mode 100644 index 000000000..d1aa0efb3 --- /dev/null +++ b/sig/openai/models/beta/agent_text_param.rbs @@ -0,0 +1,44 @@ +module OpenAI + module Models + module Beta + type agent_text_param = + { + ?format_: OpenAI::Models::Beta::text_format_param?, + ?verbosity: OpenAI::Models::Beta::AgentTextParam::verbosity? + } + + class AgentTextParam < OpenAI::Internal::Type::BaseModel + attr_accessor format_: OpenAI::Models::Beta::text_format_param? + + attr_accessor verbosity: OpenAI::Models::Beta::AgentTextParam::verbosity? + + def initialize: ( + ?format_: OpenAI::Models::Beta::text_format_param?, + ?verbosity: OpenAI::Models::Beta::AgentTextParam::verbosity? + ) -> void + + def to_hash: -> { + ?format_: OpenAI::Models::Beta::text_format_param?, + ?verbosity: OpenAI::Models::Beta::AgentTextParam::verbosity? + } + + type verbosity = :low | :medium | :high + + module Verbosity + extend OpenAI::Internal::Type::Enum + + # Produces less text. + LOW: :low + + # Uses the default amount of text. + MEDIUM: :medium + + # Produces more text. + HIGH: :high + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentTextParam::verbosity] + end + end + end + end +end diff --git a/sig/openai/models/beta/agent_tool.rbs b/sig/openai/models/beta/agent_tool.rbs new file mode 100644 index 000000000..3b7dc7d3c --- /dev/null +++ b/sig/openai/models/beta/agent_tool.rbs @@ -0,0 +1,226 @@ +module OpenAI + module Models + module Beta + type agent_tool = + OpenAI::Beta::AgentTool::Function + | OpenAI::Beta::AgentTool::ProgrammaticToolCalling + | OpenAI::Beta::AgentTool::Mcp + | OpenAI::Beta::AgentTool::WebSearch + + module AgentTool + extend OpenAI::Internal::Type::Union + + type function = + { + defer_loading: bool, + description: String, + name: String, + parameters: ::Hash[Symbol, top], + ?type: :function + } + + class Function < OpenAI::Internal::Type::BaseModel + attr_accessor defer_loading: bool + + attr_accessor description: String + + attr_accessor name: String + + attr_accessor parameters: ::Hash[Symbol, top] + + attr_accessor type: :function + + def initialize: ( + defer_loading: bool, + description: String, + name: String, + parameters: ::Hash[Symbol, top], + ?type: :function + ) -> void + + def to_hash: -> { + defer_loading: bool, + description: String, + name: String, + parameters: ::Hash[Symbol, top], + ?type: :function + } + end + + type programmatic_tool_calling = + { enabled: bool, ?type: :programmatic_tool_calling } + + class ProgrammaticToolCalling < OpenAI::Internal::Type::BaseModel + attr_accessor enabled: bool + + attr_accessor type: :programmatic_tool_calling + + def initialize: ( + enabled: bool, + ?type: :programmatic_tool_calling + ) -> void + + def to_hash: -> { enabled: bool, ?type: :programmatic_tool_calling } + end + + type mcp = + { + allowed_tools: ::Array[String]?, + connection_origin: OpenAI::Models::Beta::AgentTool::Mcp::connection_origin, + credential_id: String?, + request_metadata: ::Hash[Symbol, top], + required: bool, + server_label: String, + transport: OpenAI::Models::Beta::mcp_transport, + ?type: :mcp + } + + class Mcp < OpenAI::Internal::Type::BaseModel + attr_accessor allowed_tools: ::Array[String]? + + attr_accessor connection_origin: OpenAI::Models::Beta::AgentTool::Mcp::connection_origin + + attr_accessor credential_id: String? + + attr_accessor request_metadata: ::Hash[Symbol, top] + + attr_accessor required: bool + + attr_accessor server_label: String + + attr_accessor transport: OpenAI::Models::Beta::mcp_transport + + attr_accessor type: :mcp + + def initialize: ( + allowed_tools: ::Array[String]?, + connection_origin: OpenAI::Models::Beta::AgentTool::Mcp::connection_origin, + credential_id: String?, + request_metadata: ::Hash[Symbol, top], + required: bool, + server_label: String, + transport: OpenAI::Models::Beta::mcp_transport, + ?type: :mcp + ) -> void + + def to_hash: -> { + allowed_tools: ::Array[String]?, + connection_origin: OpenAI::Models::Beta::AgentTool::Mcp::connection_origin, + credential_id: String?, + request_metadata: ::Hash[Symbol, top], + required: bool, + server_label: String, + transport: OpenAI::Models::Beta::mcp_transport, + ?type: :mcp + } + + type connection_origin = :service | :environment + + module ConnectionOrigin + extend OpenAI::Internal::Type::Enum + + SERVICE: :service + ENVIRONMENT: :environment + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentTool::Mcp::connection_origin] + end + end + + type web_search = + { + allowed_domains: ::Array[String]?, + context_size: OpenAI::Models::Beta::AgentTool::WebSearch::context_size, + location: OpenAI::Beta::AgentTool::WebSearch::Location?, + mode: OpenAI::Models::Beta::AgentTool::WebSearch::mode, + ?type: :web_search + } + + class WebSearch < OpenAI::Internal::Type::BaseModel + attr_accessor allowed_domains: ::Array[String]? + + attr_accessor context_size: OpenAI::Models::Beta::AgentTool::WebSearch::context_size + + attr_accessor location: OpenAI::Beta::AgentTool::WebSearch::Location? + + attr_accessor mode: OpenAI::Models::Beta::AgentTool::WebSearch::mode + + attr_accessor type: :web_search + + def initialize: ( + allowed_domains: ::Array[String]?, + context_size: OpenAI::Models::Beta::AgentTool::WebSearch::context_size, + location: OpenAI::Beta::AgentTool::WebSearch::Location?, + mode: OpenAI::Models::Beta::AgentTool::WebSearch::mode, + ?type: :web_search + ) -> void + + def to_hash: -> { + allowed_domains: ::Array[String]?, + context_size: OpenAI::Models::Beta::AgentTool::WebSearch::context_size, + location: OpenAI::Beta::AgentTool::WebSearch::Location?, + mode: OpenAI::Models::Beta::AgentTool::WebSearch::mode, + ?type: :web_search + } + + type context_size = :low | :medium | :high + + module ContextSize + extend OpenAI::Internal::Type::Enum + + LOW: :low + MEDIUM: :medium + HIGH: :high + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentTool::WebSearch::context_size] + end + + type location = + { + city: String?, + country: String?, + region: String?, + timezone: String? + } + + class Location < OpenAI::Internal::Type::BaseModel + attr_accessor city: String? + + attr_accessor country: String? + + attr_accessor region: String? + + attr_accessor timezone: String? + + def initialize: ( + city: String?, + country: String?, + region: String?, + timezone: String? + ) -> void + + def to_hash: -> { + city: String?, + country: String?, + region: String?, + timezone: String? + } + end + + type mode = :disabled | :cached | :live + + module Mode + extend OpenAI::Internal::Type::Enum + + DISABLED: :disabled + CACHED: :cached + LIVE: :live + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentTool::WebSearch::mode] + end + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::agent_tool] + end + end + end +end diff --git a/sig/openai/models/beta/agent_tool_param.rbs b/sig/openai/models/beta/agent_tool_param.rbs new file mode 100644 index 000000000..bd037f055 --- /dev/null +++ b/sig/openai/models/beta/agent_tool_param.rbs @@ -0,0 +1,251 @@ +module OpenAI + module Models + module Beta + type agent_tool_param = + OpenAI::Beta::AgentToolParam::Function + | OpenAI::Beta::AgentToolParam::ToolSearch + | OpenAI::Beta::AgentToolParam::ProgrammaticToolCalling + | OpenAI::Beta::AgentToolParam::Mcp + | OpenAI::Beta::AgentToolParam::WebSearch + + module AgentToolParam + extend OpenAI::Internal::Type::Union + + type function = + { + description: String, + name: String, + parameters: ::Hash[Symbol, top], + ?type: :function, + ?defer_loading: bool + } + + class Function < OpenAI::Internal::Type::BaseModel + attr_accessor description: String + + attr_accessor name: String + + attr_accessor parameters: ::Hash[Symbol, top] + + attr_accessor type: :function + + attr_reader defer_loading: bool? + + def defer_loading=: (bool) -> bool + + def initialize: ( + description: String, + name: String, + parameters: ::Hash[Symbol, top], + ?defer_loading: bool, + ?type: :function + ) -> void + + def to_hash: -> { + description: String, + name: String, + parameters: ::Hash[Symbol, top], + ?type: :function, + ?defer_loading: bool + } + end + + type tool_search = { ?type: :tool_search } + + class ToolSearch < OpenAI::Internal::Type::BaseModel + attr_accessor type: :tool_search + + def initialize: (?type: :tool_search) -> void + + def to_hash: -> { ?type: :tool_search } + end + + type programmatic_tool_calling = + { ?type: :programmatic_tool_calling, ?enabled: bool } + + class ProgrammaticToolCalling < OpenAI::Internal::Type::BaseModel + attr_accessor type: :programmatic_tool_calling + + attr_reader enabled: bool? + + def enabled=: (bool) -> bool + + def initialize: ( + ?enabled: bool, + ?type: :programmatic_tool_calling + ) -> void + + def to_hash: -> { ?type: :programmatic_tool_calling, ?enabled: bool } + end + + type mcp = + { + server_label: String, + transport: OpenAI::Models::Beta::mcp_transport_param, + ?type: :mcp, + ?allowed_tools: ::Array[String]?, + ?connection_origin: OpenAI::Models::Beta::AgentToolParam::Mcp::connection_origin?, + ?credential_id: String?, + ?request_metadata: ::Hash[Symbol, top]?, + ?required: bool + } + + class Mcp < OpenAI::Internal::Type::BaseModel + attr_accessor server_label: String + + attr_accessor transport: OpenAI::Models::Beta::mcp_transport_param + + attr_accessor type: :mcp + + attr_accessor allowed_tools: ::Array[String]? + + attr_accessor connection_origin: OpenAI::Models::Beta::AgentToolParam::Mcp::connection_origin? + + attr_accessor credential_id: String? + + attr_accessor request_metadata: ::Hash[Symbol, top]? + + attr_reader required: bool? + + def required=: (bool) -> bool + + def initialize: ( + server_label: String, + transport: OpenAI::Models::Beta::mcp_transport_param, + ?allowed_tools: ::Array[String]?, + ?connection_origin: OpenAI::Models::Beta::AgentToolParam::Mcp::connection_origin?, + ?credential_id: String?, + ?request_metadata: ::Hash[Symbol, top]?, + ?required: bool, + ?type: :mcp + ) -> void + + def to_hash: -> { + server_label: String, + transport: OpenAI::Models::Beta::mcp_transport_param, + ?type: :mcp, + ?allowed_tools: ::Array[String]?, + ?connection_origin: OpenAI::Models::Beta::AgentToolParam::Mcp::connection_origin?, + ?credential_id: String?, + ?request_metadata: ::Hash[Symbol, top]?, + ?required: bool + } + + type connection_origin = :service | :environment + + module ConnectionOrigin + extend OpenAI::Internal::Type::Enum + + # Uses the Managed Agents service network. + SERVICE: :service + + # Uses the session's execution environment. + ENVIRONMENT: :environment + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentToolParam::Mcp::connection_origin] + end + end + + type web_search = + { + ?type: :web_search, + ?allowed_domains: ::Array[String]?, + ?context_size: OpenAI::Models::Beta::AgentToolParam::WebSearch::context_size?, + ?location: OpenAI::Beta::AgentToolParam::WebSearch::Location?, + ?mode: OpenAI::Models::Beta::AgentToolParam::WebSearch::mode? + } + + class WebSearch < OpenAI::Internal::Type::BaseModel + attr_accessor type: :web_search + + attr_accessor allowed_domains: ::Array[String]? + + attr_accessor context_size: OpenAI::Models::Beta::AgentToolParam::WebSearch::context_size? + + attr_accessor location: OpenAI::Beta::AgentToolParam::WebSearch::Location? + + attr_accessor mode: OpenAI::Models::Beta::AgentToolParam::WebSearch::mode? + + def initialize: ( + ?allowed_domains: ::Array[String]?, + ?context_size: OpenAI::Models::Beta::AgentToolParam::WebSearch::context_size?, + ?location: OpenAI::Beta::AgentToolParam::WebSearch::Location?, + ?mode: OpenAI::Models::Beta::AgentToolParam::WebSearch::mode?, + ?type: :web_search + ) -> void + + def to_hash: -> { + ?type: :web_search, + ?allowed_domains: ::Array[String]?, + ?context_size: OpenAI::Models::Beta::AgentToolParam::WebSearch::context_size?, + ?location: OpenAI::Beta::AgentToolParam::WebSearch::Location?, + ?mode: OpenAI::Models::Beta::AgentToolParam::WebSearch::mode? + } + + type context_size = :low | :medium | :high + + module ContextSize + extend OpenAI::Internal::Type::Enum + + LOW: :low + MEDIUM: :medium + HIGH: :high + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentToolParam::WebSearch::context_size] + end + + type location = + { + ?city: String?, + ?country: String?, + ?region: String?, + ?timezone: String? + } + + class Location < OpenAI::Internal::Type::BaseModel + attr_accessor city: String? + + attr_accessor country: String? + + attr_accessor region: String? + + attr_accessor timezone: String? + + def initialize: ( + ?city: String?, + ?country: String?, + ?region: String?, + ?timezone: String? + ) -> void + + def to_hash: -> { + ?city: String?, + ?country: String?, + ?region: String?, + ?timezone: String? + } + end + + type mode = :disabled | :cached | :live + + module Mode + extend OpenAI::Internal::Type::Enum + + # Disables web search. + DISABLED: :disabled + + # Uses cached search results. + CACHED: :cached + + # Searches the live web. + LIVE: :live + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentToolParam::WebSearch::mode] + end + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::agent_tool_param] + end + end + end +end diff --git a/sig/openai/models/beta/agent_update_params.rbs b/sig/openai/models/beta/agent_update_params.rbs new file mode 100644 index 000000000..6ff1993ba --- /dev/null +++ b/sig/openai/models/beta/agent_update_params.rbs @@ -0,0 +1,98 @@ +module OpenAI + module Models + module Beta + type agent_update_params = + { + agent_id: String, + ?instructions: String?, + ?metadata: ::Hash[Symbol, String]?, + ?model: String, + ?multi_agent: OpenAI::Beta::MultiAgentConfigParam?, + ?name: String?, + ?reasoning: OpenAI::Beta::AgentReasoningParam?, + ?service_tier: OpenAI::Models::Beta::AgentUpdateParams::service_tier?, + ?text: OpenAI::Beta::AgentTextParam?, + ?tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool_param]?, + ?request_options: OpenAI::request_opts + } + + class AgentUpdateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor agent_id: String + + attr_accessor instructions: String? + + attr_accessor metadata: ::Hash[Symbol, String]? + + attr_reader model: String? + + def model=: (String) -> String + + attr_accessor multi_agent: OpenAI::Beta::MultiAgentConfigParam? + + attr_accessor name: String? + + attr_accessor reasoning: OpenAI::Beta::AgentReasoningParam? + + attr_accessor service_tier: OpenAI::Models::Beta::AgentUpdateParams::service_tier? + + attr_accessor text: OpenAI::Beta::AgentTextParam? + + attr_accessor tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool_param]? + + def initialize: ( + agent_id: String, + ?instructions: String?, + ?metadata: ::Hash[Symbol, String]?, + ?model: String, + ?multi_agent: OpenAI::Beta::MultiAgentConfigParam?, + ?name: String?, + ?reasoning: OpenAI::Beta::AgentReasoningParam?, + ?service_tier: OpenAI::Models::Beta::AgentUpdateParams::service_tier?, + ?text: OpenAI::Beta::AgentTextParam?, + ?tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool_param]?, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + agent_id: String, + ?instructions: String?, + ?metadata: ::Hash[Symbol, String]?, + ?model: String, + ?multi_agent: OpenAI::Beta::MultiAgentConfigParam?, + ?name: String?, + ?reasoning: OpenAI::Beta::AgentReasoningParam?, + ?service_tier: OpenAI::Models::Beta::AgentUpdateParams::service_tier?, + ?text: OpenAI::Beta::AgentTextParam?, + ?tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool_param]?, + ?request_options: OpenAI::RequestOptions + } + + type service_tier = :auto | :default | :flex | :priority | :fast + + module ServiceTier + extend OpenAI::Internal::Type::Enum + + # Selects the service tier automatically. + AUTO: :auto + + # Uses the default service tier. + DEFAULT: :default + + # Uses the flex service tier. + FLEX: :flex + + # Uses the priority service tier. + PRIORITY: :priority + + # Uses the fast service tier. + FAST: :fast + + def self?.values: -> ::Array[OpenAI::Models::Beta::AgentUpdateParams::service_tier] + end + end + end + end +end diff --git a/sig/openai/models/beta/agent_wait_for_subagents_call_item.rbs b/sig/openai/models/beta/agent_wait_for_subagents_call_item.rbs new file mode 100644 index 000000000..1a29cb423 --- /dev/null +++ b/sig/openai/models/beta/agent_wait_for_subagents_call_item.rbs @@ -0,0 +1,47 @@ +module OpenAI + module Models + module Beta + type agent_wait_for_subagents_call_item = + { + id: String, + recipient_agent_ids: ::Array[String], + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :wait_for_subagents_call + } + + class AgentWaitForSubagentsCallItem < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor recipient_agent_ids: ::Array[String] + + attr_accessor sender_agent_id: String + + attr_accessor status: OpenAI::Models::Beta::agent_function_call_status + + attr_accessor turn_id: String + + attr_accessor type: :wait_for_subagents_call + + def initialize: ( + id: String, + recipient_agent_ids: ::Array[String], + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :wait_for_subagents_call + ) -> void + + def to_hash: -> { + id: String, + recipient_agent_ids: ::Array[String], + sender_agent_id: String, + status: OpenAI::Models::Beta::agent_function_call_status, + turn_id: String, + ?type: :wait_for_subagents_call + } + end + end + end +end diff --git a/sig/openai/models/beta/agent_web_search_call_item.rbs b/sig/openai/models/beta/agent_web_search_call_item.rbs new file mode 100644 index 000000000..837201114 --- /dev/null +++ b/sig/openai/models/beta/agent_web_search_call_item.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + type agent_web_search_call_item = + { + id: String, + action: OpenAI::Models::Beta::web_search_action?, + status: OpenAI::Models::Beta::agent_output_item_status, + turn_id: String, + ?type: :web_search_call + } + + class AgentWebSearchCallItem < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor action: OpenAI::Models::Beta::web_search_action? + + attr_accessor status: OpenAI::Models::Beta::agent_output_item_status + + attr_accessor turn_id: String + + attr_accessor type: :web_search_call + + def initialize: ( + id: String, + action: OpenAI::Models::Beta::web_search_action?, + status: OpenAI::Models::Beta::agent_output_item_status, + turn_id: String, + ?type: :web_search_call + ) -> void + + def to_hash: -> { + id: String, + action: OpenAI::Models::Beta::web_search_action?, + status: OpenAI::Models::Beta::agent_output_item_status, + turn_id: String, + ?type: :web_search_call + } + end + end + end +end diff --git a/sig/openai/models/beta/agents/environment_info.rbs b/sig/openai/models/beta/agents/environment_info.rbs new file mode 100644 index 000000000..ead6995c4 --- /dev/null +++ b/sig/openai/models/beta/agents/environment_info.rbs @@ -0,0 +1,80 @@ +module OpenAI + module Models + module Beta + module Agents + type environment_info = + { + id: String, + files: ::Array[OpenAI::Models::Beta::hosted_environment_file], + ?object: :"agent.environment", + plugins: ::Array[OpenAI::Beta::HostedPlugin], + skills: ::Array[OpenAI::Models::Beta::hosted_skill], + status: OpenAI::Models::Beta::Agents::EnvironmentInfo::status, + type: OpenAI::Models::Beta::Agents::EnvironmentInfo::type_ + } + + class EnvironmentInfo < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor files: ::Array[OpenAI::Models::Beta::hosted_environment_file] + + attr_accessor object: :"agent.environment" + + attr_accessor plugins: ::Array[OpenAI::Beta::HostedPlugin] + + attr_accessor skills: ::Array[OpenAI::Models::Beta::hosted_skill] + + attr_accessor status: OpenAI::Models::Beta::Agents::EnvironmentInfo::status + + attr_accessor type: OpenAI::Models::Beta::Agents::EnvironmentInfo::type_ + + def initialize: ( + id: String, + files: ::Array[OpenAI::Models::Beta::hosted_environment_file], + plugins: ::Array[OpenAI::Beta::HostedPlugin], + skills: ::Array[OpenAI::Models::Beta::hosted_skill], + status: OpenAI::Models::Beta::Agents::EnvironmentInfo::status, + type: OpenAI::Models::Beta::Agents::EnvironmentInfo::type_, + ?object: :"agent.environment" + ) -> void + + def to_hash: -> { + id: String, + files: ::Array[OpenAI::Models::Beta::hosted_environment_file], + ?object: :"agent.environment", + plugins: ::Array[OpenAI::Beta::HostedPlugin], + skills: ::Array[OpenAI::Models::Beta::hosted_skill], + status: OpenAI::Models::Beta::Agents::EnvironmentInfo::status, + type: OpenAI::Models::Beta::Agents::EnvironmentInfo::type_ + } + + type status = + :pending | :connected | :disconnected | :expired | :failed + + module Status + extend OpenAI::Internal::Type::Enum + + PENDING: :pending + CONNECTED: :connected + DISCONNECTED: :disconnected + EXPIRED: :expired + FAILED: :failed + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::EnvironmentInfo::status] + end + + type type_ = :openai_hosted | :self_hosted + + module Type + extend OpenAI::Internal::Type::Enum + + OPENAI_HOSTED: :openai_hosted + SELF_HOSTED: :self_hosted + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::EnvironmentInfo::type_] + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/environment_retrieve_params.rbs b/sig/openai/models/beta/agents/environment_retrieve_params.rbs new file mode 100644 index 000000000..b0b1e1ca2 --- /dev/null +++ b/sig/openai/models/beta/agents/environment_retrieve_params.rbs @@ -0,0 +1,27 @@ +module OpenAI + module Models + module Beta + module Agents + type environment_retrieve_params = + { environment_id: String, ?request_options: OpenAI::request_opts } + + class EnvironmentRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor environment_id: String + + def initialize: ( + environment_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + environment_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/environments/environment_file.rbs b/sig/openai/models/beta/agents/environments/environment_file.rbs new file mode 100644 index 000000000..6995f30e0 --- /dev/null +++ b/sig/openai/models/beta/agents/environments/environment_file.rbs @@ -0,0 +1,43 @@ +module OpenAI + module Models + module Beta + module Agents + class EnvironmentFile = Environments::EnvironmentFile + + module Environments + type environment_file = + { + environment_id: String, + ?object: :"agent.environment.file", + path: String, + size_bytes: Integer + } + + class EnvironmentFile < OpenAI::Internal::Type::BaseModel + attr_accessor environment_id: String + + attr_accessor object: :"agent.environment.file" + + attr_accessor path: String + + attr_accessor size_bytes: Integer + + def initialize: ( + environment_id: String, + path: String, + size_bytes: Integer, + ?object: :"agent.environment.file" + ) -> void + + def to_hash: -> { + environment_id: String, + ?object: :"agent.environment.file", + path: String, + size_bytes: Integer + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/environments/environment_template.rbs b/sig/openai/models/beta/agents/environments/environment_template.rbs new file mode 100644 index 000000000..b3711331f --- /dev/null +++ b/sig/openai/models/beta/agents/environments/environment_template.rbs @@ -0,0 +1,255 @@ +module OpenAI + module Models + module Beta + module Agents + class EnvironmentTemplate = Environments::EnvironmentTemplate + + module Environments + type environment_template = + { + id: String, + capability_directories: ::Array[String], + created_at: Integer, + files: ::Array[OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::file], + name: String?, + network: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network, + ?object: :"agent.environment.template", + packages: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages, + plugins: ::Array[OpenAI::Beta::HostedPlugin], + skills: ::Array[OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::skill], + updated_at: Integer + } + + class EnvironmentTemplate < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor capability_directories: ::Array[String] + + attr_accessor created_at: Integer + + attr_accessor files: ::Array[OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::file] + + attr_accessor name: String? + + attr_accessor network: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network + + attr_accessor object: :"agent.environment.template" + + attr_accessor packages: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages + + attr_accessor plugins: ::Array[OpenAI::Beta::HostedPlugin] + + attr_accessor skills: ::Array[OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::skill] + + attr_accessor updated_at: Integer + + def initialize: ( + id: String, + capability_directories: ::Array[String], + created_at: Integer, + files: ::Array[OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::file], + name: String?, + network: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network, + packages: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages, + plugins: ::Array[OpenAI::Beta::HostedPlugin], + skills: ::Array[OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::skill], + updated_at: Integer, + ?object: :"agent.environment.template" + ) -> void + + def to_hash: -> { + id: String, + capability_directories: ::Array[String], + created_at: Integer, + files: ::Array[OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::file], + name: String?, + network: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network, + ?object: :"agent.environment.template", + packages: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages, + plugins: ::Array[OpenAI::Beta::HostedPlugin], + skills: ::Array[OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::skill], + updated_at: Integer + } + + type file = + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File::FileID + | OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File::Inline + + module File + extend OpenAI::Internal::Type::Union + + type file_id = { file_id: String, path: String, ?type: :file_id } + + class FileID < OpenAI::Internal::Type::BaseModel + attr_accessor file_id: String + + attr_accessor path: String + + attr_accessor type: :file_id + + def initialize: ( + file_id: String, + path: String, + ?type: :file_id + ) -> void + + def to_hash: -> { + file_id: String, + path: String, + ?type: :file_id + } + end + + type inline = + { path: String, size_bytes: Integer, ?type: :inline } + + class Inline < OpenAI::Internal::Type::BaseModel + attr_accessor path: String + + attr_accessor size_bytes: Integer + + attr_accessor type: :inline + + def initialize: ( + path: String, + size_bytes: Integer, + ?type: :inline + ) -> void + + def to_hash: -> { + path: String, + size_bytes: Integer, + ?type: :inline + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::file] + end + + type network = + { + access: OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Network::access, + allowed_domains: ::Array[String] + } + + class Network < OpenAI::Internal::Type::BaseModel + attr_accessor access: OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Network::access + + attr_accessor allowed_domains: ::Array[String] + + def initialize: ( + access: OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Network::access, + allowed_domains: ::Array[String] + ) -> void + + def to_hash: -> { + access: OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Network::access, + allowed_domains: ::Array[String] + } + + type access = :enabled | :disabled | :restricted + + module Access + extend OpenAI::Internal::Type::Enum + + # Allows unrestricted network access. + ENABLED: :enabled + + # Disables network access. + DISABLED: :disabled + + # Allows access only to configured domains. + RESTRICTED: :restricted + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::Network::access] + end + end + + type packages = + { + npm: ::Array[String], + python: ::Array[String], + system_: ::Array[String] + } + + class Packages < OpenAI::Internal::Type::BaseModel + attr_accessor npm: ::Array[String] + + attr_accessor python: ::Array[String] + + attr_accessor system_: ::Array[String] + + def initialize: ( + npm: ::Array[String], + python: ::Array[String], + system_: ::Array[String] + ) -> void + + def to_hash: -> { + npm: ::Array[String], + python: ::Array[String], + system_: ::Array[String] + } + end + + type skill = + OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill::SkillReference + | OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill::Inline + + module Skill + extend OpenAI::Internal::Type::Union + + type skill_reference = + { skill_id: String, ?type: :skill_reference, version: String? } + + class SkillReference < OpenAI::Internal::Type::BaseModel + attr_accessor skill_id: String + + attr_accessor type: :skill_reference + + attr_accessor version: String? + + def initialize: ( + skill_id: String, + version: String?, + ?type: :skill_reference + ) -> void + + def to_hash: -> { + skill_id: String, + ?type: :skill_reference, + version: String? + } + end + + type inline = + { description: String, name: String, ?type: :inline } + + class Inline < OpenAI::Internal::Type::BaseModel + attr_accessor description: String + + attr_accessor name: String + + attr_accessor type: :inline + + def initialize: ( + description: String, + name: String, + ?type: :inline + ) -> void + + def to_hash: -> { + description: String, + name: String, + ?type: :inline + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::Agents::Environments::EnvironmentTemplate::skill] + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/environments/environment_template_deleted.rbs b/sig/openai/models/beta/agents/environments/environment_template_deleted.rbs new file mode 100644 index 000000000..70a08c6dc --- /dev/null +++ b/sig/openai/models/beta/agents/environments/environment_template_deleted.rbs @@ -0,0 +1,38 @@ +module OpenAI + module Models + module Beta + module Agents + class EnvironmentTemplateDeleted = Environments::EnvironmentTemplateDeleted + + module Environments + type environment_template_deleted = + { + id: String, + deleted: bool, + ?object: :"agent.environment.template.deleted" + } + + class EnvironmentTemplateDeleted < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor deleted: bool + + attr_accessor object: :"agent.environment.template.deleted" + + def initialize: ( + id: String, + deleted: bool, + ?object: :"agent.environment.template.deleted" + ) -> void + + def to_hash: -> { + id: String, + deleted: bool, + ?object: :"agent.environment.template.deleted" + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/environments/file_create_params.rbs b/sig/openai/models/beta/agents/environments/file_create_params.rbs new file mode 100644 index 000000000..88df488da --- /dev/null +++ b/sig/openai/models/beta/agents/environments/file_create_params.rbs @@ -0,0 +1,29 @@ +module OpenAI + module Models + module Beta + module Agents + module Environments + type file_create_params = + { environment_id: String, ?request_options: OpenAI::request_opts } + + class FileCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor environment_id: String + + def initialize: ( + environment_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + environment_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/environments/file_list_params.rbs b/sig/openai/models/beta/agents/environments/file_list_params.rbs new file mode 100644 index 000000000..2646557c6 --- /dev/null +++ b/sig/openai/models/beta/agents/environments/file_list_params.rbs @@ -0,0 +1,72 @@ +module OpenAI + module Models + module Beta + module Agents + module Environments + type file_list_params = + { + environment_id: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::Environments::FileListParams::order, + ?page: String, + ?path: String?, + ?request_options: OpenAI::request_opts + } + + class FileListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor environment_id: String + + attr_accessor limit: Integer? + + attr_reader order: OpenAI::Models::Beta::Agents::Environments::FileListParams::order? + + def order=: ( + OpenAI::Models::Beta::Agents::Environments::FileListParams::order + ) -> OpenAI::Models::Beta::Agents::Environments::FileListParams::order + + attr_reader page: String? + + def page=: (String) -> String + + attr_accessor path: String? + + def initialize: ( + environment_id: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::Environments::FileListParams::order, + ?page: String, + ?path: String?, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + environment_id: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::Environments::FileListParams::order, + ?page: String, + ?path: String?, + ?request_options: OpenAI::RequestOptions + } + + type order = :asc | :desc + + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC: :asc + + # Returns resources in descending order. + DESC: :desc + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Environments::FileListParams::order] + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/environments/template_create_params.rbs b/sig/openai/models/beta/agents/environments/template_create_params.rbs new file mode 100644 index 000000000..83b5cfbba --- /dev/null +++ b/sig/openai/models/beta/agents/environments/template_create_params.rbs @@ -0,0 +1,138 @@ +module OpenAI + module Models + module Beta + module Agents + module Environments + type template_create_params = + { + ?capability_directories: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]?, + ?name: String?, + ?network: OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network?, + ?packages: OpenAI::Beta::Agents::Environments::TemplateCreateParams::Packages?, + ?plugins: ::Array[OpenAI::Beta::HostedPluginParam]?, + ?setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]?, + ?skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]?, + ?request_options: OpenAI::request_opts + } + + class TemplateCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor capability_directories: ::Array[String]? + + attr_accessor env: ::Hash[Symbol, String]? + + attr_accessor files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]? + + attr_accessor name: String? + + attr_accessor network: OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network? + + attr_accessor packages: OpenAI::Beta::Agents::Environments::TemplateCreateParams::Packages? + + attr_accessor plugins: ::Array[OpenAI::Beta::HostedPluginParam]? + + attr_accessor setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]? + + attr_accessor skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]? + + def initialize: ( + ?capability_directories: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]?, + ?name: String?, + ?network: OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network?, + ?packages: OpenAI::Beta::Agents::Environments::TemplateCreateParams::Packages?, + ?plugins: ::Array[OpenAI::Beta::HostedPluginParam]?, + ?setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]?, + ?skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]?, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + ?capability_directories: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]?, + ?name: String?, + ?network: OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network?, + ?packages: OpenAI::Beta::Agents::Environments::TemplateCreateParams::Packages?, + ?plugins: ::Array[OpenAI::Beta::HostedPluginParam]?, + ?setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]?, + ?skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]?, + ?request_options: OpenAI::RequestOptions + } + + type network = + { + access: OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Network::access, + ?allowed_domains: ::Array[String]? + } + + class Network < OpenAI::Internal::Type::BaseModel + attr_accessor access: OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Network::access + + attr_accessor allowed_domains: ::Array[String]? + + def initialize: ( + access: OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Network::access, + ?allowed_domains: ::Array[String]? + ) -> void + + def to_hash: -> { + access: OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Network::access, + ?allowed_domains: ::Array[String]? + } + + type access = :enabled | :disabled | :restricted + + module Access + extend OpenAI::Internal::Type::Enum + + # Allows unrestricted network access, matching an omitted network policy. + ENABLED: :enabled + + # Disables network access. + DISABLED: :disabled + + # Allows access only to configured domains. + RESTRICTED: :restricted + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Environments::TemplateCreateParams::Network::access] + end + end + + type packages = + { + ?npm: ::Array[String]?, + ?python: ::Array[String]?, + ?system_: ::Array[String]? + } + + class Packages < OpenAI::Internal::Type::BaseModel + attr_accessor npm: ::Array[String]? + + attr_accessor python: ::Array[String]? + + attr_accessor system_: ::Array[String]? + + def initialize: ( + ?npm: ::Array[String]?, + ?python: ::Array[String]?, + ?system_: ::Array[String]? + ) -> void + + def to_hash: -> { + ?npm: ::Array[String]?, + ?python: ::Array[String]?, + ?system_: ::Array[String]? + } + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/environments/template_delete_params.rbs b/sig/openai/models/beta/agents/environments/template_delete_params.rbs new file mode 100644 index 000000000..b63acf4d6 --- /dev/null +++ b/sig/openai/models/beta/agents/environments/template_delete_params.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Beta + module Agents + module Environments + type template_delete_params = + { + environment_template_id: String, + ?request_options: OpenAI::request_opts + } + + class TemplateDeleteParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor environment_template_id: String + + def initialize: ( + environment_template_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + environment_template_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/environments/template_list_params.rbs b/sig/openai/models/beta/agents/environments/template_list_params.rbs new file mode 100644 index 000000000..6188fe3c7 --- /dev/null +++ b/sig/openai/models/beta/agents/environments/template_list_params.rbs @@ -0,0 +1,64 @@ +module OpenAI + module Models + module Beta + module Agents + module Environments + type template_list_params = + { + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Environments::TemplateListParams::order, + ?request_options: OpenAI::request_opts + } + + class TemplateListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_reader after: String? + + def after=: (String) -> String + + attr_reader limit: Integer? + + def limit=: (Integer) -> Integer + + attr_reader order: OpenAI::Models::Beta::Agents::Environments::TemplateListParams::order? + + def order=: ( + OpenAI::Models::Beta::Agents::Environments::TemplateListParams::order + ) -> OpenAI::Models::Beta::Agents::Environments::TemplateListParams::order + + def initialize: ( + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Environments::TemplateListParams::order, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Environments::TemplateListParams::order, + ?request_options: OpenAI::RequestOptions + } + + type order = :asc | :desc + + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC: :asc + + # Returns resources in descending order. + DESC: :desc + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Environments::TemplateListParams::order] + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/environments/template_retrieve_params.rbs b/sig/openai/models/beta/agents/environments/template_retrieve_params.rbs new file mode 100644 index 000000000..a24721eaa --- /dev/null +++ b/sig/openai/models/beta/agents/environments/template_retrieve_params.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Beta + module Agents + module Environments + type template_retrieve_params = + { + environment_template_id: String, + ?request_options: OpenAI::request_opts + } + + class TemplateRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor environment_template_id: String + + def initialize: ( + environment_template_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + environment_template_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/environments/template_update_params.rbs b/sig/openai/models/beta/agents/environments/template_update_params.rbs new file mode 100644 index 000000000..690a20d94 --- /dev/null +++ b/sig/openai/models/beta/agents/environments/template_update_params.rbs @@ -0,0 +1,143 @@ +module OpenAI + module Models + module Beta + module Agents + module Environments + type template_update_params = + { + environment_template_id: String, + ?capability_directories: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]?, + ?name: String?, + ?network: OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network?, + ?packages: OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Packages?, + ?plugins: ::Array[OpenAI::Beta::HostedPluginParam]?, + ?setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]?, + ?skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]?, + ?request_options: OpenAI::request_opts + } + + class TemplateUpdateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor environment_template_id: String + + attr_accessor capability_directories: ::Array[String]? + + attr_accessor env: ::Hash[Symbol, String]? + + attr_accessor files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]? + + attr_accessor name: String? + + attr_accessor network: OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network? + + attr_accessor packages: OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Packages? + + attr_accessor plugins: ::Array[OpenAI::Beta::HostedPluginParam]? + + attr_accessor setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]? + + attr_accessor skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]? + + def initialize: ( + environment_template_id: String, + ?capability_directories: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]?, + ?name: String?, + ?network: OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network?, + ?packages: OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Packages?, + ?plugins: ::Array[OpenAI::Beta::HostedPluginParam]?, + ?setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]?, + ?skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]?, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + environment_template_id: String, + ?capability_directories: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]?, + ?name: String?, + ?network: OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network?, + ?packages: OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Packages?, + ?plugins: ::Array[OpenAI::Beta::HostedPluginParam]?, + ?setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]?, + ?skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]?, + ?request_options: OpenAI::RequestOptions + } + + type network = + { + access: OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Network::access, + ?allowed_domains: ::Array[String]? + } + + class Network < OpenAI::Internal::Type::BaseModel + attr_accessor access: OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Network::access + + attr_accessor allowed_domains: ::Array[String]? + + def initialize: ( + access: OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Network::access, + ?allowed_domains: ::Array[String]? + ) -> void + + def to_hash: -> { + access: OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Network::access, + ?allowed_domains: ::Array[String]? + } + + type access = :enabled | :disabled | :restricted + + module Access + extend OpenAI::Internal::Type::Enum + + # Allows unrestricted network access, matching an omitted network policy. + ENABLED: :enabled + + # Disables network access. + DISABLED: :disabled + + # Allows access only to configured domains. + RESTRICTED: :restricted + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Environments::TemplateUpdateParams::Network::access] + end + end + + type packages = + { + ?npm: ::Array[String]?, + ?python: ::Array[String]?, + ?system_: ::Array[String]? + } + + class Packages < OpenAI::Internal::Type::BaseModel + attr_accessor npm: ::Array[String]? + + attr_accessor python: ::Array[String]? + + attr_accessor system_: ::Array[String]? + + def initialize: ( + ?npm: ::Array[String]?, + ?python: ::Array[String]?, + ?system_: ::Array[String]? + ) -> void + + def to_hash: -> { + ?npm: ::Array[String]?, + ?python: ::Array[String]?, + ?system_: ::Array[String]? + } + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/session_create_params.rbs b/sig/openai/models/beta/agents/session_create_params.rbs new file mode 100644 index 000000000..23b450548 --- /dev/null +++ b/sig/openai/models/beta/agents/session_create_params.rbs @@ -0,0 +1,144 @@ +module OpenAI + module Models + module Beta + module Agents + type session_create_params = + { + environment: OpenAI::Models::Beta::environment_param, + ?agent: OpenAI::Beta::Agents::SessionCreateParams::Agent, + ?agent_id: String, + ?input: OpenAI::Models::Beta::Agents::SessionCreateParams::input?, + ?metadata: ::Hash[Symbol, String]?, + ?vault_ids: ::Array[String]?, + ?request_options: OpenAI::request_opts + } + + class SessionCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor environment: OpenAI::Models::Beta::environment_param + + attr_reader agent: OpenAI::Beta::Agents::SessionCreateParams::Agent? + + def agent=: ( + OpenAI::Beta::Agents::SessionCreateParams::Agent + ) -> OpenAI::Beta::Agents::SessionCreateParams::Agent + + attr_reader agent_id: String? + + def agent_id=: (String) -> String + + attr_accessor input: OpenAI::Models::Beta::Agents::SessionCreateParams::input? + + attr_accessor metadata: ::Hash[Symbol, String]? + + attr_accessor vault_ids: ::Array[String]? + + def initialize: ( + environment: OpenAI::Models::Beta::environment_param, + ?agent: OpenAI::Beta::Agents::SessionCreateParams::Agent, + ?agent_id: String, + ?input: OpenAI::Models::Beta::Agents::SessionCreateParams::input?, + ?metadata: ::Hash[Symbol, String]?, + ?vault_ids: ::Array[String]?, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + environment: OpenAI::Models::Beta::environment_param, + ?agent: OpenAI::Beta::Agents::SessionCreateParams::Agent, + ?agent_id: String, + ?input: OpenAI::Models::Beta::Agents::SessionCreateParams::input?, + ?metadata: ::Hash[Symbol, String]?, + ?vault_ids: ::Array[String]?, + ?request_options: OpenAI::RequestOptions + } + + type agent = + { + ?instructions: String?, + ?model: String, + ?multi_agent: OpenAI::Beta::MultiAgentConfigParam?, + ?reasoning: OpenAI::Beta::AgentReasoningParam?, + ?service_tier: OpenAI::Models::Beta::Agents::SessionCreateParams::Agent::service_tier?, + ?text: OpenAI::Beta::AgentTextParam?, + ?tools: ::Array[OpenAI::Models::Beta::agent_tool_param]? + } + + class Agent < OpenAI::Internal::Type::BaseModel + attr_accessor instructions: String? + + attr_reader model: String? + + def model=: (String) -> String + + attr_accessor multi_agent: OpenAI::Beta::MultiAgentConfigParam? + + attr_accessor reasoning: OpenAI::Beta::AgentReasoningParam? + + attr_accessor service_tier: OpenAI::Models::Beta::Agents::SessionCreateParams::Agent::service_tier? + + attr_accessor text: OpenAI::Beta::AgentTextParam? + + attr_accessor tools: ::Array[OpenAI::Models::Beta::agent_tool_param]? + + def initialize: ( + ?instructions: String?, + ?model: String, + ?multi_agent: OpenAI::Beta::MultiAgentConfigParam?, + ?reasoning: OpenAI::Beta::AgentReasoningParam?, + ?service_tier: OpenAI::Models::Beta::Agents::SessionCreateParams::Agent::service_tier?, + ?text: OpenAI::Beta::AgentTextParam?, + ?tools: ::Array[OpenAI::Models::Beta::agent_tool_param]? + ) -> void + + def to_hash: -> { + ?instructions: String?, + ?model: String, + ?multi_agent: OpenAI::Beta::MultiAgentConfigParam?, + ?reasoning: OpenAI::Beta::AgentReasoningParam?, + ?service_tier: OpenAI::Models::Beta::Agents::SessionCreateParams::Agent::service_tier?, + ?text: OpenAI::Beta::AgentTextParam?, + ?tools: ::Array[OpenAI::Models::Beta::agent_tool_param]? + } + + type service_tier = :auto | :default | :flex | :priority | :fast + + module ServiceTier + extend OpenAI::Internal::Type::Enum + + # Selects the service tier automatically. + AUTO: :auto + + # Uses the default service tier. + DEFAULT: :default + + # Uses the flex service tier. + FLEX: :flex + + # Uses the priority service tier. + PRIORITY: :priority + + # Uses the fast service tier. + FAST: :fast + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::SessionCreateParams::Agent::service_tier] + end + end + + type input = + String | ::Array[OpenAI::Beta::AgentSessionInputMessageParam] + + module Input + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Beta::Agents::SessionCreateParams::input] + + AgentSessionInputMessageParamArray: OpenAI::Internal::Type::Converter + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/session_delete_params.rbs b/sig/openai/models/beta/agents/session_delete_params.rbs new file mode 100644 index 000000000..8f668b7b9 --- /dev/null +++ b/sig/openai/models/beta/agents/session_delete_params.rbs @@ -0,0 +1,27 @@ +module OpenAI + module Models + module Beta + module Agents + type session_delete_params = + { session_id: String, ?request_options: OpenAI::request_opts } + + class SessionDeleteParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + def initialize: ( + session_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/session_list_params.rbs b/sig/openai/models/beta/agents/session_list_params.rbs new file mode 100644 index 000000000..7d9718cfb --- /dev/null +++ b/sig/openai/models/beta/agents/session_list_params.rbs @@ -0,0 +1,67 @@ +module OpenAI + module Models + module Beta + module Agents + type session_list_params = + { + ?after: String, + ?agent_id: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::SessionListParams::order, + ?request_options: OpenAI::request_opts + } + + class SessionListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_reader after: String? + + def after=: (String) -> String + + attr_reader agent_id: String? + + def agent_id=: (String) -> String + + attr_accessor limit: Integer? + + attr_reader order: OpenAI::Models::Beta::Agents::SessionListParams::order? + + def order=: ( + OpenAI::Models::Beta::Agents::SessionListParams::order + ) -> OpenAI::Models::Beta::Agents::SessionListParams::order + + def initialize: ( + ?after: String, + ?agent_id: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::SessionListParams::order, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + ?after: String, + ?agent_id: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::SessionListParams::order, + ?request_options: OpenAI::RequestOptions + } + + type order = :asc | :desc + + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC: :asc + + # Returns resources in descending order. + DESC: :desc + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::SessionListParams::order] + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/session_retrieve_params.rbs b/sig/openai/models/beta/agents/session_retrieve_params.rbs new file mode 100644 index 000000000..eadb3a612 --- /dev/null +++ b/sig/openai/models/beta/agents/session_retrieve_params.rbs @@ -0,0 +1,27 @@ +module OpenAI + module Models + module Beta + module Agents + type session_retrieve_params = + { session_id: String, ?request_options: OpenAI::request_opts } + + class SessionRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + def initialize: ( + session_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/session_update_params.rbs b/sig/openai/models/beta/agents/session_update_params.rbs new file mode 100644 index 000000000..2948d824b --- /dev/null +++ b/sig/openai/models/beta/agents/session_update_params.rbs @@ -0,0 +1,35 @@ +module OpenAI + module Models + module Beta + module Agents + type session_update_params = + { + session_id: String, + ?metadata: ::Hash[Symbol, String]?, + ?request_options: OpenAI::request_opts + } + + class SessionUpdateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor metadata: ::Hash[Symbol, String]? + + def initialize: ( + session_id: String, + ?metadata: ::Hash[Symbol, String]?, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + ?metadata: ::Hash[Symbol, String]?, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/artifact_content_params.rbs b/sig/openai/models/beta/agents/sessions/artifact_content_params.rbs new file mode 100644 index 000000000..f40a65ba7 --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/artifact_content_params.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + type artifact_content_params = + { + session_id: String, + artifact_id: String, + ?request_options: OpenAI::request_opts + } + + class ArtifactContentParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor artifact_id: String + + def initialize: ( + session_id: String, + artifact_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + artifact_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/artifact_delete_params.rbs b/sig/openai/models/beta/agents/sessions/artifact_delete_params.rbs new file mode 100644 index 000000000..574761b85 --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/artifact_delete_params.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + type artifact_delete_params = + { + session_id: String, + artifact_id: String, + ?request_options: OpenAI::request_opts + } + + class ArtifactDeleteParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor artifact_id: String + + def initialize: ( + session_id: String, + artifact_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + artifact_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/artifact_list_params.rbs b/sig/openai/models/beta/agents/sessions/artifact_list_params.rbs new file mode 100644 index 000000000..e2516905e --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/artifact_list_params.rbs @@ -0,0 +1,70 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + type artifact_list_params = + { + session_id: String, + ?after: String?, + ?environment_id: String?, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::Sessions::ArtifactListParams::order, + ?request_options: OpenAI::request_opts + } + + class ArtifactListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor after: String? + + attr_accessor environment_id: String? + + attr_accessor limit: Integer? + + attr_reader order: OpenAI::Models::Beta::Agents::Sessions::ArtifactListParams::order? + + def order=: ( + OpenAI::Models::Beta::Agents::Sessions::ArtifactListParams::order + ) -> OpenAI::Models::Beta::Agents::Sessions::ArtifactListParams::order + + def initialize: ( + session_id: String, + ?after: String?, + ?environment_id: String?, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::Sessions::ArtifactListParams::order, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + ?after: String?, + ?environment_id: String?, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::Sessions::ArtifactListParams::order, + ?request_options: OpenAI::RequestOptions + } + + type order = :asc | :desc + + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC: :asc + + # Returns resources in descending order. + DESC: :desc + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Sessions::ArtifactListParams::order] + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/artifact_retrieve_params.rbs b/sig/openai/models/beta/agents/sessions/artifact_retrieve_params.rbs new file mode 100644 index 000000000..71ae0bbf0 --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/artifact_retrieve_params.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + type artifact_retrieve_params = + { + session_id: String, + artifact_id: String, + ?request_options: OpenAI::request_opts + } + + class ArtifactRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor artifact_id: String + + def initialize: ( + session_id: String, + artifact_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + artifact_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/event_create_params.rbs b/sig/openai/models/beta/agents/sessions/event_create_params.rbs new file mode 100644 index 000000000..bfb7d763e --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/event_create_params.rbs @@ -0,0 +1,44 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + type event_create_params = + { + session_id: String, + events: ::Array[OpenAI::Models::Beta::agent_session_input_param], + ?idempotency_key: String, + ?request_options: OpenAI::request_opts + } + + class EventCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor events: ::Array[OpenAI::Models::Beta::agent_session_input_param] + + attr_reader idempotency_key: String? + + def idempotency_key=: (String) -> String + + def initialize: ( + session_id: String, + events: ::Array[OpenAI::Models::Beta::agent_session_input_param], + ?idempotency_key: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + events: ::Array[OpenAI::Models::Beta::agent_session_input_param], + ?idempotency_key: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/event_stream_params.rbs b/sig/openai/models/beta/agents/sessions/event_stream_params.rbs new file mode 100644 index 000000000..2f9c4a341 --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/event_stream_params.rbs @@ -0,0 +1,29 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + type event_stream_params = + { session_id: String, ?request_options: OpenAI::request_opts } + + class EventStreamParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + def initialize: ( + session_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/item_list_params.rbs b/sig/openai/models/beta/agents/sessions/item_list_params.rbs new file mode 100644 index 000000000..def826107 --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/item_list_params.rbs @@ -0,0 +1,69 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + type item_list_params = + { + session_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::ItemListParams::order, + ?request_options: OpenAI::request_opts + } + + class ItemListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_reader after: String? + + def after=: (String) -> String + + attr_reader limit: Integer? + + def limit=: (Integer) -> Integer + + attr_reader order: OpenAI::Models::Beta::Agents::Sessions::ItemListParams::order? + + def order=: ( + OpenAI::Models::Beta::Agents::Sessions::ItemListParams::order + ) -> OpenAI::Models::Beta::Agents::Sessions::ItemListParams::order + + def initialize: ( + session_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::ItemListParams::order, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::ItemListParams::order, + ?request_options: OpenAI::RequestOptions + } + + type order = :asc | :desc + + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC: :asc + + # Returns resources in descending order. + DESC: :desc + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Sessions::ItemListParams::order] + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/session_artifact.rbs b/sig/openai/models/beta/agents/sessions/session_artifact.rbs new file mode 100644 index 000000000..5ebd95131 --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/session_artifact.rbs @@ -0,0 +1,63 @@ +module OpenAI + module Models + module Beta + module Agents + class SessionArtifact = Sessions::SessionArtifact + + module Sessions + type session_artifact = + { + id: String, + created_at: Integer, + environment_id: String, + ?object: :"agent.session.artifact", + path: String, + session_id: String, + size_bytes: Integer, + turn_id: String + } + + class SessionArtifact < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created_at: Integer + + attr_accessor environment_id: String + + attr_accessor object: :"agent.session.artifact" + + attr_accessor path: String + + attr_accessor session_id: String + + attr_accessor size_bytes: Integer + + attr_accessor turn_id: String + + def initialize: ( + id: String, + created_at: Integer, + environment_id: String, + path: String, + session_id: String, + size_bytes: Integer, + turn_id: String, + ?object: :"agent.session.artifact" + ) -> void + + def to_hash: -> { + id: String, + created_at: Integer, + environment_id: String, + ?object: :"agent.session.artifact", + path: String, + session_id: String, + size_bytes: Integer, + turn_id: String + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/session_artifact_deleted.rbs b/sig/openai/models/beta/agents/sessions/session_artifact_deleted.rbs new file mode 100644 index 000000000..a4e3d6eaf --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/session_artifact_deleted.rbs @@ -0,0 +1,38 @@ +module OpenAI + module Models + module Beta + module Agents + class SessionArtifactDeleted = Sessions::SessionArtifactDeleted + + module Sessions + type session_artifact_deleted = + { + id: String, + deleted: bool, + ?object: :"agent.session.artifact.deleted" + } + + class SessionArtifactDeleted < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor deleted: bool + + attr_accessor object: :"agent.session.artifact.deleted" + + def initialize: ( + id: String, + deleted: bool, + ?object: :"agent.session.artifact.deleted" + ) -> void + + def to_hash: -> { + id: String, + deleted: bool, + ?object: :"agent.session.artifact.deleted" + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/subagent_list_params.rbs b/sig/openai/models/beta/agents/sessions/subagent_list_params.rbs new file mode 100644 index 000000000..898d727c0 --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/subagent_list_params.rbs @@ -0,0 +1,69 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + type subagent_list_params = + { + session_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::SubagentListParams::order, + ?request_options: OpenAI::request_opts + } + + class SubagentListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_reader after: String? + + def after=: (String) -> String + + attr_reader limit: Integer? + + def limit=: (Integer) -> Integer + + attr_reader order: OpenAI::Models::Beta::Agents::Sessions::SubagentListParams::order? + + def order=: ( + OpenAI::Models::Beta::Agents::Sessions::SubagentListParams::order + ) -> OpenAI::Models::Beta::Agents::Sessions::SubagentListParams::order + + def initialize: ( + session_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::SubagentListParams::order, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::SubagentListParams::order, + ?request_options: OpenAI::RequestOptions + } + + type order = :asc | :desc + + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC: :asc + + # Returns resources in descending order. + DESC: :desc + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Sessions::SubagentListParams::order] + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/subagent_retrieve_params.rbs b/sig/openai/models/beta/agents/sessions/subagent_retrieve_params.rbs new file mode 100644 index 000000000..f6666d280 --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/subagent_retrieve_params.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + type subagent_retrieve_params = + { + session_id: String, + subagent_id: String, + ?request_options: OpenAI::request_opts + } + + class SubagentRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor subagent_id: String + + def initialize: ( + session_id: String, + subagent_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + subagent_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/subagents/item_list_params.rbs b/sig/openai/models/beta/agents/sessions/subagents/item_list_params.rbs new file mode 100644 index 000000000..2c0f87297 --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/subagents/item_list_params.rbs @@ -0,0 +1,76 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + module Subagents + type item_list_params = + { + session_id: String, + subagent_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::Subagents::ItemListParams::order, + ?request_options: OpenAI::request_opts + } + + class ItemListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor subagent_id: String + + attr_reader after: String? + + def after=: (String) -> String + + attr_reader limit: Integer? + + def limit=: (Integer) -> Integer + + attr_reader order: OpenAI::Models::Beta::Agents::Sessions::Subagents::ItemListParams::order? + + def order=: ( + OpenAI::Models::Beta::Agents::Sessions::Subagents::ItemListParams::order + ) -> OpenAI::Models::Beta::Agents::Sessions::Subagents::ItemListParams::order + + def initialize: ( + session_id: String, + subagent_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::Subagents::ItemListParams::order, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + subagent_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::Subagents::ItemListParams::order, + ?request_options: OpenAI::RequestOptions + } + + type order = :asc | :desc + + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC: :asc + + # Returns resources in descending order. + DESC: :desc + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Sessions::Subagents::ItemListParams::order] + end + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/subagents/turn_list_params.rbs b/sig/openai/models/beta/agents/sessions/subagents/turn_list_params.rbs new file mode 100644 index 000000000..d1bff2c0d --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/subagents/turn_list_params.rbs @@ -0,0 +1,76 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + module Subagents + type turn_list_params = + { + session_id: String, + subagent_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::Subagents::TurnListParams::order, + ?request_options: OpenAI::request_opts + } + + class TurnListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor subagent_id: String + + attr_reader after: String? + + def after=: (String) -> String + + attr_reader limit: Integer? + + def limit=: (Integer) -> Integer + + attr_reader order: OpenAI::Models::Beta::Agents::Sessions::Subagents::TurnListParams::order? + + def order=: ( + OpenAI::Models::Beta::Agents::Sessions::Subagents::TurnListParams::order + ) -> OpenAI::Models::Beta::Agents::Sessions::Subagents::TurnListParams::order + + def initialize: ( + session_id: String, + subagent_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::Subagents::TurnListParams::order, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + subagent_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::Subagents::TurnListParams::order, + ?request_options: OpenAI::RequestOptions + } + + type order = :asc | :desc + + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC: :asc + + # Returns resources in descending order. + DESC: :desc + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Sessions::Subagents::TurnListParams::order] + end + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/subagents/turn_retrieve_params.rbs b/sig/openai/models/beta/agents/sessions/subagents/turn_retrieve_params.rbs new file mode 100644 index 000000000..d89b6021d --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/subagents/turn_retrieve_params.rbs @@ -0,0 +1,44 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + module Subagents + type turn_retrieve_params = + { + session_id: String, + subagent_id: String, + turn_id: String, + ?request_options: OpenAI::request_opts + } + + class TurnRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor subagent_id: String + + attr_accessor turn_id: String + + def initialize: ( + session_id: String, + subagent_id: String, + turn_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + subagent_id: String, + turn_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/subagents/turns/item_list_params.rbs b/sig/openai/models/beta/agents/sessions/subagents/turns/item_list_params.rbs new file mode 100644 index 000000000..05ebb7c6f --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/subagents/turns/item_list_params.rbs @@ -0,0 +1,83 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + module Subagents + module Turns + type item_list_params = + { + session_id: String, + subagent_id: String, + turn_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::order, + ?request_options: OpenAI::request_opts + } + + class ItemListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor subagent_id: String + + attr_accessor turn_id: String + + attr_reader after: String? + + def after=: (String) -> String + + attr_reader limit: Integer? + + def limit=: (Integer) -> Integer + + attr_reader order: OpenAI::Models::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::order? + + def order=: ( + OpenAI::Models::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::order + ) -> OpenAI::Models::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::order + + def initialize: ( + session_id: String, + subagent_id: String, + turn_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::order, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + subagent_id: String, + turn_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::order, + ?request_options: OpenAI::RequestOptions + } + + type order = :asc | :desc + + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC: :asc + + # Returns resources in descending order. + DESC: :desc + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::order] + end + end + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/turn.rbs b/sig/openai/models/beta/agents/sessions/turn.rbs new file mode 100644 index 000000000..3b36e5271 --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/turn.rbs @@ -0,0 +1,108 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + type turn = + { + id: String, + agent_id: String, + completed_at: Integer?, + created_at: Integer, + error: OpenAI::Beta::SessionTurnError?, + ?object: :"agent.session.turn", + session_id: String, + started_at: Integer?, + status: OpenAI::Models::Beta::Agents::Sessions::Turn::status, + subagent_id: String?, + usage: OpenAI::Beta::TokenUsage? + } + + class Turn < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor agent_id: String + + attr_accessor completed_at: Integer? + + attr_accessor created_at: Integer + + attr_accessor error: OpenAI::Beta::SessionTurnError? + + attr_accessor object: :"agent.session.turn" + + attr_accessor session_id: String + + attr_accessor started_at: Integer? + + attr_accessor status: OpenAI::Models::Beta::Agents::Sessions::Turn::status + + attr_accessor subagent_id: String? + + attr_accessor usage: OpenAI::Beta::TokenUsage? + + def initialize: ( + id: String, + agent_id: String, + completed_at: Integer?, + created_at: Integer, + error: OpenAI::Beta::SessionTurnError?, + session_id: String, + started_at: Integer?, + status: OpenAI::Models::Beta::Agents::Sessions::Turn::status, + subagent_id: String?, + usage: OpenAI::Beta::TokenUsage?, + ?object: :"agent.session.turn" + ) -> void + + def to_hash: -> { + id: String, + agent_id: String, + completed_at: Integer?, + created_at: Integer, + error: OpenAI::Beta::SessionTurnError?, + ?object: :"agent.session.turn", + session_id: String, + started_at: Integer?, + status: OpenAI::Models::Beta::Agents::Sessions::Turn::status, + subagent_id: String?, + usage: OpenAI::Beta::TokenUsage? + } + + type status = + :queued + | :in_progress + | :waiting + | :completed + | :failed + | :cancelled + + module Status + extend OpenAI::Internal::Type::Enum + + # The turn is waiting to start. + QUEUED: :queued + + # The turn is in progress. + IN_PROGRESS: :in_progress + + # The turn is waiting for external input. + WAITING: :waiting + + # The turn completed successfully. + COMPLETED: :completed + + # The turn failed. + FAILED: :failed + + # The turn was cancelled. + CANCELLED: :cancelled + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Sessions::Turn::status] + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/turn_list_params.rbs b/sig/openai/models/beta/agents/sessions/turn_list_params.rbs new file mode 100644 index 000000000..48b89fec7 --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/turn_list_params.rbs @@ -0,0 +1,69 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + type turn_list_params = + { + session_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::TurnListParams::order, + ?request_options: OpenAI::request_opts + } + + class TurnListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_reader after: String? + + def after=: (String) -> String + + attr_reader limit: Integer? + + def limit=: (Integer) -> Integer + + attr_reader order: OpenAI::Models::Beta::Agents::Sessions::TurnListParams::order? + + def order=: ( + OpenAI::Models::Beta::Agents::Sessions::TurnListParams::order + ) -> OpenAI::Models::Beta::Agents::Sessions::TurnListParams::order + + def initialize: ( + session_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::TurnListParams::order, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::TurnListParams::order, + ?request_options: OpenAI::RequestOptions + } + + type order = :asc | :desc + + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC: :asc + + # Returns resources in descending order. + DESC: :desc + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Sessions::TurnListParams::order] + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/sessions/turn_retrieve_params.rbs b/sig/openai/models/beta/agents/sessions/turn_retrieve_params.rbs new file mode 100644 index 000000000..0864efe53 --- /dev/null +++ b/sig/openai/models/beta/agents/sessions/turn_retrieve_params.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Beta + module Agents + module Sessions + type turn_retrieve_params = + { + session_id: String, + turn_id: String, + ?request_options: OpenAI::request_opts + } + + class TurnRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor session_id: String + + attr_accessor turn_id: String + + def initialize: ( + session_id: String, + turn_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + session_id: String, + turn_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vault.rbs b/sig/openai/models/beta/agents/vault.rbs new file mode 100644 index 000000000..b78a74cac --- /dev/null +++ b/sig/openai/models/beta/agents/vault.rbs @@ -0,0 +1,44 @@ +module OpenAI + module Models + module Beta + module Agents + type vault = + { + id: String, + created_at: Integer, + metadata: ::Hash[Symbol, String], + name: String?, + ?object: :vault + } + + class Vault < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created_at: Integer + + attr_accessor metadata: ::Hash[Symbol, String] + + attr_accessor name: String? + + attr_accessor object: :vault + + def initialize: ( + id: String, + created_at: Integer, + metadata: ::Hash[Symbol, String], + name: String?, + ?object: :vault + ) -> void + + def to_hash: -> { + id: String, + created_at: Integer, + metadata: ::Hash[Symbol, String], + name: String?, + ?object: :vault + } + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vault_create_params.rbs b/sig/openai/models/beta/agents/vault_create_params.rbs new file mode 100644 index 000000000..04dd5191f --- /dev/null +++ b/sig/openai/models/beta/agents/vault_create_params.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Beta + module Agents + type vault_create_params = + { + ?metadata: ::Hash[Symbol, String]?, + ?name: String, + ?request_options: OpenAI::request_opts + } + + class VaultCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor metadata: ::Hash[Symbol, String]? + + attr_reader name: String? + + def name=: (String) -> String + + def initialize: ( + ?metadata: ::Hash[Symbol, String]?, + ?name: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + ?metadata: ::Hash[Symbol, String]?, + ?name: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vault_delete_params.rbs b/sig/openai/models/beta/agents/vault_delete_params.rbs new file mode 100644 index 000000000..30fee81c9 --- /dev/null +++ b/sig/openai/models/beta/agents/vault_delete_params.rbs @@ -0,0 +1,27 @@ +module OpenAI + module Models + module Beta + module Agents + type vault_delete_params = + { vault_id: String, ?request_options: OpenAI::request_opts } + + class VaultDeleteParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor vault_id: String + + def initialize: ( + vault_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + vault_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vault_deleted.rbs b/sig/openai/models/beta/agents/vault_deleted.rbs new file mode 100644 index 000000000..02b8ae24c --- /dev/null +++ b/sig/openai/models/beta/agents/vault_deleted.rbs @@ -0,0 +1,30 @@ +module OpenAI + module Models + module Beta + module Agents + type vault_deleted = + { id: String, deleted: bool, ?object: :"vault.deleted" } + + class VaultDeleted < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor deleted: bool + + attr_accessor object: :"vault.deleted" + + def initialize: ( + id: String, + deleted: bool, + ?object: :"vault.deleted" + ) -> void + + def to_hash: -> { + id: String, + deleted: bool, + ?object: :"vault.deleted" + } + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vault_list_params.rbs b/sig/openai/models/beta/agents/vault_list_params.rbs new file mode 100644 index 000000000..bfd23a6be --- /dev/null +++ b/sig/openai/models/beta/agents/vault_list_params.rbs @@ -0,0 +1,69 @@ +module OpenAI + module Models + module Beta + module Agents + type vault_list_params = + { + ?after: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::VaultListParams::order, + ?status: OpenAI::Models::Beta::Agents::vault_status_filter, + ?request_options: OpenAI::request_opts + } + + class VaultListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_reader after: String? + + def after=: (String) -> String + + attr_accessor limit: Integer? + + attr_reader order: OpenAI::Models::Beta::Agents::VaultListParams::order? + + def order=: ( + OpenAI::Models::Beta::Agents::VaultListParams::order + ) -> OpenAI::Models::Beta::Agents::VaultListParams::order + + attr_reader status: OpenAI::Models::Beta::Agents::vault_status_filter? + + def status=: ( + OpenAI::Models::Beta::Agents::vault_status_filter + ) -> OpenAI::Models::Beta::Agents::vault_status_filter + + def initialize: ( + ?after: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::VaultListParams::order, + ?status: OpenAI::Models::Beta::Agents::vault_status_filter, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + ?after: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::VaultListParams::order, + ?status: OpenAI::Models::Beta::Agents::vault_status_filter, + ?request_options: OpenAI::RequestOptions + } + + type order = :asc | :desc + + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC: :asc + + # Returns resources in descending order. + DESC: :desc + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::VaultListParams::order] + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vault_retrieve_params.rbs b/sig/openai/models/beta/agents/vault_retrieve_params.rbs new file mode 100644 index 000000000..1f8ed5992 --- /dev/null +++ b/sig/openai/models/beta/agents/vault_retrieve_params.rbs @@ -0,0 +1,27 @@ +module OpenAI + module Models + module Beta + module Agents + type vault_retrieve_params = + { vault_id: String, ?request_options: OpenAI::request_opts } + + class VaultRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor vault_id: String + + def initialize: ( + vault_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + vault_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vault_status.rbs b/sig/openai/models/beta/agents/vault_status.rbs new file mode 100644 index 000000000..2331afd9c --- /dev/null +++ b/sig/openai/models/beta/agents/vault_status.rbs @@ -0,0 +1,18 @@ +module OpenAI + module Models + module Beta + module Agents + type vault_status = :active | :archived + + module VaultStatus + extend OpenAI::Internal::Type::Enum + + ACTIVE: :active + ARCHIVED: :archived + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::vault_status] + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vault_status_filter.rbs b/sig/openai/models/beta/agents/vault_status_filter.rbs new file mode 100644 index 000000000..667b25c47 --- /dev/null +++ b/sig/openai/models/beta/agents/vault_status_filter.rbs @@ -0,0 +1,19 @@ +module OpenAI + module Models + module Beta + module Agents + type vault_status_filter = + OpenAI::Models::Beta::Agents::vault_status + | ::Array[OpenAI::Models::Beta::Agents::vault_status] + + module VaultStatusFilter + extend OpenAI::Internal::Type::Union + + def self?.variants: -> ::Array[OpenAI::Models::Beta::Agents::vault_status_filter] + + VaultStatusArray: OpenAI::Internal::Type::Converter + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vaults/credential.rbs b/sig/openai/models/beta/agents/vaults/credential.rbs new file mode 100644 index 000000000..7f863f558 --- /dev/null +++ b/sig/openai/models/beta/agents/vaults/credential.rbs @@ -0,0 +1,56 @@ +module OpenAI + module Models + module Beta + module Agents + module Vaults + type credential = + { + id: String, + auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth, + created_at: Integer, + name: String, + ?object: :"vault.credential", + updated_at: Integer, + vault_id: String + } + + class Credential < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth + + attr_accessor created_at: Integer + + attr_accessor name: String + + attr_accessor object: :"vault.credential" + + attr_accessor updated_at: Integer + + attr_accessor vault_id: String + + def initialize: ( + id: String, + auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth, + created_at: Integer, + name: String, + updated_at: Integer, + vault_id: String, + ?object: :"vault.credential" + ) -> void + + def to_hash: -> { + id: String, + auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth, + created_at: Integer, + name: String, + ?object: :"vault.credential", + updated_at: Integer, + vault_id: String + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vaults/credential_auth.rbs b/sig/openai/models/beta/agents/vaults/credential_auth.rbs new file mode 100644 index 000000000..ee59d5c6b --- /dev/null +++ b/sig/openai/models/beta/agents/vaults/credential_auth.rbs @@ -0,0 +1,104 @@ +module OpenAI + module Models + module Beta + module Agents + module Vaults + type credential_auth = + OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth + | OpenAI::Beta::Agents::Vaults::CredentialAuth::StaticBearer + + module CredentialAuth + extend OpenAI::Internal::Type::Union + + type mcp_oauth = + { + expires_at: String?, + mcp_server_url: String, + refresh: OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth::Refresh?, + ?type: :mcp_oauth + } + + class McpOauth < OpenAI::Internal::Type::BaseModel + attr_accessor expires_at: String? + + attr_accessor mcp_server_url: String + + attr_accessor refresh: OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth::Refresh? + + attr_accessor type: :mcp_oauth + + def initialize: ( + expires_at: String?, + mcp_server_url: String, + refresh: OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth::Refresh?, + ?type: :mcp_oauth + ) -> void + + def to_hash: -> { + expires_at: String?, + mcp_server_url: String, + refresh: OpenAI::Beta::Agents::Vaults::CredentialAuth::McpOauth::Refresh?, + ?type: :mcp_oauth + } + + type refresh = + { + client_id: String, + resource: String?, + scope: String?, + token_endpoint: String, + token_endpoint_auth: OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth + } + + class Refresh < OpenAI::Internal::Type::BaseModel + attr_accessor client_id: String + + attr_accessor resource: String? + + attr_accessor scope: String? + + attr_accessor token_endpoint: String + + attr_accessor token_endpoint_auth: OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth + + def initialize: ( + client_id: String, + resource: String?, + scope: String?, + token_endpoint: String, + token_endpoint_auth: OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth + ) -> void + + def to_hash: -> { + client_id: String, + resource: String?, + scope: String?, + token_endpoint: String, + token_endpoint_auth: OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth + } + end + end + + type static_bearer = + { mcp_server_url: String, ?type: :static_bearer } + + class StaticBearer < OpenAI::Internal::Type::BaseModel + attr_accessor mcp_server_url: String + + attr_accessor type: :static_bearer + + def initialize: ( + mcp_server_url: String, + ?type: :static_bearer + ) -> void + + def to_hash: -> { mcp_server_url: String, ?type: :static_bearer } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::Agents::Vaults::credential_auth] + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vaults/credential_auth_create_param.rbs b/sig/openai/models/beta/agents/vaults/credential_auth_create_param.rbs new file mode 100644 index 000000000..3533b35a7 --- /dev/null +++ b/sig/openai/models/beta/agents/vaults/credential_auth_create_param.rbs @@ -0,0 +1,121 @@ +module OpenAI + module Models + module Beta + module Agents + module Vaults + type credential_auth_create_param = + OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth + | OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::StaticBearer + + module CredentialAuthCreateParam + extend OpenAI::Internal::Type::Union + + type mcp_oauth = + { + access_token: String, + mcp_server_url: String, + ?type: :mcp_oauth, + ?expires_at: String?, + ?refresh: OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::Refresh? + } + + class McpOauth < OpenAI::Internal::Type::BaseModel + attr_accessor access_token: String + + attr_accessor mcp_server_url: String + + attr_accessor type: :mcp_oauth + + attr_accessor expires_at: String? + + attr_accessor refresh: OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::Refresh? + + def initialize: ( + access_token: String, + mcp_server_url: String, + ?expires_at: String?, + ?refresh: OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::Refresh?, + ?type: :mcp_oauth + ) -> void + + def to_hash: -> { + access_token: String, + mcp_server_url: String, + ?type: :mcp_oauth, + ?expires_at: String?, + ?refresh: OpenAI::Beta::Agents::Vaults::CredentialAuthCreateParam::McpOauth::Refresh? + } + + type refresh = + { + client_id: String, + refresh_token: String, + token_endpoint: String, + token_endpoint_auth: OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth_create_param, + ?resource: String?, + ?scope: String? + } + + class Refresh < OpenAI::Internal::Type::BaseModel + attr_accessor client_id: String + + attr_accessor refresh_token: String + + attr_accessor token_endpoint: String + + attr_accessor token_endpoint_auth: OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth_create_param + + attr_accessor resource: String? + + attr_accessor scope: String? + + def initialize: ( + client_id: String, + refresh_token: String, + token_endpoint: String, + token_endpoint_auth: OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth_create_param, + ?resource: String?, + ?scope: String? + ) -> void + + def to_hash: -> { + client_id: String, + refresh_token: String, + token_endpoint: String, + token_endpoint_auth: OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth_create_param, + ?resource: String?, + ?scope: String? + } + end + end + + type static_bearer = + { token: String, mcp_server_url: String, ?type: :static_bearer } + + class StaticBearer < OpenAI::Internal::Type::BaseModel + attr_accessor token: String + + attr_accessor mcp_server_url: String + + attr_accessor type: :static_bearer + + def initialize: ( + token: String, + mcp_server_url: String, + ?type: :static_bearer + ) -> void + + def to_hash: -> { + token: String, + mcp_server_url: String, + ?type: :static_bearer + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::Agents::Vaults::credential_auth_create_param] + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vaults/credential_auth_rotate_param.rbs b/sig/openai/models/beta/agents/vaults/credential_auth_rotate_param.rbs new file mode 100644 index 000000000..10c65f05f --- /dev/null +++ b/sig/openai/models/beta/agents/vaults/credential_auth_rotate_param.rbs @@ -0,0 +1,90 @@ +module OpenAI + module Models + module Beta + module Agents + module Vaults + type credential_auth_rotate_param = + OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth + | OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::StaticBearer + + module CredentialAuthRotateParam + extend OpenAI::Internal::Type::Union + + type mcp_oauth = + { + ?type: :mcp_oauth, + ?access_token: String?, + ?expires_at: String?, + ?refresh: OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::Refresh? + } + + class McpOauth < OpenAI::Internal::Type::BaseModel + attr_accessor type: :mcp_oauth + + attr_accessor access_token: String? + + attr_accessor expires_at: String? + + attr_accessor refresh: OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::Refresh? + + def initialize: ( + ?access_token: String?, + ?expires_at: String?, + ?refresh: OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::Refresh?, + ?type: :mcp_oauth + ) -> void + + def to_hash: -> { + ?type: :mcp_oauth, + ?access_token: String?, + ?expires_at: String?, + ?refresh: OpenAI::Beta::Agents::Vaults::CredentialAuthRotateParam::McpOauth::Refresh? + } + + type refresh = + { + ?refresh_token: String?, + ?scope: String?, + ?token_endpoint_auth: OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth_rotate_param? + } + + class Refresh < OpenAI::Internal::Type::BaseModel + attr_accessor refresh_token: String? + + attr_accessor scope: String? + + attr_accessor token_endpoint_auth: OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth_rotate_param? + + def initialize: ( + ?refresh_token: String?, + ?scope: String?, + ?token_endpoint_auth: OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth_rotate_param? + ) -> void + + def to_hash: -> { + ?refresh_token: String?, + ?scope: String?, + ?token_endpoint_auth: OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth_rotate_param? + } + end + end + + type static_bearer = { token: String, ?type: :static_bearer } + + class StaticBearer < OpenAI::Internal::Type::BaseModel + attr_accessor token: String + + attr_accessor type: :static_bearer + + def initialize: (token: String, ?type: :static_bearer) -> void + + def to_hash: -> { token: String, ?type: :static_bearer } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::Agents::Vaults::credential_auth_rotate_param] + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vaults/credential_create_params.rbs b/sig/openai/models/beta/agents/vaults/credential_create_params.rbs new file mode 100644 index 000000000..158f4d460 --- /dev/null +++ b/sig/openai/models/beta/agents/vaults/credential_create_params.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + module Agents + module Vaults + type credential_create_params = + { + vault_id: String, + auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth_create_param, + name: String, + ?request_options: OpenAI::request_opts + } + + class CredentialCreateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor vault_id: String + + attr_accessor auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth_create_param + + attr_accessor name: String + + def initialize: ( + vault_id: String, + auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth_create_param, + name: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + vault_id: String, + auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth_create_param, + name: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vaults/credential_delete_params.rbs b/sig/openai/models/beta/agents/vaults/credential_delete_params.rbs new file mode 100644 index 000000000..0aad6cf3d --- /dev/null +++ b/sig/openai/models/beta/agents/vaults/credential_delete_params.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Beta + module Agents + module Vaults + type credential_delete_params = + { + vault_id: String, + credential_id: String, + ?request_options: OpenAI::request_opts + } + + class CredentialDeleteParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor vault_id: String + + attr_accessor credential_id: String + + def initialize: ( + vault_id: String, + credential_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + vault_id: String, + credential_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vaults/credential_deleted.rbs b/sig/openai/models/beta/agents/vaults/credential_deleted.rbs new file mode 100644 index 000000000..90eadd636 --- /dev/null +++ b/sig/openai/models/beta/agents/vaults/credential_deleted.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Beta + module Agents + module Vaults + type credential_deleted = + { id: String, deleted: bool, ?object: :"vault.credential.deleted" } + + class CredentialDeleted < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor deleted: bool + + attr_accessor object: :"vault.credential.deleted" + + def initialize: ( + id: String, + deleted: bool, + ?object: :"vault.credential.deleted" + ) -> void + + def to_hash: -> { + id: String, + deleted: bool, + ?object: :"vault.credential.deleted" + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vaults/credential_list_params.rbs b/sig/openai/models/beta/agents/vaults/credential_list_params.rbs new file mode 100644 index 000000000..816c6df2c --- /dev/null +++ b/sig/openai/models/beta/agents/vaults/credential_list_params.rbs @@ -0,0 +1,76 @@ +module OpenAI + module Models + module Beta + module Agents + module Vaults + type credential_list_params = + { + vault_id: String, + ?after: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::Vaults::CredentialListParams::order, + ?status: OpenAI::Models::Beta::Agents::vault_status_filter, + ?request_options: OpenAI::request_opts + } + + class CredentialListParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor vault_id: String + + attr_reader after: String? + + def after=: (String) -> String + + attr_accessor limit: Integer? + + attr_reader order: OpenAI::Models::Beta::Agents::Vaults::CredentialListParams::order? + + def order=: ( + OpenAI::Models::Beta::Agents::Vaults::CredentialListParams::order + ) -> OpenAI::Models::Beta::Agents::Vaults::CredentialListParams::order + + attr_reader status: OpenAI::Models::Beta::Agents::vault_status_filter? + + def status=: ( + OpenAI::Models::Beta::Agents::vault_status_filter + ) -> OpenAI::Models::Beta::Agents::vault_status_filter + + def initialize: ( + vault_id: String, + ?after: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::Vaults::CredentialListParams::order, + ?status: OpenAI::Models::Beta::Agents::vault_status_filter, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + vault_id: String, + ?after: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::Vaults::CredentialListParams::order, + ?status: OpenAI::Models::Beta::Agents::vault_status_filter, + ?request_options: OpenAI::RequestOptions + } + + type order = :asc | :desc + + module Order + extend OpenAI::Internal::Type::Enum + + # Returns resources in ascending order. + ASC: :asc + + # Returns resources in descending order. + DESC: :desc + + def self?.values: -> ::Array[OpenAI::Models::Beta::Agents::Vaults::CredentialListParams::order] + end + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vaults/credential_retrieve_params.rbs b/sig/openai/models/beta/agents/vaults/credential_retrieve_params.rbs new file mode 100644 index 000000000..1323dcaa1 --- /dev/null +++ b/sig/openai/models/beta/agents/vaults/credential_retrieve_params.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Beta + module Agents + module Vaults + type credential_retrieve_params = + { + vault_id: String, + credential_id: String, + ?request_options: OpenAI::request_opts + } + + class CredentialRetrieveParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor vault_id: String + + attr_accessor credential_id: String + + def initialize: ( + vault_id: String, + credential_id: String, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + vault_id: String, + credential_id: String, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vaults/credential_update_params.rbs b/sig/openai/models/beta/agents/vaults/credential_update_params.rbs new file mode 100644 index 000000000..1b2701552 --- /dev/null +++ b/sig/openai/models/beta/agents/vaults/credential_update_params.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + module Agents + module Vaults + type credential_update_params = + { + vault_id: String, + credential_id: String, + auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth_rotate_param, + ?request_options: OpenAI::request_opts + } + + class CredentialUpdateParams < OpenAI::Internal::Type::BaseModel + extend OpenAI::Internal::Type::RequestParameters::Converter + include OpenAI::Internal::Type::RequestParameters + + attr_accessor vault_id: String + + attr_accessor credential_id: String + + attr_accessor auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth_rotate_param + + def initialize: ( + vault_id: String, + credential_id: String, + auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth_rotate_param, + ?request_options: OpenAI::request_opts + ) -> void + + def to_hash: -> { + vault_id: String, + credential_id: String, + auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth_rotate_param, + ?request_options: OpenAI::RequestOptions + } + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth.rbs b/sig/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth.rbs new file mode 100644 index 000000000..261511c3f --- /dev/null +++ b/sig/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth.rbs @@ -0,0 +1,50 @@ +module OpenAI + module Models + module Beta + module Agents + module Vaults + type mcp_oauth_token_endpoint_auth = + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::None + | OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretBasic + | OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuth::ClientSecretPost + + module McpOauthTokenEndpointAuth + extend OpenAI::Internal::Type::Union + + type none = { ?type: :none } + + class None < OpenAI::Internal::Type::BaseModel + attr_accessor type: :none + + def initialize: (?type: :none) -> void + + def to_hash: -> { ?type: :none } + end + + type client_secret_basic = { ?type: :client_secret_basic } + + class ClientSecretBasic < OpenAI::Internal::Type::BaseModel + attr_accessor type: :client_secret_basic + + def initialize: (?type: :client_secret_basic) -> void + + def to_hash: -> { ?type: :client_secret_basic } + end + + type client_secret_post = { ?type: :client_secret_post } + + class ClientSecretPost < OpenAI::Internal::Type::BaseModel + attr_accessor type: :client_secret_post + + def initialize: (?type: :client_secret_post) -> void + + def to_hash: -> { ?type: :client_secret_post } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth] + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_create_param.rbs b/sig/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_create_param.rbs new file mode 100644 index 000000000..311515931 --- /dev/null +++ b/sig/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_create_param.rbs @@ -0,0 +1,68 @@ +module OpenAI + module Models + module Beta + module Agents + module Vaults + type mcp_oauth_token_endpoint_auth_create_param = + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::None + | OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretBasic + | OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthCreateParam::ClientSecretPost + + module McpOauthTokenEndpointAuthCreateParam + extend OpenAI::Internal::Type::Union + + type none = { ?type: :none } + + class None < OpenAI::Internal::Type::BaseModel + attr_accessor type: :none + + def initialize: (?type: :none) -> void + + def to_hash: -> { ?type: :none } + end + + type client_secret_basic = + { client_secret: String, ?type: :client_secret_basic } + + class ClientSecretBasic < OpenAI::Internal::Type::BaseModel + attr_accessor client_secret: String + + attr_accessor type: :client_secret_basic + + def initialize: ( + client_secret: String, + ?type: :client_secret_basic + ) -> void + + def to_hash: -> { + client_secret: String, + ?type: :client_secret_basic + } + end + + type client_secret_post = + { client_secret: String, ?type: :client_secret_post } + + class ClientSecretPost < OpenAI::Internal::Type::BaseModel + attr_accessor client_secret: String + + attr_accessor type: :client_secret_post + + def initialize: ( + client_secret: String, + ?type: :client_secret_post + ) -> void + + def to_hash: -> { + client_secret: String, + ?type: :client_secret_post + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth_create_param] + end + end + end + end + end +end diff --git a/sig/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_rotate_param.rbs b/sig/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_rotate_param.rbs new file mode 100644 index 000000000..a34e1bfaa --- /dev/null +++ b/sig/openai/models/beta/agents/vaults/mcp_oauth_token_endpoint_auth_rotate_param.rbs @@ -0,0 +1,57 @@ +module OpenAI + module Models + module Beta + module Agents + module Vaults + type mcp_oauth_token_endpoint_auth_rotate_param = + OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretBasic + | OpenAI::Beta::Agents::Vaults::McpOauthTokenEndpointAuthRotateParam::ClientSecretPost + + module McpOauthTokenEndpointAuthRotateParam + extend OpenAI::Internal::Type::Union + + type client_secret_basic = + { ?type: :client_secret_basic, ?client_secret: String? } + + class ClientSecretBasic < OpenAI::Internal::Type::BaseModel + attr_accessor type: :client_secret_basic + + attr_accessor client_secret: String? + + def initialize: ( + ?client_secret: String?, + ?type: :client_secret_basic + ) -> void + + def to_hash: -> { + ?type: :client_secret_basic, + ?client_secret: String? + } + end + + type client_secret_post = + { ?type: :client_secret_post, ?client_secret: String? } + + class ClientSecretPost < OpenAI::Internal::Type::BaseModel + attr_accessor type: :client_secret_post + + attr_accessor client_secret: String? + + def initialize: ( + ?client_secret: String?, + ?type: :client_secret_post + ) -> void + + def to_hash: -> { + ?type: :client_secret_post, + ?client_secret: String? + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::Agents::Vaults::mcp_oauth_token_endpoint_auth_rotate_param] + end + end + end + end + end +end diff --git a/sig/openai/models/beta/environment.rbs b/sig/openai/models/beta/environment.rbs new file mode 100644 index 000000000..68d9e87a1 --- /dev/null +++ b/sig/openai/models/beta/environment.rbs @@ -0,0 +1,181 @@ +module OpenAI + module Models + module Beta + type environment = + OpenAI::Beta::Environment::None + | OpenAI::Beta::Environment::OpenAIHosted + | OpenAI::Beta::Environment::SelfHosted + + module Environment + extend OpenAI::Internal::Type::Union + + type none = { ?type: :none } + + class None < OpenAI::Internal::Type::BaseModel + attr_accessor type: :none + + def initialize: (?type: :none) -> void + + def to_hash: -> { ?type: :none } + end + + type openai_hosted = + { + id: String, + capability_directories: ::Array[String], + files: ::Array[OpenAI::Models::Beta::hosted_environment_file], + network: OpenAI::Beta::Environment::OpenAIHosted::Network, + packages: OpenAI::Beta::Environment::OpenAIHosted::Packages, + plugins: ::Array[OpenAI::Beta::HostedPlugin], + skills: ::Array[OpenAI::Models::Beta::hosted_skill], + ?type: :openai_hosted + } + + class OpenAIHosted < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor capability_directories: ::Array[String] + + attr_accessor files: ::Array[OpenAI::Models::Beta::hosted_environment_file] + + attr_accessor network: OpenAI::Beta::Environment::OpenAIHosted::Network + + attr_accessor packages: OpenAI::Beta::Environment::OpenAIHosted::Packages + + attr_accessor plugins: ::Array[OpenAI::Beta::HostedPlugin] + + attr_accessor skills: ::Array[OpenAI::Models::Beta::hosted_skill] + + attr_accessor type: :openai_hosted + + def initialize: ( + id: String, + capability_directories: ::Array[String], + files: ::Array[OpenAI::Models::Beta::hosted_environment_file], + network: OpenAI::Beta::Environment::OpenAIHosted::Network, + packages: OpenAI::Beta::Environment::OpenAIHosted::Packages, + plugins: ::Array[OpenAI::Beta::HostedPlugin], + skills: ::Array[OpenAI::Models::Beta::hosted_skill], + ?type: :openai_hosted + ) -> void + + def to_hash: -> { + id: String, + capability_directories: ::Array[String], + files: ::Array[OpenAI::Models::Beta::hosted_environment_file], + network: OpenAI::Beta::Environment::OpenAIHosted::Network, + packages: OpenAI::Beta::Environment::OpenAIHosted::Packages, + plugins: ::Array[OpenAI::Beta::HostedPlugin], + skills: ::Array[OpenAI::Models::Beta::hosted_skill], + ?type: :openai_hosted + } + + type network = + { + access: OpenAI::Models::Beta::Environment::OpenAIHosted::Network::access, + allowed_domains: ::Array[String] + } + + class Network < OpenAI::Internal::Type::BaseModel + attr_accessor access: OpenAI::Models::Beta::Environment::OpenAIHosted::Network::access + + attr_accessor allowed_domains: ::Array[String] + + def initialize: ( + access: OpenAI::Models::Beta::Environment::OpenAIHosted::Network::access, + allowed_domains: ::Array[String] + ) -> void + + def to_hash: -> { + access: OpenAI::Models::Beta::Environment::OpenAIHosted::Network::access, + allowed_domains: ::Array[String] + } + + type access = :enabled | :disabled | :restricted + + module Access + extend OpenAI::Internal::Type::Enum + + # Allows unrestricted network access. + ENABLED: :enabled + + # Disables network access. + DISABLED: :disabled + + # Allows access only to configured domains. + RESTRICTED: :restricted + + def self?.values: -> ::Array[OpenAI::Models::Beta::Environment::OpenAIHosted::Network::access] + end + end + + type packages = + { + npm: ::Array[String], + python: ::Array[String], + system_: ::Array[String] + } + + class Packages < OpenAI::Internal::Type::BaseModel + attr_accessor npm: ::Array[String] + + attr_accessor python: ::Array[String] + + attr_accessor system_: ::Array[String] + + def initialize: ( + npm: ::Array[String], + python: ::Array[String], + system_: ::Array[String] + ) -> void + + def to_hash: -> { + npm: ::Array[String], + python: ::Array[String], + system_: ::Array[String] + } + end + end + + type self_hosted = + { + id: String, + capability_directories: ::Array[String], + remote_url: String, + ?type: :self_hosted, + workspace_directory: String + } + + class SelfHosted < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor capability_directories: ::Array[String] + + attr_accessor remote_url: String + + attr_accessor type: :self_hosted + + attr_accessor workspace_directory: String + + def initialize: ( + id: String, + capability_directories: ::Array[String], + remote_url: String, + workspace_directory: String, + ?type: :self_hosted + ) -> void + + def to_hash: -> { + id: String, + capability_directories: ::Array[String], + remote_url: String, + ?type: :self_hosted, + workspace_directory: String + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::environment] + end + end + end +end diff --git a/sig/openai/models/beta/environment_param.rbs b/sig/openai/models/beta/environment_param.rbs new file mode 100644 index 000000000..72358fa8c --- /dev/null +++ b/sig/openai/models/beta/environment_param.rbs @@ -0,0 +1,183 @@ +module OpenAI + module Models + module Beta + type environment_param = + OpenAI::Beta::EnvironmentParam::None + | OpenAI::Beta::EnvironmentParam::OpenAIHosted + | OpenAI::Beta::EnvironmentParam::SelfHosted + + module EnvironmentParam + extend OpenAI::Internal::Type::Union + + type none = { ?type: :none } + + class None < OpenAI::Internal::Type::BaseModel + attr_accessor type: :none + + def initialize: (?type: :none) -> void + + def to_hash: -> { ?type: :none } + end + + type openai_hosted = + { + ?type: :openai_hosted, + ?capability_directories: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?environment_template_id: String, + ?files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]?, + ?network: OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network?, + ?packages: OpenAI::Beta::EnvironmentParam::OpenAIHosted::Packages?, + ?plugins: ::Array[OpenAI::Beta::HostedPluginParam]?, + ?setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]?, + ?skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]? + } + + class OpenAIHosted < OpenAI::Internal::Type::BaseModel + attr_accessor type: :openai_hosted + + attr_accessor capability_directories: ::Array[String]? + + attr_accessor env: ::Hash[Symbol, String]? + + attr_reader environment_template_id: String? + + def environment_template_id=: (String) -> String + + attr_accessor files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]? + + attr_accessor network: OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network? + + attr_accessor packages: OpenAI::Beta::EnvironmentParam::OpenAIHosted::Packages? + + attr_accessor plugins: ::Array[OpenAI::Beta::HostedPluginParam]? + + attr_accessor setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]? + + attr_accessor skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]? + + def initialize: ( + ?capability_directories: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?environment_template_id: String, + ?files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]?, + ?network: OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network?, + ?packages: OpenAI::Beta::EnvironmentParam::OpenAIHosted::Packages?, + ?plugins: ::Array[OpenAI::Beta::HostedPluginParam]?, + ?setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]?, + ?skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]?, + ?type: :openai_hosted + ) -> void + + def to_hash: -> { + ?type: :openai_hosted, + ?capability_directories: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?environment_template_id: String, + ?files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]?, + ?network: OpenAI::Beta::EnvironmentParam::OpenAIHosted::Network?, + ?packages: OpenAI::Beta::EnvironmentParam::OpenAIHosted::Packages?, + ?plugins: ::Array[OpenAI::Beta::HostedPluginParam]?, + ?setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]?, + ?skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]? + } + + type network = + { + access: OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::Network::access, + ?allowed_domains: ::Array[String]? + } + + class Network < OpenAI::Internal::Type::BaseModel + attr_accessor access: OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::Network::access + + attr_accessor allowed_domains: ::Array[String]? + + def initialize: ( + access: OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::Network::access, + ?allowed_domains: ::Array[String]? + ) -> void + + def to_hash: -> { + access: OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::Network::access, + ?allowed_domains: ::Array[String]? + } + + type access = :enabled | :disabled | :restricted + + module Access + extend OpenAI::Internal::Type::Enum + + # Allows unrestricted network access, matching an omitted network policy. + ENABLED: :enabled + + # Disables network access. + DISABLED: :disabled + + # Allows access only to configured domains. + RESTRICTED: :restricted + + def self?.values: -> ::Array[OpenAI::Models::Beta::EnvironmentParam::OpenAIHosted::Network::access] + end + end + + type packages = + { + ?npm: ::Array[String]?, + ?python: ::Array[String]?, + ?system_: ::Array[String]? + } + + class Packages < OpenAI::Internal::Type::BaseModel + attr_accessor npm: ::Array[String]? + + attr_accessor python: ::Array[String]? + + attr_accessor system_: ::Array[String]? + + def initialize: ( + ?npm: ::Array[String]?, + ?python: ::Array[String]?, + ?system_: ::Array[String]? + ) -> void + + def to_hash: -> { + ?npm: ::Array[String]?, + ?python: ::Array[String]?, + ?system_: ::Array[String]? + } + end + end + + type self_hosted = + { + ?type: :self_hosted, + workspace_directory: String, + ?capability_directories: ::Array[String]? + } + + class SelfHosted < OpenAI::Internal::Type::BaseModel + attr_accessor type: :self_hosted + + attr_accessor workspace_directory: String + + attr_accessor capability_directories: ::Array[String]? + + def initialize: ( + workspace_directory: String, + ?capability_directories: ::Array[String]?, + ?type: :self_hosted + ) -> void + + def to_hash: -> { + ?type: :self_hosted, + workspace_directory: String, + ?capability_directories: ::Array[String]? + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::environment_param] + end + end + end +end diff --git a/sig/openai/models/beta/hosted_environment_file.rbs b/sig/openai/models/beta/hosted_environment_file.rbs new file mode 100644 index 000000000..7cfe3c438 --- /dev/null +++ b/sig/openai/models/beta/hosted_environment_file.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + type hosted_environment_file = + OpenAI::Beta::HostedEnvironmentFileID + | OpenAI::Beta::HostedEnvironmentFile::Inline + + module HostedEnvironmentFile + extend OpenAI::Internal::Type::Union + + type inline = + { id: String, path: String, size_bytes: Integer, ?type: :inline } + + class Inline < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor path: String + + attr_accessor size_bytes: Integer + + attr_accessor type: :inline + + def initialize: ( + id: String, + path: String, + size_bytes: Integer, + ?type: :inline + ) -> void + + def to_hash: -> { + id: String, + path: String, + size_bytes: Integer, + ?type: :inline + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::hosted_environment_file] + end + end + end +end diff --git a/sig/openai/models/beta/hosted_environment_file_id.rbs b/sig/openai/models/beta/hosted_environment_file_id.rbs new file mode 100644 index 000000000..9e209d911 --- /dev/null +++ b/sig/openai/models/beta/hosted_environment_file_id.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + type hosted_environment_file_id = + { + id: String, + file_id: String, + path: String, + size_bytes: Integer, + ?type: :file_id + } + + class HostedEnvironmentFileID < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor file_id: String + + attr_accessor path: String + + attr_accessor size_bytes: Integer + + attr_accessor type: :file_id + + def initialize: ( + id: String, + file_id: String, + path: String, + size_bytes: Integer, + ?type: :file_id + ) -> void + + def to_hash: -> { + id: String, + file_id: String, + path: String, + size_bytes: Integer, + ?type: :file_id + } + end + end + end +end diff --git a/sig/openai/models/beta/hosted_environment_file_param.rbs b/sig/openai/models/beta/hosted_environment_file_param.rbs new file mode 100644 index 000000000..11bc7d4e6 --- /dev/null +++ b/sig/openai/models/beta/hosted_environment_file_param.rbs @@ -0,0 +1,47 @@ +module OpenAI + module Models + module Beta + type hosted_environment_file_param = + OpenAI::Beta::HostedEnvironmentFileParam::FileID + | OpenAI::Beta::HostedEnvironmentFileParam::Inline + + module HostedEnvironmentFileParam + extend OpenAI::Internal::Type::Union + + type file_id = { file_id: String, path: String, ?type: :file_id } + + class FileID < OpenAI::Internal::Type::BaseModel + attr_accessor file_id: String + + attr_accessor path: String + + attr_accessor type: :file_id + + def initialize: ( + file_id: String, + path: String, + ?type: :file_id + ) -> void + + def to_hash: -> { file_id: String, path: String, ?type: :file_id } + end + + type inline = { data: String, path: String, ?type: :inline } + + class Inline < OpenAI::Internal::Type::BaseModel + attr_accessor data: String + + attr_accessor path: String + + attr_accessor type: :inline + + def initialize: (data: String, path: String, ?type: :inline) -> void + + def to_hash: -> { data: String, path: String, ?type: :inline } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::hosted_environment_file_param] + end + end + end +end diff --git a/sig/openai/models/beta/hosted_plugin.rbs b/sig/openai/models/beta/hosted_plugin.rbs new file mode 100644 index 000000000..8c8434386 --- /dev/null +++ b/sig/openai/models/beta/hosted_plugin.rbs @@ -0,0 +1,23 @@ +module OpenAI + module Models + module Beta + type hosted_plugin = { description: String, name: String, ?type: :inline } + + class HostedPlugin < OpenAI::Internal::Type::BaseModel + attr_accessor description: String + + attr_accessor name: String + + attr_accessor type: :inline + + def initialize: ( + description: String, + name: String, + ?type: :inline + ) -> void + + def to_hash: -> { description: String, name: String, ?type: :inline } + end + end + end +end diff --git a/sig/openai/models/beta/hosted_plugin_param.rbs b/sig/openai/models/beta/hosted_plugin_param.rbs new file mode 100644 index 000000000..98de523bb --- /dev/null +++ b/sig/openai/models/beta/hosted_plugin_param.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Models + module Beta + type hosted_plugin_param = + { + description: String, + name: String, + source: OpenAI::Beta::InlineCapabilitySourceParam, + ?type: :inline + } + + class HostedPluginParam < OpenAI::Internal::Type::BaseModel + attr_accessor description: String + + attr_accessor name: String + + attr_accessor source: OpenAI::Beta::InlineCapabilitySourceParam + + attr_accessor type: :inline + + def initialize: ( + description: String, + name: String, + source: OpenAI::Beta::InlineCapabilitySourceParam, + ?type: :inline + ) -> void + + def to_hash: -> { + description: String, + name: String, + source: OpenAI::Beta::InlineCapabilitySourceParam, + ?type: :inline + } + end + end + end +end diff --git a/sig/openai/models/beta/hosted_skill.rbs b/sig/openai/models/beta/hosted_skill.rbs new file mode 100644 index 000000000..2245a3848 --- /dev/null +++ b/sig/openai/models/beta/hosted_skill.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Beta + type hosted_skill = + OpenAI::Beta::HostedSkillReference | OpenAI::Beta::HostedSkill::Inline + + module HostedSkill + extend OpenAI::Internal::Type::Union + + type inline = { description: String, name: String, ?type: :inline } + + class Inline < OpenAI::Internal::Type::BaseModel + attr_accessor description: String + + attr_accessor name: String + + attr_accessor type: :inline + + def initialize: ( + description: String, + name: String, + ?type: :inline + ) -> void + + def to_hash: -> { description: String, name: String, ?type: :inline } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::hosted_skill] + end + end + end +end diff --git a/sig/openai/models/beta/hosted_skill_param.rbs b/sig/openai/models/beta/hosted_skill_param.rbs new file mode 100644 index 000000000..96dca4af6 --- /dev/null +++ b/sig/openai/models/beta/hosted_skill_param.rbs @@ -0,0 +1,70 @@ +module OpenAI + module Models + module Beta + type hosted_skill_param = + OpenAI::Beta::HostedSkillParam::SkillReference + | OpenAI::Beta::HostedSkillParam::Inline + + module HostedSkillParam + extend OpenAI::Internal::Type::Union + + type skill_reference = + { skill_id: String, ?type: :skill_reference, ?version: String? } + + class SkillReference < OpenAI::Internal::Type::BaseModel + attr_accessor skill_id: String + + attr_accessor type: :skill_reference + + attr_accessor version: String? + + def initialize: ( + skill_id: String, + ?version: String?, + ?type: :skill_reference + ) -> void + + def to_hash: -> { + skill_id: String, + ?type: :skill_reference, + ?version: String? + } + end + + type inline = + { + description: String, + name: String, + source: OpenAI::Beta::InlineCapabilitySourceParam, + ?type: :inline + } + + class Inline < OpenAI::Internal::Type::BaseModel + attr_accessor description: String + + attr_accessor name: String + + attr_accessor source: OpenAI::Beta::InlineCapabilitySourceParam + + attr_accessor type: :inline + + def initialize: ( + description: String, + name: String, + source: OpenAI::Beta::InlineCapabilitySourceParam, + ?type: :inline + ) -> void + + def to_hash: -> { + description: String, + name: String, + source: OpenAI::Beta::InlineCapabilitySourceParam, + ?type: :inline + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::hosted_skill_param] + end + end + end +end diff --git a/sig/openai/models/beta/hosted_skill_reference.rbs b/sig/openai/models/beta/hosted_skill_reference.rbs new file mode 100644 index 000000000..1c8ecbfdd --- /dev/null +++ b/sig/openai/models/beta/hosted_skill_reference.rbs @@ -0,0 +1,42 @@ +module OpenAI + module Models + module Beta + type hosted_skill_reference = + { + description: String, + name: String, + skill_id: String, + ?type: :skill_reference, + version: String + } + + class HostedSkillReference < OpenAI::Internal::Type::BaseModel + attr_accessor description: String + + attr_accessor name: String + + attr_accessor skill_id: String + + attr_accessor type: :skill_reference + + attr_accessor version: String + + def initialize: ( + description: String, + name: String, + skill_id: String, + version: String, + ?type: :skill_reference + ) -> void + + def to_hash: -> { + description: String, + name: String, + skill_id: String, + ?type: :skill_reference, + version: String + } + end + end + end +end diff --git a/sig/openai/models/beta/inline_capability_source_param.rbs b/sig/openai/models/beta/inline_capability_source_param.rbs new file mode 100644 index 000000000..e52d0637c --- /dev/null +++ b/sig/openai/models/beta/inline_capability_source_param.rbs @@ -0,0 +1,28 @@ +module OpenAI + module Models + module Beta + type inline_capability_source_param = + { data: String, ?media_type: :"application/zip", ?type: :base64 } + + class InlineCapabilitySourceParam < OpenAI::Internal::Type::BaseModel + attr_accessor data: String + + attr_accessor media_type: :"application/zip" + + attr_accessor type: :base64 + + def initialize: ( + data: String, + ?media_type: :"application/zip", + ?type: :base64 + ) -> void + + def to_hash: -> { + data: String, + ?media_type: :"application/zip", + ?type: :base64 + } + end + end + end +end diff --git a/sig/openai/models/beta/input_content.rbs b/sig/openai/models/beta/input_content.rbs new file mode 100644 index 000000000..6de92063a --- /dev/null +++ b/sig/openai/models/beta/input_content.rbs @@ -0,0 +1,39 @@ +module OpenAI + module Models + module Beta + type input_content = + OpenAI::Beta::InputContent::InputText + | OpenAI::Beta::InputContent::InputImage + + module InputContent + extend OpenAI::Internal::Type::Union + + type input_text = { text: String, ?type: :input_text } + + class InputText < OpenAI::Internal::Type::BaseModel + attr_accessor text: String + + attr_accessor type: :input_text + + def initialize: (text: String, ?type: :input_text) -> void + + def to_hash: -> { text: String, ?type: :input_text } + end + + type input_image = { image_url: String, ?type: :input_image } + + class InputImage < OpenAI::Internal::Type::BaseModel + attr_accessor image_url: String + + attr_accessor type: :input_image + + def initialize: (image_url: String, ?type: :input_image) -> void + + def to_hash: -> { image_url: String, ?type: :input_image } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::input_content] + end + end + end +end diff --git a/sig/openai/models/beta/input_content_param.rbs b/sig/openai/models/beta/input_content_param.rbs new file mode 100644 index 000000000..cfa9924f4 --- /dev/null +++ b/sig/openai/models/beta/input_content_param.rbs @@ -0,0 +1,39 @@ +module OpenAI + module Models + module Beta + type input_content_param = + OpenAI::Beta::InputContentParam::InputText + | OpenAI::Beta::InputContentParam::InputImage + + module InputContentParam + extend OpenAI::Internal::Type::Union + + type input_text = { text: String, ?type: :input_text } + + class InputText < OpenAI::Internal::Type::BaseModel + attr_accessor text: String + + attr_accessor type: :input_text + + def initialize: (text: String, ?type: :input_text) -> void + + def to_hash: -> { text: String, ?type: :input_text } + end + + type input_image = { image_url: String, ?type: :input_image } + + class InputImage < OpenAI::Internal::Type::BaseModel + attr_accessor image_url: String + + attr_accessor type: :input_image + + def initialize: (image_url: String, ?type: :input_image) -> void + + def to_hash: -> { image_url: String, ?type: :input_image } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::input_content_param] + end + end + end +end diff --git a/sig/openai/models/beta/mcp_transport.rbs b/sig/openai/models/beta/mcp_transport.rbs new file mode 100644 index 000000000..7cc270502 --- /dev/null +++ b/sig/openai/models/beta/mcp_transport.rbs @@ -0,0 +1,63 @@ +module OpenAI + module Models + module Beta + type mcp_transport = + OpenAI::Beta::McpTransport::HTTP | OpenAI::Beta::McpTransport::Stdio + + module McpTransport + extend OpenAI::Internal::Type::Union + + type http = { server_url: String, ?type: :http } + + class HTTP < OpenAI::Internal::Type::BaseModel + attr_accessor server_url: String + + attr_accessor type: :http + + def initialize: (server_url: String, ?type: :http) -> void + + def to_hash: -> { server_url: String, ?type: :http } + end + + type stdio = + { + args: ::Array[String], + command: String, + cwd: String, + env_vars: ::Array[String], + ?type: :stdio + } + + class Stdio < OpenAI::Internal::Type::BaseModel + attr_accessor args: ::Array[String] + + attr_accessor command: String + + attr_accessor cwd: String + + attr_accessor env_vars: ::Array[String] + + attr_accessor type: :stdio + + def initialize: ( + args: ::Array[String], + command: String, + cwd: String, + env_vars: ::Array[String], + ?type: :stdio + ) -> void + + def to_hash: -> { + args: ::Array[String], + command: String, + cwd: String, + env_vars: ::Array[String], + ?type: :stdio + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::mcp_transport] + end + end + end +end diff --git a/sig/openai/models/beta/mcp_transport_param.rbs b/sig/openai/models/beta/mcp_transport_param.rbs new file mode 100644 index 000000000..d90cf9d9f --- /dev/null +++ b/sig/openai/models/beta/mcp_transport_param.rbs @@ -0,0 +1,89 @@ +module OpenAI + module Models + module Beta + type mcp_transport_param = + OpenAI::Beta::McpTransportParam::HTTP + | OpenAI::Beta::McpTransportParam::Stdio + + module McpTransportParam + extend OpenAI::Internal::Type::Union + + type http = + { + server_url: String, + ?type: :http, + ?authorization: String?, + ?headers: ::Hash[Symbol, String]? + } + + class HTTP < OpenAI::Internal::Type::BaseModel + attr_accessor server_url: String + + attr_accessor type: :http + + attr_accessor authorization: String? + + attr_accessor headers: ::Hash[Symbol, String]? + + def initialize: ( + server_url: String, + ?authorization: String?, + ?headers: ::Hash[Symbol, String]?, + ?type: :http + ) -> void + + def to_hash: -> { + server_url: String, + ?type: :http, + ?authorization: String?, + ?headers: ::Hash[Symbol, String]? + } + end + + type stdio = + { + command: String, + cwd: String, + ?type: :stdio, + ?args: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?env_vars: ::Array[String]? + } + + class Stdio < OpenAI::Internal::Type::BaseModel + attr_accessor command: String + + attr_accessor cwd: String + + attr_accessor type: :stdio + + attr_accessor args: ::Array[String]? + + attr_accessor env: ::Hash[Symbol, String]? + + attr_accessor env_vars: ::Array[String]? + + def initialize: ( + command: String, + cwd: String, + ?args: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?env_vars: ::Array[String]?, + ?type: :stdio + ) -> void + + def to_hash: -> { + command: String, + cwd: String, + ?type: :stdio, + ?args: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?env_vars: ::Array[String]? + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::mcp_transport_param] + end + end + end +end diff --git a/sig/openai/models/beta/multi_agent_config.rbs b/sig/openai/models/beta/multi_agent_config.rbs new file mode 100644 index 000000000..30e6f438a --- /dev/null +++ b/sig/openai/models/beta/multi_agent_config.rbs @@ -0,0 +1,21 @@ +module OpenAI + module Models + module Beta + type multi_agent_config = + { enabled: bool, max_concurrent_subagents: Integer? } + + class MultiAgentConfig < OpenAI::Internal::Type::BaseModel + attr_accessor enabled: bool + + attr_accessor max_concurrent_subagents: Integer? + + def initialize: ( + enabled: bool, + max_concurrent_subagents: Integer? + ) -> void + + def to_hash: -> { enabled: bool, max_concurrent_subagents: Integer? } + end + end + end +end diff --git a/sig/openai/models/beta/multi_agent_config_param.rbs b/sig/openai/models/beta/multi_agent_config_param.rbs new file mode 100644 index 000000000..5ab7ab420 --- /dev/null +++ b/sig/openai/models/beta/multi_agent_config_param.rbs @@ -0,0 +1,23 @@ +module OpenAI + module Models + module Beta + type multi_agent_config_param = + { enabled: bool, ?max_concurrent_subagents: Integer } + + class MultiAgentConfigParam < OpenAI::Internal::Type::BaseModel + attr_accessor enabled: bool + + attr_reader max_concurrent_subagents: Integer? + + def max_concurrent_subagents=: (Integer) -> Integer + + def initialize: ( + enabled: bool, + ?max_concurrent_subagents: Integer + ) -> void + + def to_hash: -> { enabled: bool, ?max_concurrent_subagents: Integer } + end + end + end +end diff --git a/sig/openai/models/beta/output_text.rbs b/sig/openai/models/beta/output_text.rbs new file mode 100644 index 000000000..192bf2e64 --- /dev/null +++ b/sig/openai/models/beta/output_text.rbs @@ -0,0 +1,17 @@ +module OpenAI + module Models + module Beta + type output_text = { text: String, ?type: :output_text } + + class OutputText < OpenAI::Internal::Type::BaseModel + attr_accessor text: String + + attr_accessor type: :output_text + + def initialize: (text: String, ?type: :output_text) -> void + + def to_hash: -> { text: String, ?type: :output_text } + end + end + end +end diff --git a/sig/openai/models/beta/persisted_agent_tool.rbs b/sig/openai/models/beta/persisted_agent_tool.rbs new file mode 100644 index 000000000..0c70364a3 --- /dev/null +++ b/sig/openai/models/beta/persisted_agent_tool.rbs @@ -0,0 +1,237 @@ +module OpenAI + module Models + module Beta + type persisted_agent_tool = + OpenAI::Beta::PersistedAgentTool::Function + | OpenAI::Beta::PersistedAgentTool::ToolSearch + | OpenAI::Beta::PersistedAgentTool::ProgrammaticToolCalling + | OpenAI::Beta::PersistedAgentTool::Mcp + | OpenAI::Beta::PersistedAgentTool::WebSearch + + module PersistedAgentTool + extend OpenAI::Internal::Type::Union + + type function = + { + defer_loading: bool, + description: String, + name: String, + parameters: ::Hash[Symbol, top], + ?type: :function + } + + class Function < OpenAI::Internal::Type::BaseModel + attr_accessor defer_loading: bool + + attr_accessor description: String + + attr_accessor name: String + + attr_accessor parameters: ::Hash[Symbol, top] + + attr_accessor type: :function + + def initialize: ( + defer_loading: bool, + description: String, + name: String, + parameters: ::Hash[Symbol, top], + ?type: :function + ) -> void + + def to_hash: -> { + defer_loading: bool, + description: String, + name: String, + parameters: ::Hash[Symbol, top], + ?type: :function + } + end + + type tool_search = { ?type: :tool_search } + + class ToolSearch < OpenAI::Internal::Type::BaseModel + attr_accessor type: :tool_search + + def initialize: (?type: :tool_search) -> void + + def to_hash: -> { ?type: :tool_search } + end + + type programmatic_tool_calling = + { enabled: bool, ?type: :programmatic_tool_calling } + + class ProgrammaticToolCalling < OpenAI::Internal::Type::BaseModel + attr_accessor enabled: bool + + attr_accessor type: :programmatic_tool_calling + + def initialize: ( + enabled: bool, + ?type: :programmatic_tool_calling + ) -> void + + def to_hash: -> { enabled: bool, ?type: :programmatic_tool_calling } + end + + type mcp = + { + allowed_tools: ::Array[String]?, + connection_origin: OpenAI::Models::Beta::PersistedAgentTool::Mcp::connection_origin, + credential_id: String?, + request_metadata: ::Hash[Symbol, top], + required: bool, + server_label: String, + transport: OpenAI::Models::Beta::persisted_mcp_transport, + ?type: :mcp + } + + class Mcp < OpenAI::Internal::Type::BaseModel + attr_accessor allowed_tools: ::Array[String]? + + attr_accessor connection_origin: OpenAI::Models::Beta::PersistedAgentTool::Mcp::connection_origin + + attr_accessor credential_id: String? + + attr_accessor request_metadata: ::Hash[Symbol, top] + + attr_accessor required: bool + + attr_accessor server_label: String + + attr_accessor transport: OpenAI::Models::Beta::persisted_mcp_transport + + attr_accessor type: :mcp + + def initialize: ( + allowed_tools: ::Array[String]?, + connection_origin: OpenAI::Models::Beta::PersistedAgentTool::Mcp::connection_origin, + credential_id: String?, + request_metadata: ::Hash[Symbol, top], + required: bool, + server_label: String, + transport: OpenAI::Models::Beta::persisted_mcp_transport, + ?type: :mcp + ) -> void + + def to_hash: -> { + allowed_tools: ::Array[String]?, + connection_origin: OpenAI::Models::Beta::PersistedAgentTool::Mcp::connection_origin, + credential_id: String?, + request_metadata: ::Hash[Symbol, top], + required: bool, + server_label: String, + transport: OpenAI::Models::Beta::persisted_mcp_transport, + ?type: :mcp + } + + type connection_origin = :service | :environment + + module ConnectionOrigin + extend OpenAI::Internal::Type::Enum + + SERVICE: :service + ENVIRONMENT: :environment + + def self?.values: -> ::Array[OpenAI::Models::Beta::PersistedAgentTool::Mcp::connection_origin] + end + end + + type web_search = + { + allowed_domains: ::Array[String]?, + context_size: OpenAI::Models::Beta::PersistedAgentTool::WebSearch::context_size, + location: OpenAI::Beta::PersistedAgentTool::WebSearch::Location?, + mode: OpenAI::Models::Beta::PersistedAgentTool::WebSearch::mode, + ?type: :web_search + } + + class WebSearch < OpenAI::Internal::Type::BaseModel + attr_accessor allowed_domains: ::Array[String]? + + attr_accessor context_size: OpenAI::Models::Beta::PersistedAgentTool::WebSearch::context_size + + attr_accessor location: OpenAI::Beta::PersistedAgentTool::WebSearch::Location? + + attr_accessor mode: OpenAI::Models::Beta::PersistedAgentTool::WebSearch::mode + + attr_accessor type: :web_search + + def initialize: ( + allowed_domains: ::Array[String]?, + context_size: OpenAI::Models::Beta::PersistedAgentTool::WebSearch::context_size, + location: OpenAI::Beta::PersistedAgentTool::WebSearch::Location?, + mode: OpenAI::Models::Beta::PersistedAgentTool::WebSearch::mode, + ?type: :web_search + ) -> void + + def to_hash: -> { + allowed_domains: ::Array[String]?, + context_size: OpenAI::Models::Beta::PersistedAgentTool::WebSearch::context_size, + location: OpenAI::Beta::PersistedAgentTool::WebSearch::Location?, + mode: OpenAI::Models::Beta::PersistedAgentTool::WebSearch::mode, + ?type: :web_search + } + + type context_size = :low | :medium | :high + + module ContextSize + extend OpenAI::Internal::Type::Enum + + LOW: :low + MEDIUM: :medium + HIGH: :high + + def self?.values: -> ::Array[OpenAI::Models::Beta::PersistedAgentTool::WebSearch::context_size] + end + + type location = + { + city: String?, + country: String?, + region: String?, + timezone: String? + } + + class Location < OpenAI::Internal::Type::BaseModel + attr_accessor city: String? + + attr_accessor country: String? + + attr_accessor region: String? + + attr_accessor timezone: String? + + def initialize: ( + city: String?, + country: String?, + region: String?, + timezone: String? + ) -> void + + def to_hash: -> { + city: String?, + country: String?, + region: String?, + timezone: String? + } + end + + type mode = :disabled | :cached | :live + + module Mode + extend OpenAI::Internal::Type::Enum + + DISABLED: :disabled + CACHED: :cached + LIVE: :live + + def self?.values: -> ::Array[OpenAI::Models::Beta::PersistedAgentTool::WebSearch::mode] + end + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::persisted_agent_tool] + end + end + end +end diff --git a/sig/openai/models/beta/persisted_agent_tool_param.rbs b/sig/openai/models/beta/persisted_agent_tool_param.rbs new file mode 100644 index 000000000..e92b57df7 --- /dev/null +++ b/sig/openai/models/beta/persisted_agent_tool_param.rbs @@ -0,0 +1,251 @@ +module OpenAI + module Models + module Beta + type persisted_agent_tool_param = + OpenAI::Beta::PersistedAgentToolParam::Function + | OpenAI::Beta::PersistedAgentToolParam::ToolSearch + | OpenAI::Beta::PersistedAgentToolParam::ProgrammaticToolCalling + | OpenAI::Beta::PersistedAgentToolParam::Mcp + | OpenAI::Beta::PersistedAgentToolParam::WebSearch + + module PersistedAgentToolParam + extend OpenAI::Internal::Type::Union + + type function = + { + description: String, + name: String, + parameters: ::Hash[Symbol, top], + ?type: :function, + ?defer_loading: bool + } + + class Function < OpenAI::Internal::Type::BaseModel + attr_accessor description: String + + attr_accessor name: String + + attr_accessor parameters: ::Hash[Symbol, top] + + attr_accessor type: :function + + attr_reader defer_loading: bool? + + def defer_loading=: (bool) -> bool + + def initialize: ( + description: String, + name: String, + parameters: ::Hash[Symbol, top], + ?defer_loading: bool, + ?type: :function + ) -> void + + def to_hash: -> { + description: String, + name: String, + parameters: ::Hash[Symbol, top], + ?type: :function, + ?defer_loading: bool + } + end + + type tool_search = { ?type: :tool_search } + + class ToolSearch < OpenAI::Internal::Type::BaseModel + attr_accessor type: :tool_search + + def initialize: (?type: :tool_search) -> void + + def to_hash: -> { ?type: :tool_search } + end + + type programmatic_tool_calling = + { ?type: :programmatic_tool_calling, ?enabled: bool } + + class ProgrammaticToolCalling < OpenAI::Internal::Type::BaseModel + attr_accessor type: :programmatic_tool_calling + + attr_reader enabled: bool? + + def enabled=: (bool) -> bool + + def initialize: ( + ?enabled: bool, + ?type: :programmatic_tool_calling + ) -> void + + def to_hash: -> { ?type: :programmatic_tool_calling, ?enabled: bool } + end + + type mcp = + { + server_label: String, + transport: OpenAI::Models::Beta::persisted_mcp_transport_param, + ?type: :mcp, + ?allowed_tools: ::Array[String]?, + ?connection_origin: OpenAI::Models::Beta::PersistedAgentToolParam::Mcp::connection_origin?, + ?credential_id: String?, + ?request_metadata: ::Hash[Symbol, top]?, + ?required: bool + } + + class Mcp < OpenAI::Internal::Type::BaseModel + attr_accessor server_label: String + + attr_accessor transport: OpenAI::Models::Beta::persisted_mcp_transport_param + + attr_accessor type: :mcp + + attr_accessor allowed_tools: ::Array[String]? + + attr_accessor connection_origin: OpenAI::Models::Beta::PersistedAgentToolParam::Mcp::connection_origin? + + attr_accessor credential_id: String? + + attr_accessor request_metadata: ::Hash[Symbol, top]? + + attr_reader required: bool? + + def required=: (bool) -> bool + + def initialize: ( + server_label: String, + transport: OpenAI::Models::Beta::persisted_mcp_transport_param, + ?allowed_tools: ::Array[String]?, + ?connection_origin: OpenAI::Models::Beta::PersistedAgentToolParam::Mcp::connection_origin?, + ?credential_id: String?, + ?request_metadata: ::Hash[Symbol, top]?, + ?required: bool, + ?type: :mcp + ) -> void + + def to_hash: -> { + server_label: String, + transport: OpenAI::Models::Beta::persisted_mcp_transport_param, + ?type: :mcp, + ?allowed_tools: ::Array[String]?, + ?connection_origin: OpenAI::Models::Beta::PersistedAgentToolParam::Mcp::connection_origin?, + ?credential_id: String?, + ?request_metadata: ::Hash[Symbol, top]?, + ?required: bool + } + + type connection_origin = :service | :environment + + module ConnectionOrigin + extend OpenAI::Internal::Type::Enum + + # Uses the Managed Agents service network. + SERVICE: :service + + # Uses the session's execution environment. + ENVIRONMENT: :environment + + def self?.values: -> ::Array[OpenAI::Models::Beta::PersistedAgentToolParam::Mcp::connection_origin] + end + end + + type web_search = + { + ?type: :web_search, + ?allowed_domains: ::Array[String]?, + ?context_size: OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::context_size?, + ?location: OpenAI::Beta::PersistedAgentToolParam::WebSearch::Location?, + ?mode: OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::mode? + } + + class WebSearch < OpenAI::Internal::Type::BaseModel + attr_accessor type: :web_search + + attr_accessor allowed_domains: ::Array[String]? + + attr_accessor context_size: OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::context_size? + + attr_accessor location: OpenAI::Beta::PersistedAgentToolParam::WebSearch::Location? + + attr_accessor mode: OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::mode? + + def initialize: ( + ?allowed_domains: ::Array[String]?, + ?context_size: OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::context_size?, + ?location: OpenAI::Beta::PersistedAgentToolParam::WebSearch::Location?, + ?mode: OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::mode?, + ?type: :web_search + ) -> void + + def to_hash: -> { + ?type: :web_search, + ?allowed_domains: ::Array[String]?, + ?context_size: OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::context_size?, + ?location: OpenAI::Beta::PersistedAgentToolParam::WebSearch::Location?, + ?mode: OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::mode? + } + + type context_size = :low | :medium | :high + + module ContextSize + extend OpenAI::Internal::Type::Enum + + LOW: :low + MEDIUM: :medium + HIGH: :high + + def self?.values: -> ::Array[OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::context_size] + end + + type location = + { + ?city: String?, + ?country: String?, + ?region: String?, + ?timezone: String? + } + + class Location < OpenAI::Internal::Type::BaseModel + attr_accessor city: String? + + attr_accessor country: String? + + attr_accessor region: String? + + attr_accessor timezone: String? + + def initialize: ( + ?city: String?, + ?country: String?, + ?region: String?, + ?timezone: String? + ) -> void + + def to_hash: -> { + ?city: String?, + ?country: String?, + ?region: String?, + ?timezone: String? + } + end + + type mode = :disabled | :cached | :live + + module Mode + extend OpenAI::Internal::Type::Enum + + # Disables web search. + DISABLED: :disabled + + # Uses cached search results. + CACHED: :cached + + # Searches the live web. + LIVE: :live + + def self?.values: -> ::Array[OpenAI::Models::Beta::PersistedAgentToolParam::WebSearch::mode] + end + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::persisted_agent_tool_param] + end + end + end +end diff --git a/sig/openai/models/beta/persisted_mcp_transport.rbs b/sig/openai/models/beta/persisted_mcp_transport.rbs new file mode 100644 index 000000000..5c4848922 --- /dev/null +++ b/sig/openai/models/beta/persisted_mcp_transport.rbs @@ -0,0 +1,75 @@ +module OpenAI + module Models + module Beta + type persisted_mcp_transport = + OpenAI::Beta::PersistedMcpTransport::HTTP + | OpenAI::Beta::PersistedMcpTransport::Stdio + + module PersistedMcpTransport + extend OpenAI::Internal::Type::Union + + type http = + { headers: ::Hash[Symbol, String], server_url: String, ?type: :http } + + class HTTP < OpenAI::Internal::Type::BaseModel + attr_accessor headers: ::Hash[Symbol, String] + + attr_accessor server_url: String + + attr_accessor type: :http + + def initialize: ( + headers: ::Hash[Symbol, String], + server_url: String, + ?type: :http + ) -> void + + def to_hash: -> { + headers: ::Hash[Symbol, String], + server_url: String, + ?type: :http + } + end + + type stdio = + { + args: ::Array[String], + command: String, + cwd: String, + env_vars: ::Array[String], + ?type: :stdio + } + + class Stdio < OpenAI::Internal::Type::BaseModel + attr_accessor args: ::Array[String] + + attr_accessor command: String + + attr_accessor cwd: String + + attr_accessor env_vars: ::Array[String] + + attr_accessor type: :stdio + + def initialize: ( + args: ::Array[String], + command: String, + cwd: String, + env_vars: ::Array[String], + ?type: :stdio + ) -> void + + def to_hash: -> { + args: ::Array[String], + command: String, + cwd: String, + env_vars: ::Array[String], + ?type: :stdio + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::persisted_mcp_transport] + end + end + end +end diff --git a/sig/openai/models/beta/persisted_mcp_transport_param.rbs b/sig/openai/models/beta/persisted_mcp_transport_param.rbs new file mode 100644 index 000000000..cb4c22dec --- /dev/null +++ b/sig/openai/models/beta/persisted_mcp_transport_param.rbs @@ -0,0 +1,79 @@ +module OpenAI + module Models + module Beta + type persisted_mcp_transport_param = + OpenAI::Beta::PersistedMcpTransportParam::HTTP + | OpenAI::Beta::PersistedMcpTransportParam::Stdio + + module PersistedMcpTransportParam + extend OpenAI::Internal::Type::Union + + type http = + { + server_url: String, + ?type: :http, + ?headers: ::Hash[Symbol, String]? + } + + class HTTP < OpenAI::Internal::Type::BaseModel + attr_accessor server_url: String + + attr_accessor type: :http + + attr_accessor headers: ::Hash[Symbol, String]? + + def initialize: ( + server_url: String, + ?headers: ::Hash[Symbol, String]?, + ?type: :http + ) -> void + + def to_hash: -> { + server_url: String, + ?type: :http, + ?headers: ::Hash[Symbol, String]? + } + end + + type stdio = + { + command: String, + cwd: String, + ?type: :stdio, + ?args: ::Array[String]?, + ?env_vars: ::Array[String]? + } + + class Stdio < OpenAI::Internal::Type::BaseModel + attr_accessor command: String + + attr_accessor cwd: String + + attr_accessor type: :stdio + + attr_accessor args: ::Array[String]? + + attr_accessor env_vars: ::Array[String]? + + def initialize: ( + command: String, + cwd: String, + ?args: ::Array[String]?, + ?env_vars: ::Array[String]?, + ?type: :stdio + ) -> void + + def to_hash: -> { + command: String, + cwd: String, + ?type: :stdio, + ?args: ::Array[String]?, + ?env_vars: ::Array[String]? + } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::persisted_mcp_transport_param] + end + end + end +end diff --git a/sig/openai/models/beta/session_error.rbs b/sig/openai/models/beta/session_error.rbs new file mode 100644 index 000000000..30c6ed9d0 --- /dev/null +++ b/sig/openai/models/beta/session_error.rbs @@ -0,0 +1,32 @@ +module OpenAI + module Models + module Beta + type session_error = + { code: String?, message: String, param: String?, type: String } + + class SessionError < OpenAI::Internal::Type::BaseModel + attr_accessor code: String? + + attr_accessor message: String + + attr_accessor param: String? + + attr_accessor type: String + + def initialize: ( + code: String?, + message: String, + param: String?, + type: String + ) -> void + + def to_hash: -> { + code: String?, + message: String, + param: String?, + type: String + } + end + end + end +end diff --git a/sig/openai/models/beta/session_turn_error.rbs b/sig/openai/models/beta/session_turn_error.rbs new file mode 100644 index 000000000..c28d5efa7 --- /dev/null +++ b/sig/openai/models/beta/session_turn_error.rbs @@ -0,0 +1,96 @@ +module OpenAI + module Models + module Beta + type session_turn_error = + { code: OpenAI::Models::Beta::SessionTurnError::code, message: String } + + class SessionTurnError < OpenAI::Internal::Type::BaseModel + attr_accessor code: OpenAI::Models::Beta::SessionTurnError::code + + attr_accessor message: String + + def initialize: ( + code: OpenAI::Models::Beta::SessionTurnError::code, + message: String + ) -> void + + def to_hash: -> { + code: OpenAI::Models::Beta::SessionTurnError::code, + message: String + } + + type code = + :context_length_exceeded + | :session_budget_exceeded + | :usage_limit_exceeded + | :rate_limit_exceeded + | :server_overloaded + | :cyber_policy + | :connection_failed + | :server_error + | :authentication_error + | :invalid_request + | :resource_not_found + | :sandbox_error + | :executor_version_incompatible + | :active_turn_not_steerable + | :request_timeout + | :internal_error + + module Code + extend OpenAI::Internal::Type::Enum + + # The request exceeds the model's context window. + CONTEXT_LENGTH_EXCEEDED: :context_length_exceeded + + # The session has reached its usage budget. + SESSION_BUDGET_EXCEEDED: :session_budget_exceeded + + # The organization has reached a usage, plan, or billing limit. + USAGE_LIMIT_EXCEEDED: :usage_limit_exceeded + + # The request exceeds the available rate limit. + RATE_LIMIT_EXCEEDED: :rate_limit_exceeded + + # The model service is temporarily overloaded. + SERVER_OVERLOADED: :server_overloaded + + # The request was rejected by a safety policy. + CYBER_POLICY: :cyber_policy + + # The request could not connect to the model service. + CONNECTION_FAILED: :connection_failed + + # The model service encountered an unexpected error. + SERVER_ERROR: :server_error + + # The API credentials are invalid or lack the required access. + AUTHENTICATION_ERROR: :authentication_error + + # The request contains invalid input or configuration. + INVALID_REQUEST: :invalid_request + + # The requested model or resource is unavailable. + RESOURCE_NOT_FOUND: :resource_not_found + + # The request could not complete in its execution environment. + SANDBOX_ERROR: :sandbox_error + + # The executor must be upgraded before it can run this turn. + EXECUTOR_VERSION_INCOMPATIBLE: :executor_version_incompatible + + # The session cannot accept additional input while a request is running. + ACTIVE_TURN_NOT_STEERABLE: :active_turn_not_steerable + + # The request timed out before the model service responded. + REQUEST_TIMEOUT: :request_timeout + + # An unexpected internal error prevented the session request from completing. + INTERNAL_ERROR: :internal_error + + def self?.values: -> ::Array[OpenAI::Models::Beta::SessionTurnError::code] + end + end + end + end +end diff --git a/sig/openai/models/beta/setup_command_param.rbs b/sig/openai/models/beta/setup_command_param.rbs new file mode 100644 index 000000000..edd9e3931 --- /dev/null +++ b/sig/openai/models/beta/setup_command_param.rbs @@ -0,0 +1,17 @@ +module OpenAI + module Models + module Beta + type setup_command_param = { command: String, ?cwd: String? } + + class SetupCommandParam < OpenAI::Internal::Type::BaseModel + attr_accessor command: String + + attr_accessor cwd: String? + + def initialize: (command: String, ?cwd: String?) -> void + + def to_hash: -> { command: String, ?cwd: String? } + end + end + end +end diff --git a/sig/openai/models/beta/subagent.rbs b/sig/openai/models/beta/subagent.rbs new file mode 100644 index 000000000..9fa75ec71 --- /dev/null +++ b/sig/openai/models/beta/subagent.rbs @@ -0,0 +1,76 @@ +module OpenAI + module Models + module Beta + type subagent = + { + id: String, + closed_at: Integer?, + instructions: ::Array[OpenAI::Models::Beta::agent_content]?, + name: String?, + ?object: :"agent.session.subagent", + opened_at: Integer, + parent_agent_id: String, + session_id: String, + status: OpenAI::Models::Beta::Subagent::status + } + + class Subagent < OpenAI::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor closed_at: Integer? + + attr_accessor instructions: ::Array[OpenAI::Models::Beta::agent_content]? + + attr_accessor name: String? + + attr_accessor object: :"agent.session.subagent" + + attr_accessor opened_at: Integer + + attr_accessor parent_agent_id: String + + attr_accessor session_id: String + + attr_accessor status: OpenAI::Models::Beta::Subagent::status + + def initialize: ( + id: String, + closed_at: Integer?, + instructions: ::Array[OpenAI::Models::Beta::agent_content]?, + name: String?, + opened_at: Integer, + parent_agent_id: String, + session_id: String, + status: OpenAI::Models::Beta::Subagent::status, + ?object: :"agent.session.subagent" + ) -> void + + def to_hash: -> { + id: String, + closed_at: Integer?, + instructions: ::Array[OpenAI::Models::Beta::agent_content]?, + name: String?, + ?object: :"agent.session.subagent", + opened_at: Integer, + parent_agent_id: String, + session_id: String, + status: OpenAI::Models::Beta::Subagent::status + } + + type status = :active | :closed + + module Status + extend OpenAI::Internal::Type::Enum + + # The subagent remains available, including while idle between turns. + ACTIVE: :active + + # The subagent is closed. + CLOSED: :closed + + def self?.values: -> ::Array[OpenAI::Models::Beta::Subagent::status] + end + end + end + end +end diff --git a/sig/openai/models/beta/summary_text.rbs b/sig/openai/models/beta/summary_text.rbs new file mode 100644 index 000000000..21addfab1 --- /dev/null +++ b/sig/openai/models/beta/summary_text.rbs @@ -0,0 +1,17 @@ +module OpenAI + module Models + module Beta + type summary_text = { text: String, ?type: :summary_text } + + class SummaryText < OpenAI::Internal::Type::BaseModel + attr_accessor text: String + + attr_accessor type: :summary_text + + def initialize: (text: String, ?type: :summary_text) -> void + + def to_hash: -> { text: String, ?type: :summary_text } + end + end + end +end diff --git a/sig/openai/models/beta/text_format.rbs b/sig/openai/models/beta/text_format.rbs new file mode 100644 index 000000000..592be3313 --- /dev/null +++ b/sig/openai/models/beta/text_format.rbs @@ -0,0 +1,39 @@ +module OpenAI + module Models + module Beta + type text_format = + OpenAI::Beta::TextFormat::Text | OpenAI::Beta::TextFormat::JSONSchema + + module TextFormat + extend OpenAI::Internal::Type::Union + + type text = { ?type: :text } + + class Text < OpenAI::Internal::Type::BaseModel + attr_accessor type: :text + + def initialize: (?type: :text) -> void + + def to_hash: -> { ?type: :text } + end + + type json_schema = { schema: ::Hash[Symbol, top], ?type: :json_schema } + + class JSONSchema < OpenAI::Internal::Type::BaseModel + attr_accessor schema: ::Hash[Symbol, top] + + attr_accessor type: :json_schema + + def initialize: ( + schema: ::Hash[Symbol, top], + ?type: :json_schema + ) -> void + + def to_hash: -> { schema: ::Hash[Symbol, top], ?type: :json_schema } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::text_format] + end + end + end +end diff --git a/sig/openai/models/beta/text_format_param.rbs b/sig/openai/models/beta/text_format_param.rbs new file mode 100644 index 000000000..bc76561f1 --- /dev/null +++ b/sig/openai/models/beta/text_format_param.rbs @@ -0,0 +1,40 @@ +module OpenAI + module Models + module Beta + type text_format_param = + OpenAI::Beta::TextFormatParam::Text + | OpenAI::Beta::TextFormatParam::JSONSchema + + module TextFormatParam + extend OpenAI::Internal::Type::Union + + type text = { ?type: :text } + + class Text < OpenAI::Internal::Type::BaseModel + attr_accessor type: :text + + def initialize: (?type: :text) -> void + + def to_hash: -> { ?type: :text } + end + + type json_schema = { schema: ::Hash[Symbol, top], ?type: :json_schema } + + class JSONSchema < OpenAI::Internal::Type::BaseModel + attr_accessor schema: ::Hash[Symbol, top] + + attr_accessor type: :json_schema + + def initialize: ( + schema: ::Hash[Symbol, top], + ?type: :json_schema + ) -> void + + def to_hash: -> { schema: ::Hash[Symbol, top], ?type: :json_schema } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::text_format_param] + end + end + end +end diff --git a/sig/openai/models/beta/token_usage.rbs b/sig/openai/models/beta/token_usage.rbs new file mode 100644 index 000000000..31bde0ea4 --- /dev/null +++ b/sig/openai/models/beta/token_usage.rbs @@ -0,0 +1,62 @@ +module OpenAI + module Models + module Beta + type token_usage = + { + input_tokens: Integer, + input_tokens_details: OpenAI::Beta::TokenUsage::InputTokensDetails, + output_tokens: Integer, + output_tokens_details: OpenAI::Beta::TokenUsage::OutputTokensDetails, + total_tokens: Integer + } + + class TokenUsage < OpenAI::Internal::Type::BaseModel + attr_accessor input_tokens: Integer + + attr_accessor input_tokens_details: OpenAI::Beta::TokenUsage::InputTokensDetails + + attr_accessor output_tokens: Integer + + attr_accessor output_tokens_details: OpenAI::Beta::TokenUsage::OutputTokensDetails + + attr_accessor total_tokens: Integer + + def initialize: ( + input_tokens: Integer, + input_tokens_details: OpenAI::Beta::TokenUsage::InputTokensDetails, + output_tokens: Integer, + output_tokens_details: OpenAI::Beta::TokenUsage::OutputTokensDetails, + total_tokens: Integer + ) -> void + + def to_hash: -> { + input_tokens: Integer, + input_tokens_details: OpenAI::Beta::TokenUsage::InputTokensDetails, + output_tokens: Integer, + output_tokens_details: OpenAI::Beta::TokenUsage::OutputTokensDetails, + total_tokens: Integer + } + + type input_tokens_details = { cached_tokens: Integer } + + class InputTokensDetails < OpenAI::Internal::Type::BaseModel + attr_accessor cached_tokens: Integer + + def initialize: (cached_tokens: Integer) -> void + + def to_hash: -> { cached_tokens: Integer } + end + + type output_tokens_details = { reasoning_tokens: Integer } + + class OutputTokensDetails < OpenAI::Internal::Type::BaseModel + attr_accessor reasoning_tokens: Integer + + def initialize: (reasoning_tokens: Integer) -> void + + def to_hash: -> { reasoning_tokens: Integer } + end + end + end + end +end diff --git a/sig/openai/models/beta/web_search_action.rbs b/sig/openai/models/beta/web_search_action.rbs new file mode 100644 index 000000000..e08e36d00 --- /dev/null +++ b/sig/openai/models/beta/web_search_action.rbs @@ -0,0 +1,85 @@ +module OpenAI + module Models + module Beta + type web_search_action = + OpenAI::Beta::WebSearchAction::Search + | OpenAI::Beta::WebSearchAction::OpenPage + | OpenAI::Beta::WebSearchAction::FindInPage + | OpenAI::Beta::WebSearchAction::Other + + module WebSearchAction + extend OpenAI::Internal::Type::Union + + type search = + { queries: ::Array[String]?, query: String?, ?type: :search } + + class Search < OpenAI::Internal::Type::BaseModel + attr_accessor queries: ::Array[String]? + + attr_accessor query: String? + + attr_accessor type: :search + + def initialize: ( + queries: ::Array[String]?, + query: String?, + ?type: :search + ) -> void + + def to_hash: -> { + queries: ::Array[String]?, + query: String?, + ?type: :search + } + end + + type open_page = { ?type: :open_page, url: String? } + + class OpenPage < OpenAI::Internal::Type::BaseModel + attr_accessor type: :open_page + + attr_accessor url: String? + + def initialize: (url: String?, ?type: :open_page) -> void + + def to_hash: -> { ?type: :open_page, url: String? } + end + + type find_in_page = + { pattern: String?, ?type: :find_in_page, url: String? } + + class FindInPage < OpenAI::Internal::Type::BaseModel + attr_accessor pattern: String? + + attr_accessor type: :find_in_page + + attr_accessor url: String? + + def initialize: ( + pattern: String?, + url: String?, + ?type: :find_in_page + ) -> void + + def to_hash: -> { + pattern: String?, + ?type: :find_in_page, + url: String? + } + end + + type other = { ?type: :other } + + class Other < OpenAI::Internal::Type::BaseModel + attr_accessor type: :other + + def initialize: (?type: :other) -> void + + def to_hash: -> { ?type: :other } + end + + def self?.variants: -> ::Array[OpenAI::Models::Beta::web_search_action] + end + end + end +end diff --git a/sig/openai/resources/beta.rbs b/sig/openai/resources/beta.rbs index e8daff064..b99d36e71 100644 --- a/sig/openai/resources/beta.rbs +++ b/sig/openai/resources/beta.rbs @@ -1,6 +1,8 @@ module OpenAI module Resources class Beta + attr_reader agents: OpenAI::Resources::Beta::Agents + attr_reader responses: OpenAI::Resources::Beta::Responses attr_reader chatkit: OpenAI::Resources::Beta::ChatKit diff --git a/sig/openai/resources/beta/agents.rbs b/sig/openai/resources/beta/agents.rbs new file mode 100644 index 000000000..3db0071a9 --- /dev/null +++ b/sig/openai/resources/beta/agents.rbs @@ -0,0 +1,59 @@ +module OpenAI + module Resources + class Beta + class Agents + attr_reader environments: OpenAI::Resources::Beta::Agents::Environments + + attr_reader vaults: OpenAI::Resources::Beta::Agents::Vaults + + attr_reader sessions: OpenAI::Resources::Beta::Agents::Sessions + + def create: ( + model: String, + ?instructions: String?, + ?metadata: ::Hash[Symbol, String]?, + ?multi_agent: OpenAI::Beta::MultiAgentConfigParam?, + ?name: String?, + ?reasoning: OpenAI::Beta::AgentReasoningParam?, + ?service_tier: OpenAI::Models::Beta::AgentCreateParams::service_tier?, + ?text: OpenAI::Beta::AgentTextParam?, + ?tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool_param]?, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agent + + def retrieve: ( + String agent_id, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agent + + def update: ( + String agent_id, + ?instructions: String?, + ?metadata: ::Hash[Symbol, String]?, + ?model: String, + ?multi_agent: OpenAI::Beta::MultiAgentConfigParam?, + ?name: String?, + ?reasoning: OpenAI::Beta::AgentReasoningParam?, + ?service_tier: OpenAI::Models::Beta::AgentUpdateParams::service_tier?, + ?text: OpenAI::Beta::AgentTextParam?, + ?tools: ::Array[OpenAI::Models::Beta::persisted_agent_tool_param]?, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agent + + def list: ( + ?after: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::AgentListParams::order, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::CursorPage[OpenAI::Beta::Agent] + + def delete: ( + String agent_id, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::AgentDeleted + + def initialize: (client: OpenAI::Client) -> void + end + end + end +end diff --git a/sig/openai/resources/beta/agents/environments.rbs b/sig/openai/resources/beta/agents/environments.rbs new file mode 100644 index 000000000..f1e11c398 --- /dev/null +++ b/sig/openai/resources/beta/agents/environments.rbs @@ -0,0 +1,20 @@ +module OpenAI + module Resources + class Beta + class Agents + class Environments + attr_reader files: OpenAI::Resources::Beta::Agents::Environments::Files + + attr_reader templates: OpenAI::Resources::Beta::Agents::Environments::Templates + + def retrieve: ( + String environment_id, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::EnvironmentInfo + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end +end diff --git a/sig/openai/resources/beta/agents/environments/files.rbs b/sig/openai/resources/beta/agents/environments/files.rbs new file mode 100644 index 000000000..8048c3ca4 --- /dev/null +++ b/sig/openai/resources/beta/agents/environments/files.rbs @@ -0,0 +1,28 @@ +module OpenAI + module Resources + class Beta + class Agents + class Environments + class Files + def create: ( + String environment_id, + hosted_environment_file_param: OpenAI::Models::Beta::hosted_environment_file_param, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Environments::EnvironmentFile + + def list: ( + String environment_id, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::Environments::FileListParams::order, + ?page: String, + ?path: String?, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::TokenPage[OpenAI::Beta::Agents::Environments::EnvironmentFile] + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end + end +end diff --git a/sig/openai/resources/beta/agents/environments/templates.rbs b/sig/openai/resources/beta/agents/environments/templates.rbs new file mode 100644 index 000000000..f95482602 --- /dev/null +++ b/sig/openai/resources/beta/agents/environments/templates.rbs @@ -0,0 +1,57 @@ +module OpenAI + module Resources + class Beta + class Agents + class Environments + class Templates + def create: ( + ?capability_directories: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]?, + ?name: String?, + ?network: OpenAI::Beta::Agents::Environments::TemplateCreateParams::Network?, + ?packages: OpenAI::Beta::Agents::Environments::TemplateCreateParams::Packages?, + ?plugins: ::Array[OpenAI::Beta::HostedPluginParam]?, + ?setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]?, + ?skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]?, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Environments::EnvironmentTemplate + + def retrieve: ( + String environment_template_id, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Environments::EnvironmentTemplate + + def update: ( + String environment_template_id, + ?capability_directories: ::Array[String]?, + ?env: ::Hash[Symbol, String]?, + ?files: ::Array[OpenAI::Models::Beta::hosted_environment_file_param]?, + ?name: String?, + ?network: OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Network?, + ?packages: OpenAI::Beta::Agents::Environments::TemplateUpdateParams::Packages?, + ?plugins: ::Array[OpenAI::Beta::HostedPluginParam]?, + ?setup_commands: ::Array[OpenAI::Beta::SetupCommandParam]?, + ?skills: ::Array[OpenAI::Models::Beta::hosted_skill_param]?, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Environments::EnvironmentTemplate + + def list: ( + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Environments::TemplateListParams::order, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::CursorPage[OpenAI::Beta::Agents::Environments::EnvironmentTemplate] + + def delete: ( + String environment_template_id, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Environments::EnvironmentTemplateDeleted + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end + end +end diff --git a/sig/openai/resources/beta/agents/sessions.rbs b/sig/openai/resources/beta/agents/sessions.rbs new file mode 100644 index 000000000..84be3a403 --- /dev/null +++ b/sig/openai/resources/beta/agents/sessions.rbs @@ -0,0 +1,65 @@ +module OpenAI + module Resources + class Beta + class Agents + class Sessions + attr_reader subagents: OpenAI::Resources::Beta::Agents::Sessions::Subagents + + attr_reader artifacts: OpenAI::Resources::Beta::Agents::Sessions::Artifacts + + attr_reader items: OpenAI::Resources::Beta::Agents::Sessions::Items + + attr_reader events: OpenAI::Resources::Beta::Agents::Sessions::Events + + attr_reader turns: OpenAI::Resources::Beta::Agents::Sessions::Turns + + def create: ( + environment: OpenAI::Models::Beta::environment_param, + ?agent: OpenAI::Beta::Agents::SessionCreateParams::Agent, + ?agent_id: String, + ?input: OpenAI::Models::Beta::Agents::SessionCreateParams::input?, + ?metadata: ::Hash[Symbol, String]?, + ?vault_ids: ::Array[String]?, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::AgentSession + + def create_streaming: ( + environment: OpenAI::Models::Beta::environment_param, + ?agent: OpenAI::Beta::Agents::SessionCreateParams::Agent, + ?agent_id: String, + ?input: OpenAI::Models::Beta::Agents::SessionCreateParams::input?, + ?metadata: ::Hash[Symbol, String]?, + ?vault_ids: ::Array[String]?, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::Stream[OpenAI::Models::Beta::agent_session_event] + + def retrieve: ( + String session_id, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::AgentSession + + def update: ( + String session_id, + ?metadata: ::Hash[Symbol, String]?, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::AgentSession + + def list: ( + ?after: String, + ?agent_id: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::SessionListParams::order, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::CursorPage[OpenAI::Beta::AgentSession] + + def delete: ( + String session_id, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::AgentSessionDeleted + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end +end diff --git a/sig/openai/resources/beta/agents/sessions/artifacts.rbs b/sig/openai/resources/beta/agents/sessions/artifacts.rbs new file mode 100644 index 000000000..b5c6ca4f2 --- /dev/null +++ b/sig/openai/resources/beta/agents/sessions/artifacts.rbs @@ -0,0 +1,40 @@ +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Artifacts + def retrieve: ( + String artifact_id, + session_id: String, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Sessions::SessionArtifact + + def list: ( + String session_id, + ?after: String?, + ?environment_id: String?, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::Sessions::ArtifactListParams::order, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::CursorPage[OpenAI::Beta::Agents::Sessions::SessionArtifact] + + def delete: ( + String artifact_id, + session_id: String, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Sessions::SessionArtifactDeleted + + def content: ( + String artifact_id, + session_id: String, + ?request_options: OpenAI::request_opts + ) -> (StringIO & OpenAI::ResponseCarrier) + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end + end +end diff --git a/sig/openai/resources/beta/agents/sessions/events.rbs b/sig/openai/resources/beta/agents/sessions/events.rbs new file mode 100644 index 000000000..100d5e904 --- /dev/null +++ b/sig/openai/resources/beta/agents/sessions/events.rbs @@ -0,0 +1,25 @@ +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Events + def create: ( + String session_id, + events: ::Array[OpenAI::Models::Beta::agent_session_input_param], + ?idempotency_key: String, + ?request_options: OpenAI::request_opts + ) -> nil + + def stream_streaming: ( + String session_id, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::Stream[OpenAI::Models::Beta::agent_session_event] + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end + end +end diff --git a/sig/openai/resources/beta/agents/sessions/items.rbs b/sig/openai/resources/beta/agents/sessions/items.rbs new file mode 100644 index 000000000..855335868 --- /dev/null +++ b/sig/openai/resources/beta/agents/sessions/items.rbs @@ -0,0 +1,21 @@ +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Items + def list: ( + String session_id, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::ItemListParams::order, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::CursorPage[OpenAI::Models::Beta::agent_session_item] + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end + end +end diff --git a/sig/openai/resources/beta/agents/sessions/subagents.rbs b/sig/openai/resources/beta/agents/sessions/subagents.rbs new file mode 100644 index 000000000..e74a56429 --- /dev/null +++ b/sig/openai/resources/beta/agents/sessions/subagents.rbs @@ -0,0 +1,31 @@ +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Subagents + attr_reader items: OpenAI::Resources::Beta::Agents::Sessions::Subagents::Items + + attr_reader turns: OpenAI::Resources::Beta::Agents::Sessions::Subagents::Turns + + def retrieve: ( + String subagent_id, + session_id: String, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Subagent + + def list: ( + String session_id, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::SubagentListParams::order, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::CursorPage[OpenAI::Beta::Subagent] + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end + end +end diff --git a/sig/openai/resources/beta/agents/sessions/subagents/items.rbs b/sig/openai/resources/beta/agents/sessions/subagents/items.rbs new file mode 100644 index 000000000..856f9b141 --- /dev/null +++ b/sig/openai/resources/beta/agents/sessions/subagents/items.rbs @@ -0,0 +1,24 @@ +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Subagents + class Items + def list: ( + String subagent_id, + session_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::Subagents::ItemListParams::order, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::CursorPage[OpenAI::Models::Beta::agent_session_item] + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end + end + end +end diff --git a/sig/openai/resources/beta/agents/sessions/subagents/turns.rbs b/sig/openai/resources/beta/agents/sessions/subagents/turns.rbs new file mode 100644 index 000000000..bb52981af --- /dev/null +++ b/sig/openai/resources/beta/agents/sessions/subagents/turns.rbs @@ -0,0 +1,33 @@ +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Subagents + class Turns + attr_reader items: OpenAI::Resources::Beta::Agents::Sessions::Subagents::Turns::Items + + def retrieve: ( + String turn_id, + session_id: String, + subagent_id: String, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Sessions::Turn + + def list: ( + String subagent_id, + session_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::Subagents::TurnListParams::order, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::CursorPage[OpenAI::Beta::Agents::Sessions::Turn] + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end + end + end +end diff --git a/sig/openai/resources/beta/agents/sessions/subagents/turns/items.rbs b/sig/openai/resources/beta/agents/sessions/subagents/turns/items.rbs new file mode 100644 index 000000000..d502da1f1 --- /dev/null +++ b/sig/openai/resources/beta/agents/sessions/subagents/turns/items.rbs @@ -0,0 +1,27 @@ +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Subagents + class Turns + class Items + def list: ( + String turn_id, + session_id: String, + subagent_id: String, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::Subagents::Turns::ItemListParams::order, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::CursorPage[OpenAI::Models::Beta::agent_session_item] + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end + end + end + end +end diff --git a/sig/openai/resources/beta/agents/sessions/turns.rbs b/sig/openai/resources/beta/agents/sessions/turns.rbs new file mode 100644 index 000000000..f82176344 --- /dev/null +++ b/sig/openai/resources/beta/agents/sessions/turns.rbs @@ -0,0 +1,27 @@ +module OpenAI + module Resources + class Beta + class Agents + class Sessions + class Turns + def retrieve: ( + String turn_id, + session_id: String, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Sessions::Turn + + def list: ( + String session_id, + ?after: String, + ?limit: Integer, + ?order: OpenAI::Models::Beta::Agents::Sessions::TurnListParams::order, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::CursorPage[OpenAI::Beta::Agents::Sessions::Turn] + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end + end +end diff --git a/sig/openai/resources/beta/agents/vaults.rbs b/sig/openai/resources/beta/agents/vaults.rbs new file mode 100644 index 000000000..ab02a68d9 --- /dev/null +++ b/sig/openai/resources/beta/agents/vaults.rbs @@ -0,0 +1,37 @@ +module OpenAI + module Resources + class Beta + class Agents + class Vaults + attr_reader credentials: OpenAI::Resources::Beta::Agents::Vaults::Credentials + + def create: ( + ?metadata: ::Hash[Symbol, String]?, + ?name: String, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Vault + + def retrieve: ( + String vault_id, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Vault + + def list: ( + ?after: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::VaultListParams::order, + ?status: OpenAI::Models::Beta::Agents::vault_status_filter, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::CursorPage[OpenAI::Beta::Agents::Vault] + + def delete: ( + String vault_id, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::VaultDeleted + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end +end diff --git a/sig/openai/resources/beta/agents/vaults/credentials.rbs b/sig/openai/resources/beta/agents/vaults/credentials.rbs new file mode 100644 index 000000000..99370377a --- /dev/null +++ b/sig/openai/resources/beta/agents/vaults/credentials.rbs @@ -0,0 +1,48 @@ +module OpenAI + module Resources + class Beta + class Agents + class Vaults + class Credentials + def create: ( + String vault_id, + auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth_create_param, + name: String, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Vaults::Credential + + def retrieve: ( + String credential_id, + vault_id: String, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Vaults::Credential + + def update: ( + String credential_id, + vault_id: String, + auth: OpenAI::Models::Beta::Agents::Vaults::credential_auth_rotate_param, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Vaults::Credential + + def list: ( + String vault_id, + ?after: String, + ?limit: Integer?, + ?order: OpenAI::Models::Beta::Agents::Vaults::CredentialListParams::order, + ?status: OpenAI::Models::Beta::Agents::vault_status_filter, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Internal::CursorPage[OpenAI::Beta::Agents::Vaults::Credential] + + def delete: ( + String credential_id, + vault_id: String, + ?request_options: OpenAI::request_opts + ) -> OpenAI::Beta::Agents::Vaults::CredentialDeleted + + def initialize: (client: OpenAI::Client) -> void + end + end + end + end + end +end diff --git a/test/fixtures/rbs_compatibility/agent_session_stream_valid.rb.txt b/test/fixtures/rbs_compatibility/agent_session_stream_valid.rb.txt new file mode 100644 index 000000000..3e4b7141d --- /dev/null +++ b/test/fixtures/rbs_compatibility/agent_session_stream_valid.rb.txt @@ -0,0 +1,11 @@ +client = OpenAI::Client.new(api_key: "fake-key") +client.beta.agents.sessions.stream("session_test", input: "Hello", tool_handlers: {"lookup" => ->(arguments) { arguments.fetch("query").to_s }}) do |stream| + stream.each do |event| + event.event_id.to_s + end +end +stream = client.beta.agents.sessions.stream("session_test", input: [{role: :user, content: [{type: :input_text, text: "Hello"}]}]) +stream.until_done +stream.close +message = OpenAI::Beta::AgentSessionMessage.new(id: "message_test", content: [], phase: nil, role: :assistant, status: :completed, turn_id: "turn_test") +message.output_text.upcase diff --git a/test/openai/helpers/agent_session_stream_test.rb b/test/openai/helpers/agent_session_stream_test.rb new file mode 100644 index 000000000..f0cbcb1b9 --- /dev/null +++ b/test/openai/helpers/agent_session_stream_test.rb @@ -0,0 +1,464 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class OpenAI::Test::AgentSessionStreamTest < Minitest::Test + class Body + attr_reader :closed, :reads + + def initialize(events) + @events = events + @reads = 0 + end + + def each + @events.each_with_index do |event, index| + @reads += 1 + yield "data: #{JSON.generate({event_id: index.to_s}.merge(event))}\n\n" + end + end + + def close = @closed = true + end + + class Server < OpenAI::HTTPClient + attr_accessor :status, :input_error, :tool_errors, :lost_responses + attr_reader :body, :requests + + def initialize(events) + super() + @body = Body.new(events) + @requests = [] + @status = "idle" + @tool_errors = [] + @lost_responses = [] + end + + def execute(request) + @requests << request + if request.method == :get + if request.url.path.end_with?("/events") + return response(200, @body, "text/event-stream") + end + + return response(200, JSON.generate(id: "session_test", status: @status)) + end + + input = JSON.parse(request.body).fetch("events").first + kind = input.fetch("type") + if @lost_responses.delete(kind) + raise OpenAI::Errors::APIConnectionError.new(url: request.url) + end + + error = kind == "agent.session.input.message" ? @input_error : @tool_errors.shift + if error + return response( + 400, + JSON.generate(error: {type: "invalid_request_error", code: "invalid_request_error", message: error}) + ) + end + + response(204, "") + end + + def response(status, body, content_type = "application/json") + OpenAI::HTTPClient::Response.new(status: status, headers: {"content-type" => content_type}, body: body) + end + + def submissions + @requests.select { |r| r.method == :post }.map { |r| JSON.parse(r.body).fetch("events").first } + end + end + + def setup + super + configure + end + + def configure(events = [turn("created"), turn("completed"), idle]) + @server = Server.new(events) + @client = OpenAI::Client.new( + api_key: "fake-key", + base_url: "https://sdk-test.example/v1", + http_client: @server, + max_retries: 1 + ) + @sessions = @client.beta.agents.sessions + end + + def test_lifecycle_selects_coordinator_and_waits_for_idle + configure( + [ + idle, + turn("created", "child", "subagent"), + turn("created"), + turn("completed", "child"), + idle, + turn("completed", "other"), + idle, + turn("completed"), + idle, + turn("created", "later") + ] + ) + events = @sessions.stream("session_test", input: "Hello").to_a + assert_equal(9, events.size) + assert_instance_of(OpenAI::Models::Beta::AgentSessionTurnCreatedEvent, events[2]) + assert_equal(9, @server.body.reads) + assert(@server.body.closed) + assert_equal([:get, :get, :post], @server.requests.map(&:method)) + assert_equal("/v1/agents/sessions/session_test/events", @server.requests[1].url.path) + assert_equal( + [{"role" => "user", "content" => [{"type" => "input_text", "text" => "Hello"}]}], + @server.submissions.first["input"] + ) + end + + def test_failed_and_cancelled_turns_remain_visible + %w[failed cancelled].each do |kind| + configure([turn("created"), turn(kind), idle]) + assert_equal("agent.session.turn.#{kind}", @sessions.stream("session_test", input: "Hi").to_a[1].type.to_s) + assert(@server.body.closed) + end + + configure([{type: "agent.session.failed", session: {id: "session_test", status: "failed"}}]) + assert_equal(1, @sessions.stream("session_test", input: "Hi").to_a.size) + assert(@server.body.closed) + end + + def test_cleanup_on_break_exception_explicit_close_and_block_exit + @sessions.stream("session_test", input: "Hi").each { |event| break if event } + assert(@server.body.closed) + configure + assert_raises(RuntimeError) { + @sessions.stream("session_test", input: "Hi").each { |event| raise "consumer" if event } + } + assert(@server.body.closed) + configure + @sessions.stream("session_test", input: "Hi").close + assert(@server.body.closed) + configure + @sessions.stream("session_test", input: "Hi") { |_stream| nil } + assert(@server.body.closed) + assert_equal(1, @server.submissions.size) + end + + def test_until_done_consumes_remaining_events_after_external_iteration + configure([turn("created"), call("{}"), turn("completed"), idle]) + handled = 0 + stream = @sessions.stream( + "session_test", + input: "Hi", + tool_handlers: { + "search" => -> (_args) { + handled += 1 + "ok" + } + } + ) + events = stream.each + assert_instance_of(OpenAI::Models::Beta::AgentSessionTurnCreatedEvent, events.next) + stream.until_done + assert_equal(1, handled) + assert(@server.body.closed) + assert_raises(StopIteration) { events.next } + end + + def test_rejects_active_empty_and_failed_input_and_unexpected_eof + @server.status = "in_progress" + assert_raises(ArgumentError) { @sessions.stream("session_test", input: "Hi") } + assert_equal(1, @server.requests.size) + ["", []].each { |input| assert_raises(ArgumentError) { @sessions.stream("session_test", input: input) } } + configure + @server.input_error = "rejected" + assert_raises(OpenAI::Errors::BadRequestError) { @sessions.stream("session_test", input: "Hi") } + assert(@server.body.closed) + configure([turn("created"), turn("completed")]) + assert_raises(RuntimeError) { @sessions.stream("session_test", input: "Hi").until_done } + assert(@server.body.closed) + end + + def test_handlers_are_sequential_deduplicate_calls_and_preserve_events + first = call({nested: {values: ["original"]}}).merge(event_id: "duplicate") + configure( + [ + turn("created"), + first, + first, + call({nested: {values: ["original"]}}), + call("{}", "call_two"), + call("{}", "manual", "unknown"), + turn("completed"), + idle + ] + ) + seen = [] + events = [] + @sessions + .stream( + "session_test", + input: "Hi", + tool_handlers: { + "search" => lambda { |args| + seen << events.last.item.call_id + args["nested"]&.fetch("values")&.push("changed") + {ok: true} + } + } + ) + .each { |event| events << event } + assert_equal(%w[call_test call_two], seen) + assert_equal(["original"], events[1].item.arguments[:nested][:values]) + assert_equal(7, events.size) + assert_equal(["{\"ok\":true}", "{\"ok\":true}"], @server.submissions.drop(1).map { |e| e["output"] }) + end + + def test_consumer_mutation_does_not_change_selected_handler_arguments_or_result_routing + configure([turn("created"), call({nested: {values: ["original"]}}), call("{}"), turn("completed"), idle]) + seen = [] + @sessions + .stream( + "session_test", + input: "Hi", + tool_handlers: { + "search" => -> (args) { + seen << args + "ok" + } + } + ) + .each do |event| + event.turn_id.replace("mutated_coordinator") if event.type == :"agent.session.turn.created" + next unless event.type == :"agent.session.turn.item.added" + + event.item.name.replace("unregistered") + event.item.call_id.replace("different_call") + event.item.turn_id.replace("different_turn") + event.item.arguments[:nested][:values] << "changed" if event.item.arguments.is_a?(Hash) + event.item.arguments = {changed: true} + end + + assert_equal([{"nested" => {"values" => ["original"]}}], seen) + assert_equal("call_test", @server.submissions.last["call_id"]) + assert_equal("turn_root", @server.submissions.last["turn_id"]) + assert_equal(2, @server.submissions.size) + end + + def test_full_call_dedup_outlives_bounded_event_cache_and_uses_turn_id + first = call("{}").merge(event_id: "old") + configure( + [turn("created"), first] + + Array.new(1025) { idle } + + [first, call("{}").merge(item: call("{}")[:item].merge(turn_id: "child")), turn("completed"), idle] + ) + count = 0 + stream = @sessions.stream( + "session_test", + input: "Hi", + tool_handlers: { + "search" => -> (_args) { + count += 1 + nil + } + } + ) + stream.until_done + assert_equal(2, count) + assert_operator(stream.instance_variable_get(:@recent_events).size, :<=, 1024) + end + + def test_invalid_arguments_and_handler_errors_submit_generic_failures + ["{", "[]", "null", [], 1, nil, "{}"].each do |args| + configure([turn("created"), call(args), turn("completed"), idle]) + @sessions + .stream("session_test", input: "Hi", tool_handlers: {"search" => -> (_input) { raise "fake-secret" }}) + .until_done + result = @server.submissions.last + assert_equal(false, result["success"]) + assert_equal("Tool handler failed.", result["error"]) + refute_includes(JSON.generate(@server.submissions), "fake-secret") + end + end + + def test_malformed_content_outputs_submit_generic_failures + [[1], [{type: :input_text}], [{type: :input_text, text: 1}], [{type: :input_image, image_url: nil}]].each do | + output + | + configure([turn("created"), call("{}"), turn("completed"), idle]) + @sessions.stream("session_test", input: "Hi", tool_handlers: {"search" => -> (_args) { output }}).until_done + assert_equal(false, @server.submissions.last["success"]) + assert_equal("Tool handler failed.", @server.submissions.last["error"]) + end + end + + def test_protocol_errors_preserve_raw_stream_exceptions_and_cleanup + events = [ + turn("created"), + { + type: "error", + session_id: "session_test", + error: {type: "server_error", code: "server_error", message: "fake failure"} + }, + turn("failed"), + idle + ] + configure(events) + helper_error = assert_raises(OpenAI::Errors::APIStatusError) do + @sessions.stream("session_test", input: "Hi").until_done + end + + assert(@server.body.closed) + assert_equal(2, @server.body.reads) + configure(events) + assert_raises(helper_error.class) { @sessions.events.stream_streaming("session_test").to_a } + assert(@server.body.closed) + end + + def test_string_null_and_content_outputs + [ + "answer", + nil, + [{type: "input_text", text: "answer"}], + [OpenAI::Beta::InputContentParam::InputImage.new(image_url: "https://example.com/image.png")] + ].each do |output| + configure([turn("created"), call("{}"), turn("completed"), idle]) + @sessions + .stream( + "session_test", + input: [{role: :user, content: [{type: :input_text, text: "Hi"}]}], + tool_handlers: {"search" => -> (_args) { output }} + ) + .until_done + if output.nil? + assert_nil(@server.submissions.last["output"]) + else + assert_equal(JSON.parse(JSON.generate(output)), @server.submissions.last["output"]) + end + + assert_equal(true, @server.submissions.last["success"]) + end + end + + def test_explicit_input_key_precedes_request_options_and_tool_keys_are_distinct + configure([turn("created"), call("{}"), call("{}", "other_call"), turn("completed"), idle]) + @sessions + .stream( + "session_test", + input: "Hi", + idempotency_key: "method-key", + request_options: {idempotency_key: "options-key"}, + tool_handlers: {"search" => -> (_args) { "ok" }} + ) + .until_done + keys = @server.requests.select { |request| request.method == :post }.map { |request| + request.headers["idempotency-key"] + } + assert_equal("method-key", keys.first) + assert_equal(3, keys.uniq.size) + refute_includes(keys, "options-key") + configure + @sessions.stream("session_test", input: "Hi", request_options: {idempotency_key: "options-key"}).until_done + assert_equal("options-key", @server.requests.last.headers["idempotency-key"]) + end + + def test_retry_keys_options_and_narrow_pending_call_race + configure([turn("created"), call("{}"), turn("completed"), idle]) + @server.lost_responses = %w[agent.session.input.message agent.session.input.tool_result] + @server.tool_errors = ["Unknown pending tool call: call_test"] + options = OpenAI::RequestOptions.new( + timeout: 4.0, + extra_headers: {"IDEMPOTENCY-KEY" => "input-key", "X-Test" => "yes"} + ) + @sessions + .stream( + "session_test", + input: "Hi", + idempotency_key: "ignored", + request_options: options, + tool_handlers: {"search" => -> (_args) { "ok" }} + ) + .until_done + posts = @server.requests.select { |r| r.method == :post } + assert_equal(["input-key"], posts.take(2).map { |r| r.headers["idempotency-key"] }.uniq) + keys = posts.drop(2).map { |r| r.headers["idempotency-key"] }.uniq + assert_equal(1, keys.size) + refute_equal("input-key", keys.first) + assert_equal(5, posts.size) + @server.requests.each do |request| + assert_equal(4.0, request.timeout) + assert_equal("yes", request.headers["x-test"]) + assert_equal("agents=v1", request.headers["openai-beta"]) + end + + assert_equal("input-key", options.extra_headers["IDEMPOTENCY-KEY"]) + configure([turn("created"), call("{}")]) + @server.tool_errors = ["Unknown pending tool call: different_call"] + assert_raises(OpenAI::Errors::BadRequestError) do + @sessions.stream("session_test", input: "Hi", tool_handlers: {"search" => -> (_args) { "ok" }}).until_done + end + + assert_equal(2, @server.submissions.size) + assert(@server.body.closed) + end + + def test_output_text_is_pure_and_independent_of_phase + [nil, :commentary, :final_answer].each do |phase| + message = OpenAI::Models::Beta::AgentSessionMessage.new( + id: "message_test", + role: :assistant, + phase: phase, + status: :completed, + turn_id: "turn_root", + content: [ + {type: :output_text, text: "Hello"}, + {type: :input_text, text: "ignored"}, + {type: :input_image, image_url: "https://example.com/image.png"}, + {type: :output_text, text: " world"} + ] + ) + original = message.to_json + assert_equal("Hello world", message.output_text) + assert_equal(original, message.to_json) + message.content = [] + assert_equal("", message.output_text) + end + end + + private + + def turn(kind, id = "turn_root", subagent_id = nil) + { + type: "agent.session.turn.#{kind}", + session_id: "session_test", + turn_id: id, + turn: { + id: id, + object: "agent.session.turn", + agent_id: "agent_test", + session_id: "session_test", + created_at: 1, + status: kind == "created" ? "in_progress" : kind, + subagent_id: subagent_id + } + } + end + + def idle = {type: "agent.session.idle", session: {id: "session_test", status: "idle"}} + + def call(arguments, call_id = "call_test", name = "search") + { + type: "agent.session.turn.item.added", + session_id: "session_test", + turn_id: "turn_root", + item: { + id: "item_test", + type: "function_call", + name: name, + call_id: call_id, + arguments: arguments, + status: "in_progress", + turn_id: "turn_root" + } + } + end +end diff --git a/test/openai/resource_namespaces.rb b/test/openai/resource_namespaces.rb index 1a0f83885..2abd463cd 100644 --- a/test/openai/resource_namespaces.rb +++ b/test/openai/resource_namespaces.rb @@ -24,6 +24,21 @@ module Users end end + module Agents + module Environments + end + + module Sessions + module Subagents + module Turns + end + end + end + + module Vaults + end + end + module Alpha end @@ -31,6 +46,21 @@ module Audio end module Beta + module Agents + module Environments + end + + module Sessions + module Subagents + module Turns + end + end + end + + module Vaults + end + end + module ChatKit end @@ -65,6 +95,9 @@ module Files module Conversations end + module Environments + end + module Evals module Runs end @@ -141,22 +174,40 @@ module Safety module ServiceAccounts end + module Sessions + module Subagents + module Turns + end + end + end + module Skills module Versions end end + module Subagents + module Turns + end + end + module Threads module Runs end end + module Turns + end + module Uploads end module Users end + module Vaults + end + module VectorStores end diff --git a/test/openai/resources/agents_pagination_test.rb b/test/openai/resources/agents_pagination_test.rb new file mode 100644 index 000000000..b238a410e --- /dev/null +++ b/test/openai/resources/agents_pagination_test.rb @@ -0,0 +1,99 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class OpenAI::Test::AgentsPaginationTest < Minitest::Test + def test_sessions_preserve_order_and_limit + assert_two_pages("agents/sessions", {limit: 1, order: "asc"}) do |client| + client.beta.agents.sessions.list(limit: 1, order: :asc, after: "before_first") + end + end + + def test_vaults_preserve_status_filter_and_limit + assert_two_pages("vaults", {limit: 1, status: "archived"}) do |client| + client.beta.agents.vaults.list(limit: 1, status: :archived, after: "before_first") + end + end + + def test_credentials_preserve_vault_path_and_status_filter + assert_two_pages("vaults/vault_fake/credentials", {:limit => 1, "status[]" => %w[active archived]}) do |client| + client.beta.agents.vaults.credentials.list( + "vault_fake", + limit: 1, + status: [:active, :archived], + after: "before_first" + ) + end + end + + def test_items_preserve_filter_and_follow_response_cursor + assert_two_pages( + "agents/sessions/session_test/items", + {limit: 1, order: "asc"}, + cursor_key: :after + ) do |client| + client.beta.agents.sessions.items.list( + "session_test", + limit: 1, + order: :asc, + after: "before_first" + ) + end + end + + def test_turns_preserve_filter_and_follow_last_id + assert_two_pages( + "agents/sessions/session_test/turns", + {limit: 1, order: "asc"}, + cursor_key: :last_id + ) do |client| + client.beta.agents.sessions.turns.list( + "session_test", + limit: 1, + order: :asc, + after: "before_first" + ) + end + end + + private def assert_two_pages(path, filters, cursor_key: nil) + requests = [] + transport = Minitest::Mock.new(OpenAI::HTTPClient.new) + [true, false].each_with_index do |has_more, index| + item_id = "item_#{index + 1}" + response = OpenAI::HTTPClient::Response.new( + status: 200, + headers: {"content-type" => "application/json", "x-request-id" => "request_#{index + 1}"}, + body: JSON.generate( + {object: "list", data: [{id: item_id}], has_more: has_more, last_id: item_id}.merge( + cursor_key ? {cursor_key => "item_#{index + 1}"} : {} + ) + ) + ) + transport.expect(:execute, response) do |request| + requests << request + true + end + end + + client = OpenAI::Client.new( + api_key: "fake-api-key", + base_url: "https://sdk-test.example/v1", + http_client: transport + ) + + first_page = yield(client) + assert_instance_of(OpenAI::Internal::CursorPage, first_page) + assert_equal("request_1", first_page._request_id) + assert_equal(["item_1", "item_2"], first_page.to_enum.map(&:id)) + transport.verify + assert_equal(2, requests.length) + requests.each_with_index do |request, index| + assert_equal("/v1/#{path}", request.url.path) + query = URI.decode_www_form(request.url.query).group_by(&:first).transform_values { |pairs| pairs.map(&:last) } + assert_equal([index.zero? ? "before_first" : "item_1"], query.fetch("after")) + filters.each { |key, value| assert_equal(Array(value).map(&:to_s), query.fetch(key.to_s)) } + assert_equal("agents=v1", request.headers.fetch("openai-beta")) + end + end +end diff --git a/test/openai/resources/beta/agents/environments/files_test.rb b/test/openai/resources/beta/agents/environments/files_test.rb new file mode 100644 index 000000000..8cbcc354e --- /dev/null +++ b/test/openai/resources/beta/agents/environments/files_test.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +require_relative "../../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::Environments::FilesTest < OpenAI::Test::ResourceTest + def test_create_required_params + response = @openai.beta.agents.environments.files.create( + "environment_id", + hosted_environment_file_param: {file_id: "file_id", path: "path", type: :file_id} + ) + + assert_pattern do + response => OpenAI::Beta::Agents::Environments::EnvironmentFile + end + + assert_pattern do + response => { + environment_id: String, + object: Symbol, + path: String, + size_bytes: Integer + } + end + end + + def test_list + response = @openai.beta.agents.environments.files.list("environment_id") + + assert_pattern do + response => OpenAI::Internal::TokenPage + end + + # Validate this response only; pagination is covered with finite fixtures. + row = response.data&.first + return if row.nil? + + assert_pattern do + row => OpenAI::Beta::Agents::Environments::EnvironmentFile + end + + assert_pattern do + row => { + environment_id: String, + object: Symbol, + path: String, + size_bytes: Integer + } + end + end +end diff --git a/test/openai/resources/beta/agents/environments/templates_test.rb b/test/openai/resources/beta/agents/environments/templates_test.rb new file mode 100644 index 000000000..04fc690a4 --- /dev/null +++ b/test/openai/resources/beta/agents/environments/templates_test.rb @@ -0,0 +1,132 @@ +# frozen_string_literal: true + +require_relative "../../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::Environments::TemplatesTest < OpenAI::Test::ResourceTest + def test_create + response = @openai.beta.agents.environments.templates.create + + assert_pattern do + response => OpenAI::Beta::Agents::Environments::EnvironmentTemplate + end + + assert_pattern do + response => { + id: String, + capability_directories: ^(OpenAI::Internal::Type::ArrayOf[String]), + created_at: Integer, + files: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File]), + name: String | nil, + network: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network, + object: Symbol, + packages: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages, + plugins: ^(OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::HostedPlugin]), + skills: ^(OpenAI::Internal::Type::ArrayOf[ + union: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill + ]), + updated_at: Integer + } + end + end + + def test_retrieve + response = @openai.beta.agents.environments.templates.retrieve("environment_template_id") + + assert_pattern do + response => OpenAI::Beta::Agents::Environments::EnvironmentTemplate + end + + assert_pattern do + response => { + id: String, + capability_directories: ^(OpenAI::Internal::Type::ArrayOf[String]), + created_at: Integer, + files: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File]), + name: String | nil, + network: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network, + object: Symbol, + packages: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages, + plugins: ^(OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::HostedPlugin]), + skills: ^(OpenAI::Internal::Type::ArrayOf[ + union: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill + ]), + updated_at: Integer + } + end + end + + def test_update + response = @openai.beta.agents.environments.templates.update("environment_template_id") + + assert_pattern do + response => OpenAI::Beta::Agents::Environments::EnvironmentTemplate + end + + assert_pattern do + response => { + id: String, + capability_directories: ^(OpenAI::Internal::Type::ArrayOf[String]), + created_at: Integer, + files: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File]), + name: String | nil, + network: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network, + object: Symbol, + packages: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages, + plugins: ^(OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::HostedPlugin]), + skills: ^(OpenAI::Internal::Type::ArrayOf[ + union: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill + ]), + updated_at: Integer + } + end + end + + def test_list + response = @openai.beta.agents.environments.templates.list + + assert_pattern do + response => OpenAI::Internal::CursorPage + end + + row = response.to_enum.first + return if row.nil? + + assert_pattern do + row => OpenAI::Beta::Agents::Environments::EnvironmentTemplate + end + + assert_pattern do + row => { + id: String, + capability_directories: ^(OpenAI::Internal::Type::ArrayOf[String]), + created_at: Integer, + files: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::File]), + name: String | nil, + network: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Network, + object: Symbol, + packages: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Packages, + plugins: ^(OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::HostedPlugin]), + skills: ^(OpenAI::Internal::Type::ArrayOf[ + union: OpenAI::Beta::Agents::Environments::EnvironmentTemplate::Skill + ]), + updated_at: Integer + } + end + end + + def test_delete + response = @openai.beta.agents.environments.templates.delete("environment_template_id") + + assert_pattern do + response => OpenAI::Beta::Agents::Environments::EnvironmentTemplateDeleted + end + + assert_pattern do + response => { + id: String, + deleted: OpenAI::Internal::Type::Boolean, + object: Symbol + } + end + end +end diff --git a/test/openai/resources/beta/agents/environments_test.rb b/test/openai/resources/beta/agents/environments_test.rb new file mode 100644 index 000000000..0f37deb47 --- /dev/null +++ b/test/openai/resources/beta/agents/environments_test.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require_relative "../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::EnvironmentsTest < OpenAI::Test::ResourceTest + def test_retrieve + response = @openai.beta.agents.environments.retrieve("environment_id") + + assert_pattern do + response => OpenAI::Beta::Agents::EnvironmentInfo + end + + assert_pattern do + response => { + id: String, + files: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::HostedEnvironmentFile]), + object: Symbol, + plugins: ^(OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::HostedPlugin]), + skills: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::HostedSkill]), + status: OpenAI::Beta::Agents::EnvironmentInfo::Status, + type: OpenAI::Beta::Agents::EnvironmentInfo::Type + } + end + end +end diff --git a/test/openai/resources/beta/agents/sessions/artifacts_test.rb b/test/openai/resources/beta/agents/sessions/artifacts_test.rb new file mode 100644 index 000000000..9067427c1 --- /dev/null +++ b/test/openai/resources/beta/agents/sessions/artifacts_test.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +require_relative "../../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::Sessions::ArtifactsTest < OpenAI::Test::ResourceTest + def test_retrieve_required_params + response = @openai.beta.agents.sessions.artifacts.retrieve("artifact_id", session_id: "session_id") + + assert_pattern do + response => OpenAI::Beta::Agents::Sessions::SessionArtifact + end + + assert_pattern do + response => { + id: String, + created_at: Integer, + environment_id: String, + object: Symbol, + path: String, + session_id: String, + size_bytes: Integer, + turn_id: String + } + end + end + + def test_list + response = @openai.beta.agents.sessions.artifacts.list("session_id") + + assert_pattern do + response => OpenAI::Internal::CursorPage + end + + row = response.to_enum.first + return if row.nil? + + assert_pattern do + row => OpenAI::Beta::Agents::Sessions::SessionArtifact + end + + assert_pattern do + row => { + id: String, + created_at: Integer, + environment_id: String, + object: Symbol, + path: String, + session_id: String, + size_bytes: Integer, + turn_id: String + } + end + end + + def test_delete_required_params + response = @openai.beta.agents.sessions.artifacts.delete("artifact_id", session_id: "session_id") + + assert_pattern do + response => OpenAI::Beta::Agents::Sessions::SessionArtifactDeleted + end + + assert_pattern do + response => { + id: String, + deleted: OpenAI::Internal::Type::Boolean, + object: Symbol + } + end + end + + def test_content_required_params + response = @openai.beta.agents.sessions.artifacts.content("artifact_id", session_id: "session_id") + + assert_pattern do + response => StringIO + end + end +end diff --git a/test/openai/resources/beta/agents/sessions/events_test.rb b/test/openai/resources/beta/agents/sessions/events_test.rb new file mode 100644 index 000000000..cf6081fc3 --- /dev/null +++ b/test/openai/resources/beta/agents/sessions/events_test.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require_relative "../../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::Sessions::EventsTest < OpenAI::Test::ResourceTest + def test_create_required_params + response = @openai.beta.agents.sessions.events.create( + "session_id", + events: [ + { + input: [{content: [{text: "text", type: :input_text}], role: :user}], + type: :"agent.session.input.message" + } + ] + ) + + assert_pattern do + response => nil + end + end +end diff --git a/test/openai/resources/beta/agents/sessions/items_test.rb b/test/openai/resources/beta/agents/sessions/items_test.rb new file mode 100644 index 000000000..486574f47 --- /dev/null +++ b/test/openai/resources/beta/agents/sessions/items_test.rb @@ -0,0 +1,146 @@ +# frozen_string_literal: true + +require_relative "../../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::Sessions::ItemsTest < OpenAI::Test::ResourceTest + def test_list + response = @openai.beta.agents.sessions.items.list("session_id") + + assert_pattern do + response => OpenAI::Internal::CursorPage + end + + row = response.to_enum.first + return if row.nil? + + assert_pattern do + row => OpenAI::Beta::AgentSessionItem + end + + assert_pattern do + case row + in ( + OpenAI::Beta::AgentSessionMessage | OpenAI::Beta::AgentReasoningItem | OpenAI::Beta::AgentFunctionCallItem | OpenAI::Beta::AgentSessionItem::FunctionCallOutput | OpenAI::Beta::AgentSessionItem::AgentMessage | OpenAI::Beta::AgentMcpCallItem | OpenAI::Beta::AgentWebSearchCallItem | OpenAI::Beta::AgentCommandExecutionItem | OpenAI::Beta::AgentCreateSubagentCallItem | OpenAI::Beta::AgentSendSubagentInputCallItem | OpenAI::Beta::AgentResumeSubagentCallItem | OpenAI::Beta::AgentWaitForSubagentsCallItem | OpenAI::Beta::AgentInterruptSubagentCallItem | OpenAI::Beta::AgentCloseSubagentCallItem + ) + nil + end + end + + assert_pattern do + case row + in ( + { + type: :message, + id: String | nil, + content: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentSessionMessageContent]), + phase: OpenAI::Beta::AgentSessionMessage::Phase | nil, + role: OpenAI::Beta::AgentSessionMessage::Role, + status: OpenAI::Beta::AgentOutputItemStatus, + turn_id: String + } | { + type: :reasoning, + id: String, + status: OpenAI::Beta::AgentOutputItemStatus | nil, + summary: ^(OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::SummaryText]), + turn_id: String + } | { + type: :function_call, + id: String, + arguments: OpenAI::Internal::Type::Unknown, + call_id: String, + name: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :function_call_output, + id: String, + call_id: String, + error: String | nil, + output: OpenAI::Beta::AgentFunctionCallOutput | nil, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :agent_message, + id: String, + content: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent]), + recipient_agent_id: String, + sender_agent_id: String, + turn_id: String + } | { + type: :mcp_call, + id: String, + arguments: OpenAI::Internal::Type::Unknown, + error: OpenAI::Internal::Type::Unknown, + name: String, + output: OpenAI::Internal::Type::Unknown, + server_label: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :web_search_call, + id: String, + action: OpenAI::Beta::WebSearchAction | nil, + status: OpenAI::Beta::AgentOutputItemStatus, + turn_id: String + } | { + type: :command_execution, + id: String, + command: String, + cwd: String | nil, + duration_ms: Integer | nil, + exit_code: Integer | nil, + output: String | nil, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :create_subagent_call, + id: String, + agent_id: String, + content: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent]), + model: String | nil, + reasoning_effort: String | nil, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :send_subagent_input_call, + id: String, + content: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent]), + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :resume_subagent_call, + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :wait_for_subagents_call, + id: String, + recipient_agent_ids: ^(OpenAI::Internal::Type::ArrayOf[String]), + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :interrupt_subagent_call, + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :close_subagent_call, + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } + ) + nil + end + end + end +end diff --git a/test/openai/resources/beta/agents/sessions/subagents/items_test.rb b/test/openai/resources/beta/agents/sessions/subagents/items_test.rb new file mode 100644 index 000000000..7a1979b40 --- /dev/null +++ b/test/openai/resources/beta/agents/sessions/subagents/items_test.rb @@ -0,0 +1,146 @@ +# frozen_string_literal: true + +require_relative "../../../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::Sessions::Subagents::ItemsTest < OpenAI::Test::ResourceTest + def test_list_required_params + response = @openai.beta.agents.sessions.subagents.items.list("subagent_id", session_id: "session_id") + + assert_pattern do + response => OpenAI::Internal::CursorPage + end + + row = response.to_enum.first + return if row.nil? + + assert_pattern do + row => OpenAI::Beta::AgentSessionItem + end + + assert_pattern do + case row + in ( + OpenAI::Beta::AgentSessionMessage | OpenAI::Beta::AgentReasoningItem | OpenAI::Beta::AgentFunctionCallItem | OpenAI::Beta::AgentSessionItem::FunctionCallOutput | OpenAI::Beta::AgentSessionItem::AgentMessage | OpenAI::Beta::AgentMcpCallItem | OpenAI::Beta::AgentWebSearchCallItem | OpenAI::Beta::AgentCommandExecutionItem | OpenAI::Beta::AgentCreateSubagentCallItem | OpenAI::Beta::AgentSendSubagentInputCallItem | OpenAI::Beta::AgentResumeSubagentCallItem | OpenAI::Beta::AgentWaitForSubagentsCallItem | OpenAI::Beta::AgentInterruptSubagentCallItem | OpenAI::Beta::AgentCloseSubagentCallItem + ) + nil + end + end + + assert_pattern do + case row + in ( + { + type: :message, + id: String | nil, + content: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentSessionMessageContent]), + phase: OpenAI::Beta::AgentSessionMessage::Phase | nil, + role: OpenAI::Beta::AgentSessionMessage::Role, + status: OpenAI::Beta::AgentOutputItemStatus, + turn_id: String + } | { + type: :reasoning, + id: String, + status: OpenAI::Beta::AgentOutputItemStatus | nil, + summary: ^(OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::SummaryText]), + turn_id: String + } | { + type: :function_call, + id: String, + arguments: OpenAI::Internal::Type::Unknown, + call_id: String, + name: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :function_call_output, + id: String, + call_id: String, + error: String | nil, + output: OpenAI::Beta::AgentFunctionCallOutput | nil, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :agent_message, + id: String, + content: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent]), + recipient_agent_id: String, + sender_agent_id: String, + turn_id: String + } | { + type: :mcp_call, + id: String, + arguments: OpenAI::Internal::Type::Unknown, + error: OpenAI::Internal::Type::Unknown, + name: String, + output: OpenAI::Internal::Type::Unknown, + server_label: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :web_search_call, + id: String, + action: OpenAI::Beta::WebSearchAction | nil, + status: OpenAI::Beta::AgentOutputItemStatus, + turn_id: String + } | { + type: :command_execution, + id: String, + command: String, + cwd: String | nil, + duration_ms: Integer | nil, + exit_code: Integer | nil, + output: String | nil, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :create_subagent_call, + id: String, + agent_id: String, + content: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent]), + model: String | nil, + reasoning_effort: String | nil, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :send_subagent_input_call, + id: String, + content: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent]), + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :resume_subagent_call, + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :wait_for_subagents_call, + id: String, + recipient_agent_ids: ^(OpenAI::Internal::Type::ArrayOf[String]), + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :interrupt_subagent_call, + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :close_subagent_call, + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } + ) + nil + end + end + end +end diff --git a/test/openai/resources/beta/agents/sessions/subagents/turns/items_test.rb b/test/openai/resources/beta/agents/sessions/subagents/turns/items_test.rb new file mode 100644 index 000000000..f91675e19 --- /dev/null +++ b/test/openai/resources/beta/agents/sessions/subagents/turns/items_test.rb @@ -0,0 +1,150 @@ +# frozen_string_literal: true + +require_relative "../../../../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::Sessions::Subagents::Turns::ItemsTest < OpenAI::Test::ResourceTest + def test_list_required_params + response = @openai.beta.agents.sessions.subagents.turns.items.list( + "turn_id", + session_id: "session_id", + subagent_id: "subagent_id" + ) + + assert_pattern do + response => OpenAI::Internal::CursorPage + end + + row = response.to_enum.first + return if row.nil? + + assert_pattern do + row => OpenAI::Beta::AgentSessionItem + end + + assert_pattern do + case row + in ( + OpenAI::Beta::AgentSessionMessage | OpenAI::Beta::AgentReasoningItem | OpenAI::Beta::AgentFunctionCallItem | OpenAI::Beta::AgentSessionItem::FunctionCallOutput | OpenAI::Beta::AgentSessionItem::AgentMessage | OpenAI::Beta::AgentMcpCallItem | OpenAI::Beta::AgentWebSearchCallItem | OpenAI::Beta::AgentCommandExecutionItem | OpenAI::Beta::AgentCreateSubagentCallItem | OpenAI::Beta::AgentSendSubagentInputCallItem | OpenAI::Beta::AgentResumeSubagentCallItem | OpenAI::Beta::AgentWaitForSubagentsCallItem | OpenAI::Beta::AgentInterruptSubagentCallItem | OpenAI::Beta::AgentCloseSubagentCallItem + ) + nil + end + end + + assert_pattern do + case row + in ( + { + type: :message, + id: String | nil, + content: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentSessionMessageContent]), + phase: OpenAI::Beta::AgentSessionMessage::Phase | nil, + role: OpenAI::Beta::AgentSessionMessage::Role, + status: OpenAI::Beta::AgentOutputItemStatus, + turn_id: String + } | { + type: :reasoning, + id: String, + status: OpenAI::Beta::AgentOutputItemStatus | nil, + summary: ^(OpenAI::Internal::Type::ArrayOf[OpenAI::Beta::SummaryText]), + turn_id: String + } | { + type: :function_call, + id: String, + arguments: OpenAI::Internal::Type::Unknown, + call_id: String, + name: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :function_call_output, + id: String, + call_id: String, + error: String | nil, + output: OpenAI::Beta::AgentFunctionCallOutput | nil, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :agent_message, + id: String, + content: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent]), + recipient_agent_id: String, + sender_agent_id: String, + turn_id: String + } | { + type: :mcp_call, + id: String, + arguments: OpenAI::Internal::Type::Unknown, + error: OpenAI::Internal::Type::Unknown, + name: String, + output: OpenAI::Internal::Type::Unknown, + server_label: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :web_search_call, + id: String, + action: OpenAI::Beta::WebSearchAction | nil, + status: OpenAI::Beta::AgentOutputItemStatus, + turn_id: String + } | { + type: :command_execution, + id: String, + command: String, + cwd: String | nil, + duration_ms: Integer | nil, + exit_code: Integer | nil, + output: String | nil, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :create_subagent_call, + id: String, + agent_id: String, + content: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent]), + model: String | nil, + reasoning_effort: String | nil, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :send_subagent_input_call, + id: String, + content: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent]), + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :resume_subagent_call, + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :wait_for_subagents_call, + id: String, + recipient_agent_ids: ^(OpenAI::Internal::Type::ArrayOf[String]), + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :interrupt_subagent_call, + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } | { + type: :close_subagent_call, + id: String, + recipient_agent_id: String, + sender_agent_id: String, + status: OpenAI::Beta::AgentFunctionCallStatus, + turn_id: String + } + ) + nil + end + end + end +end diff --git a/test/openai/resources/beta/agents/sessions/subagents/turns_test.rb b/test/openai/resources/beta/agents/sessions/subagents/turns_test.rb new file mode 100644 index 000000000..e27acdafc --- /dev/null +++ b/test/openai/resources/beta/agents/sessions/subagents/turns_test.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +require_relative "../../../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::Sessions::Subagents::TurnsTest < OpenAI::Test::ResourceTest + def test_retrieve_required_params + response = @openai.beta.agents.sessions.subagents.turns.retrieve( + "turn_id", + session_id: "session_id", + subagent_id: "subagent_id" + ) + + assert_pattern do + response => OpenAI::Beta::Agents::Sessions::Turn + end + + assert_pattern do + response => { + id: String, + agent_id: String, + completed_at: Integer | nil, + created_at: Integer, + error: OpenAI::Beta::SessionTurnError | nil, + object: Symbol, + session_id: String, + started_at: Integer | nil, + status: OpenAI::Beta::Agents::Sessions::Turn::Status, + subagent_id: String | nil, + usage: OpenAI::Beta::TokenUsage | nil + } + end + end + + def test_list_required_params + response = @openai.beta.agents.sessions.subagents.turns.list("subagent_id", session_id: "session_id") + + assert_pattern do + response => OpenAI::Internal::CursorPage + end + + row = response.to_enum.first + return if row.nil? + + assert_pattern do + row => OpenAI::Beta::Agents::Sessions::Turn + end + + assert_pattern do + row => { + id: String, + agent_id: String, + completed_at: Integer | nil, + created_at: Integer, + error: OpenAI::Beta::SessionTurnError | nil, + object: Symbol, + session_id: String, + started_at: Integer | nil, + status: OpenAI::Beta::Agents::Sessions::Turn::Status, + subagent_id: String | nil, + usage: OpenAI::Beta::TokenUsage | nil + } + end + end +end diff --git a/test/openai/resources/beta/agents/sessions/subagents_test.rb b/test/openai/resources/beta/agents/sessions/subagents_test.rb new file mode 100644 index 000000000..f71fb18ca --- /dev/null +++ b/test/openai/resources/beta/agents/sessions/subagents_test.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +require_relative "../../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::Sessions::SubagentsTest < OpenAI::Test::ResourceTest + def test_retrieve_required_params + response = @openai.beta.agents.sessions.subagents.retrieve("subagent_id", session_id: "session_id") + + assert_pattern do + response => OpenAI::Beta::Subagent + end + + assert_pattern do + response => { + id: String, + closed_at: Integer | nil, + instructions: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent]) | nil, + name: String | nil, + object: Symbol, + opened_at: Integer, + parent_agent_id: String, + session_id: String, + status: OpenAI::Beta::Subagent::Status + } + end + end + + def test_list + response = @openai.beta.agents.sessions.subagents.list("session_id") + + assert_pattern do + response => OpenAI::Internal::CursorPage + end + + row = response.to_enum.first + return if row.nil? + + assert_pattern do + row => OpenAI::Beta::Subagent + end + + assert_pattern do + row => { + id: String, + closed_at: Integer | nil, + instructions: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentContent]) | nil, + name: String | nil, + object: Symbol, + opened_at: Integer, + parent_agent_id: String, + session_id: String, + status: OpenAI::Beta::Subagent::Status + } + end + end +end diff --git a/test/openai/resources/beta/agents/sessions/turns_test.rb b/test/openai/resources/beta/agents/sessions/turns_test.rb new file mode 100644 index 000000000..1607dee8c --- /dev/null +++ b/test/openai/resources/beta/agents/sessions/turns_test.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +require_relative "../../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::Sessions::TurnsTest < OpenAI::Test::ResourceTest + def test_retrieve_required_params + response = @openai.beta.agents.sessions.turns.retrieve("turn_id", session_id: "session_id") + + assert_pattern do + response => OpenAI::Beta::Agents::Sessions::Turn + end + + assert_pattern do + response => { + id: String, + agent_id: String, + completed_at: Integer | nil, + created_at: Integer, + error: OpenAI::Beta::SessionTurnError | nil, + object: Symbol, + session_id: String, + started_at: Integer | nil, + status: OpenAI::Beta::Agents::Sessions::Turn::Status, + subagent_id: String | nil, + usage: OpenAI::Beta::TokenUsage | nil + } + end + end + + def test_list + response = @openai.beta.agents.sessions.turns.list("session_id") + + assert_pattern do + response => OpenAI::Internal::CursorPage + end + + row = response.to_enum.first + return if row.nil? + + assert_pattern do + row => OpenAI::Beta::Agents::Sessions::Turn + end + + assert_pattern do + row => { + id: String, + agent_id: String, + completed_at: Integer | nil, + created_at: Integer, + error: OpenAI::Beta::SessionTurnError | nil, + object: Symbol, + session_id: String, + started_at: Integer | nil, + status: OpenAI::Beta::Agents::Sessions::Turn::Status, + subagent_id: String | nil, + usage: OpenAI::Beta::TokenUsage | nil + } + end + end +end diff --git a/test/openai/resources/beta/agents/sessions_test.rb b/test/openai/resources/beta/agents/sessions_test.rb new file mode 100644 index 000000000..e593631b6 --- /dev/null +++ b/test/openai/resources/beta/agents/sessions_test.rb @@ -0,0 +1,128 @@ +# frozen_string_literal: true + +require_relative "../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::SessionsTest < OpenAI::Test::ResourceTest + def test_create_required_params + response = @openai.beta.agents.sessions.create(environment: {type: :none}) + + assert_pattern do + response => OpenAI::Beta::AgentSession + end + + assert_pattern do + response => { + id: String, + agent: OpenAI::Beta::AgentSession::Agent, + created_at: Integer, + environment: OpenAI::Beta::Environment, + error: String | nil, + last_active_at: Integer, + metadata: ^(OpenAI::Internal::Type::HashOf[String]), + object: Symbol, + required_actions: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentSession::RequiredAction]), + status: OpenAI::Beta::AgentSession::Status, + usage: OpenAI::Beta::TokenUsage | nil, + vault_ids: ^(OpenAI::Internal::Type::ArrayOf[String]) + } + end + end + + def test_retrieve + response = @openai.beta.agents.sessions.retrieve("session_id") + + assert_pattern do + response => OpenAI::Beta::AgentSession + end + + assert_pattern do + response => { + id: String, + agent: OpenAI::Beta::AgentSession::Agent, + created_at: Integer, + environment: OpenAI::Beta::Environment, + error: String | nil, + last_active_at: Integer, + metadata: ^(OpenAI::Internal::Type::HashOf[String]), + object: Symbol, + required_actions: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentSession::RequiredAction]), + status: OpenAI::Beta::AgentSession::Status, + usage: OpenAI::Beta::TokenUsage | nil, + vault_ids: ^(OpenAI::Internal::Type::ArrayOf[String]) + } + end + end + + def test_update + response = @openai.beta.agents.sessions.update("session_id") + + assert_pattern do + response => OpenAI::Beta::AgentSession + end + + assert_pattern do + response => { + id: String, + agent: OpenAI::Beta::AgentSession::Agent, + created_at: Integer, + environment: OpenAI::Beta::Environment, + error: String | nil, + last_active_at: Integer, + metadata: ^(OpenAI::Internal::Type::HashOf[String]), + object: Symbol, + required_actions: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentSession::RequiredAction]), + status: OpenAI::Beta::AgentSession::Status, + usage: OpenAI::Beta::TokenUsage | nil, + vault_ids: ^(OpenAI::Internal::Type::ArrayOf[String]) + } + end + end + + def test_list + response = @openai.beta.agents.sessions.list + + assert_pattern do + response => OpenAI::Internal::CursorPage + end + + row = response.to_enum.first + return if row.nil? + + assert_pattern do + row => OpenAI::Beta::AgentSession + end + + assert_pattern do + row => { + id: String, + agent: OpenAI::Beta::AgentSession::Agent, + created_at: Integer, + environment: OpenAI::Beta::Environment, + error: String | nil, + last_active_at: Integer, + metadata: ^(OpenAI::Internal::Type::HashOf[String]), + object: Symbol, + required_actions: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::AgentSession::RequiredAction]), + status: OpenAI::Beta::AgentSession::Status, + usage: OpenAI::Beta::TokenUsage | nil, + vault_ids: ^(OpenAI::Internal::Type::ArrayOf[String]) + } + end + end + + def test_delete + response = @openai.beta.agents.sessions.delete("session_id") + + assert_pattern do + response => OpenAI::Beta::AgentSessionDeleted + end + + assert_pattern do + response => { + id: String, + deleted: OpenAI::Internal::Type::Boolean, + object: Symbol + } + end + end +end diff --git a/test/openai/resources/beta/agents/vaults/credentials_test.rb b/test/openai/resources/beta/agents/vaults/credentials_test.rb new file mode 100644 index 000000000..d67e78ee6 --- /dev/null +++ b/test/openai/resources/beta/agents/vaults/credentials_test.rb @@ -0,0 +1,116 @@ +# frozen_string_literal: true + +require_relative "../../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::Vaults::CredentialsTest < OpenAI::Test::ResourceTest + def test_create_required_params + response = @openai.beta.agents.vaults.credentials.create( + "vault_id", + auth: {access_token: "access_token", mcp_server_url: "mcp_server_url", type: :mcp_oauth}, + name: "x" + ) + + assert_pattern do + response => OpenAI::Beta::Agents::Vaults::Credential + end + + assert_pattern do + response => { + id: String, + auth: OpenAI::Beta::Agents::Vaults::CredentialAuth, + created_at: Integer, + name: String, + object: Symbol, + updated_at: Integer, + vault_id: String + } + end + end + + def test_retrieve_required_params + response = @openai.beta.agents.vaults.credentials.retrieve("credential_id", vault_id: "vault_id") + + assert_pattern do + response => OpenAI::Beta::Agents::Vaults::Credential + end + + assert_pattern do + response => { + id: String, + auth: OpenAI::Beta::Agents::Vaults::CredentialAuth, + created_at: Integer, + name: String, + object: Symbol, + updated_at: Integer, + vault_id: String + } + end + end + + def test_update_required_params + response = @openai.beta.agents.vaults.credentials.update( + "credential_id", + vault_id: "vault_id", + auth: {type: :mcp_oauth} + ) + + assert_pattern do + response => OpenAI::Beta::Agents::Vaults::Credential + end + + assert_pattern do + response => { + id: String, + auth: OpenAI::Beta::Agents::Vaults::CredentialAuth, + created_at: Integer, + name: String, + object: Symbol, + updated_at: Integer, + vault_id: String + } + end + end + + def test_list + response = @openai.beta.agents.vaults.credentials.list("vault_id") + + assert_pattern do + response => OpenAI::Internal::CursorPage + end + + row = response.to_enum.first + return if row.nil? + + assert_pattern do + row => OpenAI::Beta::Agents::Vaults::Credential + end + + assert_pattern do + row => { + id: String, + auth: OpenAI::Beta::Agents::Vaults::CredentialAuth, + created_at: Integer, + name: String, + object: Symbol, + updated_at: Integer, + vault_id: String + } + end + end + + def test_delete_required_params + response = @openai.beta.agents.vaults.credentials.delete("credential_id", vault_id: "vault_id") + + assert_pattern do + response => OpenAI::Beta::Agents::Vaults::CredentialDeleted + end + + assert_pattern do + response => { + id: String, + deleted: OpenAI::Internal::Type::Boolean, + object: Symbol + } + end + end +end diff --git a/test/openai/resources/beta/agents/vaults_test.rb b/test/openai/resources/beta/agents/vaults_test.rb new file mode 100644 index 000000000..234c7f0ff --- /dev/null +++ b/test/openai/resources/beta/agents/vaults_test.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +require_relative "../../../test_helper" + +class OpenAI::Test::Resources::Beta::Agents::VaultsTest < OpenAI::Test::ResourceTest + def test_create + response = @openai.beta.agents.vaults.create + + assert_pattern do + response => OpenAI::Beta::Agents::Vault + end + + assert_pattern do + response => { + id: String, + created_at: Integer, + metadata: ^(OpenAI::Internal::Type::HashOf[String]), + name: String | nil, + object: Symbol + } + end + end + + def test_retrieve + response = @openai.beta.agents.vaults.retrieve("vault_id") + + assert_pattern do + response => OpenAI::Beta::Agents::Vault + end + + assert_pattern do + response => { + id: String, + created_at: Integer, + metadata: ^(OpenAI::Internal::Type::HashOf[String]), + name: String | nil, + object: Symbol + } + end + end + + def test_list + response = @openai.beta.agents.vaults.list + + assert_pattern do + response => OpenAI::Internal::CursorPage + end + + row = response.to_enum.first + return if row.nil? + + assert_pattern do + row => OpenAI::Beta::Agents::Vault + end + + assert_pattern do + row => { + id: String, + created_at: Integer, + metadata: ^(OpenAI::Internal::Type::HashOf[String]), + name: String | nil, + object: Symbol + } + end + end + + def test_delete + response = @openai.beta.agents.vaults.delete("vault_id") + + assert_pattern do + response => OpenAI::Beta::Agents::VaultDeleted + end + + assert_pattern do + response => { + id: String, + deleted: OpenAI::Internal::Type::Boolean, + object: Symbol + } + end + end +end diff --git a/test/openai/resources/beta/agents_test.rb b/test/openai/resources/beta/agents_test.rb new file mode 100644 index 000000000..56cace7c1 --- /dev/null +++ b/test/openai/resources/beta/agents_test.rb @@ -0,0 +1,132 @@ +# frozen_string_literal: true + +require_relative "../../test_helper" + +class OpenAI::Test::Resources::Beta::AgentsTest < OpenAI::Test::ResourceTest + def test_create_required_params + response = @openai.beta.agents.create(model: "model") + + assert_pattern do + response => OpenAI::Beta::Agent + end + + assert_pattern do + response => { + id: String, + created_at: Integer, + instructions: String | nil, + metadata: ^(OpenAI::Internal::Type::HashOf[String]), + model: String, + multi_agent: OpenAI::Beta::MultiAgentConfig, + name: String | nil, + object: Symbol, + reasoning: OpenAI::Beta::AgentReasoning, + service_tier: OpenAI::Beta::Agent::ServiceTier, + text: OpenAI::Beta::AgentText, + tools: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::PersistedAgentTool]), + updated_at: Integer + } + end + end + + def test_retrieve + response = @openai.beta.agents.retrieve("agent_id") + + assert_pattern do + response => OpenAI::Beta::Agent + end + + assert_pattern do + response => { + id: String, + created_at: Integer, + instructions: String | nil, + metadata: ^(OpenAI::Internal::Type::HashOf[String]), + model: String, + multi_agent: OpenAI::Beta::MultiAgentConfig, + name: String | nil, + object: Symbol, + reasoning: OpenAI::Beta::AgentReasoning, + service_tier: OpenAI::Beta::Agent::ServiceTier, + text: OpenAI::Beta::AgentText, + tools: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::PersistedAgentTool]), + updated_at: Integer + } + end + end + + def test_update + response = @openai.beta.agents.update("agent_id") + + assert_pattern do + response => OpenAI::Beta::Agent + end + + assert_pattern do + response => { + id: String, + created_at: Integer, + instructions: String | nil, + metadata: ^(OpenAI::Internal::Type::HashOf[String]), + model: String, + multi_agent: OpenAI::Beta::MultiAgentConfig, + name: String | nil, + object: Symbol, + reasoning: OpenAI::Beta::AgentReasoning, + service_tier: OpenAI::Beta::Agent::ServiceTier, + text: OpenAI::Beta::AgentText, + tools: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::PersistedAgentTool]), + updated_at: Integer + } + end + end + + def test_list + response = @openai.beta.agents.list + + assert_pattern do + response => OpenAI::Internal::CursorPage + end + + row = response.to_enum.first + return if row.nil? + + assert_pattern do + row => OpenAI::Beta::Agent + end + + assert_pattern do + row => { + id: String, + created_at: Integer, + instructions: String | nil, + metadata: ^(OpenAI::Internal::Type::HashOf[String]), + model: String, + multi_agent: OpenAI::Beta::MultiAgentConfig, + name: String | nil, + object: Symbol, + reasoning: OpenAI::Beta::AgentReasoning, + service_tier: OpenAI::Beta::Agent::ServiceTier, + text: OpenAI::Beta::AgentText, + tools: ^(OpenAI::Internal::Type::ArrayOf[union: OpenAI::Beta::PersistedAgentTool]), + updated_at: Integer + } + end + end + + def test_delete + response = @openai.beta.agents.delete("agent_id") + + assert_pattern do + response => OpenAI::Beta::AgentDeleted + end + + assert_pattern do + response => { + id: String, + deleted: OpenAI::Internal::Type::Boolean, + object: Symbol + } + end + end +end diff --git a/test/openai/resources/environment_token_page_test.rb b/test/openai/resources/environment_token_page_test.rb new file mode 100644 index 000000000..125ba505e --- /dev/null +++ b/test/openai/resources/environment_token_page_test.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +require_relative "../test_helper" + +class OpenAI::Test::EnvironmentTokenPageTest < Minitest::Test + def test_files_forward_token_and_preserve_filters_and_request_options + token = "synthetic:token/+=" + requests = [] + transport = Minitest::Mock.new(OpenAI::HTTPClient.new) + 2.times do |index| + response = OpenAI::HTTPClient::Response.new( + status: 200, + headers: {"content-type" => "application/json"}, + body: JSON.generate( + object: "page", + data: [ + { + object: "agent.environment.file", + environment_id: "env_test", + path: "/workspace/test/#{index}.txt", + size_bytes: 1 + } + ], + next: index.zero? ? token : nil, + has_more: index.zero? + ) + ) + transport.expect(:execute, response) { |request| + requests << request + true + } + end + + client = OpenAI::Client.new(api_key: "synthetic", base_url: "https://sdk-test.example/v1", http_client: transport) + page = client.beta.agents.environments.files.list( + "env_test", + path: "/workspace/test", + order: :asc, + limit: 1, + request_options: {extra_headers: {"x-pagination-test" => "preserved", "OpenAI-Beta" => "agents=v1"}} + ) + assert_instance_of(OpenAI::Internal::TokenPage, page) + assert_equal(["/workspace/test/0.txt", "/workspace/test/1.txt"], page.to_enum.map(&:path)) + transport.verify + assert_equal(2, requests.length) + requests.each_with_index do |request, index| + assert_equal("/v1/agents/environments/env_test/files", request.url.path) + query = URI.decode_www_form(request.url.query).to_h + expected = {"path" => "/workspace/test", "order" => "asc", "limit" => "1"} + expected["page"] = token unless index.zero? + assert_equal(expected, query) + assert_equal("preserved", request.headers.fetch("x-pagination-test")) + assert_equal("agents=v1", request.headers.fetch("openai-beta")) + end + end +end