Skip to content
Discussion options

You must be logged in to vote

Hi @karl-spark 👋

The failure at ~270s is almost certainly an upstream idle/processing timeout (“other side closed”) from the provider/proxy in front of grok-4-fast-reasoning. Your call runs long (38k tokens in, heavy reasoning), and the server closes the HTTP/2 stream before it finishes.

**What to try (works in practice):

  1. Stream the response (keeps the connection active and survives idle limits)**
ts
import { streamObject } from "ai";
const { partialObjectStream, toFinalStream } = await streamObject({
  model: xai("grok-4-fast-reasoning"),
  schema,
  input,
  maxTokens: 8_000,          // cap output
});
for await (const delta of partialObjectStream) {
  // emit partials to client; keep…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@karl-spark
Comment options

Answer selected by karl-spark
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants