API Guide

Effective from: 27 August 2026 · version 2026-08-28


Connect to ThaiProMax from your own system over our REST API — check your balance, run AI jobs, and call any of our models using the same standard as the OpenAI API.

1. Authentication

Every request must carry an API Key created from the API Key menu on your dashboard, sent as a Bearer token in the HTTP header.

Authorization: Bearer your_api_key_here

Your key starts with isk_. Keep it secret and never embed it in browser-side code where anyone can read it.

2. Account and balance

Use this to check your plan, your monthly Points balance, and the Credits in your account.

GET /api/v1/me

Example response (JSON)

{
  "subscription": {
    "plan": "premium",
    "planName": "Premium Plan",
    "status": "active",
    "billingCycle": "monthly",
    "periodStart": "2026-06-01T00:00:00.000Z",
    "periodEnd": "2026-07-01T00:00:00.000Z",
    "pointsRemaining": 42500,
    "pointsLimit": 44000,
    "pointsUsed": 1500
  },
  "wallet": {
    "credits": 5000
  }
}
3. Running an AI job

Submit a job by capability. Points are deducted first; once they run out, Credits are used.

GET /api/v1/generate?capabilityKey=gen_light
ParameterTypeDescription
capabilityKeyString (required)The capability key, for example gen_light (10 Credits) or gen_heavy (1,000 Credits).

Example response (JSON)

{
  "ok": true,
  "newValue": 42,
  "capabilityKey": "gen_light",
  "costCredits": 10,
  "source": "points",
  "newCredits": null,
  "newPoints": 42490
}
4. Chat API (works with coding IDEs)

Call any of our models using the same standard as the OpenAI API. Point your coding IDE app or SDK at it with your API Key. Usage is billed by actual token count, taking Points first and then Credits.

Base URL for your IDE or SDK

https://example.com/api/v1
SettingValue
API ProviderChoose OpenAI Compatible
Base URLhttps://example.com/api/v1
API KeyYour isk_... key from the API Key menu on your dashboard
Model IDPick one from GET /api/v1/models
POST /api/v1/chat/completions
  • Supports stream: true (SSE) and tool calling (tools of type function) per the OpenAI standard.
  • Supports web search — append :online to the model name. It works from any IDE app without changing the request body.
  • Only models in our catalogue are accepted; anything else returns 400 model_not_found.
  • Upstream routing is chosen automatically; any routing fields you send are ignored.
  • The usage.cost field in the response is the number of Credits charged for that request, including any web search.

Example request body

{
  "model": "google/gemini-3.5-flash",
  "stream": false,
  "messages": [
    { "role": "user", "content": "Hello, please introduce yourself." }
  ]
}

Example response (JSON)

{
  "id": "gen-xxxxxxxxxx",
  "object": "chat.completion",
  "model": "google/gemini-3.5-flash",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": { "role": "assistant", "content": "Hello! I am ..." }
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 45,
    "total_tokens": 57,
    "cost": 2
  }
}
4.1 Web search
  • Option 1 (best for IDEs): append :online to the model name, e.g. google/gemini-3.5-flash:online. Just change the Model ID in your app.
  • Option 2 (configurable): send a plugins field in the request body to set engine, max_results (max 10), search_prompt, include_domains, and exclude_domains.
  • Search adds a small cost per query, already included in usage.cost. There is no separate bill.

Example request body with options

{
  "model": "google/gemini-3.5-flash",
  "plugins": [
    { "id": "web", "max_results": 5, "exclude_domains": ["reddit.com"] }
  ],
  "messages": [
    { "role": "user", "content": "What is the latest AI news this week?" }
  ]
}
4.2 Model list and pricing
GET /api/v1/models

Returns every model currently enabled, with pricing per one million tokens in Credits.

Example response (JSON)

{
  "object": "list",
  "data": [
    {
      "id": "google/gemini-3.5-flash",
      "object": "model",
      "name": "Gemini 3.5 Flash",
      "context_length": 1000000,
      "pricing": {
        "prompt": 12375,
        "completion": 74250,
        "unit": "credits_per_1m_tokens"
      }
    }
  ]
}
5. Code examples
curl -X GET "https://example.com/api/v1/generate?capabilityKey=gen_light" \
  -H "Authorization: Bearer your_api_key_here"
const apiKey = 'your_api_key_here';
const url = 'https://example.com/api/v1/generate?capabilityKey=gen_light';

fetch(url, {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Accept': 'application/json'
  }
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
import requests

api_key = "your_api_key_here"
url = "https://example.com/api/v1/me"

headers = {
    "Authorization": f"Bearer {api_key}",
    "Accept": "application/json"
}

response = requests.get(url, headers=headers)
print(response.json())
Stuck connecting?

Send us the request you tried and we will take a look.

Go to the contact page

AI Assistant
Please Sign In

Sign in to chat with our smart AI assistant in real-time.

Sign In