capture-api-response-test-fixture

Store and manage API response test fixtures for provider parsing validation. Fixtures are organized in __fixtures__ subfolders within provider packages, using naming conventions documented in existing examples Supports two testing patterns: generateText (log raw response to console and copy into fixture) and streamText (use includeRawChunks and saveRawChunks helper to capture streaming chunks) Recommends storing true provider responses unless size constraints require semantic-preserving cuts Includes example scripts in /examples/ai-functions for generating fixtures via pnpm tsx

INSTALLATION
npx skills add https://github.com/vercel/ai --skill capture-api-response-test-fixture
Run in your project or agent environment. Adjust flags if your CLI version differs.

SKILL.md

$2a

run(async () => {

const result = await generateText({

model: openai('gpt-5-nano'),

prompt: 'Invent a new holiday and describe its traditions.',

});

console.log(JSON.stringify(result.response.body, null, 2));

});

#### streamText (doStream testing)

For `streamText`, you need to set `includeRawChunks` to `true` and use the special `saveRawChunks` helper. Run the script from the `/example/ai-functions` folder via `pnpm tsx src/stream-text/script-name.ts`. The result is then stored in the `/examples/ai-functions/output` folder. You can copy it to your fixtures folder and rename it.

import { openai } from '@ai-sdk/openai';

import { streamText } from 'ai';

import { run } from '../lib/run';

import { saveRawChunks } from '../lib/save-raw-chunks';

run(async () => {

const result = streamText({

model: openai('gpt-5-nano'),

prompt: 'Invent a new holiday and describe its traditions.',

includeRawChunks: true,

});

await saveRawChunks({ result, filename: 'openai-gpt-5-nano' });

});

BrowserAct

Let your agent run on any real-world website

Bypass CAPTCHA & anti-bot for free. Start local, scale to cloud.

Explore BrowserAct Skills →

Stop writing automation&scrapers

Install the CLI. Run your first Skill in 30 seconds. Scale when you're ready.

Start free
free · no credit card