Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat(issue-2826): default Codex imagegen to cheap gpt-5.6-luna at low effort

[._.]/ Adam Eivy883e9ac1064a
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index d7cdf9aed8..b1799204c2 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -4,6 +4,10 @@
- `[issue-2815]` Added **Kimi Code** (Moonshot AI's `kimi` binary) as a first-class agentic-coding provider in both CLI (headless one-shot) and TUI (interactive PTY) flavors — `kimi-cli` and `kimi-tui`, mirroring the Grok/Antigravity/Codex process providers. Both ship disabled (opt-in) and are harness-capable, so once enabled they're selectable as CoS-agent / reviewer / runner / TUI providers. The headless path runs `kimi --print` (which implies `--afk`, auto-approving tool calls) and delivers the prompt as the `--prompt <value>` argv; the TUI path runs `kimi --yolo`. Model selection uses a `kimi-configured-default` sentinel — PortOS omits `--model` so the local `kimi` binary uses your own configured default (set via `/model`), while a real model id you pin is passed through as `--model <id>`. The context window is mapped to Kimi K2's 256K. Existing installs pick the pair up on restart via migration `201-kimi-providers`. The pre-existing `nvidia-kimi` HTTP API entry is unchanged. (Prompt-delivery path defaults to the argv value and should be confirmed against a live `kimi` binary.)
+## Image generation
+
+- **[issue-2826]** Codex image generation now defaults to the cheap **`gpt-5.6-luna`** model at **low** reasoning effort instead of silently running Codex's heaviest default tier. Every Codex-backed render (comic pages, scene images, avatars, universe art) now takes the light, low-cost path out of the box, on fresh installs and existing ones alike. You can override both in **Settings → Image Gen**: the existing Model field now shows the default as its placeholder, and a new Reasoning effort dropdown lets you dial it up (or leave it on the cheap default). An explicit choice always wins over the default.
+
## Federation
- [issue-2779] Layered Intelligence proposal-execution outcomes now federate back to the peer that filed the proposal. A CoS hand-off task filed on one machine can be claimed and executed on another (task federation, #1712/#1714), but the per-proposal execution outcome (#2765) was only recorded into the machine that ran the agent — its `li-outcomes` collection isn't federated, so the originating machine's execution awareness never reflected a proposal a peer implemented. The executing machine now stamps the execution verdict (with its completion time) into the completed hand-off task's federated metadata, and when that terminal state syncs back the originating machine derives the outcome from it — so its per-domain "how reliably do my own hand-offs get implemented" signal now reflects cross-peer executions. Only the machine that actually filed the proposal records it (a third sync peer that merely adopts the finished task records nothing), and recording is durably idempotent: a re-synced terminal task is a no-op while a genuinely re-executed (newer) hand-off overwrites, so the outcome converges even across a crash or a peer that stored the terminal task before upgrading. `li-outcomes` stays local; the verdict rides the already-federated task as additive metadata (no schema-version bump).
diff --git a/client/src/components/settings/ImageGenTab.jsx b/client/src/components/settings/ImageGenTab.jsx
index 265a1c4a30..c53fb9b09c 100644
--- a/client/src/components/settings/ImageGenTab.jsx
+++ b/client/src/components/settings/ImageGenTab.jsx
@@ -25,9 +25,15 @@ import {
import { IMAGE_GEN_MODE } from '../../lib/imageGenBackends';
import { resolveCleanersFromConfig } from '../../lib/imageCleaners';
import { useMediaJobSse } from '../../hooks/useMediaJobSse';
+import { CODEX_EFFORT_LEVELS } from '../../utils/providers';
const SDAPI_TOOL_ID = 'sdapi';
const CODEX_TOOL_ID = 'codex-imagegen';
+// Mirror of server/services/imageGen/modes.js — shown as placeholder/default
+// hints so the user sees what a blank Model / Effort field will actually use.
+// The server owns the real default; these are display-only.
+const CODEX_IMAGEGEN_DEFAULT_MODEL = 'gpt-5.6-luna';
+const CODEX_IMAGEGEN_DEFAULT_EFFORT = 'low';
const DEFAULT_TEST_PROMPT = 'a small cyberpunk fox sitting on a neon-lit rooftop at night, cinematic, highly detailed';
const normalizeUrl = (url) => (url || '').trim().replace(/\/+$/, '');
@@ -85,6 +91,8 @@ export function ImageGenTab() {
const [codexEnabled, setCodexEnabled] = useState(false);
const [codexPath, setCodexPath] = useState('');
const [codexModel, setCodexModel] = useState('');
+ // Empty = use the shipped default effort (CODEX_IMAGEGEN_DEFAULT_EFFORT).
+ const [codexEffort, setCodexEffort] = useState('');
const [codexParallelLimit, setCodexParallelLimit] = useState(1);
// Per-provider cleaner toggles. Both run after the PNG lands and before
// the SSE complete event so subscribers see the cleaned bytes. SynthID
@@ -110,12 +118,13 @@ export function ImageGenTab() {
// Stable ids for label/input associations
const codexPathId = useId();
const codexModelId = useId();
+ const codexEffortId = useId();
const codexParallelId = useId();
// Snapshot of saved values so we can show the "dirty" state
const [saved, setSaved] = useState({
mode: IMAGE_GEN_MODE.EXTERNAL, sdapiUrl: '', pythonPath: '', exposeA1111: false,
- codexEnabled: false, codexPath: '', codexModel: '', codexParallelLimit: 1,
+ codexEnabled: false, codexPath: '', codexModel: '', codexEffort: '', codexParallelLimit: 1,
cleanC2PAByMode: { external: true, local: true, codex: true },
denoiseByMode: { external: false, local: false, codex: false },
});
@@ -187,6 +196,7 @@ export function ImageGenTab() {
const cxEnabled = cx.enabled === true;
const cxPath = cx.codexPath || '';
const cxModel = cx.model || '';
+ const cxEffort = cx.effort || '';
const bounds = cx.parallelLimitBounds && Number.isFinite(cx.parallelLimitBounds.max)
? cx.parallelLimitBounds
: PARALLEL_FALLBACK;
@@ -206,13 +216,14 @@ export function ImageGenTab() {
setCodexEnabled(cxEnabled);
setCodexPath(cxPath);
setCodexModel(cxModel);
+ setCodexEffort(cxEffort);
setCodexParallelLimit(cxParallel);
setParallelLimitDraft(String(cxParallel));
setCleanC2PAByMode(c2);
setDenoiseByMode(dn);
setSaved({
mode: m, sdapiUrl: url, pythonPath: py, exposeA1111: expose,
- codexEnabled: cxEnabled, codexPath: cxPath, codexModel: cxModel,
+ codexEnabled: cxEnabled, codexPath: cxPath, codexModel: cxModel, codexEffort: cxEffort,
codexParallelLimit: cxParallel,
cleanC2PAByMode: c2, denoiseByMode: dn,
});
@@ -238,6 +249,7 @@ export function ImageGenTab() {
|| codexEnabled !== saved.codexEnabled
|| codexPath !== saved.codexPath
|| codexModel !== saved.codexModel
+ || codexEffort !== saved.codexEffort
|| codexParallelLimit !== saved.codexParallelLimit
|| cleanC2PAByMode.codex !== saved.cleanC2PAByMode.codex
|| cleanC2PAByMode.local !== saved.cleanC2PAByMode.local
@@ -251,6 +263,7 @@ export function ImageGenTab() {
const url = normalizeUrl(sdapiUrl) || undefined;
const cxPath = codexPath?.trim() || undefined;
const cxModel = codexModel?.trim() || undefined;
+ const cxEffort = codexEffort?.trim() || undefined;
const cxParallel = clampParallel(codexParallelLimit, parallelBounds);
const patch = {
imageGen: {
@@ -258,7 +271,7 @@ export function ImageGenTab() {
external: { sdapiUrl: url, cleanC2PA: cleanC2PAByMode.external, denoise: denoiseByMode.external },
local: { pythonPath: pythonPath || undefined, cleanC2PA: cleanC2PAByMode.local, denoise: denoiseByMode.local },
codex: {
- enabled: codexEnabled, codexPath: cxPath, model: cxModel, parallelLimit: cxParallel,
+ enabled: codexEnabled, codexPath: cxPath, model: cxModel, effort: cxEffort, parallelLimit: cxParallel,
cleanC2PA: cleanC2PAByMode.codex, denoise: denoiseByMode.codex,
},
expose: { a1111: exposeA1111 },
@@ -275,7 +288,7 @@ export function ImageGenTab() {
// updated with the trimmed "codex").
setSaved({
mode, sdapiUrl: url || '', pythonPath, exposeA1111,
- codexEnabled, codexPath: cxPath || '', codexModel: cxModel || '',
+ codexEnabled, codexPath: cxPath || '', codexModel: cxModel || '', codexEffort: cxEffort || '',
codexParallelLimit: cxParallel,
cleanC2PAByMode, denoiseByMode,
});
@@ -287,6 +300,7 @@ export function ImageGenTab() {
// sees matches what was saved.
if (cxPath !== codexPath) setCodexPath(cxPath || '');
if (cxModel !== codexModel) setCodexModel(cxModel || '');
+ if (cxEffort !== codexEffort) setCodexEffort(cxEffort || '');
toast.success('Image gen settings saved');
} catch (err) {
toast.error(err.message || 'Failed to save settings');
@@ -310,7 +324,7 @@ export function ImageGenTab() {
category: 'image-generation',
description: 'Generate images via the Codex CLI built-in image_gen tool ($imagegen prompt prefix). Requires a Codex plan that includes image_gen.',
enabled: codexEnabled,
- config: { codexPath: cxPath, model: cxModel },
+ config: { codexPath: cxPath, model: cxModel, effort: cxEffort },
promptHints: 'Use POST /api/image-gen/generate with { prompt, mode: "codex" } — or call the image_generate voice tool with provider: "codex".',
};
@@ -569,9 +583,24 @@ export function ImageGenTab() {
value={codexModel}
onChange={(e) => setCodexModel(e.target.value)}
className="w-full bg-port-bg border border-port-border rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-port-accent"
- placeholder="gpt-5.4"
+ placeholder={`${CODEX_IMAGEGEN_DEFAULT_MODEL} (default)`}
/>
- <p className="text-xs text-gray-500 mt-1">Passed as <code>codex exec -m &lt;model&gt;</code>. Leave empty to use Codex's default.</p>
+ <p className="text-xs text-gray-500 mt-1">Passed as <code>codex exec -m &lt;model&gt;</code>. Leave empty to use the cheap default (<code>{CODEX_IMAGEGEN_DEFAULT_MODEL}</code>).</p>
+ </div>
+ <div>
+ <label htmlFor={codexEffortId} className="block text-xs font-medium text-gray-400 mb-1">Reasoning effort (optional)</label>
+ <select
+ id={codexEffortId}
+ value={codexEffort}
+ onChange={(e) => setCodexEffort(e.target.value)}
+ className="w-full bg-port-bg border border-port-border rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-port-accent"
+ >
+ <option value="">Default ({CODEX_IMAGEGEN_DEFAULT_EFFORT})</option>
+ {CODEX_EFFORT_LEVELS.map((lvl) => (
+ <option key={lvl} value={lvl}>{lvl}</option>
+ ))}
+ </select>
+ <p className="text-xs text-gray-500 mt-1">Passed as <code>codex exec -c model_reasoning_effort=&lt;level&gt;</code>. Lower effort is cheaper; leave on the shipped default (<code>{CODEX_IMAGEGEN_DEFAULT_EFFORT}</code>) or drop to <code>minimal</code> for the cheapest possible renders.</p>
</div>
<div>
<label htmlFor={codexParallelId} className="block text-xs font-medium text-gray-400 mb-1">Parallel render limit</label>
diff --git a/server/routes/imageGen.js b/server/routes/imageGen.js
index 80c3957e81..73b6be7cf5 100644
--- a/server/routes/imageGen.js
+++ b/server/routes/imageGen.js
@@ -19,6 +19,7 @@ import {
import { optionalUploadFields } from '../lib/multipart.js';
import * as imageGen from '../services/imageGen/index.js';
import { local, IMAGE_GEN_MODE, IMAGE_GEN_MODES } from '../services/imageGen/index.js';
+import { CODEX_IMAGEGEN_DEFAULT_MODEL } from '../services/imageGen/modes.js';
import setupRouter from './imageGenSetup.js';
import { enqueueJob, attachSseClient as attachQueueSseClient, cancelJob, listJobs } from '../services/mediaJobQueue/index.js';
import { getImageModels, isFlux2, isEditOnly, repoForModel, requiredReposForModel } from '../lib/mediaModels.js';
@@ -398,6 +399,10 @@ router.post('/generate', imageGenUploads, asyncHandler(async (req, res) => {
{ status: 400, code: 'CODEX_IMAGEGEN_DISABLED' },
);
}
+ // Resolve the effective model so the queue row + response metadata report
+ // what actually renders (gpt-5.6-luna by default) instead of "codex"/null.
+ // codex.generateImage applies the same default, so this is display parity.
+ const codexModel = c.model || CODEX_IMAGEGEN_DEFAULT_MODEL;
const queued = enqueueJob({
kind: 'image',
// `mode: IMAGE_GEN_MODE.CODEX` is the queue's discriminator —
@@ -406,11 +411,12 @@ router.post('/generate', imageGenUploads, asyncHandler(async (req, res) => {
params: {
mode: IMAGE_GEN_MODE.CODEX,
codexPath: c.codexPath,
- model: c.model,
+ model: codexModel,
+ effort: c.effort,
...params,
},
});
- return res.json(queuedImageResponse({ ...queued, mode: IMAGE_GEN_MODE.CODEX, model: c.model || null }));
+ return res.json(queuedImageResponse({ ...queued, mode: IMAGE_GEN_MODE.CODEX, model: codexModel }));
}
if (mode === IMAGE_GEN_MODE.LOCAL) {
const py = settings.imageGen?.local?.pythonPath || null;
diff --git a/server/services/creativeDirector/firstPassGen.js b/server/services/creativeDirector/firstPassGen.js
index 1b975dc3ba..44ea896d2f 100644
--- a/server/services/creativeDirector/firstPassGen.js
+++ b/server/services/creativeDirector/firstPassGen.js
@@ -79,7 +79,7 @@ async function resolveQueueModeParams() {
return {
mode,
ready: true,
- jobParams: { mode: IMAGE_GEN_MODE.CODEX, codexPath: c.codexPath, model: c.model, cleanC2PA, denoise },
+ jobParams: { mode: IMAGE_GEN_MODE.CODEX, codexPath: c.codexPath, model: c.model, effort: c.effort, cleanC2PA, denoise },
};
}
if (mode === IMAGE_GEN_MODE.LOCAL) {
diff --git a/server/services/imageGen/codex.js b/server/services/imageGen/codex.js
index e6a40d9ec4..9751e683aa 100644
--- a/server/services/imageGen/codex.js
+++ b/server/services/imageGen/codex.js
@@ -32,8 +32,8 @@ import { autoCleanGeneratedImage } from '../../lib/imageClean.js';
import { imageGenEvents } from '../imageGenEvents.js';
import { broadcastSse, attachSseClient as attachSse, closeJobAfterDelay } from '../../lib/sseUtils.js';
import { killWithEscalation } from '../../lib/killWithEscalation.js';
-import { buildCodexStartupArgs } from '../../lib/providerModels.js';
-import { IMAGE_GEN_MODE } from './modes.js';
+import { buildCodexStartupArgs, buildEffortArgs, CODEX_EFFORT_LEVELS } from '../../lib/providerModels.js';
+import { IMAGE_GEN_MODE, CODEX_IMAGEGEN_DEFAULT_MODEL, CODEX_IMAGEGEN_DEFAULT_EFFORT } from './modes.js';
// 20 minutes — built-in `image_gen` typically returns in 30–90s, but with the
// parallel codex lane several renders share OpenAI throughput and a single
@@ -137,7 +137,7 @@ const describeFidelity = (strength) => {
// `initImageStrength` is mapped to a fidelity phrase via describeFidelity —
// codex CLI exposes no numeric denoise knob.
export async function generateImage({
- codexPath, model, prompt = '', width, height, negativePrompt,
+ codexPath, model, effort, prompt = '', width, height, negativePrompt,
initImagePath, initImageStrength,
jobId: providedJobId = null,
cleanC2PA = false,
@@ -145,6 +145,20 @@ export async function generateImage({
}) {
await ensureDir(PATHS.images);
+ // Ship the cheap gpt-5.6-luna / low-effort path by default (see modes.js).
+ // A caller-supplied model/effort (an explicit Settings → Image Gen override,
+ // threaded through the dispatcher) wins; `null`/`''`/absent falls back to the
+ // shipped default so a bare install never runs Codex's heaviest tier.
+ const effectiveModel = (typeof model === 'string' && model.trim()) ? model.trim() : CODEX_IMAGEGEN_DEFAULT_MODEL;
+ // Validate the effort against the known codex levels before use: an
+ // unrecognized non-empty value (a hand-edited settings.json / the unvalidated
+ // settings PUT) would otherwise pass through, buildEffortArgs would emit no
+ // override for it, and the child would silently inherit Codex's own configured
+ // effort instead of the promised cheap `low` default. Fall back to the default
+ // so the low-effort guarantee holds even for garbage input.
+ const requestedEffort = (typeof effort === 'string' && effort.trim()) ? effort.trim() : CODEX_IMAGEGEN_DEFAULT_EFFORT;
+ const effectiveEffort = CODEX_EFFORT_LEVELS.includes(requestedEffort) ? requestedEffort : CODEX_IMAGEGEN_DEFAULT_EFFORT;
+
// Defense-in-depth: HTTP routes already resolve basenames to absolute paths,
// but re-anchor here so any future caller can't attach an arbitrary local
// file via the codex CLI's `-i` flag. Mirrors imageGen/local.js — accepts
@@ -193,8 +207,12 @@ export async function generateImage({
// or an unattended `brew upgrade`. Placed before the variadic `-i` so it
// can't be swallowed as an image path.
...buildCodexStartupArgs(),
+ // Reasoning-effort override (`-c model_reasoning_effort=<level>`), defaulting
+ // to `low` — also before the variadic `-i`. A user who baked an effort pin
+ // into their config is respected via hasEffortFlag inside buildEffortArgs.
+ ...buildEffortArgs(effectiveEffort, { command: 'codex' }),
...(validInitImagePath ? ['-i', validInitImagePath] : []),
- ...(model ? ['-m', String(model)] : []),
+ '-m', effectiveModel,
...(validInitImagePath ? ['--'] : []),
fullPrompt,
];
@@ -202,7 +220,7 @@ export async function generateImage({
const meta = {
id: jobId, prompt: prompt.trim(), negativePrompt: negativePrompt || '',
width: width ? Number(width) : null, height: height ? Number(height) : null,
- filename, mode: IMAGE_GEN_MODE.CODEX, model: model || 'codex',
+ filename, mode: IMAGE_GEN_MODE.CODEX, model: effectiveModel,
createdAt: new Date().toISOString(),
};
const job = { ...meta, clients: [], status: 'running' };
@@ -222,7 +240,7 @@ export async function generateImage({
return {
jobId, filename, path: `/data/images/${filename}`, generationId: jobId,
- mode: IMAGE_GEN_MODE.CODEX, model: model || null,
+ mode: IMAGE_GEN_MODE.CODEX, model: effectiveModel,
// Async callers gate UI state on `status`; without 'running' they flip
// to 'done' before the PNG lands. SSE / socket 'completed' fires later.
status: 'running',
diff --git a/server/services/imageGen/codex.test.js b/server/services/imageGen/codex.test.js
index 9f471c3c52..c9f664db92 100644
--- a/server/services/imageGen/codex.test.js
+++ b/server/services/imageGen/codex.test.js
@@ -134,6 +134,65 @@ describe('codex provider — generateImage', () => {
await flush();
});
+ it('defaults to the cheap gpt-5.6-luna model at low effort when none is configured', async () => {
+ const job = await codex.generateImage({ prompt: 'a small fox' });
+ // The resolved default surfaces on the job descriptor so the gallery/UI reflects it.
+ expect(job.model).toBe('gpt-5.6-luna');
+ const { args } = spawnCalls[0];
+ // Model default → `-m gpt-5.6-luna`.
+ const mIdx = args.indexOf('-m');
+ expect(mIdx).toBeGreaterThan(-1);
+ expect(args[mIdx + 1]).toBe('gpt-5.6-luna');
+ // Effort default → `-c model_reasoning_effort=low`.
+ expect(args).toEqual(expect.arrayContaining(['-c', 'model_reasoning_effort=low']));
+ spawnCalls[0].child.exitCode = 1;
+ spawnCalls[0].child.emit('close', 1, null);
+ await flush();
+ });
+
+ it('honors an explicit model and effort override', async () => {
+ const job = await codex.generateImage({ prompt: 'a fox', model: 'gpt-5.6-terra', effort: 'high' });
+ expect(job.model).toBe('gpt-5.6-terra');
+ const { args } = spawnCalls[0];
+ const mIdx = args.indexOf('-m');
+ expect(args[mIdx + 1]).toBe('gpt-5.6-terra');
+ expect(args).toEqual(expect.arrayContaining(['-c', 'model_reasoning_effort=high']));
+ // The shipped defaults must NOT leak in when an override is set.
+ expect(args).not.toContain('gpt-5.6-luna');
+ expect(args).not.toEqual(expect.arrayContaining(['model_reasoning_effort=low']));
+ spawnCalls[0].child.exitCode = 1;
+ spawnCalls[0].child.emit('close', 1, null);
+ await flush();
+ });
+
+ it('falls back to low when a stored effort value is unrecognized', async () => {
+ // A hand-edited settings.json / the unvalidated settings PUT could carry a
+ // garbage effort; it must not silently disable the cheap-default guarantee.
+ await codex.generateImage({ prompt: 'a fox', effort: 'banana' });
+ const { args } = spawnCalls[0];
+ expect(args).toEqual(expect.arrayContaining(['-c', 'model_reasoning_effort=low']));
+ expect(args).not.toContain('model_reasoning_effort=banana');
+ spawnCalls[0].child.exitCode = 1;
+ spawnCalls[0].child.emit('close', 1, null);
+ await flush();
+ });
+
+ it('places the effort arg before the variadic -i so it is not swallowed as an image path', async () => {
+ await mkdir(FAKE_IMAGES_DIR, { recursive: true });
+ await writeFile(join(FAKE_IMAGES_DIR, 'ref.png'), 'fake');
+ await codex.generateImage({ prompt: 'edit', initImagePath: 'ref.png', initImageStrength: 0.2 });
+ const { args } = spawnCalls[0];
+ const effortValIdx = args.indexOf('model_reasoning_effort=low');
+ const iIdx = args.indexOf('-i');
+ expect(effortValIdx).toBeGreaterThan(-1);
+ expect(iIdx).toBeGreaterThan(-1);
+ // Effort config pair sits ahead of the variadic image flag.
+ expect(effortValIdx).toBeLessThan(iIdx);
+ spawnCalls[0].child.exitCode = 1;
+ spawnCalls[0].child.emit('close', 1, null);
+ await flush();
+ });
+
it('rejects when prompt is empty and there is no init image', async () => {
await expect(codex.generateImage({ prompt: ' ' })).rejects.toThrow(/Prompt is required/);
});
diff --git a/server/services/imageGen/index.js b/server/services/imageGen/index.js
index 939c6d7392..20b096461a 100644
--- a/server/services/imageGen/index.js
+++ b/server/services/imageGen/index.js
@@ -105,7 +105,9 @@ export async function generateImage(params) {
{ status: 400, code: 'CODEX_IMAGEGEN_DISABLED' },
);
}
- return codex.generateImage({ codexPath: c.codexPath, model: c.model, cleanC2PA, denoise, ...normalized });
+ // model/effort default to the cheap gpt-5.6-luna / low path inside
+ // codex.generateImage when unset here; a saved override wins.
+ return codex.generateImage({ codexPath: c.codexPath, model: c.model, effort: c.effort, cleanC2PA, denoise, ...normalized });
}
if (mode === IMAGE_GEN_MODE.LOCAL) {
return local.generateImage({ pythonPath: pythonPath(s), cleanC2PA, denoise, ...normalized });
diff --git a/server/services/imageGen/modes.js b/server/services/imageGen/modes.js
index 644adfb3e9..55fb0914f7 100644
--- a/server/services/imageGen/modes.js
+++ b/server/services/imageGen/modes.js
@@ -17,3 +17,14 @@ export const IMAGE_GEN_MODE = Object.freeze({
});
export const IMAGE_GEN_MODES = Object.freeze(Object.values(IMAGE_GEN_MODE));
+
+// Shipped defaults for the Codex imagegen backend. Codex's built-in image_gen
+// tool otherwise runs whatever model its logged-in session defaults to — often
+// the heaviest, most expensive tier — at default reasoning effort. Pin the cheap
+// `gpt-5.6-luna` model at `low` reasoning effort so every media-pipeline render
+// pays the light path by default. Applied as a code-level default (not a
+// settings migration) so it reaches every install and federated peer with no
+// per-install bookkeeping; an explicit `imageGen.codex.model` / `.effort` in
+// Settings still wins. Effort is one of providerModels' CODEX_EFFORT_LEVELS.
+export const CODEX_IMAGEGEN_DEFAULT_MODEL = 'gpt-5.6-luna';
+export const CODEX_IMAGEGEN_DEFAULT_EFFORT = 'low';
diff --git a/server/services/loraDatasetGenerate.js b/server/services/loraDatasetGenerate.js
index 2406b426a7..2bbc900755 100644
--- a/server/services/loraDatasetGenerate.js
+++ b/server/services/loraDatasetGenerate.js
@@ -36,7 +36,7 @@ import {
} from './universeCharacterSheet.js';
import { getImageModels } from '../lib/mediaModels.js';
import { enqueueJob, mediaJobEvents } from './mediaJobQueue/index.js';
-import { IMAGE_GEN_MODE } from './imageGen/modes.js';
+import { IMAGE_GEN_MODE, CODEX_IMAGEGEN_DEFAULT_MODEL } from './imageGen/modes.js';
import {
datasetImagePath,
datasetImagesDir,
@@ -352,7 +352,7 @@ async function resolveRenderParams({ modelId: modelOverride = null } = {}) {
{ status: 400, code: 'CODEX_IMAGEGEN_DISABLED' },
);
}
- return { base: { ...base, codexPath: c.codexPath, model: c.model }, activeMode, modelId: c.model || 'codex' };
+ return { base: { ...base, codexPath: c.codexPath, model: c.model, effort: c.effort }, activeMode, modelId: c.model || CODEX_IMAGEGEN_DEFAULT_MODEL };
}
if (activeMode === IMAGE_GEN_MODE.LOCAL) {
const allModels = getImageModels();
diff --git a/server/services/pipeline/visualStageHelpers.js b/server/services/pipeline/visualStageHelpers.js
index e6c922c773..4c0e9c1025 100644
--- a/server/services/pipeline/visualStageHelpers.js
+++ b/server/services/pipeline/visualStageHelpers.js
@@ -255,7 +255,7 @@ const enqueueImageJob = ({ prompt, world, settings, options, mode, owner, logLin
// effect on storyboard, comic-panel, or cover renders.
const { cleanC2PA, denoise } = resolveImageCleaners(undefined, settings, mode);
const params = mode === IMAGE_GEN_MODE.CODEX
- ? { mode: IMAGE_GEN_MODE.CODEX, codexPath: settings.imageGen?.codex?.codexPath, model: settings.imageGen?.codex?.model, cleanC2PA, denoise, ...baseParams }
+ ? { mode: IMAGE_GEN_MODE.CODEX, codexPath: settings.imageGen?.codex?.codexPath, model: settings.imageGen?.codex?.model, effort: settings.imageGen?.codex?.effort, cleanC2PA, denoise, ...baseParams }
: { pythonPath: settings.imageGen?.local?.pythonPath || null, modelId: options.modelId, cleanC2PA, denoise, ...baseParams };
const { jobId } = enqueueJob({ kind: 'image', params, owner });
console.log(`${logLine} mode=${mode} jobId=${jobId.slice(0, 8)}`);
diff --git a/server/services/universeBuilderRender.js b/server/services/universeBuilderRender.js
index 9fd2bcafa0..79d5f8bf59 100644
--- a/server/services/universeBuilderRender.js
+++ b/server/services/universeBuilderRender.js
@@ -184,7 +184,7 @@ export async function renderUniverseJobs(universeId, body, mapServiceError) {
const c = settings.imageGen?.codex || {};
queued = enqueueJob({
kind: 'image',
- params: { mode: IMAGE_GEN_MODE.CODEX, codexPath: c.codexPath, model: c.model, cleanC2PA, denoise, ...params },
+ params: { mode: IMAGE_GEN_MODE.CODEX, codexPath: c.codexPath, model: c.model, effort: c.effort, cleanC2PA, denoise, ...params },
});
} else {
// mode === IMAGE_GEN_MODE.LOCAL (validated upfront).
diff --git a/server/services/universeCharacterSheet.js b/server/services/universeCharacterSheet.js
index 002cb75dcb..56b3ddac24 100644
--- a/server/services/universeCharacterSheet.js
+++ b/server/services/universeCharacterSheet.js
@@ -23,7 +23,7 @@ import { buildStyleClause, purgeReferenceSheetFromAllUniverses } from './univers
import { getImageModels } from '../lib/mediaModels.js';
import { enqueueJob, mediaJobEvents } from './mediaJobQueue/index.js';
import { buildUniverseRunTag } from './universeRunTag.js';
-import { IMAGE_GEN_MODE } from './imageGen/modes.js';
+import { IMAGE_GEN_MODE, CODEX_IMAGEGEN_DEFAULT_MODEL } from './imageGen/modes.js';
import {
flattenStats, flattenPalette, flattenWardrobes, flattenProps, flattenNamedList,
} from '../lib/canonPrompt.js';
@@ -449,8 +449,8 @@ export async function renderCharacterReferenceSheet(universeId, entryId, options
{ status: 400, code: 'CODEX_IMAGEGEN_DISABLED' },
);
}
- modelId = c.model || 'codex';
- params = { ...baseParams, codexPath: c.codexPath, model: c.model };
+ modelId = c.model || CODEX_IMAGEGEN_DEFAULT_MODEL;
+ params = { ...baseParams, codexPath: c.codexPath, model: c.model, effort: c.effort };
} else if (activeMode === IMAGE_GEN_MODE.LOCAL) {
const allModels = getImageModels();
modelId = resolveSheetModelId({ override: options.modelId, settings, allModels });