Migrating from Requesty to AI Stats Gateway
Migrate from Requesty to AI Stats Gateway with an OpenAI-compatible approach: endpoint/key swap, model compatibility checks, and production validation.
Prerequisites
- Your current Requesty client configuration and env vars.
- `AI_STATS_API_KEY` available in all deployment environments.
- A baseline of current latency/error metrics for comparison.
1) Capture baseline behavior
Before changing config, capture representative prompt outputs, latency, and error behavior from your current Requesty setup.
This baseline gives you objective pass/fail criteria after migration.
Checklist
- Save responses for a small golden prompt set.
- Record median latency and error rate.
- Document current fallback model behavior.
2) Replace endpoint and credentials
Treat this as an OpenAI-compatible migration. Keep payload shape first and only update endpoint + API key source.
Move old Requesty key names to `AI_STATS_API_KEY` to standardize runtime config.
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.REQUESTY_API_KEY,
baseURL: "https://router.requesty.ai/v1",
});import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.AI_STATS_API_KEY,
baseURL: "https://api.phaseo.app/v1",
});Screenshot checkpoints
Secrets rotation
Capture your deployment secret manager after switching from Requesty key names to `AI_STATS_API_KEY`.
Suggested asset path: /migrate/requesty/01-secret-rotation.png
3) Verify model availability and normalize IDs
Check that your existing model IDs are valid in AI Stats. If needed, centralize mapping in one resolver function.
Avoid ad-hoc replacements throughout the codebase; keep migration edits reversible.
curl -s "https://api.phaseo.app/v1/models" \
-H "Authorization: Bearer $AI_STATS_API_KEY" | jq '.data | length'export function resolveGatewayModelId(input: string): string {
const aliases: Record<string, string> = {
"gpt-4.1-mini": "openai/gpt-4.1-mini",
};
return aliases[input] ?? input;
}4) Run migration validation and promote
Run your golden prompt set and compare output quality, latency, and costs against the baseline.
Promote traffic gradually and keep old config available until stability is confirmed.
Checklist
- Pass non-streaming and streaming tests.
- Compare against baseline metrics from step 1.
- Promote gradually and observe for at least one release cycle.
Screenshot checkpoints
Before/after metrics report
Capture the comparison report showing parity or deltas in latency, error rate, and token spend.
Suggested asset path: /migrate/requesty/02-metrics-comparison.png
Validation Steps
curl -s "https://api.phaseo.app/v1/health"curl -s "https://api.phaseo.app/v1/models" -H "Authorization: Bearer $AI_STATS_API_KEY"Replay your golden prompt set through the migrated path.Verify one invalid-key error path and one invalid-model error path.
FAQ
Need a custom migration diff?
Use the interactive assistant for before/after snippets tailored to your current SDK and language.