PRODUCTION USE CASE

LLM API for math reasoning

A pricing service needs to explain a prorated subscription adjustment. Application code calculates the amount; the model receives the formula, verified intermediate values, currency rules, and customer context, then writes a concise explanation.

Math reasoning response checked against a deterministic calculation
LLM API for math reasoning

Production recipe

API, primary model, and failover configuration

Production choiceRecommendationWhy
APIPOST /v1/chat/completionsOpenAI-compatible server-side request
Primary modelgpt-5.6-terraTerra is the default for quantitative reasoning plus a clear customer-facing explanation.
Fallback modelgpt-5.4Use gpt-5.4 for formula explanation when all values are precomputed. Escalate genuinely difficult derivations to Sol, then still verify deterministically.
Escalation modelgpt-5.6-solUse only when the primary route fails the defined quality or complexity boundary
Output contractTask-specific text or patchA concise explanation whose amount, units, and rounding exactly match the independently computed result.
01
Scenario

Math reasoning in a production application

A pricing service needs to explain a prorated subscription adjustment. Application code calculates the amount; the model receives the formula, verified intermediate values, currency rules, and customer context, then writes a concise explanation.

For open-ended quantitative analysis, the model can propose calculator or code-tool calls, but the final number is always recomputed and checked outside the model.

02
Architecture

How the math reasoning workflow operates

  • Compute or retrieve trusted numeric inputs.
  • Ask the model for a formula and explanation, not unchecked arithmetic.
  • Execute calculator or code tools when needed.
  • Recompute the final result and validate units and rounding.
  • Return the verified answer with a concise derivation.
03
API request

Call gpt-5.6-terra through LLMFly AI

Send the request from your server. Replace the example content and placeholder tool schema with data and tools from your application.

request.exampleCopy-ready
curl https://app.llmfly.ai/v1/chat/completions \
  -H "Authorization: Bearer $LLMFLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-terra",
    "messages": [
      {"role": "system", "content": "Explain the verified calculation using the supplied formula and values. Preserve currency, units, and rounding rules. Do not change any verified numeric input."},
      {"role": "user", "content": "Explain this prorated subscription adjustment to the customer in three short steps."}
    ]
  }'
04
Model choice

Why gpt-5.6-terra is the primary model

Terra is the default for quantitative reasoning plus a clear customer-facing explanation.

Use gpt-5.4 for formula explanation when all values are precomputed. Escalate genuinely difficult derivations to Sol, then still verify deterministically.

05
Acceptance

Acceptance checks for math reasoning

MetricPass condition
Verified answer accuracyThe final answer matches an independently checked result on the target set
Unit and precision complianceUnits, rounding, significant figures, and uncertainty follow the task contract
Consistency across equivalent promptsEquivalent formulations produce the same answer within allowed tolerance
Cost per verified solutionModel calls, tools, retries, and checks stay within the solution budget
06
Failure handling

Failures to handle before deployment

  • Using unchecked benchmark answers
  • Scoring eloquence as correctness
  • Unaided fragile arithmetic
  • Ignoring wrong units
07
Output

Returned output and run records

A concise explanation whose amount, units, and rounding exactly match the independently computed result.

Record the model ID, request ID, token usage, retries, validation result, and final disposition for every production run.

Frequently asked questions

Should the model show full internal reasoning?

Evaluate the final answer and a concise, checkable explanation; do not depend on hidden reasoning.

When should a calculator be used?

Use deterministic tools when arithmetic, symbolic work, or simulation needs verification.

How should cost be compared?

Compare cost per verified solution, including tools, retries, and validation.

Test this setup with your own inputs

Compare the primary and fallback models with the same requests, tools, and validation rules.

Compare models