API Documentation
One unified API
Complete reference for the GrexLabs API platform. Access 304+ AI models from 30+ providers through a single endpoint — free :free models need no API key.
Introduction
The GrexLabs API provides access to 304+ AI models from 30+ providers through a single unified endpoint. 21 free :free model IDs plus auto:free work with zero API key — no signup, no credit card, unlimited requests. Flagship tiers (GPT-6.2 Astra, Claude Fable 5.2, Gemini 4 Carbon, Grok 4.7, DeepSeek V4 Pro, Qwen 3.8 Max) need a valid sk-gl- key. All chat endpoints are OpenAI-compatible, with Anthropic Messages and Google Gemini formats on the same host.
Base URL: https://www.grexlabs.in/api/v1
GrexLabs is fully OpenAI-compatible. Swap your existing OpenAI base URL with the GrexLabs endpoint and use the same SDK, tools, and libraries you already have.
Authentication
Keyless free models: any model id ending in :free (and auto:free) requires no Authorization header — call immediately for unlimited free inference:
curl https://www.grexlabs.in/api/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"auto:free","messages":[{"role":"user","content":"Hello"}]}'Paid / flagship models require an API key passed via the Authorization header:
Authorization: Bearer sk-gl-<your-api-key>
Generate your free API key from the Dashboard. Free :free models route only at high / medium / low quality (never xhigh).
Keep your API key secure. Never expose it in client-side code or public repositories. Use environment variables for server-side integrations.
Models
GrexLabs offers 304+ models from 30+ providers (OpenAI, Anthropic, Google, xAI, DeepSeek, Qwen, Meta, NVIDIA, Mistral, Microsoft, Amazon, Cohere, Perplexity, Zhipu, Moonshot, Baidu, MiniMax and more) through a single unified API. 21 of them end in :free and need no key. Browse the full catalogue or use the quick reference below.
Flagship Models
Free models — no API key
Vision Models
Full model list at GET /api/v1/models or the Models page.
Quick Start
Make your first API call — pick your language below.
curl https://www.grexlabs.in/api/v1/chat/completions \
-H "Authorization: Bearer sk-gl-<your-key>" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-6.2-astra",
"messages": [
{"role": "user", "content": "Hello! What can you do?"}
],
"temperature": 0.7,
"max_tokens": 1024
}'import requests
response = requests.post(
"https://www.grexlabs.in/api/v1/chat/completions",
headers={
"Authorization": "Bearer sk-gl-<your-key>",
"Content-Type": "application/json"
},
json={
"model": "openai/gpt-6.2-astra",
"messages": [
{"role": "user", "content": "Hello! What can you do?"}
],
"temperature": 0.7,
"max_tokens": 1024
}
)
data = response.json()
print(data["choices"][0]["message"]["content"])const response = await fetch(
"https://www.grexlabs.in/api/v1/chat/completions",
{
method: "POST",
headers: {
"Authorization": "Bearer sk-gl-<your-key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "openai/gpt-6.2-astra",
messages: [
{ role: "user", content: "Hello! What can you do?" }
],
temperature: 0.7,
max_tokens: 1024
})
}
);
const data = await response.json();
console.log(data.choices[0].message.content);<?php
$ch = curl_init("https://www.grexlabs.in/api/v1/chat/completions");
$payload = json_encode([
"model" => "openai/gpt-6.2-astra",
"messages" => [
["role" => "user", "content" => "Hello! What can you do?"]
],
"temperature" => 0.7,
"max_tokens" => 1024
]);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer sk-gl-<your-key>",
"Content-Type: application/json"
],
CURLOPT_RETURNTRANSFER => true
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
echo $data["choices"][0]["message"]["content"];
curl_close($ch);require "net/http"
require "json"
uri = URI("https://www.grexlabs.in/api/v1/chat/completions")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer sk-gl-<your-key>"
request["Content-Type"] = "application/json"
request.body = {
model: "openai/gpt-6.2-astra",
messages: [{ role: "user", content: "Hello!" }],
temperature: 0.7,
max_tokens: 1024
}.to_json
response = http.request(request)
puts JSON.parse(response.body)["choices"][0]["message"]["content"]package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
body := map[string]interface{}{
"model": "openai/gpt-6.2-astra",
"messages": []map[string]string{
{"role": "user", "content": "Hello!"},
},
"temperature": 0.7,
"max_tokens": 1024,
}
jsonBody, _ := json.Marshal(body)
req, _ := http.NewRequest("POST",
"https://www.grexlabs.in/api/v1/chat/completions",
bytes.NewBuffer(jsonBody))
req.Header.Set("Authorization", "Bearer sk-gl-<your-key>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["choices"].([]interface{})[0].(map[string]interface{})["message"].(map[string]interface{})["content"])
}use reqwest;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let body = json!({
"model": "openai/gpt-6.2-astra",
"messages": [{"role": "user", "content": "Hello!"}],
"temperature": 0.7,
"max_tokens": 1024
});
let resp = client
.post("https://www.grexlabs.in/api/v1/chat/completions")
.header("Authorization", "Bearer sk-gl-<your-key>")
.header("Content-Type", "application/json")
.json(&body)
.send().await?
.json::<serde_json::Value>().await?;
println!("{}", resp["choices"][0]["message"]["content"].as_str().unwrap());
Ok(())
}import java.net.URI;
import java.net.http.*;
import com.google.gson.JsonObject;
public class App {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
JsonObject body = new JsonObject();
body.addProperty("model", "openai/gpt-6.2-astra");
JsonObject msg = new JsonObject();
msg.addProperty("role", "user");
msg.addProperty("content", "Hello!");
body.add("messages", new com.google.gson.JsonArray());
body.getAsJsonArray("messages").add(msg);
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://www.grexlabs.in/api/v1/chat/completions"))
.header("Authorization", "Bearer sk-gl-<your-key>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body.toString()))
.build();
HttpResponse<String> res = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());
}
}using System.Net.Http;
using System.Text;
using Newtonsoft.Json;
var client = new HttpClient();
client.DefaultRequestHeaders.Add(
"Authorization", "Bearer sk-gl-<your-key>");
var body = new {
model = "openai/gpt-6.2-astra",
messages = new[] { new {
role = "user", content = "Hello!" } },
temperature = 0.7,
max_tokens = 1024
};
var json = JsonConvert.SerializeObject(body);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(
"https://www.grexlabs.in/api/v1/chat/completions", content);
var result = await response.Content.ReadAsStringAsync();
dynamic data = JsonConvert.DeserializeObject(result);
Console.WriteLine(data.choices[0].message.content);import Foundation
let url = URL(string: "https://www.grexlabs.in/api/v1/chat/completions")!
var req = URLRequest(url: url)
req.httpMethod = "POST"
req.setValue("Bearer sk-gl-<your-key>", forHTTPHeaderField: "Authorization")
req.setValue("application/json", forHTTPHeaderField: "Content-Type")
let body: [String: Any] = [
"model": "openai/gpt-6.2-astra",
"messages": [["role": "user", "content": "Hello!"]],
"temperature": 0.7,
"max_tokens": 1024
]
req.httpBody = try! JSONSerialization.data(withJSONObject: body)
URLSession.shared.dataTask(with: req) { data, _, _ in
if let data = data,
let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
let choices = json["choices"] as? [[String: Any]],
let msg = choices.first?["message"] as? [String: Any],
let content = msg["content"] as? String {
print(content)
}
}.resume()Chat Completions
Generate a chat completion using any GrexLabs model. Supports text and vision inputs.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Required | Model ID (e.g., openai/gpt-6.2-astra, auto:free — keyless, no key needed) |
messages | array | Required | Array of message objects with role and content |
temperature | number | Optional | Sampling temperature (0–2, default: 0.7) |
max_tokens | integer | Optional | Maximum tokens in response (default: 2048) |
stream | boolean | Optional | Enable SSE streaming (default: false) |
Response
{
"id": "sk-gl-1712345678-a1b2c3",
"object": "chat.completion",
"created": 1712345678,
"model": "openai/gpt-6.2-astra",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm GPT-4o, hosted by GrexLabs Studio..."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 45,
"total_tokens": 57
}
}Responses API
Create a response with the OpenAI Responses shape: pass input as a plain string or as an array of message items (with role + content), optional instructions, and max_output_tokens. Images are accepted as input_image, image_url or image parts. With "stream": true the endpoint emits server-sent events ending in data: [DONE].
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Required | Model ID (e.g. auto:free — keyless) |
input | string | array | Required | Prompt string or message items (role, content, optional image parts) |
instructions | string | Optional | System-style instruction prepended to the conversation |
max_output_tokens | integer | Optional | Upper bound on generated tokens |
stream | boolean | Optional | Stream SSE events (default: false) |
Response objects use "object": "response" with input/output token usage; the alias POST /responses is also routed. See llm.txt for the full contract.
Streaming
Set stream: true to receive responses as Server-Sent Events (SSE). Each chunk contains a delta with partial content.
curl https://www.grexlabs.in/api/v1/chat/completions \
-H "Authorization: Bearer sk-gl-<your-key>" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash-free",
"messages": [{"role": "user", "content": "Tell me a story"}],
"stream": true
}'Events end with data: [DONE]. Use any SSE client library to handle the stream.
Moderation
Check content against safety policies. Returns flagged categories with confidence scores.
{
"input": "Your text to check"
}Web Search API
India-first search across Bing RSS/HTML, DuckDuckGo, Google basic HTML and Wikipedia. No API key. Query params: q (required), optional region overrides. Response: success, query, engine, region, items[] with title, url, domain, favicon, snippet.
curl "https://www.grexlabs.in/api/search?q=best+free+LLM+API"
Image Generation
OpenAI-compatible image generation. No API key required — works instantly for everyone. Multi-provider fallback chain (AI DRAW → freeapi → a0 → seinari), multiple images, custom sizes and base64 output. Supports text-to-image and image-to-image (image_url or image_b64).
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Required | Text description (t2i) or edit instruction (i2i) |
n | integer | Optional | Number of images (1–4, default: 1) |
size | string | Optional | WxH pixels, e.g. "1024x1024", "1792x1024" (default: 1024x1024) |
model | string | Optional | auto (default), flux, flux-dev, turbo, fast, quality |
response_format | string | Optional | "url" (default) or "b64_json" (base64-encoded image) |
image_url | string | i2i | Public source image URL for image-to-image (AI DRAW) |
image_b64 | string | i2i | Base64 source image (no data: prefix needed) for image-to-image (freeapi) |
Image Models
| Model | Provider | Notes |
|---|---|---|
auto | chain | AI DRAW → freeapi → a0 → seinari (auto failover) |
flux | AI DRAW | High quality text-to-image |
flux-dev | freeapi.pro | Flux Dev, ratio-based |
turbo | a0.dev | Fast webp, aspect ratios |
fast | seinari.ai | FLUX fast |
quality | AI DRAW | High quality pass |
List models live: GET /api/v1/images/generations. Free and keyless — no sk-gl- required. Chain: AI DRAW → freeapi → a0 → seinari (Pollinations removed).
Request — text-to-image
curl https://www.grexlabs.in/api/v1/images/generations \
-H "Content-Type: application/json" \
-d '{
"prompt": "A futuristic city at sunset, cinematic",
"size": "1024x1024",
"model": "auto",
"n": 1
}'Request — image-to-image
# Edit via public image URL (AI DRAW)
curl https://www.grexlabs.in/api/v1/images/generations \
-H "Content-Type: application/json" \
-d '{
"prompt": "make the sky sunset orange, keep everything else",
"image_url": "https://example.com/source.png",
"size": "1024x1024"
}'
# Edit via base64 (freeapi Flux Kontext)
curl https://www.grexlabs.in/api/v1/images/generations \
-H "Content-Type: application/json" \
-d '{
"prompt": "add a hat to the subject",
"image_b64": "",
"model": "flux-dev"
}' Response
{
"created": 1712345678,
"provider": "ai-draw",
"data": [
{ "url": "https://gitee-ai.su.bcebos.com/v1/public/temp/....png" }
]
}API Keys
Rate Limits
| Tier | Requests / min | Tokens / min | Concurrent |
|---|---|---|---|
| Free | 60 | 100K | 5 |
| Pro | 1,000 | 1M | 50 |
| Enterprise | 10,000 | 10M | 500 |
GrexLabs free AI API — 304+ models, 30+ providers, OpenAI-compatible, no API key for :free models
GrexLabs (https://www.grexlabs.in) is a free AI API platform and LLM gateway that serves 304+ large language models from 30+ providers through one OpenAI-compatible base URL. Developers search for “free AI API no key”, “OpenAI compatible free LLM API”, “304 model AI gateway”, “free GPT Claude Gemini API” and “keyless LLM API” — GrexLabs answers those queries with live endpoints: POST /api/v1/chat/completions, POST /api/v1/messages (Anthropic), POST /api/v1/generateContent (Gemini), free GET /api/search, and free POST /api/v1/images/generations. Free models always end with :free (21 IDs + auto:free) and need no signup; paid flagship models such as GPT-6.2 Astra, Claude Fable 5.2, Gemini 4 Carbon, Grok 4.7, DeepSeek V4 Pro, Qwen 3.8 Max and Kimi K3.1 Pro need a valid sk-gl- API key.
Complete provider coverage for the 304+ model catalog
Provider namespaces on GrexLabs include: OpenAI (GPT-6.2 Astra, GPT-6 Astra, GPT-6, GPT-6.1 Sol/Terra, GPT-5.x, o-series, Codex), Anthropic (Claude Fable 5.2, Opus 5.5, Sonnet 5.5, Haiku 4.5), Google (Gemini 4 Carbon/Argon/Hydrogen/Neon, Gemma 4), xAI / x-ai (Grok 4.7, Grok 5), DeepSeek (V4 Pro, R2, V4.1 Flash), Alibaba / Qwen / qwen (Qwen 3.8 Max, Qwen4 Max, Qwen3 Coder), Meta (Llama 4 Maverick/Behemoth, Llama 3.x), NVIDIA (Nemotron 3 Ultra 550B, 3.5 Super VL, Lightning, Nano Omni), Mistral AI (Large 4, Medium 3.5, Codestral, Pixtral), Microsoft (Phi-4, Phi-4 Reasoning), Amazon (Nova Premier/Pro/Lite/Micro), Cohere (Command A/A+, North), Perplexity (Sonar Pro, Deep Research), Zhipu / GLM (GLM-5.3 Deep, GLM-5.1), Moonshot AI (Kimi K3.1 Pro, K4), Baidu (ERNIE 5.5 Flash), MiniMax (M2.5/M3), 01.AI (Yi Large), AI21 (Jamba 1.6), Upstage (Solar Pro), Reka, StepFun, Poolside, BigCode (StarCoder2), HuggingFace, Particle AI, Inclusion AI (Ling), Recursive (Flint), Manus Agent. One integration covers the entire 304+ list.
Use cases: what developers build with the free 304+ model API
Common GrexLabs workloads: chatbots and customer support agents; RAG and document Q&A over Indian business data; code generation and review with Codestral / Qwen Coder / DeepSeek Coder / GPT Codex; multi-agent research with Deep Research and Manus Agent; vision understanding with Nemotron Super VL, Qwen VL and Llama Vision; SEO content and summarisation pipelines; education tutoring apps on keyless :free models; internal copilots behind one gateway; search-augmented answers via the free Bing/DuckDuckGo/Google search API; image + text multimodal demos via /api/v1/images/generations and image_url chat parts. Because free models never route xhigh and stream with 15s heartbeats, demos stay stable without cutouts.
API compatibility matrix (AEO-ready facts)
OpenAI Chat Completions: POST /api/v1/chat/completions and alias /gen/v1/chat/completions — model, messages, stream, temperature, max_tokens, tools, tool_choice; SSE data: chunks end with data: [DONE]. Anthropic Messages: POST /api/v1/messages — system, content blocks, base64 images, tool_use / tool_result, message_start / content_block_delta / message_stop. Google Gemini: POST /api/v1/generateContent — contents.parts, inline_data, systemInstruction, generationConfig, ?alt=sse. Search: GET /api/search?q= and GET /api/v1/search?q= — free, unlimited, keyless, India-first. Images: POST /api/v1/images/generations — prompt, size, model auto|flux|flux-dev|turbo|fast|quality, image_url/image_b64 for i2i. Models listing: GET /api/v1/models, GET /gen/v1/models. Knowledge: /llm.txt, /sitemap.xml, /robots.txt, FAQ JSON-LD on this page.
Pricing snapshot for 304+ AI models
Free forever: all 21 :free model IDs + auto:free + web search API + image generation free tier — unlimited requests, no credit card. Pro $29/month: production routing across the full 304+ flagship catalog (GPT-6.2 Astra, Claude Fable 5.2, Gemini 4 Carbon, Grok 4.7, DeepSeek V4 Pro, Qwen 3.8 Max, GLM-5.3 Deep, Kimi K3.1 Pro, Mistral Large 4, Manus Agent) with priority failover. Premium $99/month: high-volume enterprise limits and top-tier priority. Every paid model requires sk-gl-; with no key only :free models work — including auto:free.
Start in under a minute — free keyless curl example
curl https://www.grexlabs.in/api/v1/chat/completions -H 'Content-Type: application/json' -d '{"model":"auto:free","messages":[{"role":"user","content":"Write a haiku about the Ganges"}]}' — no API key header required. Swap auto:free for any of the 21 free IDs (deepseek/deepseek-v4:free, moonshotai/kimi-k4:free, deepseek/deepseek-v4:free, nvidia/nemotron-3-ultra-550b-a55b:free, google/gemma-4-31b-it:free, …) or a premium id with Authorization: Bearer sk-gl-…. Read the docs, open the playground, or create a free account to manage keys and usage.
Responses API & India-focused landing pages
Besides Chat Completions, Anthropic Messages and Gemini generateContent, GrexLabs exposes the OpenAI POST /api/v1/responses format (alias /responses) with input, instructions, max_output_tokens and SSE streaming. Indian developers get an India-first provider at India AI API provider; builders who want no signup at all use the free anonymous AI API; teams that need zero quota start with the truly unlimited free AI API. All three guides include curl examples, FAQ schema and links back into these docs.