Skip to content

API Parameter Tuning for Determinism

Older guides, including the first edition of this one, told you to hardcode temperature to 0.0 and lower top_p for reliable output. On Claude’s newer models that advice is obsolete. From Claude Opus 4.7 and Claude Sonnet 5 onward, sending a non-default temperature, top_p or top_k returns a 400 error, and Anthropic’s current Python SDK no longer accepts these parameters at all.

Determinism now comes from constraining the output and validating it, not from tuning probabilities. These are the controls that matter.

output_config.format constrains the reply to a JSON schema. This replaces both temperature = 0 and the old prefill trick for extraction, routing and classification. See Module 2 for the full pattern.

output_config.effort takes low, medium, high, xhigh or max (support varies by model). It shapes how much Claude thinks, how many tool calls it makes and how verbose it is.

  • Routing, classification, extraction: low. Fewer tokens, faster replies.
  • Multi-step reasoning and agents: keep the default or raise it.
  • The Superuser Rule: effort is a behavioural signal, not a budget. For a hard cap, use max_tokens.

max_tokens caps everything Claude produces, including thinking. Always check for stop_reason == "max_tokens": it means the output was cut off and is probably incomplete.

stop_sequences ends generation the moment Claude writes one of your strings, and the response reports stop_reason: "stop_sequence". Useful for free-text protocols such as END_OUTPUT; with structured outputs you rarely need it.

5. The System Prompt and Examples (The Behaviour Layer)

Section titled “5. The System Prompt and Examples (The Behaviour Layer)”

Without a temperature dial, consistency comes from the prompt: a strict role, explicit constraints, a defined output format and two or three worked examples. This is where Modules 1 to 3 do their work.

The same input is not guaranteed to produce byte-identical output. Production reliability comes from three layers instead:

  1. Constrain the shape with structured outputs or strict tool schemas.
  2. Validate every response in code and handle refusals and truncation explicitly.
  3. Test with a fixed evaluation set whenever you change a prompt or a model.

Next Steps: These controls turn Claude from a creative assistant into a dependable software component. The Architect Bundle’s scripts use every one of them.