API Documentation
One unified API
Complete reference for the GrexLabs API platform. Access 139+ AI models from 22+ providers through a single endpoint.
Introduction
The GrexLabs API provides access to 139+ AI models from 22+ providers through a single unified endpoint. Each model includes an authenticity prompt so it responds in-character. All endpoints are OpenAI-compatible.
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
All API requests require an API key passed via the Authorization header:
Authorization: Bearer sk-gl-<your-api-key>
Generate your free API key from the Dashboard.
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 139+ models from 22+ providers through a single unified API. Browse the full catalogue or use the quick reference below.
Browse All ModelsFlagship Models
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": "hy3-free",
"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": "hy3-free",
"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: "hy3-free",
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" => "hy3-free",
"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: "hy3-free",
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": "hy3-free",
"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": "hy3-free",
"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", "hy3-free");
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 = "hy3-free",
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": "hy3-free",
"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., hy3-free, deepseek-v4-flash-free) |
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": "hy3-free",
"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
}
}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"
}API Keys
Rate Limits
| Tier | Requests / min | Tokens / min | Concurrent |
|---|---|---|---|
| Free | 60 | 100K | 5 |
| Pro | 1,000 | 1M | 50 |
| Enterprise | 10,000 | 10M | 500 |