{
  "openapi": "3.1.0",
  "info": {
    "title": "llm11 API",
    "version": "0.1.0",
    "description": "An LLM router that sends every call to the cheapest model that can answer it, checks the answer, and bills in credits at provider cost."
  },
  "servers": [
    {
      "url": "https://www.llm11.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "summary": "OpenAI-compatible chat completion, triaged and verified",
        "operationId": "createChatCompletion",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "messages"
                ],
                "properties": {
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string"
                        },
                        "content": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "context": {
                    "type": "string",
                    "description": "Optional source text the groundedness check verifies the answer against."
                  },
                  "model": {
                    "type": "string",
                    "description": "A routing pack (llm11-fast, llm11-balanced, llm11-smart, llm11-auto) or a specific catalogue model id to pin."
                  },
                  "llm11_models": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "An explicit candidate pool for this request, overriding both `model` and the project default."
                  },
                  "temperature": {
                    "type": "number"
                  },
                  "max_tokens": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A chat completion with a receipt in `_llm11`."
          },
          "400": {
            "description": "Malformed body, or model/llm11_models named a pack or id that does not exist."
          },
          "401": {
            "description": "Missing or invalid API key."
          },
          "402": {
            "description": "Insufficient prepaid credit balance."
          },
          "502": {
            "description": "The upstream model provider failed."
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "summary": "Anthropic Messages-API-compatible endpoint, same engine as /v1/chat/completions",
        "operationId": "createMessage"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "An llm11_live_… or llm11_sandbox_… API key."
      }
    }
  }
}