InputsUnion1 - TypeScript SDK

InputsUnion1 type definition

The TypeScript SDK and docs are currently in beta. Report issues on GitHub.

Supported Types

models.ReasoningItem

1const value: models.ReasoningItem = {
2 id: "reasoning-abc123",
3 summary: [
4 {
5 text: "Step by step analysis",
6 type: "summary_text",
7 },
8 ],
9 type: "reasoning",
10};

models.EasyInputMessage

1const value: models.EasyInputMessage = {
2 role: "user",
3};

models.InputMessageItem

1const value: models.InputMessageItem = {
2 role: "user",
3};

models.FunctionCallItem

1const value: models.FunctionCallItem = {
2 arguments: "{\"location\":\"San Francisco\"}",
3 callId: "call-abc123",
4 id: "call-abc123",
5 name: "get_weather",
6 type: "function_call",
7};

models.FunctionCallOutputItem

1const value: models.FunctionCallOutputItem = {
2 callId: "call-abc123",
3 output: "{\"temperature\":72,\"conditions\":\"sunny\"}",
4 type: "function_call_output",
5};

models.ApplyPatchCallItem

1const value: models.ApplyPatchCallItem = {
2 callId: "call_abc123",
3 operation: {
4 diff: "@@ function main() {\n+ console.log(\"hi\");\n }",
5 path: "/src/main.ts",
6 type: "update_file",
7 },
8 status: "completed",
9 type: "apply_patch_call",
10};

models.ApplyPatchCallOutputItem

1const value: models.ApplyPatchCallOutputItem = {
2 callId: "call_abc123",
3 status: "completed",
4 type: "apply_patch_call_output",
5};

models.InputsMessage

1const value: models.InputsMessage = {
2 content: [
3 {
4 text: "Hello! How can I help you?",
5 type: "output_text",
6 },
7 ],
8 id: "msg-123",
9 role: "assistant",
10 type: "message",
11};

models.InputsReasoning

1const value: models.InputsReasoning = {
2 id: "reasoning-123",
3 summary: [
4 {
5 text: "Analyzed the problem and found the optimal solution.",
6 type: "summary_text",
7 },
8 ],
9 type: "reasoning",
10};

models.OutputFunctionCallItem

1const value: models.OutputFunctionCallItem = {
2 arguments: "{\"location\":\"San Francisco\"}",
3 callId: "call-abc123",
4 name: "get_weather",
5 type: "function_call",
6};

models.OutputCustomToolCallItem

1const value: models.OutputCustomToolCallItem = {
2 callId: "call-abc123",
3 input: "*** Begin Patch\n*** End Patch",
4 name: "apply_patch",
5 type: "custom_tool_call",
6};

models.OutputWebSearchCallItem

1const value: models.OutputWebSearchCallItem = {
2 action: {
3 pattern: "<value>",
4 type: "find_in_page",
5 url: "https://tragic-requirement.com/",
6 },
7 id: "ws-abc123",
8 status: "completed",
9 type: "web_search_call",
10};

models.OutputFileSearchCallItem

1const value: models.OutputFileSearchCallItem = {
2 id: "fs-abc123",
3 queries: [
4 "search term",
5 ],
6 status: "completed",
7 type: "file_search_call",
8};

models.OutputImageGenerationCallItem

1const value: models.OutputImageGenerationCallItem = {
2 id: "img-abc123",
3 status: "completed",
4 type: "image_generation_call",
5};

models.OutputCodeInterpreterCallItem

1const value: models.OutputCodeInterpreterCallItem = {
2 code: "print(\"hello\")",
3 containerId: "ctr-xyz789",
4 id: "ci-abc123",
5 outputs: [
6 {
7 logs: "hello\n",
8 type: "logs",
9 },
10 ],
11 status: "completed",
12 type: "code_interpreter_call",
13};

models.OutputComputerCallItem

1const value: models.OutputComputerCallItem = {
2 callId: "call-abc123",
3 pendingSafetyChecks: [],
4 status: "completed",
5 type: "computer_call",
6};

models.OutputDatetimeItem

1const value: models.OutputDatetimeItem = {
2 datetime: "2026-03-12T14:30:00.000Z",
3 status: "completed",
4 timezone: "UTC",
5 type: "openrouter:datetime",
6};

models.OutputWebSearchServerToolItem

1const value: models.OutputWebSearchServerToolItem = {
2 status: "completed",
3 type: "openrouter:web_search",
4};

models.OutputCodeInterpreterServerToolItem

1const value: models.OutputCodeInterpreterServerToolItem = {
2 status: "completed",
3 type: "openrouter:code_interpreter",
4};

models.OutputFileSearchServerToolItem

1const value: models.OutputFileSearchServerToolItem = {
2 status: "completed",
3 type: "openrouter:file_search",
4};

models.OutputImageGenerationServerToolItem

