Call Model Overview

Understand the request/response lifecycle in the TypeScript SDK call model.

Execution Lifecycle

TypeScript
const turn1 = await client.callModel({
  model: "anthropic/claude-sonnet-4.5",
  input: [{ role: "user", content: "Draft a release note." }],
});

const turn2 = await client.callModel({
  ...turn1.next_turn,
  input: [{ role: "user", content: "Now shorten it to one sentence." }],
});

Response Envelope

NameTypeRequiredDescription
id
stringRequiredCall identifier.
items
arrayRequiredStructured output items from the model.
next_turn
objectParameters to continue the same run state.
stop_reason
stringRequiredReason generation stopped.

Minimal Request

call-model-minimal.ts
await client.callModel({
  model: "openai/gpt-4o-mini",
  input: [{ role: "user", content: "Hello" }],
});
When to use callModel
Use callModel when you need direct control over items, turn continuation, and stop conditions.