{
  "info": {
    "name": "NexusAPI Quickstart",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "Set NEXUS_API_KEY locally. Keep it secret; generation uses your balance."
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://nexusapi.dev"
    },
    {
      "key": "NEXUS_API_KEY",
      "value": "",
      "type": "string"
    },
    {
      "key": "task_id",
      "value": "",
      "type": "string"
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{NEXUS_API_KEY}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "1. First text result",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": "{{base_url}}/v1/chat/completions",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"model\": \"gpt-5.4-nano\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Ответь одним словом: работает?\"\n    }\n  ],\n  \"max_tokens\": 32\n}"
        }
      }
    },
    {
      "name": "2. Available models",
      "request": {
        "method": "GET",
        "url": "{{base_url}}/public/models",
        "auth": {
          "type": "noauth"
        }
      }
    },
    {
      "name": "3. Create image task",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "url": "{{base_url}}/generate",
        "body": {
          "mode": "raw",
          "raw": "{\n  \"params\": {\n    \"model_name\": \"nano-banana-2-lite\",\n    \"prompt\": \"A red ceramic cup on a white table\",\n    \"aspect_ratio\": \"1:1\"\n  }\n}"
        }
      },
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "if (pm.response.code >= 200 && pm.response.code < 300) {",
              "  const id = pm.response.json().task_id;",
              "  if (id) pm.collectionVariables.set('task_id', id);",
              "}"
            ]
          }
        }
      ]
    },
    {
      "name": "4. Get task result",
      "request": {
        "method": "GET",
        "url": "{{base_url}}/tasks/{{task_id}}"
      }
    }
  ]
}
