You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ActionSearchSource type definition incomplete - missing type='api' and name field #2736
Confirm this is an issue with the Python library and not an underlying OpenAI API
This is an issue with the Python library
Describe the bug
The type definition for ActionSearchSource in the OpenAI Python SDK (v2.7.1) doesn't match the actual API response structure when using specialized OpenAI APIs (weather, sports, finance).
Current SDK Type Definition:
# From: src/openai/types/responses/response_function_web_search_param.pyclassActionSearchSource(BaseModel):
type: Literal["url"]
"""The type of source. Always `url`."""url: str"""The URL of the source."""
classActionSearchSource(BaseModel):
type: Literal["url", "api"]
"""The type of source. Can be 'url' for web sources or 'api' for specialized OpenAI APIs."""url: Optional[str] =None"""The URL of the source (present when type='url')."""name: Optional[str] =None"""The name/identifier of the specialized API (e.g., 'oai-weather', 'oai-sports', 'oai-finance')."""
Impact:
This causes type checking failures when working with actual API responses, forcing developers to use # type: ignore or create custom type definitions.
Create a response with web search enabled and include=["web_search_call.action.sources"]
Make a query that triggers a specialized API (e.g., "What's the weather in NYC?")
Examine the ActionSearchSource in the response
Observe that the type is 'api' instead of 'url', and there's a name field that doesn't exist in the type definition
Code snippets
fromopenaiimportOpenAIclient=OpenAI()
response=client.responses.create(
model="gpt-5-2025-08-07",
tools=[{"type": "web_search"}],
include=["web_search_call.action.sources"],
input="What's the weather in NYC today?"
)
# Response contains:# ActionSearchSource(type='api', url=None, name='oai-weather')# But types expect: type must be "url" and url must be a string
I've submitted PR #2742 that fixes this issue by updating the ActionSearchSource type definition to support both 'url' and 'api' source types, along with the optional name field for specialized APIs.
Thanks for the detailed example—it makes the missing source variant clear. The web-search guide describes specialized sources, but the generated type assumes type="url" and requires a URL, leaving the reported type="api" / name shape unrepresented.
We’re closing this report to keep the work together in openai/openai-openapi#573; the fix will continue to be tracked there. That issue preserves this report alongside #2636. Sorry for the extra redirect if you arrived from that issue, and please follow #573 for the schema correction and subsequent SDK update.
Activity
fix: update ActionSearchSource type to support specialized API sources
yashwantbezawada commentedon Nov 8, 2025
I've submitted PR #2742 that fixes this issue by updating the ActionSearchSource type definition to support both 'url' and 'api' source types, along with the optional name field for specialized APIs.
marcuswood-oai commentedon Sep 15, 2026
Thanks for the detailed example—it makes the missing source variant clear. The web-search guide describes specialized sources, but the generated type assumes
type="url"and requires a URL, leaving the reportedtype="api"/nameshape unrepresented.We’re closing this report to keep the work together in openai/openai-openapi#573; the fix will continue to be tracked there. That issue preserves this report alongside #2636. Sorry for the extra redirect if you arrived from that issue, and please follow #573 for the schema correction and subsequent SDK update.