Use this recipe when a TypeScript or JavaScript service should combine: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.
- preset-driven routing defaults
- managed
gateway:web_search - strict response parsing
- request-level metadata for debugging
Goal
- keep the caller on the official SDK
- avoid rebuilding raw compatibility payloads by hand
- preserve enough metadata to debug search results, routing, and plugin behavior
1. Start with one shared client
2. Put stable defaults in a preset first
Create a preset when multiple callers should share:- model policy
- provider preferences
- reasoning defaults
- system prompt
- deterministic caching behavior
3. Ask for grounded output through the managed search tool
- preset-managed routing and prompt defaults
- server-managed search that works without depending on provider-native search support
- structured output for predictable downstream parsing
- metadata needed for operational debugging
4. Parse the output and keep the debug fields
- which provider actually served the request
- whether managed search ran
- whether response healing ran
- which request to inspect in the dashboard
5. Verify the grounded request in logs
Open the request in Gateway -> Usage and inspect:- normalized search results
- citations
- provider selection
- plugin execution metadata
6. Split exploratory and deterministic workflows
Recommended pattern:- one preset for deterministic structured research outputs
- another preset for exploratory or higher-temperature requests
- response caching cleaner
- routing behavior easier to reason about
- search-heavy workflows separate from general-purpose generation traffic