Build AI features in TypeScript with the OpenAI SDK and the OpenRouter API key provisioned by the InsForge Model Gateway for chat, streaming, and embeddings.
InsForge provisions an OpenRouter API key for Model Gateway projects. For new AI features, use that key directly with OpenRouter’s OpenAI-compatible API instead of the deprecated InsForge AI proxy methods.Use the InsForge dashboard to copy the active OpenRouter key, store it in OPENROUTER_API_KEY, and call OpenRouter from trusted server-side code.
Do not expose OPENROUTER_API_KEY in browser bundles. In React, Next.js, Vue, Svelte, and similar apps, put OpenRouter calls behind a backend route, server action, function, or other server-only boundary.
Use a model that supports image output and request image modality. OpenRouter supports fields that may not be in the OpenAI SDK type surface yet, so extend the request and response types locally.
The previous InsForge AI SDK methods are deprecated:
insforge.ai.chat.completions.create()
insforge.ai.images.generate()
insforge.ai.embeddings.create()
They map to backend proxy routes that still exist for compatibility, but new integrations should use OpenRouter directly. The direct path gives access to OpenRouter’s complete and evolving API surface without waiting for InsForge SDK wrapper updates.
Use the InsForge dashboard or OpenRouter model catalog to choose a model. Model IDs use the provider/model format, such as openai/gpt-4o, anthropic/claude-3.5-haiku, and google/gemini-2.5-flash-image.
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.