{
  "openapi": "3.1.0",
  "info": {
    "title": "Unrestricted AI API",
    "version": "0.1.0",
    "description": "Early-access multi-model API. GET /models lists currently enabled chat models; a research listing does not imply serving availability. Text chat completions with SSE, and text-to-image generation at POST /images/generations.",
    "contact": {
      "name": "Unrestricted AI Operations",
      "url": "https://tryunrestrictedai.com/contact",
      "email": "ops@tryunrestrictedai.com"
    }
  },
  "servers": [
    {
      "url": "https://tryunrestrictedai.com/v1"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "ChatRequest": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "Public model ID from GET /models. Availability, context and output limits are model-specific."
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 256,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "role",
                "content"
              ],
              "properties": {
                "role": {
                  "enum": [
                    "system",
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60000
                }
              }
            }
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "default": 512
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 2,
            "default": 0.7
          },
          "top_p": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "stop": {
            "description": "Up to 4 stop sequences. Generation ends before any of them.",
            "oneOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 200
                },
                "minItems": 1,
                "maxItems": 4
              }
            ]
          },
          "stream": {
            "type": "boolean",
            "default": false
          },
          "stream_options": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "include_usage"
            ],
            "properties": {
              "include_usage": {
                "const": true
              }
            }
          }
        },
        "description": "OpenAI-compatible request. Sampling fields sent by clients such as SillyTavern and JanitorAI (presence_penalty, frequency_penalty, top_k, stop, seed, logit_bias, message name, and similar) are accepted and ignored. Tools, images and n>1 are rejected."
      },
      "ImageRequest": {
        "type": "object",
        "required": [
          "prompt"
        ],
        "additionalProperties": false,
        "properties": {
          "prompt": {
            "type": "string",
            "maxLength": 1500
          },
          "model": {
            "type": "string",
            "enum": [
              "lustify-v8",
              "flux-dev",
              "chroma",
              "pony-realism",
              "anime-illustrious",
              "z-image-turbo",
              "flux-schnell"
            ],
            "default": "lustify-v8",
            "description": "dall-e-* and gpt-image-* names map to the default model. Prices: lustify-v8 $0.025, flux-dev $0.025, chroma $0.025, pony-realism $0.015, anime-illustrious $0.025, z-image-turbo $0.025, flux-schnell $0.01"
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4,
            "default": 1
          },
          "size": {
            "type": "string",
            "example": "1024x1024",
            "description": "Mapped to the nearest supported aspect ratio"
          },
          "aspect_ratio": {
            "type": "string",
            "enum": [
              "1:1",
              "3:4",
              "4:3",
              "2:3",
              "3:2",
              "9:16",
              "16:9"
            ]
          },
          "response_format": {
            "type": "string",
            "enum": [
              "b64_json",
              "url"
            ],
            "default": "b64_json"
          },
          "negative_prompt": {
            "type": "string",
            "maxLength": 1000,
            "description": "Ignored by FLUX models"
          },
          "seed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 999999999
          },
          "quality": {
            "type": "string",
            "description": "Accepted and ignored"
          },
          "style": {
            "type": "string",
            "description": "Accepted and ignored"
          },
          "user": {
            "type": "string",
            "description": "Accepted and ignored"
          }
        }
      },
      "ImageResponse": {
        "type": "object",
        "properties": {
          "created": {
            "type": "integer"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "b64_json": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "revised_prompt": {
                  "type": "null"
                }
              }
            }
          },
          "model": {
            "type": "string"
          },
          "seed": {
            "type": "integer"
          },
          "output_format": {
            "type": "string",
            "enum": [
              "webp"
            ]
          },
          "usage": {
            "type": "object",
            "properties": {
              "images": {
                "type": "integer"
              },
              "cost_usd": {
                "type": "number"
              }
            }
          }
        }
      }
    }
  },
  "paths": {
    "/models": {
      "get": {
        "summary": "List enabled public models",
        "responses": {
          "200": {
            "description": "A model list; data is empty before inference opens."
          },
          "401": {
            "description": "Invalid key"
          }
        }
      }
    },
    "/chat/completions": {
      "post": {
        "summary": "Generate text from messages",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_.:-]{8,128}$"
            },
            "description": "A repeated key returns 409; completed responses are not replayed."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Chat completion JSON, or text/event-stream with stream=true. Includes confirmed token usage."
          },
          "400": {
            "description": "Invalid or unsupported fields"
          },
          "401": {
            "description": "Invalid API key"
          },
          "402": {
            "description": "Insufficient credit or key budget"
          },
          "409": {
            "description": "Duplicate idempotency key"
          },
          "413": {
            "description": "Request exceeds conservative context or body limit"
          },
          "429": {
            "description": "Rate or concurrency limit"
          },
          "502": {
            "description": "Provider failure or unresolved usage; check request history before retrying"
          },
          "503": {
            "description": "Inference unavailable; no new reservation"
          }
        }
      }
    },
    "/images/generations": {
      "post": {
        "summary": "Generate images from a text prompt (OpenAI-compatible)",
        "description": "Two hard limits on every plan: no sexual or suggestive content involving minors or anyone who could read as under 18, and no sexual or nude images of real, identifiable people. Adult prompts need a paid plan or a credit top-up. The price for n images is reserved first and only returned images are charged.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_.:-]{8,128}$"
            },
            "description": "A repeated key returns 409."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Images as WebP: data[].b64_json, or data[].url valid 24 hours with response_format=url. Includes usage.images and usage.cost_usd.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid fields, or content_policy_violation (blocked prompt, not charged)"
          },
          "401": {
            "description": "Invalid API key"
          },
          "402": {
            "description": "Insufficient credit or key budget"
          },
          "403": {
            "description": "adult_requires_paid, or image_suspended after repeated violations"
          },
          "409": {
            "description": "Duplicate idempotency key"
          },
          "422": {
            "description": "provider_refused: the provider refused the prompt; not charged"
          },
          "429": {
            "description": "Rate or concurrency limit"
          },
          "502": {
            "description": "image_upstream_failed: every provider failed; not charged"
          },
          "503": {
            "description": "Image generation unavailable"
          }
        }
      }
    }
  }
}
