{
  "info": {
    "_postman_id": "a4db6a10-bffd-4bd7-a818-1a3f8d6a6c2e",
    "name": "LLMTR Gateway API",
    "description": "Secret-free examples for LLMTR model discovery and OpenAI/Anthropic-compatible gateway calls. Public discovery requests are read-only and need no API key. Authenticated requests may incur model usage cost.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "base_url", "value": "https://llmtr.com", "type": "string" },
    { "key": "api_key", "value": "", "type": "string" },
    { "key": "chat_model", "value": "", "type": "string" }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      { "key": "token", "value": "{{api_key}}", "type": "string" }
    ]
  },
  "item": [
    {
      "name": "Public model discovery",
      "description": "Read-only requests. No API key or credit is required.",
      "item": [
        {
          "name": "List models",
          "request": {
            "auth": { "type": "noauth" },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/models",
              "host": ["{{base_url}}"],
              "path": ["v1", "models"]
            },
            "description": "Returns the public model catalog. The test stores the first Chat Completions model as chat_model."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('status is 200', () => pm.response.to.have.status(200));",
                  "const payload = pm.response.json();",
                  "pm.test('response is a non-empty model list', () => {",
                  "  pm.expect(payload.object).to.eql('list');",
                  "  pm.expect(payload.data).to.be.an('array').that.is.not.empty;",
                  "});",
                  "const chatModel = payload.data.find((model) =>",
                  "  (model.supported_operations || []).includes('CHAT_COMPLETIONS') &&",
                  "  (model.supported_endpoints || []).includes('/v1/chat/completions')",
                  ");",
                  "pm.test('a Chat Completions model is discoverable', () => pm.expect(chatModel).to.be.an('object'));",
                  "if (chatModel) pm.environment.set('chat_model', chatModel.id);"
                ]
              }
            }
          ]
        },
        {
          "name": "Get selected model",
          "request": {
            "auth": { "type": "noauth" },
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{base_url}}/v1/models/{{chat_model}}",
              "host": ["{{base_url}}"],
              "path": ["v1", "models", "{{chat_model}}"]
            },
            "description": "Run List models first so chat_model is populated."
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.test('status is 200', () => pm.response.to.have.status(200));",
                  "pm.test('model id matches the selected model', () => {",
                  "  pm.expect(pm.response.json().id).to.eql(pm.environment.get('chat_model'));",
                  "});"
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "name": "Authenticated examples",
      "description": "Set api_key as a local Postman secret before running. These requests can consume credit.",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const apiKey = pm.environment.get('api_key') || pm.collectionVariables.get('api_key');",
              "if (!apiKey) throw new Error('Set api_key as a local Postman secret before sending an authenticated request.');"
            ]
          }
        }
      ],
      "item": [
        {
          "name": "Chat completion",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json", "type": "text" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"model\": \"{{chat_model}}\",\n  \"messages\": [\n    { \"role\": \"user\", \"content\": \"Reply with one short sentence.\" }\n  ]\n}",
              "options": { "raw": { "language": "json" } }
            },
            "url": {
              "raw": "{{base_url}}/v1/chat/completions",
              "host": ["{{base_url}}"],
              "path": ["v1", "chat", "completions"]
            },
            "description": "OpenAI-compatible request using the model selected by public discovery."
          }
        },
        {
          "name": "Streaming chat completion",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json", "type": "text" },
              { "key": "Accept", "value": "text/event-stream", "type": "text" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"model\": \"{{chat_model}}\",\n  \"messages\": [\n    { \"role\": \"user\", \"content\": \"Count from one to three.\" }\n  ],\n  \"stream\": true,\n  \"stream_options\": { \"include_usage\": true }\n}",
              "options": { "raw": { "language": "json" } }
            },
            "url": {
              "raw": "{{base_url}}/v1/chat/completions",
              "host": ["{{base_url}}"],
              "path": ["v1", "chat", "completions"]
            },
            "description": "SSE example. Streaming behavior depends on the selected model's verified upstream support."
          }
        },
        {
          "name": "Anthropic-compatible message",
          "request": {
            "auth": {
              "type": "apikey",
              "apikey": [
                { "key": "key", "value": "x-api-key", "type": "string" },
                { "key": "value", "value": "{{api_key}}", "type": "string" },
                { "key": "in", "value": "header", "type": "string" }
              ]
            },
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json", "type": "text" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"model\": \"{{chat_model}}\",\n  \"max_tokens\": 256,\n  \"messages\": [\n    { \"role\": \"user\", \"content\": \"Reply with one short sentence.\" }\n  ]\n}",
              "options": { "raw": { "language": "json" } }
            },
            "url": {
              "raw": "{{base_url}}/v1/messages",
              "host": ["{{base_url}}"],
              "path": ["v1", "messages"]
            },
            "description": "Anthropic-compatible request using x-api-key."
          }
        }
      ]
    }
  ]
}
