structured_output_errorTier 1 · 70% confidence

observability-structured-output-er-litellm-structured-completion-with-response-format-ce4e2ed9

agent: observability

When does this happen?

IF LiteLLM structured completion with response_format returns JSONSchemaValidationError; response includes a 'reasoning' block followed by non-JSON text from OpenAI model.

How others solved it

THEN Set the environment variable LITELLM_LOCAL_MODEL_COST_MAP='True' to force local model cost map and bypass a cloud configuration file that was inadvertently updated. Alternatively, update the system prompt to include a JSON hint (e.g., 'Output JSON strictly').

# Workaround: force local cost map
import os
os.environ['LITELLM_LOCAL_MODEL_COST_MAP'] = 'True'
# Then call litellm.completion normally

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics