Q&A: HTTP 200 but the answer stops halfway—check finish_reason and stop_reason first
A successful status code means the request was processed, not that the text ended naturally. Read the stop reason before continuing, running a tool, raising a limit, or retrying.
The conclusion first
HTTP 200 only confirms that the API produced a protocol-level response. It does not guarantee that the model completed the intended answer. When a sentence stops halfway, JSON lacks a closing brace, or tool arguments appear without a final explanation, do not retry immediately. Inspect the stop reason first.
For OpenAI Chat responses, read choices[0].finish_reason. stop normally means a natural stop or a configured stop sequence, length means the generation token limit was reached, tool_calls means the model is asking the client to run tools, and content_filter means content was omitted by filtering.1
For Claude Messages, inspect stop_reason. end_turn means the model naturally completed the current turn, while official examples use max_tokens when output reaches the configured limit. Claude Messages is stateless by default, so a multi-turn request must resend the relevant history unless the application explicitly uses a stateful thread feature.2
The correct question after a 200 is therefore not “Why did a successful API break?” It is “Why did the model stop?”
Does stop or end_turn guarantee a complete business result?
No. Those values indicate that the model considered the turn naturally complete. If the application still sees an incomplete result, inspect the prompt and output validation before merely increasing the token cap.
Common causes include:
- The prompt asked for a brief answer, so the model ended early as instructed.
- A custom
stopsequence matched the generated text. - A JSON task did not require a strict schema, so the model ended with invalid formatting.
- The client displayed only one content block while the response contained more text or tool blocks.
- A streaming client failed to join one of the incremental events even though the server completed normally.
Save the raw response first. Confirm that every server content block or stream event reached the client, then apply business validation. Parse JSON rather than looking at it. Count requested list items. Check whether code fences and structural delimiters close.
What should I do with length or max_tokens?
They usually indicate that the output budget was too small. OpenAI's official concepts guide says prompt input and generated output together must fit within the model's context window. A longer input can leave less room for output.3
Use this order:
- Check whether the requested output cap is too small.
- Inspect usage and see whether output approached that cap.
- Remove repeated instructions, unnecessary history, and oversized tool results.
- Increase the output cap within the model's supported limit.
- Add parsing and completeness checks for structures that must be whole.
Do not raise the limit without bound. A larger budget increases worst-case latency and cost, and it can make a task harder to control. Long reports, large code migrations, and bulk extraction are usually safer when split into bounded sections with an explicit completion marker for each section.
Can I simply ask the model to continue?
Yes, but continuation is a new request and needs enough context. A safer instruction than a bare “continue” is:
The previous turn stopped at the output limit. Continue after the last complete section without repeating completed material. If the output is JSON, return only the missing part in a form that can be merged safely.
Include the previous stop reason, the last relevant output, and the original task. With Claude Messages, resend the required conversation history when you are not using a thread, because the API is stateless by default.2
Why does tool_calls have no final answer?
Because that turn is requesting a tool execution rather than ending the conversation. The client must read the tool name and arguments, execute the tool, send the tool result in the next turn, and then ask the model to complete the response.
If a client treats tool_calls as an empty answer and retries the same request, the model may request the same tool again. For tools that send mail, create orders, charge money, or modify data, this can create real duplicate actions.
A safe tool loop needs:
- A unique tool-call ID.
- An idempotency key or deduplication record for execution.
- Explicit success, failure, and timeout results.
- A next-turn message linked to the corresponding call.
- A maximum loop count to prevent repeated tool requests.
tool_callsis not truncation and not failure; it means the workflow is unfinished.
Can I solve content_filter by retrying?
Do not treat it as a normal length problem. OpenAI defines this value as content omitted because of filtering.1 Repeating the same request may produce the same result and another charge.
Inspect whether the input contains content that triggers filtering. Decide whether the business permits a compliant rewrite, or ask the user for an acceptable input. The client should label this as filtered content, not disguise it as a network error or automatically invent the omitted section.
Why does streaming look truncated more often?
A streaming response is divided across events. A read timeout, proxy buffer, connection close, or event-parser bug at any layer can leave the client with only the first part. Server logs, the upstream stop reason, and the client's received-event count must be examined together.
Use this order:
- Check whether the normal terminal event arrived.
- Check whether the last event contains a stop reason.
- Separate client cancellation, network disconnect, and normal model completion.
- Check SSE proxy buffering and idle read timeouts.
- Correlate gateway and client logs using the same request ID.
If there was no terminal event, do not assume length. A broken connection and a token cap are different failures with different retry and billing implications.
How can I create a minimal reproduction through SalpX?
The public SalpX Base URL is https://www.salpx.com/v1, authenticated with a Bearer API key.4 Use a small request to remove a client UI from the path:
curl https://www.salpx.com/v1/chat/completions \
-H "Authorization: Bearer $SALPX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<an available model>",
"messages": [{"role": "user", "content": "Return exactly five checks"}]
}'
Use the actual model list returned by GET /v1/models; do not copy an outdated example. Preserve the full JSON and record the HTTP status, request ID, model, finish_reason or stop_reason, usage, and whether a streaming request received its terminal event. Never expose a real key in logs or screenshots.
Can continuation be automated?
Yes, within strict limits. Automatically continue only when a length stop is explicit, and limit the number of attempts:
lengthormax_tokens: continuation can be appropriate.tool_calls: execute tools and continue the workflow; this is not text continuation.content_filter: stop automatic continuation.- Network interruption with no stop reason: first check whether the server already completed the request to avoid duplicate side effects.
stoporend_turn: run business completeness validation before deciding to continue.
For plain text, remove overlap at the boundary. For JSON, do not concatenate arbitrary strings; use a chunk protocol or require each chunk to be independently parseable. For tools and business writes, use idempotency keys.
Client completeness checklist
Response parsing
- Do not stop at HTTP 200.
- Read every content block, choice, or stream event.
- Store the stop reason and usage.
- Validate business completeness for JSON, lists, code, and other structures.
Retry and continuation
- Do not blindly retry parameter errors or filtered content.
- Enter controlled continuation only for an explicit length stop.
- Enter the tool loop for tool calls instead of regenerating.
- Reconcile an unknown interruption by request ID first.
- Protect every side-effecting action with idempotency.
Context management
- Include necessary history in multi-turn calls.
- Remove repeated prompts and unused tool output.
- Remember that input and output share the context budget.3
- Split long jobs and define a completion marker for each part.
One sentence to remember
The HTTP status answers whether the request was processed; the stop reason answers why the model stopped.
Read finish_reason or stop_reason first. Then choose whether to increase a limit, continue generation, run a tool, repair streaming, or stop retrying. That order reduces duplicate cost, prevents a normal tool call from being mislabeled as model failure, and protects side-effecting actions from running twice.
Sources & attribution
This article references the public materials listed below. Analysis and wording are SalpX's own; quoted material remains the property of its original authors and publishers.
- Chat API reference — OpenAI Developers · accessed 2026-11-23Note:OpenAI's official Chat API reference defining finish_reason values such as stop, length, tool_calls, and content_filter.
- Using the Messages API — Anthropic · accessed 2026-11-23Note:Anthropic's official Messages API guide showing end_turn, max_tokens, and stateless multi-turn message handling.
- Key concepts — OpenAI Developers · accessed 2026-11-23Note:OpenAI's official concepts guide explaining that input and generated output together must fit the model context window.
- SalpX API 参考 · 单页文档 — SalpX · accessed 2026-11-23Note:SalpX's official documentation publishes its base URL, Bearer authentication, model listing, and basic troubleshooting guidance.
One key for Claude, GPT and 50+ models
The SalpX gateway is OpenAI-SDK compatible. Point base_url at https://www.salpx.com/v1 and you are done.