Adding AI capabilities to existing applications shouldn't require a rewrite. Cognipeer Console provides an OpenAI-compatible API, so any existing OpenAI integration works out of the box — while giving you multi-provider routing, fallback, caching, and full observability.
This guide shows how to add AI features to a TypeScript application using Console as a drop-in gateway.
When to reach for this recipe
If your team needs the capabilities described above and you'd rather build on proven primitives than wire one from scratch — this is the shape to start from.
Architecture
Console acts as your AI gateway — routing requests to multiple providers (OpenAI, Anthropic, etc.) with automatic fallback and health-based routing.
Console SDK provides a type-safe TypeScript client with streaming support and full coverage of Console features.
1. Drop-In OpenAI Replacement
If you already use the OpenAI SDK, you can switch to Cognipeer Console by just changing the base URL and API key. Zero code changes needed.
1importOpenAIfrom"openai";
2
3// Before: Direct OpenAI
4// const openai = new OpenAI({ apiKey: "sk-..." });
Console routes your requests across providers with fallback. Configure primary and fallback models in Console dashboard, then just use a single model key in your code.
1// Console handles routing behind the scenes
2// If provider A is down, it falls back to provider B
Every request through Console is automatically traced. You can view latency, token usage, and errors in the Console dashboard — no extra instrumentation needed.
You now have AI integrated into your application with:
- Zero migration cost — OpenAI-compatible API works with existing code
- Provider resilience — Automatic fallback across multiple LLM providers
- Full observability — Every request traced with latency, tokens, and cost
- Type safety — Console SDK with full TypeScript support
- Streaming — Real-time response streaming out of the box