Your application extracts a customer request into JSON. The first model returns a usable object. You switch the model behind your API gateway, keep the schema, and the next request fails before an answer appears. After removing a constraint, the request succeeds—but the database now rejects the result.
For a developer comparing Fable 5.2 vs Astra API integrations, that sequence is more informative than a general leaderboard. It exposes three contracts: the request accepted by the provider, the JSON produced by the model, and the record accepted by your application. They need to agree, but they are not interchangeable.
This walkthrough treats the migration as a code review. The example extracts a proposed order adjustment without executing it. We will build separate Claude Messages and OpenAI Responses payloads around one modest schema, then apply an application rule that belongs outside either model. The examples are local fixtures, not measured model results.
The scope is final structured responses. If your application is switching providers during a tool loop, keep that conversation migration separate. The existing Claude thinking replay guide explains why text-only history can lose important protocol information.
Review comment: specify the model and interface together
“Astra” alone is an incomplete test label. This example compares claude-fable-5-2 with gpt-6-astra. Anthropic lists the former in its Fable 5.2 documentation, while OpenAI documents the latter on the GPT-6 Astra model page. A newer Astra release requires its own result row.
For each run, record the upstream target, your account’s model alias, endpoint family, SDK version, and schema revision. An alias can identify a gateway route without being an upstream model identifier. Preserve both labels rather than pretending they are the same thing.
A successful plain-text call only demonstrates that this particular route can return text. Before adopting structured extraction, verify that the route forwards the relevant native fields and returns enough response information to distinguish completion from refusal or interruption. Do that with a small test before connecting the route to a business database.
Keep the comparison focused on whether a particular API configuration satisfies an output contract that your application can maintain. A model’s reputation for coding or reasoning cannot establish that a gateway forwards the native structured-output fields your consumer requires.
Review comment: make the first contract deliberately small
Imagine a customer writing, “Please change order A-17 to three boxes.” The extractor should propose an order identifier and requested quantity. It should leave the identifier unknown when the message does not contain one. It should never invent an order from another customer’s history.
Design the initial object with two fields: an order identifier that may be null, and an integer quantity that may be null. Require both keys. This makes absence explicit and gives the frontend a stable object shape. Null still needs a defined business meaning; it is not permission to continue with a default value.
OpenAI’s Structured Outputs documentation explains the strict schema subset, including required properties and a closed object shape. Claude’s structured-output reference documents its own supported subset and native output configuration. A valid general JSON Schema is not automatically accepted by both services.
Start with ordinary objects, explicitly named properties, primitive types, and deliberate nullability. Avoid copying a large application model directly into the first provider request. A framework may generate definitions, defaults, constraints, and references that deserve separate review.
The JSON Schema object reference is useful for understanding what property declarations, required keys, and additional properties actually mean. Keep the business contract in version control. A schema is part of the application’s public behavior, even when a model produces its values.
This is also where the migration differs from a document-reading test. If the failure concerns whether a value came from the correct PDF page, use the separate Fable/Astra PDF evidence comparison. Shape compatibility cannot establish source accuracy.
Review comment: share the schema, keep the envelopes separate
The following Python program writes two request bodies and verifies a small local acceptance policy. It sends no requests and contains no credentials. Save it as build_schema_requests.py and run it with Python 3.
The quantity ceiling of twelve is an example application rule, not a provider limit. The code assumes that a trusted backend has already established which order the authenticated customer may access. Matching a string supplied by the model is never a substitute for that authorization step.
Notice the separate request envelopes. Claude receives its output format through output_config.format; the Responses example uses text.format. These fields are not a claim that every intermediary translates one format into the other. Consult the selected route’s contract before submitting either file.
The matching numeric output limits are starting settings, not evidence of equal reasoning budgets, latency, or cost. Run each configuration to completion and inspect the result before making a comparison. The request builder does not implement networking, response extraction, or retry behavior.
Review comment: a schema error needs a schema diagnosis
A request rejected before generation belongs in a different bucket from a completed answer that fails business validation. Record the structured error, the schema revision, the endpoint family, and the actual request fields. Remove secrets before sharing that record with support.
For an unsupported schema feature, reduce the contract to a small reproducer. Add one feature back at a time. A large nested schema with several unsupported elements makes the first error hard to interpret; repeatedly changing the prompt usually does little to identify which field was rejected.
Claude currently documents limitations on numeric and string-length constraints. Its SDK helpers may transform unsupported constraints before sending the request. This means the schema written in application code and the schema transmitted over the network may differ. Inspect the transformation rather than assuming that every declared constraint was enforced during generation.
Treat provider schema support as a capability of the specific interface and model configuration. In particular, the Fable documentation notes a structured-output restriction for organizations using customer-managed encryption keys. Check that account condition before interpreting a feature rejection as a broken gateway.
Do not quietly remove a business requirement to make the request pass. If the provider cannot enforce a particular rule, retain the rule in the application validator and document that boundary. The invoice arithmetic validation article shows an adjacent example where valid JSON still requires deterministic checks.
Review comment: inspect completion before parsing the business object
Build a response adapter for each provider. Its job is to classify the outcome and locate the final structured text, not to concatenate every response block into a JSON string. Reasoning content, refusal messages, tool calls, and final answers have different roles.
Anthropic’s stop-reason documentation explains how a turn can end. Check that outcome before treating its text as the expected business object. On the OpenAI side, inspect the Responses status, incomplete details, and refusal content before parsing the structured result.
Keep at least four outcomes distinct: request rejected, response incomplete, response refused, and candidate available. Only the last should enter the ordinary JSON and business-validation path. An incomplete result should not become an empty object that accidentally means “no change requested.”
For streaming applications, the same rule applies after the stream ends. A fragment that happens to parse is not proof that the full response completed successfully. Preserve the terminal outcome and reject interrupted assembly from automatic acceptance. Transport completion and business acceptance should remain separate events.
If your interface also streams tool arguments, the Claude tool JSON assembly guide addresses that distinct protocol boundary. Keep its tool-dispatch logic separate from the final-answer parser described here.
A repair request also needs a policy. If the customer omitted an order identifier, another generation cannot manufacture authorization. Ask for clarification. If a field is outside a known business range, retain the original candidate and route it to the appropriate review flow rather than looping until a convenient value appears.
The Gemini schema-migration guide covers a different provider and consumer-version problem. Its relevance here is the discipline of explicit contract revisions; its API field names should not be copied into these Claude or OpenAI requests.
The merge decision belongs to the consumer
Give the consumer a versioned acceptance record. For this example, a useful record includes the input fixture identifier, schema revision, actual model target, terminal response state, validation outcome, and whether a reviewer accepted the proposed adjustment. Store the model’s proposal separately from the business decision. That separation makes it possible to investigate a mistaken change without confusing what the model suggested with what the application authorized.
When introducing a new field, run the old and new consumer fixtures before changing the production schema. A nullable field can still break a client that expects exactly two keys. Conversely, removing a field may appear harmless to a human reader while breaking a required downstream import. Review compatibility from the receiving application’s perspective, not only the API’s schema validator.
Choose a release gate that reflects the consequences of an incorrect value. A support dashboard may display a proposal for human review; an automated order mutation requires a separate authorization and execution path. The example deliberately stops before that mutation. Its successful outcome means that a candidate is eligible for review, not that the customer request should be applied.
Also track repeated clarification requests. A model that produces valid objects but leaves available information null can increase handling time. Keep that failure visible alongside incorrect extraction rather than reporting only the percentage of answers that parse.
Before shipping, run a fixed packet containing complete requests, missing quantities, missing order identifiers, irrelevant numbers, conflicting instructions, and a quantity outside policy. Keep expected outcomes written down before collecting model answers. The packet should reflect your real workload, not only examples that make one model look good.
Compare accepted candidates, clarification behavior, factual extraction, and complete-workflow cost separately. A fast response that proposes the wrong order cannot win on latency. A slower response that always asks unnecessary questions may create avoidable support work. Those are product decisions the schema alone cannot settle.
When evaluating 4SAPI, confirm the two exact model routes and native structured-output support available to your account. Start with this bounded extraction task, retain both request files and response outcomes, and expand only after your consumer accepts the results consistently. No database write is needed to conduct this first pilot.
FAQ
Can I keep one schema for both APIs?
Yes, when you deliberately select a supported shared subset and verify it through both routes. Keep provider-specific request construction outside that shared definition.
Does strict output make the extracted values correct?
It constrains representation under the documented conditions. Source accuracy, customer authorization, and application policy still need their own checks.
Should I switch models after every validation failure?
First classify the failure. Missing customer information and an invalid business request will not necessarily improve when routed to a different model.
Is this a benchmark proving that one model is better?
No. It is a reproducible integration exercise. A comparison requires real model responses, documented settings, and scoring against your own workload.




