{
  "info": {
    "_postman_id": "df92f416-d1c1-4c54-bbb2-63c4f814eaa4",
    "name": "MagnetAPI.org on RapidAPI",
    "description": "OpenAI-compatible and Anthropic-compatible MagnetAPI.org requests through RapidAPI. Set rapidapiKey and rapidapiHost before running the collection.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "noauth"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://YOUR_RAPIDAPI_HOST"
    },
    {
      "key": "rapidapiHost",
      "value": "YOUR_RAPIDAPI_HOST"
    },
    {
      "key": "rapidapiKey",
      "value": ""
    },
    {
      "key": "requestId",
      "value": ""
    }
  ],
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "pm.request.headers.upsert({ key: 'X-RapidAPI-Key', value: pm.collectionVariables.get('rapidapiKey') });",
          "pm.request.headers.upsert({ key: 'X-RapidAPI-Host', value: pm.collectionVariables.get('rapidapiHost') });"
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          "const requestId = pm.response.headers.get('X-MagnetAPI-Request-ID');",
          "if (requestId) pm.collectionVariables.set('requestId', requestId);",
          "pm.test('Response is not a server error', () => pm.expect(pm.response.code).to.be.below(500));"
        ]
      }
    }
  ],
  "item": [
    {
      "name": "Account and usage",
      "item": [
        {
          "name": "API Token and trial status",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{baseUrl}}/v1/rapidapi/account"
          }
        },
        {
          "name": "Usage records",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{baseUrl}}/v1/rapidapi/usage"
          }
        },
        {
          "name": "Create usage dashboard link",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{baseUrl}}/v1/rapidapi/dashboard-link"
          }
        },
        {
          "name": "Look up last request id",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{baseUrl}}/v1/rapidapi/requests/{{requestId}}"
          }
        }
      ]
    },
    {
      "name": "OpenAI-compatible",
      "item": [
        {
          "name": "Non-billable sandbox response",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\"model\":\"magnetapi-sandbox\",\"input\":\"Verify my integration.\"}"
            },
            "url": "{{baseUrl}}/v1/responses"
          }
        },
        {
          "name": "Create Response",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\"model\":\"gpt-5.6\",\"input\":\"Reply with OK only.\"}"
            },
            "url": "{{baseUrl}}/v1/responses"
          }
        },
        {
          "name": "Chat Completion",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\"model\":\"gpt-5.6\",\"messages\":[{\"role\":\"user\",\"content\":\"Reply with OK only.\"}]}"
            },
            "url": "{{baseUrl}}/v1/chat/completions"
          }
        }
      ]
    },
    {
      "name": "Anthropic-compatible",
      "item": [
        {
          "name": "Create Message",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "anthropic-version",
                "value": "2023-06-01"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\"model\":\"claude-opus-5\",\"max_tokens\":256,\"messages\":[{\"role\":\"user\",\"content\":\"Reply with OK only.\"}]}"
            },
            "url": "{{baseUrl}}/v1/messages"
          }
        }
      ]
    }
  ]
}
