Relay365Multi-model API relay desk
← All desk bulletins
Field notes from the deskEN1 desk reads

Shift note: JSON replies need more than valid braces

A model can write a useful answer and still break the application waiting for it. Perhaps your code expects a JSON object, but the response includes an introduction, a missing field, or a number written as text. JSON mode and structured output help reduce that mismatch, but they solve different parts of the problem.

The operational rule is simple: decide what your application accepts before asking a model to produce it. Then check the response before passing it downstream.

JSON mode checks the container, not the contents

JSON is a text format for representing objects, lists, strings, numbers, booleans, and null values. Applications use it because software can parse it without interpreting ordinary prose.

JSON mode generally asks an API to produce valid JSON rather than a conversational answer. The exact behavior depends on the provider and endpoint. You should still describe the expected contents in your instructions.

Suppose you want a support ticket summary containing a subject, a priority, and a list of affected services. A response can be valid JSON while omitting the priority entirely. It can also use a different field name or supply a string where your application expects a list. Passing a JSON parser does not mean passing your application’s requirements.

A schema makes the expected fields explicit

Schema-based structured output goes further by describing the response’s permitted shape. JSON Schema is a common way to express that contract. Depending on the implementation, it can specify required fields, value types, allowed choices, and whether extra properties are acceptable.

  • A required subject field tells the system that every successful result needs a subject.
  • A priority field restricted to low, medium, or high prevents unexpected category names when that restriction is enforced.
  • An affected_services field defined as an array of strings gives downstream code a predictable collection to process.

Structural correctness is not factual correctness. A response may satisfy every schema rule while naming the wrong service or assigning an unsupported priority. Your application still needs checks appropriate to the task.

Compatible request formats can hide different capabilities

Across model families, “structured output” is not one universal feature switch. Providers can differ in supported schema keywords, strictness settings, streaming behavior, and the endpoints that accept a particular option.

An OpenAI-compatible interface makes requests more familiar, but it does not establish identical behavior underneath. Before moving a workflow to Gemini 2.5 Flash, for example, verify that the chosen route supports the output controls your application needs. Do not infer support from the model name alone.

Also distinguish schema-constrained responses from tool calling. Tool calling lets a model propose a named operation with arguments. Those arguments may be structured, but receiving them is not permission to execute an operation without validation and authorization.

Response handling belongs beside the schema

Treat the schema as one layer in a small response-handling pipeline, not as a replacement for error handling.

  • Check the API status and completion metadata before treating the response as a finished result.
  • Handle refusals, token-limit truncation, and transport errors separately from ordinary schema-validation failures.
  • Parse the completed payload and validate it locally against your expected contract.
  • Apply business checks, such as confirming that a service name exists in your own catalog.
  • Use bounded retries for recoverable failures, and avoid repeating downstream actions that may already have succeeded.

Keep early schemas small. Fewer fields and clear allowed values make failures easier to diagnose. When streaming, do not assume a partial JSON fragment is a complete, usable object.

A relay simplifies access without replacing verification

Relay365 fits teams that want pay-as-you-go access to multiple model families through a shared relay desk. It works with Claude Code, Codex, Gemini CLI, and OpenAI SDK clients. Its API base is https://api.api365relay.com; OpenAI clients add /v1.

That shared access can make comparing response contracts more convenient, but check each route’s documented capabilities before relying on a particular schema feature. If that setup suits your workflow, create a Relay365 account and start with a small, representative validation test.

The shift-note takeaway: request JSON when you need parseable text, use schema-based output when you need a defined shape, and validate both structure and meaning before your application acts.

Further desk bulletins

Curious how it runs on your own code? Sign up →