feat(design): honor OPENAI_BASE_URL for every design API call

One resolver, openaiUrl() in design/src/auth.ts, now builds every OpenAI
URL the design binary, its prototype and its live model check use. Setting
OPENAI_BASE_URL sends image generation and screenshot analysis to an
OpenAI-compatible gateway; unset or blank keeps api.openai.com. The
prototype script now goes through receiptedFetch, so its egress is
receipted like the rest, and receipts already record the gateway host.

A source scan keeps any design file outside auth.ts from hardcoding an
OpenAI API URL again, and a request-shape test proves the gateway reaches
both the vision and image endpoints.

Co-authored-by: JackJin <1037461232@qq.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
committed 2026-10-08 14:52:38 +00:00
1 parent 0668443f36
commit b150736602
14 files changed
+83 -23

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@
*/
import fs from "fs";
import { requireApiKey } from "./auth";
import { openaiUrl, requireApiKey } from "./auth";
import { receiptedFetch } from "./receipted-fetch";
import { modelRejectionHint, visionRequestBody } from "./models";
@@ -30,7 +30,7 @@ export async function diffMockups(
const timeout = setTimeout(() => controller.abort(), 60_000);
try {
const response = await receiptedFetch("diff-screenshots-request", "https://api.openai.com/v1/chat/completions", {
const response = await receiptedFetch("diff-screenshots-request", openaiUrl("chat/completions"), {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,