Skip to main content
The Go SDK and docs are currently in beta. Report issues on GitHub.
An output item from the response

Supported Types

OutputApplyPatchCallItem

outputItems := components.CreateOutputItemsApplyPatchCall(components.OutputApplyPatchCallItem{/* values here */})

OutputCodeInterpreterCallItem

outputItems := components.CreateOutputItemsCodeInterpreterCall(components.OutputCodeInterpreterCallItem{/* values here */})

OutputComputerCallItem

outputItems := components.CreateOutputItemsComputerCall(components.OutputComputerCallItem{/* values here */})

OutputCustomToolCallItem

outputItems := components.CreateOutputItemsCustomToolCall(components.OutputCustomToolCallItem{/* values here */})

OutputFileSearchCallItem

outputItems := components.CreateOutputItemsFileSearchCall(components.OutputFileSearchCallItem{/* values here */})

OutputFunctionCallItem

outputItems := components.CreateOutputItemsFunctionCall(components.OutputFunctionCallItem{/* values here */})

OutputImageGenerationCallItem

outputItems := components.CreateOutputItemsImageGenerationCall(components.OutputImageGenerationCallItem{/* values here */})

OutputMessageItem

outputItems := components.CreateOutputItemsMessage(components.OutputMessageItem{/* values here */})

OutputApplyPatchServerToolItem

outputItems := components.CreateOutputItemsOpenrouterApplyPatch(components.OutputApplyPatchServerToolItem{/* values here */})

OutputBashServerToolItem

outputItems := components.CreateOutputItemsOpenrouterBash(components.OutputBashServerToolItem{/* values here */})

OutputBrowserUseServerToolItem

outputItems := components.CreateOutputItemsOpenrouterBrowserUse(components.OutputBrowserUseServerToolItem{/* values here */})

OutputCodeInterpreterServerToolItem

outputItems := components.CreateOutputItemsOpenrouterCodeInterpreter(components.OutputCodeInterpreterServerToolItem{/* values here */})

OutputDatetimeItem

outputItems := components.CreateOutputItemsOpenrouterDatetime(components.OutputDatetimeItem{/* values here */})

OutputSearchModelsServerToolItem

outputItems := components.CreateOutputItemsOpenrouterExperimentalSearchModels(components.OutputSearchModelsServerToolItem{/* values here */})

OutputFileSearchServerToolItem

outputItems := components.CreateOutputItemsOpenrouterFileSearch(components.OutputFileSearchServerToolItem{/* values here */})

OutputFusionServerToolItem

outputItems := components.CreateOutputItemsOpenrouterFusion(components.OutputFusionServerToolItem{/* values here */})

OutputImageGenerationServerToolItem

outputItems := components.CreateOutputItemsOpenrouterImageGeneration(components.OutputImageGenerationServerToolItem{/* values here */})

OutputMcpServerToolItem

outputItems := components.CreateOutputItemsOpenrouterMcp(components.OutputMcpServerToolItem{/* values here */})

OutputMemoryServerToolItem

outputItems := components.CreateOutputItemsOpenrouterMemory(components.OutputMemoryServerToolItem{/* values here */})

OutputTextEditorServerToolItem

outputItems := components.CreateOutputItemsOpenrouterTextEditor(components.OutputTextEditorServerToolItem{/* values here */})

OutputToolSearchServerToolItem

outputItems := components.CreateOutputItemsOpenrouterToolSearch(components.OutputToolSearchServerToolItem{/* values here */})

OutputWebFetchServerToolItem

outputItems := components.CreateOutputItemsOpenrouterWebFetch(components.OutputWebFetchServerToolItem{/* values here */})

OutputWebSearchServerToolItem

outputItems := components.CreateOutputItemsOpenrouterWebSearch(components.OutputWebSearchServerToolItem{/* values here */})

OutputReasoningItem

outputItems := components.CreateOutputItemsReasoning(components.OutputReasoningItem{/* values here */})

OutputWebSearchCallItem

outputItems := components.CreateOutputItemsWebSearchCall(components.OutputWebSearchCallItem{/* values here */})

Union Discrimination

Use the Type field to determine which variant is active, then access the corresponding field:
switch outputItems.Type {
	case components.OutputItemsTypeApplyPatchCall:
		// outputItems.OutputApplyPatchCallItem is populated
	case components.OutputItemsTypeCodeInterpreterCall:
		// outputItems.OutputCodeInterpreterCallItem is populated
	case components.OutputItemsTypeComputerCall:
		// outputItems.OutputComputerCallItem is populated
	case components.OutputItemsTypeCustomToolCall:
		// outputItems.OutputCustomToolCallItem is populated
	case components.OutputItemsTypeFileSearchCall:
		// outputItems.OutputFileSearchCallItem is populated
	case components.OutputItemsTypeFunctionCall:
		// outputItems.OutputFunctionCallItem is populated
	case components.OutputItemsTypeImageGenerationCall:
		// outputItems.OutputImageGenerationCallItem is populated
	case components.OutputItemsTypeMessage:
		// outputItems.OutputMessageItem is populated
	case components.OutputItemsTypeOpenrouterApplyPatch:
		// outputItems.OutputApplyPatchServerToolItem is populated
	case components.OutputItemsTypeOpenrouterBash:
		// outputItems.OutputBashServerToolItem is populated
	case components.OutputItemsTypeOpenrouterBrowserUse:
		// outputItems.OutputBrowserUseServerToolItem is populated
	case components.OutputItemsTypeOpenrouterCodeInterpreter:
		// outputItems.OutputCodeInterpreterServerToolItem is populated
	case components.OutputItemsTypeOpenrouterDatetime:
		// outputItems.OutputDatetimeItem is populated
	case components.OutputItemsTypeOpenrouterExperimentalSearchModels:
		// outputItems.OutputSearchModelsServerToolItem is populated
	case components.OutputItemsTypeOpenrouterFileSearch:
		// outputItems.OutputFileSearchServerToolItem is populated
	case components.OutputItemsTypeOpenrouterFusion:
		// outputItems.OutputFusionServerToolItem is populated
	case components.OutputItemsTypeOpenrouterImageGeneration:
		// outputItems.OutputImageGenerationServerToolItem is populated
	case components.OutputItemsTypeOpenrouterMcp:
		// outputItems.OutputMcpServerToolItem is populated
	case components.OutputItemsTypeOpenrouterMemory:
		// outputItems.OutputMemoryServerToolItem is populated
	case components.OutputItemsTypeOpenrouterTextEditor:
		// outputItems.OutputTextEditorServerToolItem is populated
	case components.OutputItemsTypeOpenrouterToolSearch:
		// outputItems.OutputToolSearchServerToolItem is populated
	case components.OutputItemsTypeOpenrouterWebFetch:
		// outputItems.OutputWebFetchServerToolItem is populated
	case components.OutputItemsTypeOpenrouterWebSearch:
		// outputItems.OutputWebSearchServerToolItem is populated
	case components.OutputItemsTypeReasoning:
		// outputItems.OutputReasoningItem is populated
	case components.OutputItemsTypeWebSearchCall:
		// outputItems.OutputWebSearchCallItem is populated
	default:
		// Unknown type - use outputItems.GetUnknownRaw() for raw JSON
}