Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(llm): use GPT-6 Luna as the built-in assist default (#9329)

LinYushen6dc20dd314b4
diff --git a/.env.example b/.env.example
index a38c4c89a6..dfe90dd74e 100644
--- a/.env.example
+++ b/.env.example
@@ -151,7 +151,7 @@ MULTICA_LLM_API_KEY=
# self-hosted, OpenAI-compatible model server.
MULTICA_LLM_BASE_URL=
# - Default model used when a request omits `model`. When unset, falls
-# back to a small built-in default (gpt-5.6-luna).
+# back to a small built-in default (gpt-6-luna).
MULTICA_LLM_DEFAULT_MODEL=
# - Transport retry budget for every upstream LLM request. This is the one
# canonical source; the server logs the effective policy at startup
@@ -174,7 +174,7 @@ MULTICA_LLM_MAX_RETRIES=
# thinking pass that would otherwise dominate the latency budget of the
# assist calls above. Standard OpenAI endpoints reject unknown body
# fields, so only enable this when the upstream accepts it. GPT-5.6-family
-# models already get reasoning_effort=none on the follow-up questions
+# models and GPT-6 Luna get reasoning_effort=none on the follow-up questions
# request. Chat auto-titling sends no reasoning field; this switch affects
# it only when the configured upstream accepts chat_template_kwargs.
# Accepted values are true/false and 1/0
diff --git a/apps/docs/content/docs/environment-variables.fr.mdx b/apps/docs/content/docs/environment-variables.fr.mdx
index fc9cb83fbd..55e6796ad2 100644
--- a/apps/docs/content/docs/environment-variables.fr.mdx
+++ b/apps/docs/content/docs/environment-variables.fr.mdx
@@ -204,7 +204,7 @@ Ce groupe configure la génération d'assistance côté serveur, comme les titre
|---|---|---|
| `MULTICA_LLM_API_KEY` | vide | Clé d'API compatible OpenAI |
| `MULTICA_LLM_BASE_URL` | vide | Point de terminaison compatible OpenAI |
-| `MULTICA_LLM_DEFAULT_MODEL` | `gpt-5.6-luna` | Utilisé lorsqu'une requête ne précise pas de modèle |
+| `MULTICA_LLM_DEFAULT_MODEL` | `gpt-6-luna` | Utilisé lorsqu'une requête ne précise pas de modèle |
| `MULTICA_LLM_MAX_RETRIES` | `2` | Plafond de nouvelles tentatives par appel ; `0` désactive les nouvelles tentatives, `1`–`5` les plafonnent à N |
`MULTICA_LLM_MAX_RETRIES` est la seule source de la politique de nouvelles tentatives. Laissez-la non définie pour la valeur par défaut de 2, définissez `0` pour envoyer exactement une requête par appel, ou une valeur de 1 à 5 pour plafonner les nouvelles tentatives à ce nombre. C'est un plafond, pas un quota : seuls les échecs réessayables le consomment, et un succès ou l'échéance propre de l'appelant peut mettre fin à l'appel plus tôt. Toute autre valeur — négative, non numérique ou supérieure à 5 — fait échouer le démarrage au lieu d'être corrigée silencieusement. Ce plafond est un budget de latence : le délai entre deux tentatives commence à 0,5 s et double jusqu'à un maximum de 8 s, si bien qu'un budget plus élevé dépasserait les échéances des appelants et transformerait un échec réessayable en expiration de délai. Les nouvelles tentatives couvrent les échecs de connexion et les codes HTTP 408, 409, 429 et 5xx ; toutes les autres réponses 4xx sont renvoyées telles quelles. Au démarrage, le serveur journalise la politique effective sous la forme `llm retry policy`, sans aucun identifiant dans la ligne.
diff --git a/apps/docs/content/docs/environment-variables.ja.mdx b/apps/docs/content/docs/environment-variables.ja.mdx
index 6293699e04..612e4cddf2 100644
--- a/apps/docs/content/docs/environment-variables.ja.mdx
+++ b/apps/docs/content/docs/environment-variables.ja.mdx
@@ -204,13 +204,13 @@ allowlist の正確な判定順序は[ログインとサインアップ](/auth-s
|---|---|---|
| `MULTICA_LLM_API_KEY` | 空 | OpenAI 互換の API key |
| `MULTICA_LLM_BASE_URL` | 空 | OpenAI 互換の endpoint |
-| `MULTICA_LLM_DEFAULT_MODEL` | `gpt-5.6-luna` | リクエストがモデルを指定しない場合に使用 |
+| `MULTICA_LLM_DEFAULT_MODEL` | `gpt-6-luna` | リクエストがモデルを指定しない場合に使用 |
| `MULTICA_LLM_MAX_RETRIES` | `2` | 1 回の呼び出しあたりのリトライ上限。`0` はリトライ無効、`1`〜`5` は最大 N 回 |
| `MULTICA_LLM_DISABLE_THINKING` | `false` | すべてのリクエストに `chat_template_kwargs: {"enable_thinking": false}` を付加。このフィールドを解釈する gateway 用 |
`MULTICA_LLM_MAX_RETRIES` はリトライポリシーの唯一の設定元です。未設定ならデフォルトの 2 回、`0` なら 1 回の呼び出しにつきリクエストは 1 回だけ、1〜5 ならリトライは最大その回数までになります。これは割り当てではなく上限です。消費するのはリトライ対象の失敗だけで、成功や呼び出し側自身のデッドラインによって早く終わることもあります。それ以外の値(負数、非数値、5 超過)は静かに補正されるのではなく起動に失敗します。上限はレイテンシ予算です。バックオフは 0.5 秒から始まり 8 秒を上限に倍増するため、これより大きい予算は呼び出し側自身のタイムアウトを超え、リトライ可能な失敗をタイムアウトに変えてしまいます。リトライの対象は接続失敗と HTTP 408、409、429、5xx で、それ以外の 4xx はそのまま返されます。サーバーは起動時に有効なポリシーを `llm retry policy` として記録しますが、その行に資格情報は含まれません。
-`MULTICA_LLM_DISABLE_THINKING` は、モデルが推論(thinking)パスを実行してアシスト呼び出しのレイテンシ予算を食いつぶす gateway 向けの設定です。`true`(または `1`)にすると、サーバーはすべてのリクエストボディに `chat_template_kwargs: {"enable_thinking": false}` を付加します。このフィールドを転送する gateway(vLLM/sglang 系のデプロイや、GLM/Qwen 系の一部 LiteLLM ルート)は、thinking パスを省略します。標準の OpenAI endpoint は未知のボディフィールドを拒否するため、上流が受け付ける場合のみ有効にしてください。GPT-5.6 系モデルはフォローアップ質問のリクエストではサーバーが既に `reasoning_effort: none` を付けます。チャットの自動タイトル生成は推論フィールドを送信しません。本設定がそれに影響するのは、構成された上流が `chat_template_kwargs` を受け付ける場合だけです。指定できる値は `true`/`false` と `1`/`0`(大文字小文字を区別しない)で、それ以外は起動に失敗します。起動ログにはリトライポリシーと併せて有効な状態が記録されます。
+`MULTICA_LLM_DISABLE_THINKING` は、モデルが推論(thinking)パスを実行してアシスト呼び出しのレイテンシ予算を食いつぶす gateway 向けの設定です。`true`(または `1`)にすると、サーバーはすべてのリクエストボディに `chat_template_kwargs: {"enable_thinking": false}` を付加します。このフィールドを転送する gateway(vLLM/sglang 系のデプロイや、GLM/Qwen 系の一部 LiteLLM ルート)は、thinking パスを省略します。標準の OpenAI endpoint は未知のボディフィールドを拒否するため、上流が受け付ける場合のみ有効にしてください。GPT-5.6 系モデルと GPT-6 Luna はフォローアップ質問のリクエストではサーバーが既に `reasoning_effort: none` を付けます。チャットの自動タイトル生成は推論フィールドを送信しません。本設定がそれに影響するのは、構成された上流が `chat_template_kwargs` を受け付ける場合だけです。指定できる値は `true`/`false` と `1`/`0`(大文字小文字を区別しない)で、それ以外は起動に失敗します。起動ログにはリトライポリシーと併せて有効な状態が記録されます。
このレイヤーを使う機能は 2 つあり、どちらも設定した endpoint にチャットの内容を送信します。
diff --git a/apps/docs/content/docs/environment-variables.ko.mdx b/apps/docs/content/docs/environment-variables.ko.mdx
index 399c8b30c4..cd74f01dbb 100644
--- a/apps/docs/content/docs/environment-variables.ko.mdx
+++ b/apps/docs/content/docs/environment-variables.ko.mdx
@@ -204,13 +204,13 @@ reverse proxy 뒤에 배포한다면 실제 proxy 네트워크를 입력해야
|---|---|---|
| `MULTICA_LLM_API_KEY` | 비어 있음 | OpenAI 호환 API key |
| `MULTICA_LLM_BASE_URL` | 비어 있음 | OpenAI 호환 endpoint |
-| `MULTICA_LLM_DEFAULT_MODEL` | `gpt-5.6-luna` | 요청에 모델이 지정되지 않았을 때 사용 |
+| `MULTICA_LLM_DEFAULT_MODEL` | `gpt-6-luna` | 요청에 모델이 지정되지 않았을 때 사용 |
| `MULTICA_LLM_MAX_RETRIES` | `2` | 호출당 재시도 상한. `0`은 재시도 비활성화, `1`–`5`는 최대 N회 |
| `MULTICA_LLM_DISABLE_THINKING` | `false` | 모든 요청에 `chat_template_kwargs: {"enable_thinking": false}`를 첨부. 해당 필드를 해석하는 gateway용 |
`MULTICA_LLM_MAX_RETRIES`는 재시도 정책의 유일한 설정 소스입니다. 설정하지 않으면 기본값 2회, `0`이면 호출당 요청을 정확히 한 번만 보내고, 1–5면 재시도를 최대 그 횟수까지만 합니다. 할당량이 아니라 상한입니다. 재시도 대상 실패만 이를 소모하며, 성공하거나 호출자 자신의 데드라인에 걸리면 더 일찍 끝납니다. 그 밖의 값(음수, 숫자가 아닌 값, 5 초과)은 조용히 보정되지 않고 시작에 실패합니다. 상한은 지연 예산입니다. 백오프는 0.5초에서 시작해 8초 상한까지 두 배씩 늘어나므로, 더 큰 예산은 호출자 자신의 타임아웃을 넘겨 재시도 가능한 실패를 타임아웃으로 바꿉니다. 재시도는 연결 실패와 HTTP 408, 409, 429, 5xx를 대상으로 하며 그 외 4xx는 그대로 반환됩니다. 서버는 시작 시 유효한 정책을 `llm retry policy`로 기록하며 해당 줄에는 자격 증명이 포함되지 않습니다.
-`MULTICA_LLM_DISABLE_THINKING`은 모델이 추론(thinking) 패스를 실행해 어시스트 호출의 지연 예산을 잠식하는 gateway를 위한 설정입니다. `true`(또는 `1`)로 설정하면 서버가 모든 요청 본문에 `chat_template_kwargs: {"enable_thinking": false}`를 첨부하며, 이 필드를 전달하는 gateway(vLLM/sglang 계열 배포, 일부 GLM/Qwen 계열 LiteLLM 라우트)는 thinking 패스를 건너뜁니다. 표준 OpenAI endpoint는 알 수 없는 본문 필드를 거부하므로, 업스트림이 이를 받아들이는 경우에만 활성화하세요. GPT-5.6 계열 모델은 후속 질문 요청에서 서버가 이미 `reasoning_effort: none`을 붙입니다. 채팅 자동 제목 생성은 추론 필드를 보내지 않습니다. 이 설정이 그것에 영향을 주는 것은 구성된 업스트림이 `chat_template_kwargs`를 받아들이는 경우뿐입니다. 허용되는 값은 `true`/`false`와 `1`/`0`(대소문자 구분 없음)이며, 그 외 값은 시작에 실패합니다. 시작 로그에 재시도 정책과 함께 유효 상태가 기록됩니다.
+`MULTICA_LLM_DISABLE_THINKING`은 모델이 추론(thinking) 패스를 실행해 어시스트 호출의 지연 예산을 잠식하는 gateway를 위한 설정입니다. `true`(또는 `1`)로 설정하면 서버가 모든 요청 본문에 `chat_template_kwargs: {"enable_thinking": false}`를 첨부하며, 이 필드를 전달하는 gateway(vLLM/sglang 계열 배포, 일부 GLM/Qwen 계열 LiteLLM 라우트)는 thinking 패스를 건너뜁니다. 표준 OpenAI endpoint는 알 수 없는 본문 필드를 거부하므로, 업스트림이 이를 받아들이는 경우에만 활성화하세요. GPT-5.6 계열 모델과 GPT-6 Luna는 후속 질문 요청에서 서버가 이미 `reasoning_effort: none`을 붙입니다. 채팅 자동 제목 생성은 추론 필드를 보내지 않습니다. 이 설정이 그것에 영향을 주는 것은 구성된 업스트림이 `chat_template_kwargs`를 받아들이는 경우뿐입니다. 허용되는 값은 `true`/`false`와 `1`/`0`(대소문자 구분 없음)이며, 그 외 값은 시작에 실패합니다. 시작 로그에 재시도 정책과 함께 유효 상태가 기록됩니다.
이 레이어를 사용하는 기능은 두 가지이며, 둘 다 설정한 endpoint로 채팅 내용을 전송합니다.
diff --git a/apps/docs/content/docs/environment-variables.mdx b/apps/docs/content/docs/environment-variables.mdx
index b8f893f4b8..12b28e6fdb 100644
--- a/apps/docs/content/docs/environment-variables.mdx
+++ b/apps/docs/content/docs/environment-variables.mdx
@@ -204,13 +204,13 @@ This group configures server-side assist generation, such as conversation titles
|---|---|---|
| `MULTICA_LLM_API_KEY` | empty | OpenAI-compatible API key |
| `MULTICA_LLM_BASE_URL` | empty | OpenAI-compatible endpoint |
-| `MULTICA_LLM_DEFAULT_MODEL` | `gpt-5.6-luna` | Used when a request does not specify a model |
+| `MULTICA_LLM_DEFAULT_MODEL` | `gpt-6-luna` | Used when a request does not specify a model |
| `MULTICA_LLM_MAX_RETRIES` | `2` | Retry ceiling per call; `0` disables retries, `1`–`5` cap it at N |
| `MULTICA_LLM_DISABLE_THINKING` | `false` | Add `chat_template_kwargs: {"enable_thinking": false}` to every request, for gateways that honor the field |
`MULTICA_LLM_MAX_RETRIES` is the single source for the retry policy. Leave it unset for the default of 2, set `0` to send exactly one request per call, or set 1–5 to cap retries at that many. It is a ceiling, not a quota: only retryable failures consume it, and a success or the caller's own deadline can end the call sooner. Any other value — negative, non-numeric, or above 5 — fails startup instead of being corrected silently. The ceiling is a latency budget: backoff starts at 0.5s and doubles to an 8s cap, so a larger budget would outlast the callers' own deadlines and turn a retryable failure into a timeout. Retries cover connection failures and HTTP 408, 409, 429 and 5xx; all other 4xx responses are returned as-is. The server logs the effective policy at startup as `llm retry policy`, with no credentials in the line.
-`MULTICA_LLM_DISABLE_THINKING` is for gateways whose models spend a reasoning ("thinking") pass that dominates the latency budget of the assist calls. When set to `true` (or `1`), the server adds `chat_template_kwargs: {"enable_thinking": false}` to every request body; gateways that forward the field — vLLM/sglang-style deployments and some GLM/Qwen-style LiteLLM routes — then skip the thinking pass. Standard OpenAI endpoints reject unknown body fields, so only enable this when your upstream accepts it. GPT-5.6-family models already get `reasoning_effort: none` on the follow-up questions request. Chat auto-titling sends no reasoning field; this switch affects it only when the configured upstream accepts `chat_template_kwargs`. Accepted values are `true`/`false` and `1`/`0` (case-insensitive); anything else fails startup. The startup log reports the effective state alongside the retry policy.
+`MULTICA_LLM_DISABLE_THINKING` is for gateways whose models spend a reasoning ("thinking") pass that dominates the latency budget of the assist calls. When set to `true` (or `1`), the server adds `chat_template_kwargs: {"enable_thinking": false}` to every request body; gateways that forward the field — vLLM/sglang-style deployments and some GLM/Qwen-style LiteLLM routes — then skip the thinking pass. Standard OpenAI endpoints reject unknown body fields, so only enable this when your upstream accepts it. GPT-5.6-family models and GPT-6 Luna already get `reasoning_effort: none` on the follow-up questions request. Chat auto-titling sends no reasoning field; this switch affects it only when the configured upstream accepts `chat_template_kwargs`. Accepted values are `true`/`false` and `1`/`0` (case-insensitive); anything else fails startup. The startup log reports the effective state alongside the retry policy.
Two features use this layer, and each one sends chat content to the endpoint you configure:
diff --git a/apps/docs/content/docs/environment-variables.zh.mdx b/apps/docs/content/docs/environment-variables.zh.mdx
index ec53cd8425..961966948e 100644
--- a/apps/docs/content/docs/environment-variables.zh.mdx
+++ b/apps/docs/content/docs/environment-variables.zh.mdx
@@ -204,13 +204,13 @@ MULTICA_PUBLIC_URL=https://api.multica.example.com
|---|---|---|
| `MULTICA_LLM_API_KEY` | 空 | OpenAI 兼容 API key |
| `MULTICA_LLM_BASE_URL` | 空 | OpenAI 兼容 endpoint |
-| `MULTICA_LLM_DEFAULT_MODEL` | `gpt-5.6-luna` | 请求未指定模型时使用 |
+| `MULTICA_LLM_DEFAULT_MODEL` | `gpt-6-luna` | 请求未指定模型时使用 |
| `MULTICA_LLM_MAX_RETRIES` | `2` | 单次调用的重试上限;`0` 表示禁用重试,`1`–`5` 表示最多重试 N 次 |
| `MULTICA_LLM_DISABLE_THINKING` | `false` | 在每个请求中附带 `chat_template_kwargs: {"enable_thinking": false}`,供支持该字段的网关关闭模型思考 |
`MULTICA_LLM_MAX_RETRIES` 是重试策略的唯一配置源。不设置时使用默认的 2 次;设为 `0` 表示每次调用只发一个请求;设为 1–5 表示最多重试这么多次。它是上限而不是配额:只有可重试的失败才会消耗它,请求成功或调用方自身的超时都会让调用提前结束。其它取值(负数、非数字、大于 5)会让服务启动失败,而不是被静默纠正。上限是一个延迟预算:退避从 0.5s 开始翻倍,上限 8s,更大的预算会超出调用方自身的超时,把可重试的失败变成超时失败。重试覆盖连接失败以及 HTTP 408、409、429 和 5xx;其余 4xx 直接返回。服务启动时会以 `llm retry policy` 打印生效策略,其中不包含任何凭据。
-`MULTICA_LLM_DISABLE_THINKING` 面向"模型会先跑一段推理(thinking)并吃掉辅助调用延迟预算"的网关。设为 `true`(或 `1`)时,服务端会在每个请求体中附带 `chat_template_kwargs: {"enable_thinking": false}`;支持透传该字段的网关(vLLM/sglang 类部署、部分 GLM/Qwen 系的 LiteLLM 路由)会因此跳过思考阶段。标准 OpenAI 端点会拒绝未知的请求体字段,所以仅在上游接受时启用。GPT-5.6 系模型在后续提问建议请求中已由服务端附带 `reasoning_effort: none`。会话自动命名不发送推理字段;只有当所配置的上游接受 `chat_template_kwargs` 时,此项才会影响它。可接受的取值为 `true`/`false` 和 `1`/`0`(不区分大小写);其它取值会让服务启动失败。启动日志会在重试策略旁打印生效状态。
+`MULTICA_LLM_DISABLE_THINKING` 面向"模型会先跑一段推理(thinking)并吃掉辅助调用延迟预算"的网关。设为 `true`(或 `1`)时,服务端会在每个请求体中附带 `chat_template_kwargs: {"enable_thinking": false}`;支持透传该字段的网关(vLLM/sglang 类部署、部分 GLM/Qwen 系的 LiteLLM 路由)会因此跳过思考阶段。标准 OpenAI 端点会拒绝未知的请求体字段,所以仅在上游接受时启用。GPT-5.6 系模型和 GPT-6 Luna 在后续提问建议请求中已由服务端附带 `reasoning_effort: none`。会话自动命名不发送推理字段;只有当所配置的上游接受 `chat_template_kwargs` 时,此项才会影响它。可接受的取值为 `true`/`false` 和 `1`/`0`(不区分大小写);其它取值会让服务启动失败。启动日志会在重试策略旁打印生效状态。
有两个功能会使用这一层,它们都会把聊天内容发送到你配置的 endpoint:
diff --git a/server/internal/handler/chat_title.go b/server/internal/handler/chat_title.go
index b4ace2718c..14a0f6d522 100644
--- a/server/internal/handler/chat_title.go
+++ b/server/internal/handler/chat_title.go
@@ -161,7 +161,7 @@ func (h *Handler) maybeGenerateChatTitleAsync(workspaceID, userID string, sessio
func (h *Handler) generateChatSessionTitle(ctx context.Context, sessionID pgtype.UUID, currentTitle, sourceText string) (db.ChatSession, bool, error) {
// DefaultModel() is used implicitly by GenerateText when model == "": a
// deployment configures MULTICA_LLM_DEFAULT_MODEL (or the built-in
- // gpt-5.6-luna fallback) — no model is threaded through from the frontend.
+ // gpt-6-luna fallback) — no model is threaded through from the frontend.
raw, err := h.LLM.GenerateText(ctx, "", chatTitleSystemPrompt, sourceText)
if err != nil {
return db.ChatSession{}, false, err
diff --git a/server/pkg/llm/client.go b/server/pkg/llm/client.go
index c1c14f6fc7..7a4896c817 100644
--- a/server/pkg/llm/client.go
+++ b/server/pkg/llm/client.go
@@ -97,7 +97,7 @@ import (
// FallbackModel is the last-resort model used when neither the request nor the
// configured default supplies one. It is deliberately a small, inexpensive
// model since this layer backs lightweight utility calls.
-const FallbackModel = "gpt-5.6-luna"
+const FallbackModel = "gpt-6-luna"
// defaultTimeout bounds the full request lifecycle (including SDK retries) when
// the caller's context has no deadline of its own. Streaming requests are not
@@ -160,8 +160,8 @@ type Config struct {
// would otherwise dominate the latency budget of the assist calls above.
// Standard OpenAI endpoints reject unknown body fields, so this is opt-in
// per deployment rather than automatic. It never touches reasoning_effort:
- // GPT-5.6-family models already get ReasoningEffortNone from GenerateJSON,
- // and this knob targets the gateways where that field is ignored instead.
+ // GPT-5.6-family models and GPT-6 Luna already get ReasoningEffortNone from
+ // GenerateJSON; this knob targets gateways that ignore that field instead.
DisableThinking bool
// HTTPClient, when set, replaces the SDK's default transport. Primarily a
// test seam.
@@ -401,8 +401,8 @@ func (c *Client) GenerateText(ctx context.Context, model, systemPrompt, userProm
// word "JSON" has to appear somewhere in the prompt, or OpenAI-compatible
// endpoints reject the request outright.
//
-// This helper is for small, latency-sensitive utility work. For the GPT-5.6
-// family it explicitly disables reasoning and leaves sampling controls at the
+// This helper is for small, latency-sensitive utility work. For GPT-6 Luna and
+// the GPT-5.6 family it disables reasoning and leaves sampling controls at the
// model default. That keeps maxCompletionTokens available to the visible JSON
// instead of spending it on reasoning, and avoids sampling parameters that
// those models may reject. Other models keep the caller's temperature so a
@@ -431,8 +431,8 @@ func (c *Client) GenerateJSON(ctx context.Context, model, systemPrompt, userProm
if effectiveModel == "" {
effectiveModel = c.defaultModel
}
- if isGPT56Family(effectiveModel) {
- // GPT-5.6 defaults to medium reasoning. This path generates a tiny JSON
+ if strings.EqualFold(effectiveModel, "gpt-6-luna") || isGPT56Family(effectiveModel) {
+ // These models default to medium reasoning. This path generates a tiny JSON
// object under a strict wall-clock budget, so reasoning would add latency
// and consume the completion-token limit without improving the contract.
params.ReasoningEffort = shared.ReasoningEffortNone
@@ -441,7 +441,7 @@ func (c *Client) GenerateJSON(ctx context.Context, model, systemPrompt, userProm
}
if maxCompletionTokens > 0 {
// max_tokens is deprecated and rejected by current reasoning models,
- // including the GPT-5.6 family. Prefer the replacement field for every
+ // including GPT-6 Luna. Prefer the replacement field for every
// upstream; a narrow compatibility retry below covers older gateways
// that have not implemented it yet.
params.MaxCompletionTokens = openai.Int(maxCompletionTokens)
diff --git a/server/pkg/llm/client_test.go b/server/pkg/llm/client_test.go
index 3971eb296b..3e4db5bf5e 100644
--- a/server/pkg/llm/client_test.go
+++ b/server/pkg/llm/client_test.go
@@ -120,7 +120,9 @@ func TestChatRespectsRequestModel(t *testing.T) {
func TestGenerateText(t *testing.T) {
var sawSystem bool
+ var gotModel string
srv := stubUpstream(t, func(w http.ResponseWriter, body map[string]any) {
+ gotModel, _ = body["model"].(string)
if msgs, ok := body["messages"].([]any); ok {
for _, m := range msgs {
if mm, ok := m.(map[string]any); ok && mm["role"] == "system" {
@@ -143,38 +145,70 @@ func TestGenerateText(t *testing.T) {
if !sawSystem {
t.Fatal("expected system message to be sent")
}
+ if gotModel != "gpt-6-luna" {
+ t.Fatalf("expected built-in GPT-6 Luna default, got %q", gotModel)
+ }
}
-func TestGenerateJSONUsesGPT56CompatibleParameters(t *testing.T) {
- var gotBody map[string]any
- srv := stubUpstream(t, func(w http.ResponseWriter, body map[string]any) {
- gotBody = body
- w.Header().Set("Content-Type", "application/json")
- _, _ = io.WriteString(w, `{"id":"cmpl-1","object":"chat.completion","choices":[{"index":0,"message":{"role":"assistant","content":"{\"actions\":[]}"},"finish_reason":"stop"}]}`)
- })
+func TestGenerateJSONModelParameters(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ defaultModel string
+ requestModel string
+ wantModel string
+ disableReasoning bool
+ }{
+ {name: "built-in default", wantModel: "gpt-6-luna", disableReasoning: true},
+ {name: "configured GPT-6 Luna", defaultModel: "gpt-6-luna", wantModel: "gpt-6-luna", disableReasoning: true},
+ {name: "requested GPT-6 Luna", defaultModel: "gateway-model", requestModel: "gpt-6-luna", wantModel: "gpt-6-luna", disableReasoning: true},
+ {name: "configured GPT-5.6", defaultModel: "gpt-5.6-luna", wantModel: "gpt-5.6-luna", disableReasoning: true},
+ {name: "configured gateway", defaultModel: "gateway-model", wantModel: "gateway-model"},
+ {name: "requested gateway", requestModel: "gateway-model", wantModel: "gateway-model"},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ var gotBody map[string]any
+ srv := stubUpstream(t, func(w http.ResponseWriter, body map[string]any) {
+ gotBody = body
+ w.Header().Set("Content-Type", "application/json")
+ _, _ = io.WriteString(w, `{"id":"cmpl-1","object":"chat.completion","choices":[{"index":0,"message":{"role":"assistant","content":"{\"actions\":[]}"},"finish_reason":"stop"}]}`)
+ })
- c := New(Config{APIKey: "k", BaseURL: srv.URL, DefaultModel: "gpt-5.6-luna"})
- out, err := c.GenerateJSON(context.Background(), "", "Return JSON.", "Generate actions.", 0.3, 2048)
- if err != nil {
- t.Fatalf("GenerateJSON failed: %v", err)
- }
- if out != `{"actions":[]}` {
- t.Fatalf("unexpected output %q", out)
- }
- if gotBody["max_completion_tokens"] != float64(2048) {
- t.Fatalf("expected max_completion_tokens=2048, got %#v", gotBody["max_completion_tokens"])
- }
- if _, ok := gotBody["max_tokens"]; ok {
- t.Fatalf("deprecated max_tokens must be omitted, got body %#v", gotBody)
- }
- if gotBody["reasoning_effort"] != "none" {
- t.Fatalf("expected reasoning_effort=none, got body %#v", gotBody)
- }
- if _, ok := gotBody["temperature"]; ok {
- t.Fatalf("temperature must be omitted for reasoning-model compatibility, got body %#v", gotBody)
- }
- if gotBody["model"] != "gpt-5.6-luna" {
- t.Fatalf("expected configured GPT-5.6 model, got body %#v", gotBody)
+ c := New(Config{APIKey: "k", BaseURL: srv.URL, DefaultModel: tc.defaultModel})
+ out, err := c.GenerateJSON(context.Background(), tc.requestModel, "Return JSON.", "Generate actions.", 0.3, 2048)
+ if err != nil {
+ t.Fatalf("GenerateJSON failed: %v", err)
+ }
+ if out != `{"actions":[]}` {
+ t.Fatalf("unexpected output %q", out)
+ }
+ if gotBody["max_completion_tokens"] != float64(2048) {
+ t.Fatalf("expected max_completion_tokens=2048, got %#v", gotBody["max_completion_tokens"])
+ }
+ if _, ok := gotBody["max_tokens"]; ok {
+ t.Fatalf("deprecated max_tokens must be omitted, got body %#v", gotBody)
+ }
+ if gotBody["model"] != tc.wantModel {
+ t.Fatalf("expected model %q, got body %#v", tc.wantModel, gotBody)
+ }
+ if gotBody["response_format"].(map[string]any)["type"] != "json_object" {
+ t.Fatalf("expected JSON object response format, got body %#v", gotBody)
+ }
+ if tc.disableReasoning {
+ if gotBody["reasoning_effort"] != "none" {
+ t.Fatalf("expected reasoning_effort=none, got body %#v", gotBody)
+ }
+ if _, ok := gotBody["temperature"]; ok {
+ t.Fatalf("temperature must be omitted for reasoning-model compatibility, got body %#v", gotBody)
+ }
+ } else {
+ if _, ok := gotBody["reasoning_effort"]; ok {
+ t.Fatalf("gateway model must not get reasoning_effort, got body %#v", gotBody)
+ }
+ if gotBody["temperature"] != 0.3 {
+ t.Fatalf("gateway model must preserve temperature, got body %#v", gotBody)
+ }
+ }
+ })
}
}