batch-api-testing

Writes and audits unit, e2e, and live-stack tests for the Batch API.

7|12|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/OpenRouterTeam/docs --skill batch-api-testing-openrouterteam
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: batch-api-testing
Source: https://github.com/OpenRouterTeam/docs/tree/main/.agents/skills/batch-api-testing
Command: npx skills add https://github.com/OpenRouterTeam/docs --skill batch-api-testing-openrouterteam

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Verifying Batch API changes requires coordinating colocated unit tests, a live local Tilt stack with emulators, vitest e2e suites, and a test-quality audit — this Skill consolidates that entire verification workflow into one repeatable process. ## Core Features & Use Cases - Unit test authoring: Colocated bun:test suites for contracts, adapters, and skins driven by committed fixtures, golden vectors, and sync-parity assertions. - Live local stack driving: Launch and readiness-check the Tilt stack (fake provider, Spanner/Pub/Sub emulators, Redis rate limiter), submit batches through real ingress, and capture persisted-row evidence. - E2E and audit coverage: Run the vitest happy path in tests/e2e/api/batches, enforce intent-test traceability for new providers, and audit test quality before hand-off. - Use Case: After adding a new batch provider adapter, use this Skill to write parity tests, drive a live submit through the local stack, run the e2e suite one file at a time, and produce the audit report. ## Quick Start Ask the agent to write and run the Batch API tests for your change, driving the local Tilt stack and capturing persisted-row evidence.

Frequently Asked Questions about batch-api-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test Batch API changes locally?▼

Start the Tilt stack with bun run dev:up, trigger the fake provider, emulators, and Redis resources, then submit a batch through the real ingress at http://127.0.0.1:8800. Verify with persisted async_jobs rows in the Spanner emulator rather than trusting a 202 response.

How do I run the Batch API e2e tests?▼

Run batch e2e files one at a time with bun run test:e2e --run api/batches/<file>.test.ts. Running the whole directory in parallel lets files steal each other's finalize Pub/Sub messages and fail falsely.

Why does my local batch submit return 429 errors?▼

A 429 with limit_source openrouter_limiter_unavailable means the rate limiter cannot reach Redis. Trigger the redis and serverless-redis-http Tilt resources, or start the pair standalone on the dev_default network with the local SRH_TOKEN.

What test coverage is required for a new batch provider?▼

New providers need adapter unit tests from committed fixtures, an e2e matrix covering malformed rows, mixed success/failure, cancellation, and pagination, plus a minimal live-provider pass. Every research-note nuance must map to a test in a traceability table.

Why does the e2e suite fail with API key not found in local Postgres?▼

The vitest suite resolves OPENROUTER_API_KEY from the shell first and looks it up in local Postgres. An unrelated exported key fails every helper; run with env -u OPENROUTER_API_KEY or export the seeded key.