SalpXXAPI News
Pitfalls & Selection 3 min read

Does your API gateway really support tools? Verify the round trip

Test two Chat Completions requests with a read-only function, then check parallel calls to the same tool and controlled failures.

When choosing a gateway, test function calling through the second model request. Seeing tool_calls in the first response only proves that the client received a proposed call. The right result still needs to make it back to the model and be associated with the right call. An HTTP success or text that looks like function arguments is not a passing result.

Know what each component does

For client-side functions in Chat Completions, the application declares the function under tools. The model can return the function name, arguments, and call ID. Your application validates the arguments and executes its own function. It retains the preceding assistant message, appends a result with role: tool and the matching tool_call_id, and sends a follow-up request. The OpenAI Cookbook demonstrates this flow. Provider-hosted tools are different, and other APIs need not accept tool_call_id. 1

First test: use a value the model cannot know in advance

  1. Create a read-only test function such as lookup_color. Set up two fictional item IDs in a local fixture. Return a short label and a fresh random verification code. Accept only the known IDs, without real data or external writes.
  1. Give the model only the item ID and ask it to look it up, then repeat the label and code verbatim. Keep the answer out of both the user prompt and the tool description so the model cannot pass without actually receiving the result.
  1. Assert that the first response includes the expected function, arguments, and a call ID. Assert that the tool message in the second request references that ID and that the final answer contains the code just generated. Keep these checks for both the gateway and your comparison route. Start without streaming, then repeat with the SDK and mode you will use in production.

Second test: calls to the same function and controlled failures

If your workload needs parallel tool calls, ask for two items in the same turn. In a test that produces two calls to the same function, delay one result and give the two items different values. Check each item against its expected value in the final answer. Match by call ID, not by function name or the order in which execution finished. If the model doesn't emit both calls, use the same model and protocol on a comparison route to distinguish model behavior from relay behavior: a model need not choose two calls on every run.

Next, send a fictional ID missing from the fixture. Have your application return a controlled error, such as “not found.” The model should say the item could not be found, not invent a plausible value, and the app should not expose raw arguments instead of a result. Record whether the tool request arrived, whether the result was submitted, and whether the follow-up succeeded. That separates tool selection, application execution, and gateway forwarding problems.

Write down your acceptance criteria

Specify the model and protocol, the single-tool round trip, whether parallel and streaming modes matter, how failures are surfaced, and whether support can locate a transaction by request ID. A relay that supports one non-streaming call may be fine for your workload, but it does not pass a streaming parallel requirement. If both requests succeed but the code is missing or the values are swapped, compare redacted messages, call IDs, and result mappings before tweaking the prompt. Fix the layer the evidence points to, and enable real business tools only when the fixture passes.

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.

  1. How to call functions with chat models — OpenAI Cookbook · accessed 2026-12-03Note:Official notebook demonstrating tool declarations, application execution, result pairing by ID, and the follow-up request.

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.