Agent / Bot integration

This page is for autonomous agents (e.g. OpenClaw) connecting to the Gonka gateway. Register your device, get an API key, then use the OpenAI-compatible API. This URL is public and can be distributed to bots.

0. Prerequisites

1. Registration (two-step)

Base URL for this gateway: https://gonka-gateway.mingles.ai

Step 1 — Get challenge

POST https://gonka-gateway.mingles.ai/api/register-bot

Body (JSON): {"deviceId": "<UUID>", "publicKeyPem": "<PEM string>"}

Response: {"challenge": "<base64>", "expiresIn": 600, "reRegistration": false}. If device already registered, reRegistration is true; after step 2 you get a new API key (no extra bonus).

Step 2 — Sign challenge and get API key

POST https://gonka-gateway.mingles.ai/api/register-bot/verify

Body (JSON): {"deviceId": "<UUID>", "challenge": "<from step1>", "signature": "<base64 of ECDSA signature of challenge bytes (decode challenge from base64, sign with device private key, base64-encode signature)>"}

Response: {"apiKey": "sk-...", "balance": 0.1, "message": "..."}. Save apiKey; it is shown only once. Rate limit: 30 requests per hour per IP for both steps.

2. Provider config (OpenClaw)

Add to your OpenClaw models.providers:

{
  "gonka": {
    "baseUrl": "https://gonka-gateway.mingles.ai/v1",
    "apiKey": "<apiKey from step 2>",
    "auth": "api-key",
    "api": "openai-completions",
    "authHeader": true,
    "models": [
      {
        "id": "moonshotai/Kimi-K2.6",
        "name": "moonshotai/Kimi-K2.6",
        "api": "openai-completions",
        "reasoning": false,
        "input": ["text"],
        "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
        "contextWindow": 200000,
        "maxTokens": 8192
      }
    ]
  }
}

3. Balance and status

GET https://gonka-gateway.mingles.ai/api/user/balance with header Authorization: Bearer <apiKey>

Response: {"balance": 0.05, "address": "bot:<deviceId>", "low_balance": true}. Use low_balance to decide when to request payment or notify a human. If balance is insufficient, API returns 402 Payment Required.

4. Summary

StepAction
Get API keyPOST /api/register-bot (get challenge) → POST /api/register-bot/verify (sign, get apiKey)
Add providerSet baseUrl = https://gonka-gateway.mingles.ai/v1 and apiKey in OpenClaw config
Check balanceGET /api/user/balance with Bearer <apiKey>

Machine-readable: Fetch https://gonka-gateway.mingles.ai/agent.json for the same information in JSON (endpoints, URLs, provider config).