If you already use Vercel AI Gateway through the Vercel AI SDK or an OpenAI-compatible client, the safest migration path is to keep your app logic the same and swap only the provider boundary first.Documentation Index
Fetch the complete documentation index at: https://docs.ai-stats.phaseo.app/llms.txt
Use this file to discover all available pages before exploring further.
Before you start
- Current Vercel AI Gateway base URL and key configuration.
AI_STATS_API_KEYavailable in local, staging, and production environments.- A small prompt set or integration suite that covers non-streaming, streaming, and any tool-calling paths you rely on.
1) Document your current gateway boundary
Find the single place where your app creates model providers or API clients. That is the preferred migration point.- Locate the provider/client factory used by your app.
- List the model IDs currently used in production.
- Record retry, timeout, and fallback defaults.
- Note whether both edge and server runtimes need the same config change.
- Identify any shared prompt or parameter defaults that should become Gateway presets instead of remaining embedded in individual AI SDK call sites.
2) Swap endpoint and key
For most OpenAI-compatible client paths, this is a base URL and key replacement only.3) Confirm behavior parity
Run the same prompt set against old and new paths, then compare latency, output format, and token usage.- Verify non-streaming text generation.
- Verify streaming chunk handling through the same code path your app uses in production.
- Verify tool-calling paths if your app depends on them.
- Confirm application-level error mapping is unchanged.
- Move durable routing defaults and provider restrictions into Presets or Routing and Fallbacks instead of rebuilding them ad hoc in every model factory.
4) Vercel AI SDK and gateway checklist
Use this checklist before promoting traffic:- Base URL updated to
https://api.phaseo.app/v1. AI_STATS_API_KEYconfigured in every runtime that previously used the Vercel gateway key.- Official
@ai-stats/ai-sdk-providerwired in if your app uses the Vercel AI SDK directly. - Primary AI SDK text generation path passes in staging.
- One app-level streaming test passes unchanged.
- Tool-calling and structured-output flows rechecked if used.
- Old/new outputs compared for a small prompt suite.
- Rollback remains possible through config or feature-flag change only.
- Shared prompt/routing defaults moved into presets where appropriate.
- Generation lookups rechecked through
GET /v1/generations?id=<request_id>so failed requests can be replayed from the storedreplay_requestpayload whenreplay_supported=true.
5) Release plan for low risk
- Ship behind a feature flag or percentage rollout.
- Start with internal traffic or a very small production slice.
- Monitor latency, error rate, and token/cost drift.
- Keep both configs available for at least one release window.
Validation commands
- Run your app’s primary text-generation integration test.
- Run one streaming test in staging.
- Compare old/new outputs for your top prompts before full rollout.