bots-garden/mini-mepublic Fork
⑂ v2.0.0
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/mini-me.git
git clone ssh://git@rickub.com/bots-garden/mini-me.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
use-the-openai-responses-api.md · 59 lines · 4.1 KBmarkdown
Blame HistoryOpen raw

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

  1. 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_tokens
    

    No baseUrl: the default is the OpenAI API, https://api.openai.com/v1.

  2. Export the key — it never goes in the YAML:

    export OPENAI_API_KEY=sk-…
    

    Another variable name: apiKeyEnv: MY_KEY.

  3. Start mm as usual (mm, mm tui, mm acp, mm -p "…"). The model's reasoning summary, when the API streams one, shows as thoughts (💭, with showThinking: 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), like provider: openai. Two Chat Completions names are renamed for this API: max_tokens and max_completion_tokens become max_output_tokens, and reasoning_effort becomes reasoning.effort. Any other key goes as it is, so reasoning: {summary: auto} asks for the reasoning summary, for instance.
  • store: false and include: ["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. Write store or include in sampling to choose otherwise.
  • The tools as function tools, not strict: mm's tool schemas have optional fields, which strict mode refuses.
  • structuredOutput as text.format (json_schema, strict, as the openai provider sends it).
  • The summary of a compaction with reasoning.effort: none, not streamed, with no tools.

Variants

  • Another server. Set baseUrl to its OpenAI-compatible address (ending in /v1); it must serve POST /responses. Which servers do — vLLM, Ollama, llama-server… — is not verified. If one refuses include or store, write them in sampling (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 says authentication failed … is $OPENAI_API_KEY set and valid?.
  • No reasoning summary on screen. The API sends a summary only when asked: reasoning: {summary: auto} in sampling. 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
# 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`:

```text
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

1. Write the agent file with `provider: openai-responses`:

   ```yaml
   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_tokens
   ```

   No `baseUrl`: the default is the OpenAI API, `https://api.openai.com/v1`.

2. Export the key — it never goes in the YAML:

   ```bash
   export OPENAI_API_KEY=sk-…
   ```

   Another variable name: `apiKeyEnv: MY_KEY`.

3. Start mm as usual (`mm`, `mm tui`, `mm acp`, `mm -p "…"`). The model's reasoning summary, when the API streams one, shows as thoughts (`💭`, with `showThinking: 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`), like `provider: openai`. Two Chat Completions names are renamed for this API: `max_tokens` and `max_completion_tokens` become `max_output_tokens`, and `reasoning_effort` becomes `reasoning.effort`. Any other key goes as it is, so `reasoning: {summary: auto}` asks for the reasoning summary, for instance.
- **`store: false` and `include: ["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. Write `store` or `include` in `sampling` to choose otherwise.
- **The tools as function tools**, not strict: mm's tool schemas have optional fields, which strict mode refuses.
- **`structuredOutput`** as `text.format` (`json_schema`, strict, as the `openai` provider sends it).
- **The summary of a compaction** with `reasoning.effort: none`, not streamed, with no tools.

## Variants

- **Another server.** Set `baseUrl` to its OpenAI-compatible address (ending in `/v1`); it must serve `POST /responses`. Which servers do — vLLM, Ollama, llama-server… — is not verified. If one refuses `include` or `store`, write them in `sampling` (`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 says `authentication failed … is $OPENAI_API_KEY set and valid?`.
- **No reasoning summary on screen.** The API sends a summary only when asked: `reasoning: {summary: auto}` in `sampling`. 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](run-with-an-openai-compatible-server.md).

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

- [Configuration reference — provider defaults](../reference/configuration.md#provider-defaults)
- [Providers — explanation](../explanation/providers.md)