@@ -73,29 +73,24 @@ export type CoachResult = ExplainResult | HooksResult | ChatResult;
7373
7474// Verified August 2026: gpt-5.6-luna (released 2026-07-09) is $0.20 / 1M input,
7575// $1.20 / 1M output, $0.02 / 1M cached input. It is a reasoning model; at the
76- // "max" effort we run the coach on, reasoning tokens are billed as output. The
77- // actual cost is workload-dependent and can exceed the backend's $0.002/call
78- // assumption, so usage must be monitored. Overridable via AI_COACH_MODEL /
79- // AI_COACH_REASONING_EFFORT env .
76+ // reasoning tokens are billed as output. The actual cost is workload-dependent
77+ // and can exceed the backend's $0.002/call assumption, so usage must be
78+ // monitored. The model is overridable via AI_COACH_MODEL; reasoning effort is
79+ // optional and otherwise uses OpenAI's documented default .
8080export const DEFAULT_COACH_MODEL = "gpt-5.6-luna" ;
8181
8282export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max" ;
8383
84- // "Max mode": the highest reasoning effort Luna offers. The coach is a
85- // user-facing quality surface (the whole reason we left gpt-4.1-nano), so it
86- // defaults to max; background callers pass something cheaper.
87- export const DEFAULT_COACH_REASONING_EFFORT : ReasoningEffort = "max" ;
88-
8984const REASONING_EFFORTS : readonly ReasoningEffort [ ] = [ "none" , "minimal" , "low" , "medium" , "high" , "xhigh" , "max" ] ;
9085const GPT_56_EFFORTS : readonly ReasoningEffort [ ] = [ "none" , "low" , "medium" , "high" , "xhigh" , "max" ] ;
9186
9287export function normalizeReasoningEffort ( value : unknown ) : ReasoningEffort | null {
9388 return REASONING_EFFORTS . includes ( value as ReasoningEffort ) ? ( value as ReasoningEffort ) : null ;
9489}
9590
96- /** GPT-5.6 is the only model for which this app chooses `max` by default.
97- * Explicit operator overrides are preserved: silently changing `none`, `xhigh`,
98- * or `max` changes latency, cost, and quality, and model capabilities evolve . */
91+ /** Resolve the effective effort used for token-budget headroom. OpenAI documents
92+ * `medium` as GPT-5.6's default when the request omits `reasoning_effort`.
93+ * Explicit operator overrides are preserved after model validation . */
9994export function reasoningEffortForModel ( model : string , requested ?: ReasoningEffort ) : ReasoningEffort {
10095 if ( requested && isReasoningModel ( model ) ) {
10196 const supported = supportedReasoningEfforts ( model ) ;
@@ -104,7 +99,7 @@ export function reasoningEffortForModel(model: string, requested?: ReasoningEffo
10499 }
105100 }
106101 if ( requested ) return requested ;
107- return / ^ g p t - 5 \. 6 (?: - | $ ) / . test ( model ) ? DEFAULT_COACH_REASONING_EFFORT : "medium" ;
102+ return "medium" ;
108103}
109104
110105function supportedReasoningEfforts ( model : string ) : readonly ReasoningEffort [ ] | null {
@@ -155,7 +150,7 @@ export function completionTuning(
155150 ? 25_000
156151 : 16_000 ;
157152 return {
158- reasoning_effort : effort ,
153+ ... ( opts . effort ? { reasoning_effort : effort } : { } ) ,
159154 max_completion_tokens : opts . maxTokens + headroom ,
160155 } ;
161156}
0 commit comments