1const value: models.OutputImageGenerationServerToolItem = {
2 status: "completed",
3 type: "openrouter:image_generation",
4};

models.OutputBrowserUseServerToolItem

1const value: models.OutputBrowserUseServerToolItem = {
2 status: "completed",
3 type: "openrouter:browser_use",
4};

models.OutputBashServerToolItem

1const value: models.OutputBashServerToolItem = {
2 status: "completed",
3 type: "openrouter:bash",
4};

models.OutputTextEditorServerToolItem

1const value: models.OutputTextEditorServerToolItem = {
2 status: "completed",
3 type: "openrouter:text_editor",
4};

models.OutputApplyPatchServerToolItem

1const value: models.OutputApplyPatchServerToolItem = {
2 status: "completed",
3 type: "openrouter:apply_patch",
4};

models.OutputWebFetchServerToolItem

1const value: models.OutputWebFetchServerToolItem = {
2 status: "completed",
3 type: "openrouter:web_fetch",
4};

models.OutputToolSearchServerToolItem

1const value: models.OutputToolSearchServerToolItem = {
2 status: "completed",
3 type: "openrouter:tool_search",
4};

models.OutputMemoryServerToolItem

1const value: models.OutputMemoryServerToolItem = {
2 status: "completed",
3 type: "openrouter:memory",
4};

models.OutputMcpServerToolItem

1const value: models.OutputMcpServerToolItem = {
2 status: "completed",
3 type: "openrouter:mcp",
4};

models.OutputSearchModelsServerToolItem

1const value: models.OutputSearchModelsServerToolItem = {
2 status: "completed",
3 type: "openrouter:experimental__search_models",
4};

models.OutputAdvisorServerToolItem

1const value: models.OutputAdvisorServerToolItem = {
2 status: "completed",
3 type: "openrouter:advisor",
4};

models.LocalShellCallItem

1const value: models.LocalShellCallItem = {
2 action: {
3 command: [
4 "ls",
5 "-la",
6 ],
7 env: {
8 "PATH": "/usr/bin",
9 },
10 type: "exec",
11 },
12 callId: "call-abc123",
13 id: "shell-abc123",
14 status: "completed",
15 type: "local_shell_call",
16};

models.LocalShellCallOutputItem

1const value: models.LocalShellCallOutputItem = {
2 id: "output-abc123",
3 output: "total 24\ndrwxr-xr-x 5 user staff 160 Jan 1 12:00 .",
4 type: "local_shell_call_output",
5};

models.ShellCallItem

1const value: models.ShellCallItem = {
2 action: {
3 commands: [
4 "ls",
5 "-la",
6 ],
7 },
8 callId: "call-abc123",
9 type: "shell_call",
10};

models.ShellCallOutputItem

1const value: models.ShellCallOutputItem = {
2 callId: "call-abc123",
3 output: [
4 {
5 type: "stdout",
6 },
7 ],
8 type: "shell_call_output",
9};

models.McpListToolsItem

1const value: models.McpListToolsItem = {
2 id: "mcp-list-abc123",
3 serverLabel: "database-server",
4 tools: [
5 {
6 inputSchema: {
7 "properties": {
8 "query": {
9 "type": "string",
10 },
11 },
12 "type": "object",
13 },
14 name: "query_database",
15 },
16 ],
17 type: "mcp_list_tools",
18};

models.McpApprovalRequestItem

1const value: models.McpApprovalRequestItem = {
2 arguments: "{\"id\":\"123\"}",
3 id: "approval-abc123",
4 name: "delete_record",
5 serverLabel: "database-server",
6 type: "mcp_approval_request",
7};

models.McpApprovalResponseItem

1const value: models.McpApprovalResponseItem = {
2 approvalRequestId: "approval-abc123",
3 approve: true,
4 type: "mcp_approval_response",
5};

models.McpCallItem

1const value: models.McpCallItem = {
2 arguments: "{\"query\":\"SELECT * FROM users\"}",
3 id: "mcp-call-abc123",
4 name: "query_database",
5 serverLabel: "database-server",
6 type: "mcp_call",
7};

models.CustomToolCallItem

1const value: models.CustomToolCallItem = {
2 callId: "call-abc123",
3 input: "*** Begin Patch\n*** End Patch",
4 name: "apply_patch",
5 type: "custom_tool_call",
6};

models.CustomToolCallOutputItem

1const value: models.CustomToolCallOutputItem = {
2 callId: "call-abc123",
3 output: "patch applied successfully",
4 type: "custom_tool_call_output",
5};

models.CompactionItem

1const value: models.CompactionItem = {
2 encryptedContent: "enc_abc123...",
3 type: "compaction",
4};

models.ItemReferenceItem

1const value: models.ItemReferenceItem = {
2 id: "msg-abc123",
3 type: "item_reference",
4};