Interface HostedTool

All Known Implementing Classes:
HostedTool.CodeInterpreter, HostedTool.FileSearch, HostedTool.ImageGeneration, HostedTool.Mcp, HostedTool.Raw, HostedTool.WebSearch

A tool that OpenAI executes server-side, inside the same request that generates the response.

Hosted tools are not ToolCallbacks: there is nothing for the application to run, and their calls are never surfaced as tool calls - they appear in the turn transcript and, summarized, under OpenAiResponsesMetadata.HOSTED_TOOL_CALLS on the generation metadata.

HostedTool.Raw is the escape hatch for tools OpenAI ships before Spring AI types them.

Since:
2.1.0
Author:
Dimitar Proynov
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    Run Python in a sandboxed container.
    static final record 
    Search vector stores hosted at OpenAI.
    static final record 
    Generate images.
    static final record 
    Call tools on a remote MCP server from inside OpenAI's request.
    static final record 
    A tool declared as the raw request JSON, for tools this class does not type yet.
    static final record 
    Search the public web.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.openai.models.responses.Tool
    Convert this tool to the SDK request representation.
  • Method Details

    • toTool

      com.openai.models.responses.Tool toTool()
      Convert this tool to the SDK request representation.