For agents and developers

The GrexLabs API

One balance, every model. An OpenAI-compatible REST API your SDKs already speak — plus Anthropic and Gemini wire formats on the same host and key.

Base URLs: https://www.grexlabs.in/api/v1 · https://api.grexlabs.in/v1

Getting started

Base URL and authentication

All requests go to https://api.grexlabs.in/v1 (or https://www.grexlabs.in/api/v1). Free :free models need no key at all. Every other model needs a valid sk-gl- key as a Bearer token, x-api-key header, or x-goog-api-key header — no key or a wrong key returns 401.

  • Keys are created in the dashboard and shown in full exactly once
  • Verified accounts start with $10 in free credit; top-ups never expire
  • Rate is metered per token in USD and recorded per request in your activity log

Your first call

Keyless, right now:

curl https://api.grexlabs.in/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{"model":"auto:free","messages":[
        {"role":"user","content":"hello"}]}'

With a flagship model and your key:

curl https://api.grexlabs.in/v1/chat/completions \
  -H "Authorization: Bearer $GREXLABS_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model":"openai/gpt-6.2-astra","messages":[
        {"role":"user","content":"hello"}]}'

Official SDKs

Point the OpenAI SDK at the gateway — nothing else changes:

from openai import OpenAI
client = OpenAI(
    base_url="https://api.grexlabs.in/v1",
    api_key="sk-gl-...",
)
r = client.chat.completions.create(
    model="anthropic/claude-fable-5.2",
    messages=[{"role": "user", "content": "hi"}],
)
print(r.choices[0].message.content)

Anthropic and Gemini clients work the same way against /v1/messages and /v1/generateContent.

Streaming

Set stream: true for standard SSE data: chunks terminated by data: [DONE]. Heartbeat comments fire every 15 seconds and a 60-second stall watchdog re-routes a hung upstream — long answers never cut out mid-stream.

curl -N https://api.grexlabs.in/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{"model":"deepseek/deepseek-v4:free","stream":true,
       "messages":[{"role":"user","content":"count to 5"}]}'

Reasoning, parameters and tools

  • Standard controls: temperature, max_tokens, top_p, stop, seed
  • Tool calling: tools, tool_choice, tool_calls, finish_reason: "tool_calls"
  • Reasoning models stream thinking summaries back in-band
  • JSON mode via response_format on supported models

Images, search and vision

  • POST /v1/images/generations — OpenAI Images format, text-to-image and image-to-image, url or b64_json
  • GET /v1/search?q= — free keyless web search, India-first ranking, 8-second budget
  • Vision — send base64 or https image_url parts in any chat, OCR and charts included

Errors

  • 401 — missing/invalid key on a non-free model (use a :free id or fix the key)
  • 402 — balance exhausted on a paid model
  • 429 — rate limited; retry with backoff
  • 503 — every provider attempt failed; the body lists each attempt

The full reference — every endpoint, every parameter — lives in the docs. Model ids are listed at /models and llm.txt.

Ship your first call today.

$10 free credit on signup, keyless free models, and the SDK you already use.