# openai.BadRequestError: 'response_format' parameter is not supported when using 'tools' parameter

- **ID:** `llm/function-call-json-mode-conflict`
- **Domain:** llm
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

OpenAI API enforces mutual exclusivity between structured output via response_format and function/tool calling; both cannot be specified in the same request.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| openai>=1.0.0 | active | — | — |
| gpt-4-turbo-2024-04-09 | active | — | — |
| gpt-4o-2024-05-13 | active | — | — |

## Workarounds

1. **Use function calling with a single tool that wraps the desired structured output: define a function with the output schema as its parameters, and parse the function call arguments as the structured result.** (85% success)
   ```
   Use function calling with a single tool that wraps the desired structured output: define a function with the output schema as its parameters, and parse the function call arguments as the structured result.
   ```
2. **Use JSON mode with response_format and handle tool calls manually via prompt engineering: include tool descriptions in the system message and parse the LLM's natural language response to extract tool calls.** (70% success)
   ```
   Use JSON mode with response_format and handle tool calls manually via prompt engineering: include tool descriptions in the system message and parse the LLM's natural language response to extract tool calls.
   ```
3. **If using OpenAI Python SDK v1.x, pass tools=None explicitly when using response_format, and manage tool logic separately in a post-processing step.** (80% success)
   ```
   If using OpenAI Python SDK v1.x, pass tools=None explicitly when using response_format, and manage tool logic separately in a post-processing step.
   ```

## Dead Ends

- **** — LLM cannot reliably execute tool calls without explicit tools parameter; output format may not match expected schema (75% fail)
- **** — response_format enforces strict output schema; tool calls have reserved structure that conflicts with arbitrary schemas (90% fail)
- **** — Older API versions may lack the feature entirely or have different buggy behavior; not a sustainable fix (60% fail)
