{
 "openapi": "3.1.0",
 "info": {
  "title": "AI Prime Tech Gateway API",
  "version": "1.0.0",
  "description": "Anthropic-compatible and OpenAI-compatible endpoints. Point any standard SDK at this base URL and use your gateway key. Independent service, not affiliated with Anthropic.",
  "termsOfService": "https://aiprimetech.io/legal/terms",
  "contact": {
   "url": "https://aiprimetech.io/docs/"
  }
 },
 "servers": [
  {
   "url": "https://aiprimetech.io",
   "description": "Production gateway"
  }
 ],
 "components": {
  "securitySchemes": {
   "anthropicKey": {
    "type": "apiKey",
    "in": "header",
    "name": "x-api-key"
   },
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  }
 },
 "security": [
  {
   "anthropicKey": []
  },
  {
   "bearer": []
  }
 ],
 "paths": {
  "/v1/messages": {
   "post": {
    "summary": "Create a message (Anthropic Messages API)",
    "operationId": "createMessage",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "model",
         "max_tokens",
         "messages"
        ],
        "properties": {
         "model": {
          "type": "string",
          "enum": [
           "claude-opus-4-8",
           "claude-fable-5",
           "claude-sonnet-4-6",
           "claude-haiku-4-5",
           "claude-sonnet-4-6 (context-1m beta)",
           "gpt-5.5",
           "gpt-5",
           "gemini-3-pro",
           "gemini-3-flash",
           "minimax-m3"
          ]
         },
         "max_tokens": {
          "type": "integer",
          "example": 1024
         },
         "stream": {
          "type": "boolean",
          "default": false
         },
         "system": {
          "type": "string"
         },
         "messages": {
          "type": "array",
          "items": {
           "type": "object",
           "properties": {
            "role": {
             "type": "string",
             "enum": [
              "user",
              "assistant"
             ]
            },
            "content": {
             "type": "string"
            }
           }
          }
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Message response (SSE when stream=true)"
     },
     "401": {
      "description": "Invalid or missing key"
     },
     "429": {
      "description": "Rate limited"
     }
    }
   }
  },
  "/v1/chat/completions": {
   "post": {
    "summary": "Create a chat completion (OpenAI-compatible)",
    "operationId": "createChatCompletion",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "model",
         "messages"
        ],
        "properties": {
         "model": {
          "type": "string",
          "enum": [
           "claude-opus-4-8",
           "claude-fable-5",
           "claude-sonnet-4-6",
           "claude-haiku-4-5",
           "claude-sonnet-4-6 (context-1m beta)",
           "gpt-5.5",
           "gpt-5",
           "gemini-3-pro",
           "gemini-3-flash",
           "minimax-m3"
          ]
         },
         "stream": {
          "type": "boolean",
          "default": false
         },
         "messages": {
          "type": "array",
          "items": {
           "type": "object"
          }
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Completion response"
     }
    }
   }
  },
  "/v1/models": {
   "get": {
    "summary": "List available models",
    "operationId": "listModels",
    "responses": {
     "200": {
      "description": "Model catalog"
     }
    }
   }
  }
 }
}