API Docs

VedasLab AI Gateway

API Documentation v3.0

Use our unified API to integrate state-of-the-art AI models — GPT-5, Claude 4.5, Gemini 3 Pro and more — into your applications with a single endpoint. Just change the model parameter to switch between providers.

OpenAI-Compatible API

Our API follows the OpenAI Chat Completions format. If your app already works with OpenAI, just change the base URL and API key — no other code changes needed.

Authentication

All API requests require authentication. Send your API key via the X-My-API-Key header.

X-My-API-Key: your_api_key_here

Keep Your Key Secret

Never expose your API key in client-side code or public repositories. Use environment variables or backend proxies in production.

Get your API key from the User Dashboard.

Base URL

All API requests should be sent to:

https://api.vedaslab.in/api.php?path={endpoint}

Chat Completions

?path=chat/completions

GitHub API Proxy

?path=user/repos

Quick Start

Make your first AI request in 30 seconds. Copy and paste this into your terminal:

Terminal
curl -X POST "https://api.vedaslab.in/api.php?path=chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-My-API-Key: YOUR_API_KEY" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {"role": "user", "content": "Say hello!"}
    ]
  }'

That's It!

Replace YOUR_API_KEY with your actual key and you'll get a JSON response from GPT-4o. Change the model parameter to use any other available model.

POST

/chat/completions

Generate an AI response for a conversation. Supports all available models.

Request Headers

X-My-API-Key required

Your API key for authentication.

Content-Type required

Must be application/json

Body Parameters

model required string

Model ID to use. Example: gpt-4o, claude-sonnet-4, gpt-5

messages required array

Conversation messages. Each message has:

role string

system, user, or assistant

content string | array

Message text, or array for vision (text + image_url objects)

stream optional boolean

Set to true for Server-Sent Events streaming. Default: false

temperature optional number

Sampling temperature (0 to 2). Lower = focused, higher = creative. Default: 1

max_tokens optional integer

Maximum tokens in the response.

curl -X POST "https://api.vedaslab.in/api.php?path=chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-My-API-Key: YOUR_API_KEY" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Hello!"}
    ]
  }'

Response

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1738368000,
  "model": "gpt-4o",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 12,
    "total_tokens": 37
  }
}
POST

Streaming Responses

Set "stream": true to receive responses as Server-Sent Events (SSE), delivering tokens in real-time as they are generated.

How It Works

1

Send a normal chat request but add "stream": true

2

Response arrives as text/event-stream with chunks

3

Each chunk is data: {json}, final chunk is data: [DONE]

JavaScript — Streaming Example
const response = await fetch(
  "https://api.vedaslab.in/api.php?path=chat/completions",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-My-API-Key": "YOUR_API_KEY"
    },
    body: JSON.stringify({
      model: "gpt-4o",
      messages: [{ role: "user", content: "Hello!" }],
      stream: true
    })
  }
);

const reader = response.body.getReader();
const decoder = new TextDecoder();

while (true) {
  const { done, value } = await reader.read();
  if (done) break;

  const text = decoder.decode(value);
  const lines = text.split("\n")
    .filter(line => line.startsWith("data: "));

  for (const line of lines) {
    const data = line.slice(6); // Remove "data: "
    if (data === "[DONE]") break;

    const chunk = JSON.parse(data);
    const content = chunk.choices[0]?.delta?.content;
    if (content) process.stdout.write(content);
  }
}
POST

Vision / Image Analysis

Send images for analysis using vision-capable models like gpt-4o. Pass images as base64 data URLs.

cURL — Vision Example
curl -X POST "https://api.vedaslab.in/api.php?path=chat/completions" \
  -H "Content-Type: application/json" \
  -H "X-My-API-Key: YOUR_API_KEY" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {
        "role": "user",
        "content": [
          {"type": "text", "text": "What is in this image?"},
          {
            "type": "image_url",
            "image_url": {
              "url": "data:image/jpeg;base64,/9j/4AAQ..."
            }
          }
        ]
      }
    ]
  }'

Image Formats

Supported formats: JPEG, PNG, GIF, WebP. Max size: 5MB. Pass images as base64 data URLs in the image_url.url field.

Available Models

Models available depend on your API key's access tier. Toggle below to see what's available for each tier.

Free Tier Models

Included Free
Model ID Provider Context Capabilities
gpt-4o OpenAI 128k Multimodal, Vision, Fast
gpt-4.1 OpenAI 128k Chat, Coding
gpt-5-mini OpenAI 128k Lightweight, Fast
grok-code-fast-1 xAI 128k Code Generation
raptor-mini-preview Custom 32k Fast Chat

Free tier: 20 requests/hour, 100 requests/day.

Free Tier

Access to 5 models. 100 req/day limit. Perfect for testing & personal use.

Premium Tier

Access to 11+ premium models. 5,000 req/day. Priority latency & support.

Both (All Access)

Access to all models. 10,000 req/day. Highest limits & full model access.

Rate Limits

Rate limits are applied per API key based on your subscription tier. Every response includes headers showing your current usage.

Tier Hourly Limit Daily Limit Max IPs
Free 20 requests 100 requests 2
Premium 500 requests 5,000 requests 5
Both 1,000 requests 10,000 requests 10

Response Headers

X-RateLimit-Limit

Your hourly request limit

X-RateLimit-Remaining

Requests remaining in current hour

X-RateLimit-Reset

Unix timestamp when the limit resets

X-RateLimit-Daily-Limit

Your daily request limit

X-RateLimit-Daily-Remaining

Requests remaining today

X-RateLimit-Warning

Warning message when approaching limit (80%+)

Error Codes

The API uses standard HTTP status codes. Errors return a JSON body with details.

{
  "error": "Access Denied: Your API key is restricted to Free models only."
}
Status Error What To Do
401 Missing API Key Add X-My-API-Key header to your request
401 Invalid API Key Check your key is correct and active
403 Access Denied (Model) You're requesting a model outside your tier. Upgrade or use a different model
403 IP Not Whitelisted Your IP is not in the whitelist for this key. Contact admin
429 Rate Limit Exceeded Wait for X-RateLimit-Reset timestamp or reduce request frequency
500 Server Error Server configuration issue. Contact support

Integration Tips

Our API is OpenAI-compatible, so you can use existing SDKs with a base URL override.

Python — Using OpenAI SDK
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.vedaslab.in/api.php",
    default_headers={
        "X-My-API-Key": "YOUR_API_KEY"
    }
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "user", "content": "Hello!"}
    ]
)

print(response.choices[0].message.content)
Node.js — Using OpenAI SDK
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_API_KEY",
  baseURL: "https://api.vedaslab.in/api.php",
  defaultHeaders: {
    "X-My-API-Key": "YOUR_API_KEY"
  }
});

const response = await client.chat.completions.create({
  model: "gpt-4o",
  messages: [
    { role: "user", content: "Hello!" }
  ]
});

console.log(response.choices[0].message.content);

Works With Any OpenAI-Compatible Client

LangChain, LlamaIndex, Vercel AI SDK, and other frameworks that support custom OpenAI base URLs will work with VedasLab AI Gateway. Just point the base URL and pass the API key.

VedasLab AI Gateway © 2026 — vedaslab.in