Playground Postman
◆ OpenAI-compatible gateway

GME AI API

One key, every model. Point any OpenAI SDK at our gateway and start building — then resell access to your own customers with metered billing through the Merchant API.

https://gme-ai.com/v1

Overview

There are two APIs, for two audiences:

Inference API

For your app

OpenAI-compatible chat completions. Authenticate with an inference key (gme-…) and call any available model. Usage bills the key's balance.

https://gme-ai.com/v1

Merchant API

For resellers

Create customers with a balance, mint and manage their keys, move funds, and read usage — all scoped to your merchant account. Authenticate with a management key (gmadm-…).

https://gme-ai.com/api/gme-ai/merchant

Concepts & hierarchy

Platform Merchant · pool balance Customer · own balance API key(s)
Two key classes, strictly separated. An inference key (gme-…) can call /v1 but not the Merchant API. A management key (gmadm-…) can call the Merchant API but never inference. Using one where the other is expected returns 401.

Authentication

All requests use a bearer token in the Authorization header:

Authorization: Bearer gme-xxxxxxxxxxxxxxxxxxxxxxxx    # inference
Authorization: Bearer gmadm-xxxxxxxxxxxxxxxxxxxxxx    # merchant management

Keys are shown once at creation and cannot be retrieved again — save them securely. Treat a key like a password; anyone holding it can spend the balance it draws on.

Never embed a gme- key in a browser, mobile app, or any client-side code. The gateway allows cross-origin requests, so a key that ships to end users is immediately usable by anyone who extracts it — and it spends a real balance. Keep inference keys on your server and proxy requests, or issue a short-lived, capped per-user key from the Merchant API.

Playground

Try a live request against the gateway. Your key is used only in this browser and sent directly to the API — nothing is stored.

Quickstart

The Inference API is a drop-in OpenAI replacement — change the base URL and key:

Python (openai SDK)

from openai import OpenAI
client = OpenAI(base_url="https://gme-ai.com/v1", api_key="gme-YOUR_KEY")

resp = client.chat.completions.create(
    model="atg-gpt-5.4",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)

Node (openai SDK)

import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://gme-ai.com/v1", apiKey: "gme-YOUR_KEY" });

