{
  "openapi": "3.0.3",
  "info": {
    "title": "Flonno API",
    "version": "2026-09-30",
    "description": "OpenAI-compatible text Chat Completions gateway. Requests currently forward to an external inference service. Requires a scoped Flonno bearer key and funds when prepaid billing is enabled. Only documented endpoints are implemented. Prices and availability may change.",
    "termsOfService": "https://www.flonno.com/terms"
  },
  "servers": [
    {
      "url": "https://www.flonno.com/v1"
    }
  ],
  "security": [
    {
      "flonnoBearer": []
    }
  ],
  "components": {
    "securitySchemes": {
      "flonnoBearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Flonno API key. Do not put real keys in this document."
      }
    }
  },
  "paths": {
    "/models": {
      "get": {
        "operationId": "listModels",
        "summary": "List models allowed for this key",
        "description": "Requires models:read. Returns model IDs, not pricing or inference locations.",
        "responses": {
          "200": {
            "description": "Available models.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "object",
                    "data"
                  ],
                  "properties": {
                    "object": {
                      "type": "string",
                      "enum": [
                        "list"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "object": {
                            "type": "string"
                          },
                          "created": {
                            "type": "integer"
                          },
                          "owned_by": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or unsupported model."
          },
          "401": {
            "description": "Missing, invalid, expired or revoked key."
          },
          "403": {
            "description": "Permission, model access or IP restriction."
          },
          "402": {
            "description": "Insufficient available prepaid credit."
          },
          "429": {
            "description": "Rate limit exceeded."
          },
          "503": {
            "description": "Service or dependency unavailable."
          }
        }
      }
    },
    "/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "summary": "Generate a text chat completion",
        "description": "Requires chat:completions and selected model access. Input and output tokens are billable. The import example covers text messages; extra optional fields depend on the gateway and model.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "example": "glm-5.3-flash-tee"
                  },
                  "messages": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "role",
                        "content"
                      ],
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "system",
                            "user",
                            "assistant"
                          ]
                        },
                        "content": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "max_tokens": {
                    "type": "integer",
                    "minimum": 1,
                    "default": 128
                  },
                  "stream": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "additionalProperties": true
              },
              "example": {
                "model": "glm-5.3-flash-tee",
                "messages": [
                  {
                    "role": "user",
                    "content": "Give one practical tip for organizing support tickets."
                  }
                ],
                "max_tokens": 128,
                "stream": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Chat Completions JSON or an SSE stream.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or unsupported model."
          },
          "401": {
            "description": "Missing, invalid, expired or revoked key."
          },
          "403": {
            "description": "Permission, model access or IP restriction."
          },
          "402": {
            "description": "Insufficient available prepaid credit."
          },
          "429": {
            "description": "Rate limit exceeded."
          },
          "503": {
            "description": "Service or dependency unavailable."
          }
        }
      }
    }
  }
}
