{
  "openapi": "3.0.3",
  "info": {
    "title": "BeefAPI Public API",
    "version": "2026-07-08",
    "description": "Curated public contract for AI agents and developers discovering BeefAPI. It intentionally lists stable public and developer-facing surfaces, not the full admin/dashboard API."
  },
  "servers": [
    {
      "url": "https://beefapi.com",
      "description": "BeefAPI production"
    }
  ],
  "externalDocs": {
    "description": "BeefAPI agent discovery entrypoint",
    "url": "https://beefapi.com/llms.txt"
  },
  "tags": [
    {
      "name": "Public Discovery"
    },
    {
      "name": "Models"
    },
    {
      "name": "OpenAI Compatible"
    },
    {
      "name": "Anthropic Compatible"
    },
    {
      "name": "Gemini Compatible"
    }
  ],
  "paths": {
    "/api/status": {
      "get": {
        "tags": [
          "Public Discovery"
        ],
        "summary": "Get public service status metadata",
        "operationId": "getPublicStatus",
        "responses": {
          "200": {
            "description": "Public status metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/pricing.json": {
      "get": {
        "tags": [
          "Public Discovery"
        ],
        "summary": "Get the canonical public pricing snapshot",
        "operationId": "getPublicPricingJson",
        "responses": {
          "200": {
            "description": "Non-personalized public pricing, model, group, vendor, and endpoint snapshot.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicPricingSnapshot"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/pricing": {
      "get": {
        "tags": [
          "Public Discovery"
        ],
        "summary": "Get the public pricing snapshot API alias",
        "operationId": "getPublicPricingApi",
        "responses": {
          "200": {
            "description": "Same payload as /pricing.json.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicPricingSnapshot"
                }
              }
            }
          }
        }
      }
    },
    "/v1/models": {
      "get": {
        "tags": [
          "Models"
        ],
        "summary": "List available models for an API key",
        "operationId": "listModels",
        "security": [
          {
            "BeefAPIKeyBearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "OpenAI-compatible model list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/responses": {
      "post": {
        "tags": [
          "OpenAI Compatible"
        ],
        "summary": "Create an OpenAI-compatible Responses API request",
        "operationId": "createResponse",
        "security": [
          {
            "BeefAPIKeyBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpenAIResponsesRequest"
              },
              "examples": {
                "basic": {
                  "value": {
                    "model": "gpt-5.5",
                    "input": "Reply in one short sentence.",
                    "stream": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Responses API result or stream.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "tags": [
          "OpenAI Compatible"
        ],
        "summary": "Create an OpenAI-compatible Chat Completions request",
        "description": "Compatibility path. For new OpenAI/Codex-style integrations, prefer /v1/responses when supported by the client.",
        "operationId": "createChatCompletion",
        "deprecated": true,
        "security": [
          {
            "BeefAPIKeyBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Chat completion result or stream.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "tags": [
          "Anthropic Compatible"
        ],
        "summary": "Create an Anthropic-compatible Messages request",
        "operationId": "createAnthropicMessage",
        "security": [
          {
            "AnthropicAPIKey": []
          }
        ],
        "parameters": [
          {
            "name": "anthropic-version",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "example": "2023-06-01"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Anthropic Messages-compatible result or stream.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1beta/models": {
      "get": {
        "tags": [
          "Gemini Compatible"
        ],
        "summary": "List models in Gemini-compatible format",
        "operationId": "listGeminiModels",
        "security": [
          {
            "GeminiAPIKeyHeader": []
          },
          {
            "GeminiAPIKeyQuery": []
          }
        ],
        "responses": {
          "200": {
            "description": "Gemini-compatible model list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/v1beta/models/{model}:generateContent": {
      "post": {
        "tags": [
          "Gemini Compatible"
        ],
        "summary": "Generate content in Gemini-compatible format",
        "operationId": "generateGeminiContent",
        "security": [
          {
            "GeminiAPIKeyHeader": []
          },
          {
            "GeminiAPIKeyQuery": []
          }
        ],
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Gemini-compatible generation result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BeefAPIKeyBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "BeefAPI API key",
        "description": "Use Authorization: Bearer sk-..."
      },
      "AnthropicAPIKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Use a BeefAPI sk-... API key."
      },
      "GeminiAPIKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "x-goog-api-key",
        "description": "Use a BeefAPI sk-... API key."
      },
      "GeminiAPIKeyQuery": {
        "type": "apiKey",
        "in": "query",
        "name": "key",
        "description": "Use a BeefAPI sk-... API key."
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Missing, invalid, expired, or unauthorized API key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "error": {
            "type": "object",
            "additionalProperties": true
          },
          "message": {
            "type": "string"
          }
        }
      },
      "PublicPricingSnapshot": {
        "type": "object",
        "required": [
          "schema_version",
          "kind",
          "generated_at",
          "pricing_version",
          "cache_ttl_seconds",
          "currency",
          "pricing_formula",
          "canonical_urls",
          "public_groups",
          "group_ratio",
          "models",
          "vendors",
          "supported_endpoint",
          "official_model_prices"
        ],
        "properties": {
          "schema_version": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "beefapi.public_pricing_snapshot"
            ]
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "pricing_version": {
            "type": "string",
            "description": "sha256-prefixed hash of public pricing facts. Changes when public price/model/group/currency facts change.",
            "pattern": "^sha256:[a-f0-9]{64}$"
          },
          "cache_ttl_seconds": {
            "type": "integer"
          },
          "currency_note": {
            "type": "string"
          },
          "currency": {
            "$ref": "#/components/schemas/PublicPricingCurrency"
          },
          "pricing_formula": {
            "$ref": "#/components/schemas/PublicPricingFormula"
          },
          "canonical_urls": {
            "type": "object",
            "required": [
              "pricing_json",
              "public_pricing_api",
              "authenticated_pricing_api",
              "docs"
            ],
            "properties": {
              "pricing_json": {
                "type": "string",
                "format": "uri"
              },
              "public_pricing_api": {
                "type": "string",
                "format": "uri"
              },
              "authenticated_pricing_api": {
                "type": "string",
                "format": "uri"
              },
              "docs": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "public_groups": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "group_ratio": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            }
          },
          "models": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicPricingModel"
            }
          },
          "vendors": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "supported_endpoint": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "official_model_prices": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "disclaimer": {
            "type": "string"
          }
        }
      },
      "PublicPricingCurrency": {
        "type": "object",
        "required": [
          "primary_currency",
          "primary_symbol",
          "secondary_currency",
          "secondary_symbol",
          "usd_to_cny",
          "base_to_primary_rate",
          "primary_to_usd",
          "usd_exchange_rate_source",
          "usd_exchange_rate_last_sync",
          "quota_per_usd",
          "quota_per_cny"
        ],
        "properties": {
          "primary_currency": {
            "type": "string",
            "enum": [
              "CNY"
            ]
          },
          "primary_symbol": {
            "type": "string",
            "example": "¥"
          },
          "secondary_currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "secondary_symbol": {
            "type": "string",
            "example": "$"
          },
          "usd_to_cny": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "base_to_primary_rate": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Same conversion multiplier used by the public pricing page to display model ratio prices in the primary currency."
          },
          "primary_to_usd": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true,
            "description": "Multiplier from the primary display currency amount to USD equivalent."
          },
          "usd_exchange_rate_source": {
            "type": "string"
          },
          "usd_exchange_rate_last_sync": {
            "type": "integer",
            "description": "Unix timestamp in seconds. 0 means never synced or unavailable."
          },
          "quota_per_usd": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "quota_per_cny": {
            "type": "number",
            "minimum": 0,
            "exclusiveMinimum": true
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "PublicPricingFormula": {
        "type": "object",
        "required": [
          "quota_type_token_ratio",
          "quota_type_fixed_price",
          "token_price_unit",
          "fixed_price_unit",
          "ratio_input_usd_formula",
          "ratio_output_usd_formula",
          "fixed_price_usd_formula",
          "cny_conversion_formula",
          "quota_conversion_formula",
          "authenticated_finality_note"
        ],
        "properties": {
          "quota_type_token_ratio": {
            "type": "integer",
            "enum": [
              0
            ]
          },
          "quota_type_fixed_price": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "token_price_unit": {
            "type": "string",
            "enum": [
              "per_1m_tokens"
            ]
          },
          "fixed_price_unit": {
            "type": "string",
            "enum": [
              "per_request_or_task"
            ]
          },
          "ratio_input_usd_formula": {
            "type": "string"
          },
          "ratio_output_usd_formula": {
            "type": "string"
          },
          "fixed_price_usd_formula": {
            "type": "string"
          },
          "cny_conversion_formula": {
            "type": "string"
          },
          "quota_conversion_formula": {
            "type": "string"
          },
          "authenticated_finality_note": {
            "type": "string"
          }
        }
      },
      "PublicPricingModel": {
        "type": "object",
        "required": [
          "model_name",
          "quota_type",
          "quota_type_label",
          "enable_groups",
          "supported_endpoint_types",
          "price_estimates"
        ],
        "properties": {
          "model_name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "icon": {
            "type": "string"
          },
          "tags": {
            "type": "string"
          },
          "vendor_id": {
            "type": "integer"
          },
          "quota_type": {
            "type": "integer",
            "enum": [
              0,
              1
            ]
          },
          "quota_type_label": {
            "type": "string",
            "enum": [
              "token_ratio",
              "fixed_price",
              "unknown"
            ]
          },
          "model_ratio": {
            "type": "number",
            "description": "Token-ratio billing input used by pricing_formula."
          },
          "model_price_usd": {
            "type": "number",
            "description": "Fixed-price billing input in USD before group ratio."
          },
          "completion_ratio": {
            "type": "number"
          },
          "cache_ratio": {
            "type": "number"
          },
          "create_cache_ratio": {
            "type": "number"
          },
          "image_ratio": {
            "type": "number"
          },
          "audio_ratio": {
            "type": "number"
          },
          "audio_completion_ratio": {
            "type": "number"
          },
          "enable_groups": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "supported_endpoint_types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "price_estimates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicModelPriceEstimate"
            }
          }
        }
      },
      "PublicModelPriceEstimate": {
        "type": "object",
        "required": [
          "group",
          "group_ratio",
          "billing_mode",
          "unit",
          "formula"
        ],
        "properties": {
          "group": {
            "type": "string"
          },
          "group_label": {
            "type": "string"
          },
          "group_ratio": {
            "type": "number"
          },
          "billing_mode": {
            "type": "string",
            "enum": [
              "token_ratio",
              "fixed_price"
            ]
          },
          "unit": {
            "type": "string",
            "enum": [
              "per_1m_tokens",
              "per_request_or_task"
            ]
          },
          "input_cny": {
            "type": "number"
          },
          "input_usd": {
            "type": "number"
          },
          "output_cny": {
            "type": "number"
          },
          "output_usd": {
            "type": "number"
          },
          "cache_read_cny": {
            "type": "number"
          },
          "cache_read_usd": {
            "type": "number"
          },
          "cache_write_cny": {
            "type": "number"
          },
          "cache_write_usd": {
            "type": "number"
          },
          "image_input_cny": {
            "type": "number"
          },
          "image_input_usd": {
            "type": "number"
          },
          "audio_input_cny": {
            "type": "number"
          },
          "audio_input_usd": {
            "type": "number"
          },
          "audio_output_cny": {
            "type": "number"
          },
          "audio_output_usd": {
            "type": "number"
          },
          "fixed_price_cny": {
            "type": "number"
          },
          "fixed_price_usd": {
            "type": "number"
          },
          "formula": {
            "type": "string"
          }
        }
      },
      "OpenAIResponsesRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "additionalProperties": true,
        "properties": {
          "model": {
            "type": "string"
          },
          "input": {},
          "stream": {
            "type": "boolean"
          },
          "max_output_tokens": {
            "type": "integer"
          }
        }
      }
    }
  }
}
