Skip to content

Share the OpenRouter client setup across AI e2e test apps #25175

Description

@andreiborza

Several AI e2e test apps repeat the same OpenRouter setup: read E2E_OPENROUTER_API_KEY, throw if it is missing, and call createOpenRouter({ apiKey }).

Apps with this code:

  • node-eve/agent/agent.ts
  • cloudflare-mastra/src/mastra/agents/weather-agent.ts
  • cloudflare-think/src/think-agent.ts
  • gen-ai-libraries/src/libraries.ts

node-mastra now has one shared src/mastra/openrouter.ts for all its scenarios. Do the same in the other apps, so that each app creates its OpenRouter client in one place. Each e2e app is a separate package, so the scope is one helper per app, unless a shared helper in @sentry-internal/test-utils is a good fit. The Cloudflare apps read the key from env per request, so a shared helper must take the key as an argument.

Follow-up from review: PR #25115 review comment

Activity

  1. linear-code commented on Oct 8, 2026

    @linear-code
  2. nicohrubec commented on Oct 9, 2026

    @nicohrubec
    Member

    Just tried to do this but having one shared helper has the problem that think uses AI SDK v6, which needs Openrouter v2 while we use v3 for the other providers. So we'd basically have to add an argument to pass the createOpenRouter implementation that the respective app uses. Given that I'd say let's just keep it as is given that this is just two lines of code anyways and probably doesn't even warrant a function in the first place.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions