{
  "info": {
    "name": "Tokia API",
    "description": "Tokia · gateway brasileiro de IA OpenAI-compatible. Cole sua key Tokia em {{TOKIA_API_KEY}} (Variables tab) e roda. Docs completos: https://www.usetokia.com/docs",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_postman_id": "tokia-api-v1"
  },
  "auth": {
    "type": "bearer",
    "bearer": [{ "key": "token", "value": "{{TOKIA_API_KEY}}", "type": "string" }]
  },
  "variable": [
    { "key": "BASE_URL", "value": "https://api.usetokia.com/v1", "type": "string" },
    { "key": "TOKIA_API_KEY", "value": "sk-tokia-COLE_AQUI", "type": "string" }
  ],
  "item": [
    {
      "name": "Chat",
      "item": [
        {
          "name": "Chat Completions",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "{{BASE_URL}}/chat/completions",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"model\": \"deepseek-v3\",\n  \"messages\": [\n    {\"role\": \"user\", \"content\": \"Explica PIX em 1 frase\"}\n  ],\n  \"temperature\": 0.3\n}"
            }
          }
        },
        {
          "name": "Chat Streaming",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "{{BASE_URL}}/chat/completions",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"model\": \"gpt-4o-mini\",\n  \"messages\": [{\"role\":\"user\",\"content\":\"Conta uma piada brasileira\"}],\n  \"stream\": true\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Embeddings",
      "item": [
        {
          "name": "Generate Embeddings",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "{{BASE_URL}}/embeddings",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"model\": \"text-embedding-3-small\",\n  \"input\": [\"O céu de Brasília está azul\", \"Em Brasília, o dia amanheceu limpo\"]\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Images",
      "item": [
        {
          "name": "Generate Image (Flux Schnell)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "{{BASE_URL}}/images/generations",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"model\": \"flux-schnell\",\n  \"prompt\": \"uma capivara usando óculos escuros surfando em Copacabana, estilo pixar\",\n  \"n\": 1\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Models",
      "item": [
        {
          "name": "List Models (catálogo Tokia)",
          "request": {
            "method": "GET",
            "url": "{{BASE_URL}}/models",
            "auth": { "type": "noauth" }
          }
        }
      ]
    },
    {
      "name": "Account",
      "item": [
        {
          "name": "Balance + usage",
          "request": {
            "method": "GET",
            "url": "https://api.usetokia.com/usage"
          }
        },
        {
          "name": "Usage Summary (últimos 30d por modelo)",
          "request": {
            "method": "GET",
            "url": "https://api.usetokia.com/usage/summary?days=30"
          }
        },
        {
          "name": "Usage by-key (Sprint 87)",
          "request": {
            "method": "GET",
            "url": "https://api.usetokia.com/usage/by-key?days=30"
          }
        },
        {
          "name": "Rate Limit Usage (Sprint 94)",
          "request": {
            "method": "GET",
            "url": "https://api.usetokia.com/usage/rate-limit?minutes=60"
          }
        },
        {
          "name": "Recommendations (Sprint 91)",
          "request": {
            "method": "GET",
            "url": "https://api.usetokia.com/me/recommendations"
          }
        },
        {
          "name": "Invoices (Sprint 105)",
          "request": {
            "method": "GET",
            "url": "https://api.usetokia.com/me/invoices"
          }
        },
        {
          "name": "Update Preferences (Sprint 98)",
          "request": {
            "method": "PUT",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "https://api.usetokia.com/me/preferences",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"timezone\": \"America/Sao_Paulo\",\n  \"preferred_locale\": \"pt-BR\",\n  \"weekly_digest_enabled\": true\n}"
            }
          }
        }
      ]
    },
    {
      "name": "API Keys",
      "item": [
        {
          "name": "List Keys",
          "request": { "method": "GET", "url": "https://api.usetokia.com/api-keys" }
        },
        {
          "name": "Create Key",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "https://api.usetokia.com/api-keys",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"minha-key-teste\",\n  \"is_test_mode\": false\n}"
            }
          }
        },
        {
          "name": "Bulk Revoke (Sprint 96)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "https://api.usetokia.com/api-keys/bulk-revoke",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"all\": true\n}"
            }
          }
        },
        {
          "name": "Set IP Allowlist (Sprint 103)",
          "request": {
            "method": "PUT",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "https://api.usetokia.com/api-keys/{{KEY_ID}}/ip-allowlist",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"ip_allowlist\": [\"203.0.113.42\", \"203.0.113.43\"]\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Webhooks",
      "item": [
        {
          "name": "Create Webhook",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "url": "https://api.usetokia.com/webhooks",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"url\": \"https://seu-app.com/tokia-webhook\",\n  \"events\": [\"balance.low\", \"balance.topped_up\", \"key.suspended\"]\n}"
            }
          }
        },
        {
          "name": "Rotate Secret (Sprint 88)",
          "request": {
            "method": "POST",
            "url": "https://api.usetokia.com/webhooks/{{WEBHOOK_ID}}/rotate-secret"
          }
        },
        {
          "name": "Replay Attempt (Sprint 93)",
          "request": {
            "method": "POST",
            "url": "https://api.usetokia.com/webhooks/attempts/{{ATTEMPT_ID}}/replay"
          }
        }
      ]
    },
    {
      "name": "Public (sem auth)",
      "item": [
        {
          "name": "Health",
          "request": { "method": "GET", "url": "https://api.usetokia.com/healthz", "auth": { "type": "noauth" } }
        },
        {
          "name": "Upstream Health (Sprint 90)",
          "request": { "method": "GET", "url": "https://api.usetokia.com/upstream-health?days=30", "auth": { "type": "noauth" } }
        },
        {
          "name": "Uptime Recent",
          "request": { "method": "GET", "url": "https://api.usetokia.com/uptime/recent", "auth": { "type": "noauth" } }
        }
      ]
    }
  ]
}
