PRODUCTION USE CASE

LLM API for repository refactoring

An engineering team is extracting billing logic from a monolith while keeping existing HTTP and event contracts stable. Sol first produces an impact map: owners, callers, data writes, migrations, tests, and rollback points. No code is requested until that map is approved.

Repository dependency map used to plan a multi-file refactor
LLM API for repository refactoring

Production recipe

API, primary model, and failover configuration

Production choiceRecommendationWhy
APIPOST /v1/chat/completionsOpenAI-compatible server-side request
Primary modelgpt-5.6-solSol is appropriate because a repository-scale refactor depends on long-range dependency reasoning and consistent decisions across checkpoints.
Fallback modelgpt-5.6-terraUse Terra for each bounded implementation checkpoint after Sol has produced the plan. There is no lower model for changing unreviewed architecture boundaries.
Escalation modelgpt-5.6-solUse only when the primary route fails the defined quality or complexity boundary
Output contractTask-specific text or patchAn approved impact map followed by one reversible unified diff per checkpoint.
01
Scenario

Repository refactoring in a production application

An engineering team is extracting billing logic from a monolith while keeping existing HTTP and event contracts stable. Sol first produces an impact map: owners, callers, data writes, migrations, tests, and rollback points. No code is requested until that map is approved.

The implementation then runs as several small requests. Each request changes one dependency boundary, produces a patch, and ends with the exact commands required to prove compatibility.

02
Architecture

How the repository refactoring workflow operates

  • Generate and approve the impact map.
  • Freeze public interfaces and baseline behavior tests.
  • Implement one dependency boundary per request.
  • Run compatibility and migration checks after every patch.
  • Stop and re-plan when an unlisted dependency appears.
03
API request

Call gpt-5.6-sol 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-sol",
    "messages": [
      {"role": "system", "content": "Plan a repository refactor before editing. Preserve the listed public contracts. First return an impact map and reversible checkpoints; do not produce code until a checkpoint is selected."},
      {"role": "user", "content": "Extract billing from the monolith while preserving the attached HTTP and event contracts."}
    ]
  }'
04
Model choice

Why gpt-5.6-sol is the primary model

Sol is appropriate because a repository-scale refactor depends on long-range dependency reasoning and consistent decisions across checkpoints.

Use Terra for each bounded implementation checkpoint after Sol has produced the plan. There is no lower model for changing unreviewed architecture boundaries.

05
Acceptance

Acceptance checks for repository refactoring

MetricPass condition
Behavior preservationBaseline and post-refactor behavior tests produce equivalent results
Public API compatibilityDocumented public interfaces and supported call sites remain compatible
Unplanned file changesEvery changed file appears in the approved impact map or has a recorded reason
Completion without manual rescueThe staged refactor reaches the final checkpoint without an engineer rewriting the approach
06
Failure handling

Failures to handle before deployment

  • Sending the entire repository without retrieval
  • Mixing refactors with feature work
  • Skipping intermediate tests
  • Judging quality only by diff size
07
Output

Returned output and run records

An approved impact map followed by one reversible unified diff per checkpoint.

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

Frequently asked questions

How much repository context should I send?

Send the architecture map and affected files first, then retrieve dependencies as the plan requires.

How should a large refactor be evaluated?

Check behavior, compatibility, boundaries, tests, and unplanned change at each checkpoint.

Should one request perform the entire refactor?

Prefer staged, reversible changes with validation between stages.

Test this setup with your own inputs

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

Compare models