Overview
New AI integrations should call OpenRouter directly with the OpenRouter key provisioned by InsForge. The InsForge AI proxy routes for chat, image generation, and embeddings are deprecated compatibility endpoints.
Use the dashboard to copy the active OpenRouter key into a server-only OPENROUTER_API_KEY environment variable.
Direct OpenRouter REST
Chat Completion
Streaming
Embeddings
Models
OpenRouter owns the current request and response shape for AI model calls. Check OpenRouter’s API docs for model-specific parameters, supported modalities, plugins, and video generation endpoints.
InsForge Admin Helper Endpoints
These endpoints help the dashboard display the active Model Gateway key, model catalog, and usage overview. They require admin authentication.
Use either an admin JWT bearer token or an InsForge API key bearer token in the Authorization header.
Get Available Models
GET /api/ai/models now returns a flat array of model objects. Older AI proxy docs described a categorized object such as { "text": [...], "image": [...] }; update existing callers that read category properties to filter by inputModality or outputModality instead.
Returns the normalized OpenRouter model catalog as an array:
Get Active OpenRouter Key
apiKey is a raw secret. Do not log it, commit it, store it in browser storage, or return it from public endpoints. Only maskedKey is safe to display in client UI.
Get Usage Overview
Returns key-level OpenRouter usage and activity time series when the active key has activity access.
Deprecated InsForge Proxy Routes
The following routes still exist for existing applications, but new code should use OpenRouter directly.
Legacy Chat Proxy
This route validates an InsForge-shaped request, forwards it to OpenRouter, and returns an InsForge-shaped response. It does not expose the complete OpenRouter API surface.
Legacy Image Proxy
This route forwards an InsForge-shaped image request to OpenRouter chat completions with image output. It is retained for compatibility only.
Legacy Embeddings Proxy
This route forwards an InsForge-shaped embeddings request to OpenRouter. Prefer the direct OpenRouter embeddings endpoint for new code.