
Capture Api Response Test Fixture
Guide for recording real provider API responses as test fixtures for parser tests.
- CCM score
- 71 of 100
- skills.sh installs
- 1.7K
- GitHub stars
- 28.2K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers capturing raw responses for
generateText(doGenerate) andstreamText(doStream) provider parsing tests - Stores fixtures in each provider's
__fixtures__folder, following existing file naming conventions in that directory - Provides capture scripts using
runandsaveRawChunkshelpers, withincludeRawChunksenabled for streams - Designed for maintainers of AI SDK provider packages writing response-parsing tests against live model outputs
Install
$ npx -y skills add vercel/ai --skill capture-api-response-test-fixture -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
API Response Test Fixtures
For provider response parsing tests, we aim at storing test fixtures with the true responses from the providers (unless they are too large in which case some cutting that does not change semantics is advised).
The fixtures are stored in a __fixtures__ subfolder, e.g. packages/openai/src/responses/__fixtures__. See the file names in packages/openai/src/responses/__fixtures__ for naming conventions and packages/openai/src/responses/openai-responses-language-model.test.ts for how to set up test helpers.
You can use our examples under /examples/ai-functions to generate test fixtures.
generateText (doGenerate testing)
For generateText, put the script under src/generate-text/<provider>/, log the raw response output to the console, and copy it into a new test fixture.
import { openai } from '@ai-sdk/openai';
import { generateText } from 'ai';
import { run } from '../../lib/run';
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));
});
Details
- Repository
- github.com/vercel/ai
- Categories
- Testing & QA, AI Agents & LLM Apps
- First seen
- Apr 16, 2026
More from vercel/ai
All 8Similar to Capture Api Response Test Fixture
More Testing & QA
playwright-generate-testgithub/awesome-copilot18.3K installsGenerate a Playwright TypeScript test from a scenario by first driving the flow through Playwright MCP.
test-data-generationaj-geddes/useful-ai-prompts505 installsReusable factories, fixtures, and builders that generate realistic, consistent test data for automated tests.
meticulous-use-session-dataalwaysmeticulous/skills9.1K installsStructured Meticulous session data as user flows and network mocks for local testing.
python-testing-patternswshobson/agents41.5K installsComprehensive pytest guide covering fixtures, mocking, parameterization, and test-driven development workflows for Python.
test-casesstellarlinkco/myclaude1.3K installsStructured test case generation from PRDs or requirements, covering functional, edge, error, and state scenarios.
api-testing-observability-api-mocksickn33/agentic-awesome-skills451 installsAPI mocking framework that simulates real API behavior, error shapes, and latency for parallel development and testing.