GPT Mitra logoGPT MitraAPIs

Docs

Call the API

Create a Consumer key in APIs. Connect a supplier or enable a shared one, then use an exact model ID shown in Chat.

export OPENAI_API_KEY='your-consumer-key'
export OPENAI_BASE_URL='https://app.gptmitra.in/v1'
export MODEL='exact-model-id'
curl
curl -N "$OPENAI_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d "{\"model\":\"$MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}],\"stream\":true}"
Python

Install: pip install openai

import os
from openai import OpenAI

with OpenAI().chat.completions.create(
    model=os.environ["MODEL"],
    messages=[{"role": "user", "content": "Hello"}],
    stream=True,
) as stream:
    for chunk in stream:
        if chunk.choices:
            print(chunk.choices[0].delta.content or "", end="", flush=True)

Streaming Chat Completions only. No Responses or Anthropic Messages API.

Set up a connector

Create a Supplier key in APIs. On your Linux x86-64 supplier machine:

curl -fL https://app.gptmitra.in/downloads/connector-linux-amd64 -o connector
chmod +x connector
export SUPPLIER_KEY='your-supplier-key'
export PROXY_URL='wss://app.gptmitra.in/supply'

Start your backend, then run one of these:

Ollama
ollama pull qwen2.5-coder:7b
./connector -route openai.chat=http://localhost:11434 -concurrency 1

Ollama must be running (ollama serve).

vLLM
vllm serve Qwen/Qwen2.5-Coder-7B-Instruct --port 8000
# In another terminal:
./connector -route openai.chat=http://localhost:8000 -concurrency 1
OpenRouter
export UPSTREAM_API_KEY='your-openrouter-key'
export LIMIT_MODELS_TO='provider/exact-model-id'
./connector -route openai.chat=https://openrouter.ai/api -concurrency 1
OpenAI
export UPSTREAM_API_KEY='your-openai-api-key'
export LIMIT_MODELS_TO='gpt-4o-mini'
./connector -route openai.chat=https://api.openai.com -concurrency 1

Keep the connector running. Models are discovered automatically; check with Test in APIs. Upstream URLs must not end in /v1. Other backends must expose /v1/models and streaming Chat Completions with usage and [DONE]. Claude Code is not a compatible backend; use Claude models through OpenRouter instead.

Keep keys private. Paid upstreams can incur charges.