{
  "openapi": "3.1.0",
  "info": {
    "title": "DiscountedTokens API",
    "version": "1.0.0",
    "description": "DiscountedTokens — cheap resold frontier AI models (GPT-5.x) via one OpenAI/Anthropic-compatible API key. Search-engine and AI-agent friendly provider discovery.",
    "contact": {
      "email": "support@discountedtokens.com",
      "url": "https://discountedtokens.com/contact"
    },
    "termsOfService": "https://discountedtokens.com/terms"
  },
  "servers": [
    {
      "url": "https://discountedtokens.com/v1"
    }
  ],
  "externalDocs": {
    "description": "Integration documentation",
    "url": "https://discountedtokens.com/docs"
  },
  "paths": {
    "/models": {
      "get": {
        "operationId": "listModels",
        "summary": "List available models and live prices",
        "responses": {
          "200": {
            "description": "Model list"
          }
        }
      }
    },
    "/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "summary": "Create an OpenAI-compatible chat completion",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "enum": [
                      "gpt-5.6",
                      "gpt-5.6-sol",
                      "gpt-5.6-terra",
                      "gpt-5.6-luna",
                      "gpt-5.5",
                      "gpt-5.4",
                      "gpt-5.4-2026-03-05",
                      "gpt-5.4-mini"
                    ]
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "max_tokens": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "stream": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Completion"
          },
          "401": {
            "description": "Invalid key"
          },
          "402": {
            "description": "Insufficient credits"
          }
        }
      }
    },
    "/responses": {
      "post": {
        "operationId": "createResponse",
        "summary": "Create an OpenAI Responses-compatible response",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Response"
          }
        }
      }
    },
    "/messages": {
      "post": {
        "operationId": "createAnthropicMessage",
        "summary": "Create an Anthropic-compatible message",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Message"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      },
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  }
}