Skip to content

Feature: raw SSE/JSON passthrough fixtures for LLM endpoints #549

Closed

Description

@abhiaiyer91

Problem

For LLM endpoints every response is synthesized from a typed fixture, so testing a provider stream feature aimock doesn't model yet means waiting for a release. RawJSONResponse exists but is only served by the fal.ai handlers.

Proposal

An escape hatch for LLM endpoints: a fixture response that serves caller-supplied SSE events verbatim (and, for non-streaming requests, a verbatim JSON body), e.g.

llm.on({ endpoint: 'responses' }, {
  rawEvents: [
    { type: 'response.created', response: { /* ... */ } },
    { type: 'response.output_text.delta', delta: 'hi', /* ... */ },
    { type: 'response.completed', response: { /* ... */ } },
  ],
});

Journal entries, matching, streaming profiles and chaos would apply exactly as for typed fixtures; only the body is passed through.

Use case

Lets downstream projects cover new provider features immediately (citations, file output, new event types) while first-class fixture fields are designed.

Activity

  1. jpr5 commented on Oct 21, 2026

    @jpr5
    Contributor

    There's no first-class way to do this yet, but there is a workaround. llm.mount() runs before the built-in routes, so you can take over /v1/responses yourself:

    llm.mount("/v1/responses", {
      async handleRequest(req, res) {
        // decide from headers; return false before reading the body to fall through
        // ...write your own response here...
        return true;
      },
    });

    If you return false before touching the body, the request goes to aimock as usual. The catch is that anything you handle this way loses fixture matching, the journal, chaos and timing.

    What we want to build is a raw fixture type tied to a specific wire, like wire: "openai-responses". You give it your events verbatim (plus an optional json body for stream: false), aimock adds the framing, and matching, journal, chaos and timing all keep working. Responses, Chat Completions, Anthropic Messages and Gemini would come first. No date yet.

    Leaving this open. Let's keep #550 moving separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions