Skip to content

feat: add --timeout flag to image, text, and video commands#45

Open
Railly wants to merge 1 commit into
vercel-labs:mainfrom
Railly:feat/configurable-timeout
Open

feat: add --timeout flag to image, text, and video commands#45
Railly wants to merge 1 commit into
vercel-labs:mainfrom
Railly:feat/configurable-timeout

Conversation

@Railly
Copy link
Copy Markdown

@Railly Railly commented May 2, 2026

Summary

Adds a --timeout <seconds> flag to image, text, and video. Defaults are unchanged (120s for image/text, 300s for video), so this is purely additive.

Why

The hardcoded 120s default in image (and text) aborts complex prompts before the AI Gateway has a chance to respond. Real example: a sprite atlas prompt (1536x1872, 72 cells, strict layout constraints) consistently hits the 120s wall and surfaces as Gateway request failed: The operation timed out regardless of model. There is no escape hatch in the current CLI: the user has to fork or downgrade the prompt.

The Gateway itself is not the bottleneck. Per AI Gateway docs, provider timeouts go from 1s up to 789,000ms (~13 min), and that timeout only measures time-to-first-byte. The CLI's AbortSignal.timeout(120_000) is what fires first.

The current docs even acknowledge this in troubleshooting.mdx ("If you're consistently hitting timeouts, try a faster model variant"), but switching models is not always the right answer — for image generation, model choice is dictated by quality requirements, not latency tolerance.

What changes

  • --timeout <seconds> on image, text, video. Reused parsePositiveInt for validation.
  • README, commands.mdx, troubleshooting.mdx updated to document the flag and renamed the existing column to "Default timeout" for clarity.
  • No default changed, no behavior change for existing invocations.

Verification

  • bun run typecheck passes
  • bun run format:check passes
  • bun run lint passes (24 preexisting warnings, 0 new)
  • bun run build produces a working binary
  • dist/ai image --help shows the new flag with the correct default

Example

ai image "complex sprite atlas with 72 cells..." --timeout 600
ai text "long structured response..." --timeout 300
ai video "extended scene..." --timeout 900

@vercel
Copy link
Copy Markdown

vercel Bot commented May 2, 2026

Someone is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@ctate
Copy link
Copy Markdown
Collaborator

ctate commented May 3, 2026

@Railly Good one. Can you plz fix the conflict and sign your commit(s) before merging?

@Railly Railly force-pushed the feat/configurable-timeout branch from 4eb6bcf to a96bde8 Compare May 4, 2026 09:25
The hardcoded 120s default for image and text aborts complex prompts before
the AI Gateway has a chance to respond. AI Gateway accepts up to ~13min per
provider; the CLI just never let users reach for it.

Adds --timeout <seconds> to all three generation commands. Defaults are
unchanged (120s for image/text, 300s for video), so this is purely additive.

Updates README, commands docs, and troubleshooting docs to document the flag.
@Railly Railly force-pushed the feat/configurable-timeout branch from a96bde8 to 124b75f Compare May 4, 2026 09:25
@Railly
Copy link
Copy Markdown
Author

Railly commented May 4, 2026

@ctate done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants