How to keep reasoning and tools together with OpenAI's Responses API
This guide shows how to run mini-me on an OpenAI reasoning model that refuses tools on Chat Completions while it reasons — seen with gpt-6-luna:
Function tools with reasoning_effort are not supported for gpt-6-luna in /v1/chat/completions.
To use function tools, use /v1/responses or set reasoning_effort to 'none'.
An mm agent always sends tools. reasoning_effort: none makes the openai provider work, but the model no longer reasons. The openai-responses provider speaks the Responses API (POST /v1/responses) instead, and keeps both. It assumes an OpenAI API key and a model that serves /v1/responses.
Steps
-
Write the agent file with
provider: openai-responses:provider: openai-responses model: gpt-6-luna contextWindow: 400000 # this provider cannot ask the server for its window sampling: reasoning_effort: medium # sent as reasoning.effort max_completion_tokens: 16000 # sent as max_output_tokensNo
baseUrl: the default is the OpenAI API,https://api.openai.com/v1. -
Export the key — it never goes in the YAML:
export OPENAI_API_KEY=sk-…Another variable name:
apiKeyEnv: MY_KEY. -
Start mm as usual (
mm,mm tui,mm acp,mm -p "…"). The model's reasoning summary, when the API streams one, shows as thoughts (💭, withshowThinking: true); the tool calls run as with every other provider.
mm init writes such a file: choose openai-responses, then the endpoint and the key's variable (or --provider openai-responses).
What the provider sends
- The
sampling:block as written, without mm's defaults (top_p,max_tokens), likeprovider: openai. Two Chat Completions names are renamed for this API:max_tokensandmax_completion_tokensbecomemax_output_tokens, andreasoning_effortbecomesreasoning.effort. Any other key goes as it is, soreasoning: {summary: auto}asks for the reasoning summary, for instance. store: falseandinclude: ["reasoning.encrypted_content"]. Nothing is kept on OpenAI's side. The model's encrypted reasoning comes back with each answer, and mm sends it back with the tool results, so the model keeps its thread from one tool call to the next. It is also saved with the conversation when sessions are on. Writestoreorincludeinsamplingto choose otherwise.- The tools as function tools, not strict: mm's tool schemas have optional fields, which strict mode refuses.
structuredOutputastext.format(json_schema, strict, as theopenaiprovider sends it).- The summary of a compaction with
reasoning.effort: none, not streamed, with no tools.
Variants
- Another server. Set
baseUrlto its OpenAI-compatible address (ending in/v1); it must servePOST /responses. Which servers do — vLLM, Ollama, llama-server… — is not verified. If one refusesincludeorstore, write them insampling(include: []). - The key is refused. The start-up warning says
openai-responses: <baseUrl> refused the key (HTTP 401) — export OPENAI_API_KEY, and a failed question saysauthentication failed … is $OPENAI_API_KEY set and valid?. - No reasoning summary on screen. The API sends a summary only when asked:
reasoning: {summary: auto}insampling. OpenAI may require a verified organisation for it. - Chat Completions is enough. For a model that does not reason, or one served by vLLM, LM Studio or a gateway that only speaks Chat Completions, keep
provider: openai— see How to use any OpenAI-compatible server.
Checked against a fake /v1/responses server, in tests and with the built binary: the reasoning summary was shown, a bash call ran, and the encrypted reasoning and the tool's output went back with the call's call_id. No call to the OpenAI API was made in this repository.
See also
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|