From 083b6e5d4129ab60cc14857cb283b5110a93b6fc Mon Sep 17 00:00:00 2001 From: Marco Sadjadi Date: Fri, 22 May 2026 00:03:12 +0200 Subject: [PATCH] fix(preview): switch spec generation to Haiku 4.5 to fit the proxy window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sonnet still overran Cloudflare's edge timeout — the 504 fired at 90s but the proxy had already cut the connection, so the browser saw a headerless 524 reported as a CORS error. Measured against the live API: Haiku 4.5 generates the spec at ~200 tok/s, so a full 8k-token spec completes in ~40s. With a hard 60s timeout and no retries the route is guaranteed to answer well inside the proxy window. Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/api/src/routes/servers.ts | 13 ++++++++----- apps/web/app/(dashboard)/servers/new/page.tsx | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/api/src/routes/servers.ts b/apps/api/src/routes/servers.ts index 080ead7..355e6ca 100644 --- a/apps/api/src/routes/servers.ts +++ b/apps/api/src/routes/servers.ts @@ -53,11 +53,14 @@ export async function serverRoutes(app: FastifyInstance): Promise { try { const { spec, source } = await generateSpec(parsed.data.prompt, { apiKey: config.ANTHROPIC_API_KEY, - // Sonnet 4.6 drafts the spec well inside Cloudflare's ~100s proxy cap; - // Opus routinely exceeded it, which reached the browser as a CORS error. - model: 'claude-sonnet-4-6', - timeoutMs: 45_000, - maxRetries: 1, + // Preview generates the spec synchronously inside an HTTP request that + // sits behind Cloudflare's edge timeout. Haiku 4.5 (~200 tok/s — a full + // 8k-token spec in ~40s) is the only model fast enough; Sonnet and Opus + // overran the proxy cap, which reached the browser as a CORS error. The + // hard 60s timeout guarantees a clean 504 before the proxy gives up. + model: 'claude-haiku-4-5-20251001', + timeoutMs: 60_000, + maxRetries: 0, }); const previewId = await cacheSpec(spec); return reply.send({ diff --git a/apps/web/app/(dashboard)/servers/new/page.tsx b/apps/web/app/(dashboard)/servers/new/page.tsx index df32567..bac0745 100644 --- a/apps/web/app/(dashboard)/servers/new/page.tsx +++ b/apps/web/app/(dashboard)/servers/new/page.tsx @@ -457,7 +457,7 @@ function NewServerPageInner() {

Analyzing your prompt…

- Claude Sonnet 4.6 is drafting the tool spec. Usually 20–40 seconds. + Claude is drafting the tool spec. Usually 15–40 seconds.

{elapsedSec}s elapsed