AGENTS.md@packages/ai · git:20260114.b3b5624 · 2026-01-14 · sha256 51150d357b4a12b9

AGENTS.md@packages/ai git:20260114.b3b5624A

Immutable. This exact content never changes and is served at /api/v1/blob/51150d357b4a12b9.

# AI SDK Usage

## Use Cases

### Generating Text

#### text prompt

```ts
import { generateText } from 'ai';

const result = await generateText({
  model: 'openai/gpt-5',
  prompt: 'Invent a new holiday.', // text prompt
});

const text = result.text; // access generated text
```

#### Specifying the maximum number of tokens to generate

```ts
import { generateText } from 'ai';

const result = await generateText({
  model: 'openai/gpt-5',
  prompt: 'Invent a new holiday.',
  maxOutputTokens: 100, // maximum number of tokens to generate
});
```

### Streaming Text

#### text prompt and text stream

```ts
import { streamText } from 'ai';

const result = streamText({
  model: 'openai/gpt-5',
  prompt: 'Invent a new holiday.', // text prompt
});

const textStream = result.textStream; // access text stream
```

#### Specifying the maximum number of tokens to generate

```ts
import { streamText } from 'ai';

const result = await streamText({
  model: 'openai/gpt-5',
  prompt: 'Invent a new holiday.',
  maxOutputTokens: 100, // maximum number of tokens to generate
});
```