{
  "openapi": "3.1.0",
  "info": {
    "title": "DiscountedTokens API",
    "version": "1.0.0",
    "description": "Low-cost prepaid model inference for autonomous agents and developers. Independent reseller with OpenAI-, Responses-, and Anthropic-format endpoints.\n\nLowest quoted token-usage estimate for the example below: gpt-6-sol, at US$0.100 input / US$0.500 output per 1M tokens.\n\nExample: 1,000 requests, each with 2,000 billed input tokens and 500 billed output tokens, accrue approximately US$0.45 in token usage. This is not a flat price per request or a guarantee for arbitrary agent tasks. Use reported billed-token counts, not just the visible prompt or answer.\n\nMinimum credit purchase: US$5, card or supported crypto. It becomes your prepaid balance, not a per-request charge. No subscription or free trial.\n\nQuotes checked: 2026-10-15T03:10:03.000Z. Rates can change; retrieve https://discountedtokens.com/api/pricing before budgeting. Reference-only models are not sold through this API.\n\nSuccessful API requests are billed at the displayed token rates, metered to a fraction of a cent. Charges accumulate and are deducted from your prepaid balance in whole US cents, so a small request is not rounded up to a minimum charge.",
    "x-discountedtokens-pricing": {
      "price_status": "current",
      "currency": "USD",
      "unit": "per_million_tokens",
      "pricing_url": "https://discountedtokens.com/api/pricing",
      "catalog_url": "https://discountedtokens.com/v1/models",
      "minimum_credit_purchase_usd": 5,
      "billing_model": "prepaid_per_token",
      "free_trial": false,
      "authorization": "Purchase credits only with operator authorization or an operator-approved budget.",
      "assumptions": "Examples use the stated billed input/output counts, including any reported system or reasoning tokens. They are token-usage estimates, not a flat price per request or agent task. Extra usage, tools and payment/FX costs are not included.",
      "price_checked_at": "2026-10-15T03:10:03.000Z",
      "models": [
        {
          "id": "gpt-5.6-sol",
          "name": "GPT-5.6 Sol",
          "input_usd_per_million": 0.25,
          "output_usd_per_million": 1.5
        },
        {
          "id": "gpt-5.6-terra",
          "name": "GPT-5.6 Terra",
          "input_usd_per_million": 0.1,
          "output_usd_per_million": 0.6
        },
        {
          "id": "gpt-5.5",
          "name": "GPT-5.5",
          "input_usd_per_million": 0.25,
          "output_usd_per_million": 1.5
        },
        {
          "id": "gpt-5.6",
          "name": "GPT-5.6",
          "input_usd_per_million": 0.2,
          "output_usd_per_million": 1
        },
        {
          "id": "gpt-6-astra",
          "name": "GPT-6 Astra",
          "input_usd_per_million": 0.5,
          "output_usd_per_million": 2.5
        },
        {
          "id": "gpt-6-sol",
          "name": "GPT-6 Sol",
          "input_usd_per_million": 0.1,
          "output_usd_per_million": 0.5
        },
        {
          "id": "gpt-6.1-sol",
          "name": "GPT-6.1 Sol",
          "input_usd_per_million": 0.1,
          "output_usd_per_million": 0.5
        },
        {
          "id": "codex-auto-review",
          "name": "Codex Auto Review",
          "input_usd_per_million": 0.25,
          "output_usd_per_million": 1.5
        }
      ],
      "example": {
        "model": "gpt-6-sol",
        "requests": 1000,
        "input_tokens_per_request": 2000,
        "output_tokens_per_request": 500,
        "input_usd_per_million": 0.1,
        "output_usd_per_million": 0.5,
        "estimated_usage_usd": 0.45
      }
    },
    "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-sol",
                      "gpt-5.6-terra",
                      "gpt-5.5",
                      "gpt-5.6",
                      "gpt-6-astra",
                      "gpt-6-sol",
                      "gpt-6.1-sol",
                      "codex-auto-review"
                    ]
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "max_tokens": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "stream": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Completion",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "usage": {
                      "$ref": "#/components/schemas/Usage"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid key"
          },
          "402": {
            "description": "Insufficient credits"
          }
        }
      }
    },
    "/responses": {
      "post": {
        "operationId": "createResponse",
        "summary": "Create an OpenAI Responses-compatible response",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Documented text-only request format. Instructions are prepended as system text; system, developer, user and assistant input text is forwarded, with text blocks flattened. Tools, images, previous-response state and streaming are not implemented by this adapter.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "input"
                ],
                "additionalProperties": false,
                "properties": {
                  "model": {
                    "type": "string",
                    "enum": [
                      "gpt-5.6-sol",
                      "gpt-5.6-terra",
                      "gpt-5.5",
                      "gpt-5.6",
                      "gpt-6-astra",
                      "gpt-6-sol",
                      "gpt-6.1-sol",
                      "codex-auto-review"
                    ],
                    "default": "gpt-5.5"
                  },
                  "input": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "role",
                            "content"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "role": {
                              "type": "string",
                              "enum": [
                                "user",
                                "assistant",
                                "system",
                                "developer"
                              ]
                            },
                            "content": {
                              "oneOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "required": [
                                      "text"
                                    ],
                                    "additionalProperties": false,
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "description": "Text-block label, such as text or input_text. Only the text field is forwarded."
                                      },
                                      "text": {
                                        "type": "string"
                                      }
                                    }
                                  }
                                }
                              ]
                            }
                          }
                        }
                      }
                    ]
                  },
                  "max_output_tokens": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2000000,
                    "default": 4096,
                    "description": "Proxy validation ceiling only; the upstream model may impose a lower output limit."
                  },
                  "instructions": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Optional system text prepended before input messages."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Response"
          }
        }
      }
    },
    "/messages": {
      "post": {
        "operationId": "createAnthropicMessage",
        "summary": "Create an Anthropic-compatible message",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Documented text-only request format. System text and user/assistant messages are forwarded, with text blocks flattened. Tool calls, images and streaming are not implemented by this adapter.",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "messages"
                ],
                "additionalProperties": false,
                "properties": {
                  "model": {
                    "type": "string",
                    "enum": [
                      "gpt-5.6-sol",
                      "gpt-5.6-terra",
                      "gpt-5.5",
                      "gpt-5.6",
                      "gpt-6-astra",
                      "gpt-6-sol",
                      "gpt-6.1-sol",
                      "codex-auto-review"
                    ],
                    "default": "gpt-5.5"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "role",
                        "content"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "user",
                            "assistant"
                          ]
                        },
                        "content": {
                          "oneOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "required": [
                                  "text"
                                ],
                                "additionalProperties": false,
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "description": "Text-block label, such as text or input_text. Only the text field is forwarded."
                                  },
                                  "text": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  },
                  "system": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "required": [
                            "text"
                          ],
                          "additionalProperties": false,
                          "properties": {
                            "type": {
                              "type": "string",
                              "description": "Text-block label, such as text or input_text. Only the text field is forwarded."
                            },
                            "text": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    ]
                  },
                  "max_tokens": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2000000,
                    "default": 4096,
                    "description": "Proxy validation ceiling only; the upstream model may impose a lower output limit."
                  },
                  "temperature": {
                    "type": "number"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      },
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    },
    "schemas": {
      "Usage": {
        "type": "object",
        "description": "Successful API requests are billed at the displayed token rates, metered to a fraction of a cent. Charges accumulate and are deducted from your prepaid balance in whole US cents, so a small request is not rounded up to a minimum charge.",
        "properties": {
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer"
          },
          "reseller_cost_usd": {
            "type": "string",
            "description": "Exact metered cost of this request in USD, six decimals."
          },
          "reseller_cost_micros": {
            "type": "integer",
            "description": "Exact metered cost in micro-USD (1e-6 USD), before whole-cent deduction."
          },
          "charged_cents": {
            "type": "integer",
            "description": "Whole US cents deducted from the prepaid balance for this request; the sub-cent remainder carries to later requests."
          },
          "sell_rate_in_usd": {
            "type": "number",
            "description": "Input rate applied, USD per million tokens."
          },
          "sell_rate_out_usd": {
            "type": "number",
            "description": "Output rate applied, USD per million tokens."
          }
        }
      }
    }
  }
}