const r = await client.chat.completions.create({
  model: "atg-gpt-5.4",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(r.choices[0].message.content);

curl

curl https://gme-ai.com/v1/chat/completions \
  -H "Authorization: Bearer gme-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"atg-gpt-5.4","messages":[{"role":"user","content":"Hello!"}]}'

Chat completions

POST/v1/chat/completions

OpenAI-compatible. Returns a chat.completion object (or an SSE stream when stream: true).

Request body

FieldTypeDescription
model requiredstringModel id or alias (see Available models). Unknown names resolve to the default model.
messages requiredarrayChat messages: { role, content } with roles system / user / assistant / tool.
temperaturenumberSampling temperature.
top_pnumberNucleus sampling.
max_tokensintegerMax output tokens. Default 2048.
tools, tool_choicearray / stringFunction-calling tools, OpenAI schema.
response_formatobject{ "type": "json_object" } for JSON mode.
streambooleanStream the response as SSE. Default false.

Response

{
  "id": "chatcmpl-…",
  "object": "chat.completion",
  "created": 1730000000,
  "model": "atg-gpt-5.4",
  "choices": [{ "index": 0, "message": { "role": "assistant", "content": "…" }, "finish_reason": "stop" }],
  "usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 }
}
Function calling is supported: pass tools and read choices[0].message.tool_calls in the response (finish_reason: "tool_calls").

Streaming

Set "stream": true to receive Server-Sent Events. The first event carries delta.role, each following event a partial delta.content, and the stream ends with a finish_reason chunk then data: [DONE]. This is fully compatible with the OpenAI SDK's streaming helpers.

data: {"id":"chatcmpl-…","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant"}}]}
data: {"…","choices":[{"index":0,"delta":{"content":"Hel"}}]}
data: {"…","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]
The response is delivered as a standard SSE stream, OpenAI-SDK compatible. Real-time token-by-token delivery is a server-side option your operator can enable; without it, chunks are emitted once the model completes.

List models

GET/v1/models

Returns the models available to your key, in OpenAI list format:

{ "object": "list", "data": [{ "id": "atg-gpt-5.4", "object": "model", "owned_by": "atg" }, … ] }

If your key has a model allowlist, requests for models outside it return 403 model_not_allowed (even via an alias).

Available models

Model idContextBest for
atg-gpt-5.5400KFlagship — reasoning, vision, tools, JSON.
atg-gpt-5.4400KGeneral-purpose default — vision, tools, JSON.
atg-gpt-5.4-mini400KFast + economical (p95 ≈ 1.8s).
atg-gpt-5.3-codex200KCoding & agentic tool use.
atg-gpt-5.3-codex-spark200KFaster coding tier.
atg-gpt-5.2200KPrior-gen general model.
Aliases for drop-in compatibility: common OpenAI names (gpt-4o, gpt-4o-mini, gpt-4, gpt-5, …) and Claude names (claude-sonnet, claude-opus, …) are accepted and mapped to the equivalent model above. Call GET /v1/models for the live list. Pricing bills your balance per token; track exact spend in your usage report.

Merchant API

Base URL https://gme-ai.com/api/gme-ai/merchant. Authenticate every request with your management key:

Authorization: Bearer gmadm-YOUR_MANAGEMENT_KEY

All responses are JSON of the form { "ok": true, … } or { "ok": false, "error": "code", "detail": "…" }. Everything is scoped to your merchant — you can only read and manage your own customers and keys.

Merchant info

GET/api/gme-ai/merchant/me
{ "ok": true,
  "merchant": { "id": 7, "name": "Acme AI", "pool_balance_usd": 420.50, "customer_count": 12 },
  "limits": { "maxStartBalance": 5000, "maxRatePerMin": 120, "maxCustomers": 2000 } }

Create customer

POST/api/gme-ai/merchant/customers

Creates (or attaches) a customer, transfers a starting balance from your pool, and mints their first inference key. The raw key is returned once.

FieldTypeDescription
email requiredstringCustomer's email (their identity).
display_namestringFriendly name.
starting_balance_usdnumberTransferred from your pool. Above maxStartBalance the request is rejected (400 balance_exceeds_limit).
model_allowliststring[]Restrict the key to these models (blank = all). Unknown names are rejected (400 unknown_models).
daily_cap_usd, monthly_cap_usdnumberPer-key spend caps (USD). Negative values are treated as 0.
rate_per_minintegerRequests/minute. Silently clamped to maxRatePerMin (not rejected).
expires_daysintegerKey auto-expires after N days.
curl https://gme-ai.com/api/gme-ai/merchant/customers \
  -H "Authorization: Bearer gmadm-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: signup-8842" \
  -d '{"email":"[email protected]","starting_balance_usd":10,"daily_cap_usd":5}'
{ "ok": true, "customer_id": 341, "funded_usd": 10,
  "api_key": { "id": 88, "token_prefix": "gme-Abc123…", "raw_token_shown_once": "gme-…" },
  "base_url": "https://gme-ai.com/v1" }
Send an Idempotency-Key header so a retry never double-charges your pool.

List customers

GET/api/gme-ai/merchant/customers
{ "ok": true, "customers": [
  { "id": 341, "email": "[email protected]", "display_name": "Dev", "active_keys": 1, "created_at": "…" } ] }

List keys

GET/api/gme-ai/merchant/keys

Returns every inference key under your merchant, with caps, allowlist, last-used and revoked/expiry status. Raw key values are never returned — only the token_prefix hint.

Mint another key

POST/api/gme-ai/merchant/keys

Issues an additional inference key for an existing customer. Body: customer_id or email, plus optional name, daily_cap_usd, monthly_cap_usd, rate_per_min, model_allowlist, expires_days. Returns the raw key once.

Update a key

PATCH/api/gme-ai/merchant/keys/:id

Change any of daily_cap_usd, monthly_cap_usd, rate_per_min, model_allowlist, expires_days. Pass null to clear a cap. Only fields present in the body are changed.

Revoke & rotate

POST/api/gme-ai/merchant/keys/:id/revoke

Revokes a key immediately.

POST/api/gme-ai/merchant/keys/:id/rotate

Mints a replacement key (same caps, allowlist and expiry) and sets the old key to expire after a grace window so you can cut over without downtime. Body: grace_hours (default 24, max 168). Returns the new raw key once.

{ "ok": true, "new_key": { "raw_token_shown_once": "gme-…" }, "old_key_expires_in_hours": 24 }

Top-up a customer

POST/api/gme-ai/merchant/customers/:id/topup

Moves amount_usd from your pool to the customer's balance. Send an Idempotency-Key.

{ "ok": true, "customer_id": 341, "amount_usd": 25, "pool_balance": 395.50, "customer_balance": 35 }

Claw back

POST/api/gme-ai/merchant/customers/:id/clawback

Moves balance back from the customer to your pool. Body: amount_usd, or { "all": true } to sweep the whole balance. Send an Idempotency-Key.

Usage report

GET/api/gme-ai/merchant/usage?days=28

Aggregated spend for your merchant. days = 7, 28, 90 or 365 (default 28). Add &format=csv for a per-customer CSV download.

{ "ok": true, "days": 28,
  "totals":      { "calls": 1820, "tokens_in": , "tokens_out": , "cost_usd": 42.18 },
  "by_customer": [{ "member_id": 341, "email": "…", "calls": , "cost_usd":  }],
  "by_model":    [{ "model_id": "gpt-5.4", "calls": , "cost_usd":  }],
  "by_day":      [{ "d": "2026-07-17", "calls": , "cost_usd":  }] }

MCP (Model Context Protocol)

Expose the GME AI platform to Claude Desktop, Claude Code, Cursor, Cline, and any MCP-compatible client. Same API key as the OpenAI-compatible gateway above; separate transport (JSON-RPC 2.0).

MCP is Anthropic's open protocol for connecting AI models to external tools and data. Instead of your assistant calling POST /v1/chat/completions once to get text back, an MCP client can ask the GME server what tools are available, then call any of them (chat, knowledge search, workflow trigger, document create, calendar, meetings…) as a first-class action. The assistant decides when to use them; you pay per call from your ATG balance.

Endpoint

POST/api/mcp

Canonical MCP endpoint for all applications and all tenant hosts. Aliases:

Auth: Authorization: Bearer <your-mcp-token>. Note: MCP tokens are currently a separate credential from the gateway API keys — they're stored in gmeai_mcp_tokens with a per-token country + tool scope, and are minted by a platform admin. To get one, message support from the Developer page or open a ticket. A unified-key flow (one key spends ATG on both /v1/chat/completions and /api/mcp) is on the roadmap.

Client setup

Claude Desktop / Claude Code

Edit ~/.config/claude/mcp_servers.json (macOS/Linux) or %APPDATA%\Claude\mcp_servers.json (Windows) and add:

{
  "mcpServers": {
    "gme-ai": {
      "url": "https://gme-ai.com/api/mcp",
      "headers": { "Authorization": "Bearer YOUR_API_KEY" }
    }
  }
}

Cursor

Settings → MCP ServersAdd new MCP server → HTTP transport, URL https://gme-ai.com/api/mcp, header Authorization: Bearer YOUR_API_KEY.

Cline (VS Code extension)

MCP Servers panel → Configure MCP Servers — paste the same JSON block above.

Any MCP-compatible client

Point it at the URL above with a bearer token. The server implements initialize, tools/list, tools/call, and resources/list per the MCP specification (2024-11-05 protocol version).

tools/list & tools/call

Standard JSON-RPC 2.0. List everything the key can call:

curl https://gme-ai.com/api/mcp \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

Response shape:

{ "jsonrpc": "2.0", "id": 1,
  "result": {
    "tools": [
      { "name": "chat",           "description": "Ask any GME AI model",            "inputSchema": { "type": "object", "properties": { "prompt": { "type": "string" }, "model": { "type": "string" } } } },
      { "name": "kb_search",       "description": "Full-text search across your knowledge base", "inputSchema": { "type": "object", "properties": { "q": { "type": "string" } } } },
      { "name": "workflow_run",    "description": "Trigger any of your saved workflows by slug" },
      { "name": "doc_create",      "description": "Create a document in your suite" },
      { "name": "calendar_event", "description": "Schedule an event on your GME Calendar" },
      // … depends on which tools your key has access to
    ]
  }
}

Invoke one:

curl https://gme-ai.com/api/mcp \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"kb_search","arguments":{"q":"MOQ negotiation"}}}'

Billing & per-tool cost

Every successful tools/call debits your ATG balance the same way a /v1/chat/completions call does. Tools that wrap a model (e.g. chat, kb_ask) charge model tokens; tools that trigger a workflow charge the workflow's ATG cost; utility tools (kb_search, doc_create) are flat-fee. The response includes an _gme block with the actual debit:

{ "jsonrpc": "2.0", "id": 2,
  "result": { "content": [ { "type": "text", "text": "…" } ],
              "_gme": { "debit_atg": 0.42, "balance_atg": 124.31 } } }

Insufficient balance returns JSON-RPC error -32001 with a message asking the user to top up. Rate limits and idempotency rules match the OpenAI-compatible endpoint (see below).

Idempotency

Money-moving Merchant endpoints — create customer, top-up and claw back — accept an Idempotency-Key header. A retry with the same key returns the original response instead of moving funds again, so a network timeout or a client retry can never double-charge.

Idempotency-Key: any-unique-string-per-operation

Note: Idempotency-Key applies only to the fund-moving endpoints above (create customer, top-up, claw back). Key mint / update / revoke / rotate are naturally safe to repeat and do not use it.

Errors

Inference API (OpenAI error shape)

{ "error": { "message": "…", "type": "insufficient_quota", "code": "insufficient_quota" } }
StatusMeaning
400Malformed request (e.g. missing messages).
401Missing / invalid / revoked / expired key, or a management key used for inference.
402Insufficient balance, or a daily/monthly spend cap reached.
403Model not permitted by the key's allowlist, or merchant suspended.
404Requested model unavailable.
429Rate limit exceeded — slow down.
502Upstream provider error.

Merchant API

StatuserrorMeaning
401missing_api_key · invalid_management_key · management_key_revoked · management_key_expiredNo / invalid / revoked / expired gmadm- key (or a gme- key was used → invalid_management_key).
402insufficient_pool_balance · insufficient_source_balanceThe source account (pool for create/top-up, customer for claw-back) can't cover the amount.
403merchant_suspendedMerchant account suspended.
404customer_not_found · key_not_foundResource not under your merchant.
400valid_email_required · bad_balance · balance_exceeds_limit · customer_limit_reached · unknown_models · bad_amountValidation error (detail explains which).
409email_unavailable · request_in_progressEmail already belongs to a retail or other-merchant member; or a same-idempotency-key request is still running.
502transfer_state_unknown · debit_unconfirmed · credit_and_rollback_failedA funds transfer could not be confirmed. Do not blindly retry — check the pool + customer balance first.

Rate limits & caps

Need higher throughput, dedicated models, or embeddings? Contact your platform operator — those are provisioned per agreement.

GME AI API · OpenAI-compatible gateway · base https://gme-ai.com/v1