Prompt
what API should I use for tool calling and JSON output
Latest observation
Oct 8, 2026
OpenAI APIWeb search: off
Use the Responses API.
It’s the best current API for both:
- Tool calling — letting the model decide when to call your tools/functions
- Structured JSON output — getting reliably schema-shaped JSON back
Why Responses API
- It’s the newer, more flexible API
- It supports:
toolsfor function callingresponse_format/ structured outputs for JSON- multimodal inputs in one place
When to use what
-
Use Responses API if you want:
- tool calling
- JSON outputs
- a single API for most workflows
-
Use Chat Completions API only if:
- you’re maintaining older code
- you already have a working integration and don’t want to migrate yet
Example use cases
- “Call my weather API if needed, then return JSON summary” → Responses API
- “Return only valid JSON matching this schema” → Responses API
If you want, I can give you:
- a minimal Python example,
- a Node.js example, or
- an example that combines tool calling + JSON schema output.