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
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Required | Call identifier. |
items | array | Required | Structured output items from the model. |
next_turn | object | Parameters to continue the same run state. | |
stop_reason | string | Required | Reason 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.