Interfaze

logo

Beta

pricing

help

docs

blog

sign in

Get Started

Introduction

Examples

Vision

Concepts

Resources

Projects

Integrations

API Reference

Streaming

copy markdown

Streaming enables Interfaze to deliver responses in real time, creating a faster, more interactive experience.

Text streaming

Interfaze SDK

Vercel AI SDK

LangChain SDK

const stream = interfaze.chat.completions.stream({
  messages: [
    { role: "user", content: "Write a short story about a robot learning to paint" }
  ],
});

for await (const text of stream.textDeltas()) {
  process.stdout.write(text);
}

// the final completion still carries precontext and reasoning
const final = await stream.finalChatCompletion();
  • textDeltas() yields display-ready text — the inline <precontext> and <think> side-channels are stripped out and returned structured on the final completion instead.
  • For the raw chunk iterator, use create({ stream: true }).
  • The native LangChain integration strips the same side-channels out of streamed content. Set showAdditionalInfo (show_additional_info in Python) on the model to receive precontext while streaming.

Object streaming

Stream structured JSON objects as they are generated, receiving partial data incrementally rather than waiting for the full response.

Interfaze SDK

Vercel AI SDK

LangChain SDK

import { responseFormat } from "interfaze";
import { z } from "zod";

const storySchema = z.object({
  title: z.string().describe("The title of the story"),
  genre: z.string().describe("The genre of the story"),
  summary: z.string().describe("A brief summary of the story"),
});

const stream = interfaze.chat.completions.stream({
  messages: [
    { role: "user", content: "Write a short story about a robot learning to paint" }
  ],
  response_format: responseFormat(z.toJSONSchema(storySchema), "story_schema"),
});

for await (const partial of stream.textDeltas()) {
  process.stdout.write(partial);
}

const final = await stream.finalChatCompletion();
console.log(JSON.parse(final.choices[0]?.message.content ?? "{}"));

Previous

Reasoning

Next

Function Calling

Interfaze

logo

Product

Playground

OCR

Models

Leaderboards

Pricing

OpenWebSearch