← Back
Menu
← Back

Developer docs

Integrate your app with APIGate

A gateway that proxies your AI API calls, tracking real cost and usage across every provider you use — same requests, same responses, one place to see the numbers.

Quickstart

  1. Create a project, then add a provider (e.g. OpenAI). Adding your first provider auto-generates an APIGate key for that project.

  2. Point your app at APIGate instead of the provider directly:

    https://gateway.vinfosol.com/proxy/{proxy_key}/{provider_slug}/{path}

    The rest of the path, query params, and request body pass through unchanged — APIGate forwards your call to the real provider and returns the real response, while logging cost and usage. Cost covers tokens and the other units APIGate prices; tool fees (web search, Google Search grounding) are billed by your provider separately and are not included. Streaming works here too: with "stream": true the provider's events reach you as they arrive. For an OpenAI-style chat request that streams without setting stream_options, APIGate adds "include_usage": true so the usage can be counted; you then receive one extra last event that carries the usage and an empty choices list, exactly as the OpenAI API documents.

  3. Add your APIGate key on every request, in the X-Gateway-Key header. Find your project's proxy_key and your app's key on the Providers page.

Authentication

Every request needs an APIGate key, sent as a header. Replace YOUR_APIGATE_KEY below with your real key from the Providers page:

X-Gateway-Key: YOUR_APIGATE_KEY

Keys start with gwk_. For WebSocket streaming connections, a browser client that can't set custom headers on the handshake may instead pass the key as a query parameter: ?gateway_key=gwk_...

Your real provider credentials (e.g. your OpenAI key) are stored encrypted and never sent to your client — APIGate injects them server-side when forwarding to the provider.

One endpoint for every provider Recommended

Write your calling code once, in OpenAI's own request shape, against this one fixed URL — no proxy_key or provider slug in the path. Switching which provider actually serves a model is a change to the "model" field alone, nothing else in your code. Replace YOUR_APIGATE_KEY with your real key from the Providers page:

curl https://gateway.vinfosol.com/v1/chat/completions \
  -H "X-Gateway-Key: YOUR_APIGATE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Add a provider on the Providers page, then just change "model" to one of its real model names — e.g. claude-sonnet-5 or gemini-3.6-flash — and the exact same request/headers/URL work unchanged. Works today for OpenAI, Anthropic (Claude), Google (Gemini), xAI (Grok), DeepSeek, Mistral, Groq, and OpenRouter. Any other provider still works through the per-provider URL shown below.

Supports real streaming ("stream": true, standard Server-Sent Events) and tool/function calling (tools/tool_choice), translated automatically for whichever provider the model belongs to — your app's tool-calling code doesn't need to know or care which provider actually answered.

The URL path looks like OpenAI's own API because it speaks OpenAI's request/response shape — this doesn't mean it only works with OpenAI. Any model from any provider you've added can be called through this one endpoint.

Example request (per-provider)

Connects only to one specific provider, in its own native request shape — use the recommended endpoint above instead unless you have a specific reason not to. Replace YOUR_APIGATE_KEY with your real key from the Providers page:

curl https://gateway.vinfosol.com/proxy/{proxy_key}/openai/chat/completions \
  -H "X-Gateway-Key: YOUR_APIGATE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Add a custom model & price programmatically

If you have a custom or fine-tuned model, you can register its price from your own app code — no need to log in and use the Providers page. This creates the exact same pricing rule the "Add Custom Pricing Rule" button on the Providers page creates, and it takes priority over the built-in catalog price for that model. Replace YOUR_APIGATE_KEY with your real key from the Providers page:

curl -X POST https://gateway.vinfosol.com/v1/pricing-rules \
  -H "X-Gateway-Key: YOUR_APIGATE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "provider_slug": "claude",
    "model_match": "my-finetuned-claude-v2",
    "input_cost_per_1m": 3.00,
    "output_cost_per_1m": 15.00
  }'

The provider (provider_slug) must already be added on your project with real credentials — this only registers a model + price under it, it can't create a new provider connection by itself. Rates are per 1M tokens; use flat_cost_per_request instead for a model billed per call rather than per token. A wrong price here only ever affects your own project's cost numbers — it never changes APIGate's built-in catalog prices or any other project.

This endpoint uses the same X-Gateway-Key your app already uses for AI requests — there's no separate "admin" key. If that key leaks, whoever has it could also create or overwrite pricing rules on this project (though never on the shared catalog or any other project). If this matters for your use case, lock the key to your server's IP address or origin on the Providers page ("Restrict key" on that key's row) so it can't be used from anywhere else even if it leaks.

Supported providers

ProviderSlugAuth type
Anthropic (Claude) claude header
OpenAI (GPT) openai bearer
OpenRouter openrouter bearer
Google (Gemini) gemini query
xAI (Grok) grok bearer
DeepSeek deepseek bearer
Mistral mistral bearer
Groq groq bearer
Anthropic (Claude)
claude
header
OpenAI (GPT)
openai
bearer
OpenRouter
openrouter
bearer
Google (Gemini)
gemini
query
xAI (Grok)
grok
bearer
DeepSeek
deepseek
bearer
Mistral
mistral
bearer
Groq
groq
bearer

Don't see your provider? Add a custom one with your own base URL and auth type from the Providers page — no code change needed on APIGate's side.

Streaming (WebSocket)

For providers with a real-time/live API (e.g. Gemini Live), connect over WebSocket instead of plain HTTP:

wss://gateway.vinfosol.com/proxy/{proxy_key}/{provider_slug}/ws/{path}

APIGate opens its own connection to the provider and pipes frames both directions, tracking usage as it goes. Only providers with streaming support enabled show this option on the Providers page.

Errors

StatusMeaning
401Missing, invalid, expired, or manually deactivated X-Gateway-Key. Regenerate a key from the Providers page.
403Key is paused — it hit its spend or token limit, or was auto-paused after repeated rate-limit hits flagged as suspicious activity. Both are fixable from the Providers page (raise the limit, or reactivate the key) without regenerating it.
404Unknown project (proxy_key), or the provider slug doesn't exist / isn't active in that project.
429Rate limit hit (60 requests/minute per app key) or your plan's monthly request/streaming cap has been reached.
401

Missing, invalid, expired, or manually deactivated X-Gateway-Key. Regenerate a key from the Providers page.

403

Key is paused — spend/token limit hit, or auto-paused after suspicious rate-limit activity. Fixable from the Providers page without regenerating the key.

404

Unknown project (proxy_key), or the provider slug doesn't exist / isn't active in that project.

429

Rate limit hit (60 requests/minute per app key) or your plan's monthly request/streaming cap has been reached.

Any other status code is passed through unchanged from the real provider — a 400 from OpenAI still means what OpenAI says it means.

Plan limits

Requests/month, streaming minutes, and project/key counts are capped per plan. See Pricing for the current numbers on Free, Pro, and Deluxe.