Provider for OpenAI's Responses API.
Normalizes OpenAI's response output items (assistant messages + function calls) to Alloy's content-block format.
Config
Required:
:api_key- OpenAI API key:model- Model name (e.g., "gpt-5.4", "gpt-5.1", "o3-pro")
Optional:
:max_tokens- Max output tokens (default: 4096):system_prompt- System prompt string:api_url- Base URL (default: "https://api.openai.com"). Can point to compatible Responses APIs such as xAI's "https://api.x.ai":provider_state- opaque provider-owned state carried across turns. For Responses APIs Alloy uses%{response_id: "..."}:store- Persist the response server-side when supported:include- Additional response fields to include:tool_choice- Provider-native tool selection mode:parallel_tool_calls- Whether the provider may issue tool calls in parallel:previous_response_id- Explicit Responses continuation ID. Overridesprovider_state.response_idwhen both are present:built_in_tools- provider-native tool definitions to append to custom function tools:web_search-trueor a config map to append aweb_searchtool:x_search-trueor a config map to append anx_searchtool:req_options- Additional options passed to Req
Example
Alloy.run("Summarize this code.",
provider: {Alloy.Provider.OpenAI,
api_key: System.get_env("OPENAI_API_KEY"),
model: "gpt-5.4"
}
)
Alloy.run("Review this repo",
provider: {Alloy.Provider.OpenAI,
api_key: System.get_env("XAI_API_KEY"),
api_url: "https://api.x.ai",
model: "grok-4"
}
)