- Responses
- Chat Completions
- Messages
Send the assistant turn back unchanged
Each example appends the model’s whole answer to the history, with every part it returned. That keeps the parts the model needs to continue: Responsesreasoning and function_call items, Chat Completions tool_calls and reasoning_details, and Messages thinking and tool_use blocks. A tool result without the call it answers fails with 400, as Tool calling explains, and Reasoning covers why models need their earlier reasoning.
Responses doesn’t store anything
The official Responses API can keep a conversation on the server. NagaAI doesn’t, and it ignoresprevious_response_id, store, conversation, background and prompt. There is no GET /v1/responses/{id} either. A request that relies on previous_response_id gets an answer without the earlier context, and no error tells you so. Send the earlier output items in input instead, as the Responses example does.
Some clients replace earlier turns with item_reference entries when store is on, expecting the server to fill them in. NagaAI refuses such a request with 400 and names the input item to send in full. Turn storing off in the client: in the Vercel AI SDK that’s providerOptions: { openai: { store: false } }. Codex CLI and OpenCode already send store: false.
Let NagaAI trim a conversation that outgrows the window
A history grows with every turn, and one day it no longer fits the model’s context window. By default NagaAI then refuses the request with400 context_length_exceeded, so nothing is forgotten without your say. Send truncation: "auto" and NagaAI drops whole turns from the middle of the history instead, oldest first, until the input fits with room left for the answer. The key is the same in all three APIs.
- Responses
- Chat Completions
- Messages
max_output_tokens in Responses and max_tokens elsewhere.
A history of one or two turns has no middle to drop, and neither does a single turn with a long tool loop. Such a request still fails with context_length_exceeded. So does one whose kept turns alone overflow the window. With fallback models, each model is trimmed to its own window, so a model with a larger window loses less.
Troubleshooting
The model forgets earlier turns
The request doesn’t carry them. Check that your code appends both the assistant answer and the next user message to the history before each call.400 context_length_exceeded on a long conversation
The history no longer fits the model’s window. Send truncation: "auto" to let NagaAI drop turns from its middle. You can also keep a summary of old turns in your application, or pick a model with a larger limits.context_window in /v1/models.
400 that names an item_reference
The client sent a reference to a stored item. Turn off store in the client so that it sends the items themselves.