You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d106696
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/gateway/index.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,9 +93,9 @@ Why this set matters:
93
93
94
94
Planning note:
95
95
96
-
-Keep `/v1/models`as a flat `provider/model` list for client compatibility.
97
-
-Treat agent and sub-agent selection as separate OpenClaw routing concerns, not pseudo-model entries.
98
-
-When you need agent-scoped filtering, pass `x-openclaw-agent-id` on both model-list and request calls.
96
+
-`/v1/models`is agent-first: it returns `openclaw`, `openclaw/default`, and `openclaw/<agentId>`.
97
+
-`openclaw/default` is the stable alias that always maps to the configured default agent.
98
+
-Use `x-openclaw-model` when you want a backend provider/model override; otherwise the selected agent's normal model and embedding setup stays in control.
99
99
100
100
All of these run on the main Gateway port and use the same trusted operator auth boundary as the rest of the Gateway HTTP API.
-`x-openclaw-message-channel: <channel>` sets the synthetic ingress channel context for channel-aware prompts and policies.
61
65
62
-
Advanced:
66
+
Compatibility aliases still accepted:
63
67
64
-
-`x-openclaw-session-key: <sessionKey>` to fully control session routing.
65
-
-`x-openclaw-message-channel: <channel>` to set the synthetic ingress channel context for channel-aware prompts and policies.
66
-
67
-
For `/v1/models` and `/v1/embeddings`, `x-openclaw-agent-id` is still useful:
68
-
69
-
-`/v1/models` uses it for agent-scoped model filtering where relevant.
70
-
-`/v1/embeddings` uses it to resolve agent-specific memory-search embedding config.
68
+
-`model: "openclaw:<agentId>"`
69
+
-`model: "agent:<agentId>"`
71
70
72
71
## Enabling the endpoint
73
72
@@ -120,34 +119,40 @@ This is the highest-leverage compatibility set for self-hosted frontends and too
120
119
121
120
<AccordionGroup>
122
121
<Accordiontitle="What does `/v1/models` return?">
123
-
A flat OpenAI-style model list.
122
+
An OpenClaw agent-target list.
124
123
125
-
The returned ids are canonical `provider/model` values such as `openai/gpt-5.4`.
126
-
These ids are meant to be passed back directly as the OpenAI `model` field.
124
+
The returned ids are `openclaw`, `openclaw/default`, and `openclaw/<agentId>` entries.
125
+
Use them directly as OpenAI `model` values.
127
126
128
127
</Accordion>
129
128
<Accordiontitle="Does `/v1/models` list agents or sub-agents?">
130
-
No.
129
+
It lists top-level agent targets, not backend provider models and not sub-agents.
131
130
132
-
`/v1/models` lists model choices, not execution topology. Agents and sub-agents are OpenClaw routing concerns, so they are selected separately with `x-openclaw-agent-id` or the `openclaw:<agentId>` / `agent:<agentId>` model aliases on chat and responses requests.
131
+
Sub-agents remain internal execution topology. They do not appear as pseudo-models.
133
132
134
133
</Accordion>
135
-
<Accordiontitle="How does agent-scoped filtering work?">
136
-
Send `x-openclaw-agent-id: <agentId>` when you want the model list for a specific agent.
134
+
<Accordiontitle="Why is `openclaw/default` included?">
135
+
`openclaw/default` is the stable alias for the configured default agent.
137
136
138
-
OpenClaw filters the model list against that agent's allowed models and fallbacks when configured. If no allowlist is configured, the endpoint returns the full catalog.
137
+
That means clients can keep using one predictable id even if the real default agent id changes between environments.
139
138
140
139
</Accordion>
141
-
<Accordiontitle="How do sub-agents pick a model?">
142
-
Sub-agent model choice is resolved at spawn time from OpenClaw agent config.
140
+
<Accordiontitle="How do I override the backend model?">
141
+
Use `x-openclaw-model`.
142
+
143
+
Examples:
144
+
`x-openclaw-model: openai/gpt-5.4`
145
+
`x-openclaw-model: gpt-5.4`
143
146
144
-
That means sub-agent model selection does not create extra `/v1/models` entries. Keep the compatibility list flat, and treat agent and sub-agent selection as separate OpenClaw-native routing behavior.
147
+
If you omit it, the selected agent runs with its normal configured model choice.
145
148
146
149
</Accordion>
147
-
<Accordiontitle="What should clients do in practice?">
148
-
Use `/v1/models` to populate the normal model picker.
150
+
<Accordiontitle="How do embeddings fit this contract?">
151
+
`/v1/embeddings` uses the same agent-target `model` ids.
149
152
150
-
If your client or integration also knows which OpenClaw agent it wants, set `x-openclaw-agent-id` when listing models and when sending chat, responses, or embeddings requests. That keeps the picker aligned with the target agent's allowed model set.
153
+
Use `model: "openclaw/default"` or `model: "openclaw/<agentId>"`.
154
+
When you need a specific embedding model, send it in `x-openclaw-model`.
155
+
Without that header, the request passes through to the selected agent's normal embedding setup.
- use `Authorization: Bearer <token>` with the normal Gateway auth config
26
26
- treat the endpoint as full operator access for the gateway instance
27
-
- select agents with `model: "openclaw:<agentId>"`, `model: "agent:<agentId>"`, or `x-openclaw-agent-id`
27
+
- select agents with `model: "openclaw"`, `model: "openclaw/default"`, `model: "openclaw/<agentId>"`, or `x-openclaw-agent-id`
28
+
- use `x-openclaw-model` when you want to override the selected agent's backend model
28
29
- use `x-openclaw-session-key` for explicit session routing
29
30
- use `x-openclaw-message-channel` when you want a non-default synthetic ingress channel context
30
31
@@ -37,7 +38,7 @@ The same compatibility surface also includes:
37
38
-`POST /v1/embeddings`
38
39
-`POST /v1/chat/completions`
39
40
40
-
For the canonical explanation of how model listing, agent routing, and sub-agent model selection fit together, see [OpenAI Chat Completions](/gateway/openai-http-api#model-list-and-agent-routing).
41
+
For the canonical explanation of how agent-target models, `openclaw/default`, embeddings pass-through, and backend model overrides fit together, see [OpenAI Chat Completions](/gateway/openai-http-api#agent-first-model-contract) and [Model list and agent routing](/gateway/openai-http-api#model-list-and-agent-routing).
0 commit comments