{
  "openapi": "3.0.3",
  "info": {
    "title": "Bifrost — Intelligent AI Gateway",
    "description": "OpenAI-compatible AI execution layer with intelligent routing, optimization, caching, and recovery across 14 providers and 48+ models.",
    "version": "0.1.0",
    "contact": {
      "name": "OMIX Digital Solutions",
      "url": "https://omixsystems.store",
      "email": "omixsystems@gmail.com"
    }
  },
  "servers": [
    {
      "url": "https://bifrost.omixsystems.store/v1",
      "description": "Production"
    }
  ],
  "paths": {
    "/chat/completions": {
      "post": {
        "operationId": "chatCompletions",
        "summary": "Chat Completions",
        "description": "Create a chat completion. Compatible with OpenAI API format. Use model 'bifrost/auto' for intelligent routing, or specify a model directly.",
        "tags": ["Completions"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["model", "messages"],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Model ID. Use 'bifrost/auto' for automatic routing, or a specific model like 'gpt-4o', 'claude-sonnet-4', 'gemini-2.5-flash'.",
                    "example": "bifrost/auto"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": ["role", "content"],
                      "properties": {
                        "role": { "type": "string", "enum": ["system", "user", "assistant"] },
                        "content": { "type": "string" }
                      }
                    }
                  },
                  "stream": { "type": "boolean", "default": false },
                  "temperature": { "type": "number", "default": 0.7 },
                  "max_tokens": { "type": "integer", "default": 4096 },
                  "tools": { "type": "array" },
                  "tool_choice": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Chat completion response",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ChatCompletion" }
              }
            }
          }
        }
      }
    },
    "/models": {
      "get": {
        "operationId": "listModels",
        "summary": "List Models",
        "description": "List all available models across all registered providers.",
        "tags": ["Models"],
        "responses": {
          "200": {
            "description": "List of models",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": { "type": "string", "example": "list" },
                    "data": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Model" }
                    },
                    "total": { "type": "integer" }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ChatCompletion": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "object": { "type": "string", "example": "chat.completion" },
          "created": { "type": "integer" },
          "model": { "type": "string" },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": { "type": "integer" },
                "message": {
                  "type": "object",
                  "properties": {
                    "role": { "type": "string" },
                    "content": { "type": "string" }
                  }
                },
                "finish_reason": { "type": "string" }
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": { "type": "integer" },
              "completion_tokens": { "type": "integer" },
              "total_tokens": { "type": "integer" }
            }
          }
        }
      },
      "Model": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "object": { "type": "string", "example": "model" },
          "created": { "type": "integer" },
          "owned_by": { "type": "string" },
          "provider": { "type": "string" },
          "display_name": { "type": "string" },
          "context_window": { "type": "integer" },
          "capabilities": {
            "type": "object",
            "properties": {
              "streaming": { "type": "boolean" },
              "tool_use": { "type": "boolean" }
            }
          },
          "pricing": {
            "type": "object",
            "properties": {
              "input": { "type": "number" },
              "output": { "type": "number" }
            }
          }
        }
      }
    }
  }
}
