Code for each endpoint: Chat Completions, Responses, Messages.
Rules
- Every call needs its result, and every result its call. A tool call without a matching result, or a result without its call (
tool_output_unmatched), fails with400before the request reaches a provider. - Responses keeps no state. Send the earlier
function_callitems back together with theirfunction_call_outputitems. See Conversation state. - Models without tool support lose the tools. If
toolsis missing from a model’ssupported_parameters, NagaAI removes the tools from the request and the model answers in text. - Some models accept only
tool_choice: "auto". Forclaude-opus-5.5,claude-fable-5.1and Mythos 5.1, NagaAI turnsrequiredor a named tool intoauto, so the model may answer in text. - NagaAI refuses legacy fields.
functions, thefunctionrole andfunction_callon a message fail with400, and NagaAI drops a top-levelfunction_call. Usetools,tool_choice,tool_callsand thetoolrole. - Function tools and web search only. NagaAI supports your own function tools and web search. NagaAI drops other server-side tools, see Differences.