Skip to main content
Model Inference enables you to run LLM operations within your data plane, keeping data secure while leveraging AI capabilities. This guide covers how to submit inference requests and handle results.

Prerequisites

  • SDK installed and configured (see Authentication)
  • A data plane ID where inference will run
  • An API key with appropriate permissions

Basic inference request

Submit a simple inference request with a system prompt and user message:

Tracking job completion

Inference jobs are asynchronous. Poll for completion using the job ID:
For more polling patterns, see Tracking Job Status.

Configuring inference parameters

Fine-tune the model’s behavior with configuration options:

Multi-turn conversations

Include previous messages for context-aware responses:

Tool-use messages (agent loops)

In agent-style flows, the model emits tool_use content blocks requesting a tool call and you reply with a matching tool_result block. Both share the same tool_use_id so the model can correlate the request and response across turns.
The legacy { role, text: string } request shape is still accepted for backwards compatibility — the API auto-canonicalizes it into a single text content block. Responses always emit the content-block shape. New integrations should use content blocks directly. See Model Inference API reference.

Choosing a model

Select the model based on your task requirements: For detailed guidance, see Choosing the Right Model.

Typing responses

Use TypeScript generics to type the structured output:

Error handling

Handle common inference errors:

Best practices

Structured Output Guide

Deep dive into JSON Schema for inference

Choosing Models

Select the right model for your task

Model Inference API

Complete API reference

Tracking Jobs

Monitor job status and handle completion