{
  "openapi": "3.1.0",
  "info": {
    "title": "VANTRA API",
    "version": "2026-11-20",
    "description": "OpenAI-compatible chat completions and embeddings with zero data retention: prompts and answers are handled in memory and never stored or used for training. Docs: https://vantra.cloud/docs",
    "contact": {
      "email": "support@vantra.cloud",
      "url": "https://vantra.cloud/docs"
    }
  },
  "servers": [
    {
      "url": "https://vantra.cloud/api/v1"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "paths": {
    "/balance": {
      "get": {
        "summary": "What this key can still spend",
        "description": "Your prepaid credit (shared by all your keys, or this key’s own for admin-made keys), this month’s spending and requests on this key, its monthly limit, allowed models and expiry. Never charged.",
        "responses": {
          "200": {
            "description": "The balance, in US dollars",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, revoked or expired key"
          }
        }
      }
    },
    "/usage": {
      "get": {
        "summary": "What this key has used, per day and model",
        "description": "Requests, tokens and spending (US dollars) for this key only, per UTC day and model, with totals. Days with no use are left out. Never charged.",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90,
              "default": 30
            },
            "description": "The last N days, ending today (UTC)"
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "First day (UTC). Use instead of days"
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Last day (UTC), default today; at most 90 days after from"
          }
        ],
        "responses": {
          "200": {
            "description": "Usage per day and model",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "A bad or too long date range"
          },
          "401": {
            "description": "Missing, invalid, revoked or expired key"
          }
        }
      }
    },
    "/requests": {
      "get": {
        "summary": "This key’s request log (last 7 days)",
        "description": "Time, request ID, endpoint, model, status, error code, tokens, cost and duration of this key’s requests, newest first. Never prompts or answers. Never charged.",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "One request, by its x-vantra-request-id"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "errors",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "true: only failed requests (status 400 and above)"
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "For the next page: the \"at\" of the last request you have"
          }
        ],
        "responses": {
          "200": {
            "description": "Requests, newest first, with has_more",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "A bad parameter"
          },
          "401": {
            "description": "Missing, invalid, revoked or expired key"
          },
          "404": {
            "description": "No request with that ID on this key in the last 7 days"
          }
        }
      }
    },
    "/models": {
      "get": {
        "summary": "List models",
        "security": [],
        "responses": {
          "200": {
            "description": "The models, with prices in US dollars per million tokens",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/models/{model}": {
      "get": {
        "summary": "Get one model",
        "description": "The same fields as one entry of GET /models. Works with the OpenAI SDK’s models.retrieve().",
        "security": [],
        "parameters": [
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "core-swift"
          }
        ],
        "responses": {
          "200": {
            "description": "The model",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "No such model (model_not_found)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/chat/completions": {
      "post": {
        "summary": "Create a chat completion",
        "description": "Streams with server-sent events when \"stream\" is true. Supports tools (function calling), JSON output, and pictures for models that read them.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The answer (JSON), or a stream of chat.completion.chunk events ending with \"data: [DONE]\"",
            "headers": {
              "x-vantra-request-id": {
                "schema": {
                  "type": "string"
                }
              },
              "x-vantra-cost-usd": {
                "schema": {
                  "type": "string"
                },
                "description": "Non-streamed answers only"
              },
              "x-vantra-credit-low": {
                "schema": {
                  "type": "string"
                },
                "description": "\"true\" when the credit was under $1 at the start of the request"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (invalid_json, invalid_messages, invalid_tools, invalid_response_format, unsupported_content, model_not_found, wrong_endpoint, context_length_exceeded)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, revoked or expired API key (key_expired)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Credit used up (insufficient_credit) or the key reached its monthly limit (key_limit_reached)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The model is Studio-only (studio_only), or this key is limited to other models (model_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request over 4 MB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 60 requests a minute on one key (see retry-after)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The model host returned an error; nothing was charged",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Model not available (model_unavailable), or busy at the host (model_busy): retry after the retry-after header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "The model host timed out; nothing was charged",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/responses": {
      "post": {
        "summary": "Create a response (OpenAI Responses API)",
        "description": "Text and picture input, instructions, function tools and function_call_output items, tool_choice, text.format (JSON), max_output_tokens, temperature, top_p, reasoning.effort and streaming. Nothing is stored: store is always false and previous_response_id is refused; send the whole conversation in input.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "input"
                ],
                "properties": {
                  "model": {
                    "enum": [
                      "core-swift",
                      "core-apex"
                    ]
                  },
                  "input": {},
                  "instructions": {
                    "type": "string"
                  },
                  "tools": {
                    "type": "array"
                  },
                  "stream": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A response object, or a stream of response.* events",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (invalid_json, invalid_messages, invalid_tools, invalid_response_format, unsupported_content, model_not_found, wrong_endpoint, context_length_exceeded)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, revoked or expired API key (key_expired)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Credit used up (insufficient_credit) or the key reached its monthly limit (key_limit_reached)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The model is Studio-only (studio_only), or this key is limited to other models (model_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request over 4 MB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 60 requests a minute on one key (see retry-after)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The model host returned an error; nothing was charged",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Model not available (model_unavailable), or busy at the host (model_busy): retry after the retry-after header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "The model host timed out; nothing was charged",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/embeddings": {
      "post": {
        "summary": "Create embeddings",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One vector per input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmbeddingResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (invalid_json, invalid_messages, invalid_tools, invalid_response_format, unsupported_content, model_not_found, wrong_endpoint, context_length_exceeded)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, revoked or expired API key (key_expired)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Credit used up (insufficient_credit) or the key reached its monthly limit (key_limit_reached)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The model is Studio-only (studio_only), or this key is limited to other models (model_not_allowed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request over 4 MB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 60 requests a minute on one key (see retry-after)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The model host returned an error; nothing was charged",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Model not available (model_unavailable), or busy at the host (model_busy): retry after the retry-after header",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "The model host timed out; nothing was charged",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your VANTRA API key (vk_…), from https://vantra.cloud/studio/api"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "type": {
                "type": "string"
              },
              "code": {
                "type": "string"
              }
            },
            "required": [
              "message",
              "type",
              "code"
            ]
          }
        }
      },
      "Message": {
        "type": "object",
        "required": [
          "role"
        ],
        "properties": {
          "role": {
            "enum": [
              "system",
              "user",
              "assistant",
              "tool"
            ]
          },
          "content": {
            "description": "Text, or parts. Picture parts (image_url with an https:// or data: URL) only in user messages, for models that read pictures.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              },
              {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "const": "text"
                        },
                        "text": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "text"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "type": {
                          "const": "image_url"
                        },
                        "image_url": {
                          "type": "object",
                          "properties": {
                            "url": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "url"
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "image_url"
                      ]
                    }
                  ]
                }
              }
            ]
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ToolCall"
            },
            "description": "assistant messages"
          },
          "tool_call_id": {
            "type": "string",
            "description": "tool messages: the call this answers"
          }
        }
      },
      "ToolCall": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "const": "function"
          },
          "function": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "arguments": {
                "type": "string",
                "description": "JSON"
              }
            }
          }
        }
      },
      "ChatRequest": {
        "type": "object",
        "required": [
          "model",
          "messages"
        ],
        "properties": {
          "model": {
            "enum": [
              "core-swift",
              "core-apex"
            ]
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 500,
            "items": {
              "$ref": "#/components/schemas/Message"
            }
          },
          "stream": {
            "type": "boolean"
          },
          "stream_options": {
            "type": "object",
            "properties": {
              "include_usage": {
                "type": "boolean"
              }
            }
          },
          "tools": {
            "type": "array",
            "maxItems": 128,
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "const": "function"
                },
                "function": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "parameters": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "name"
                  ]
                }
              }
            }
          },
          "tool_choice": {
            "oneOf": [
              {
                "enum": [
                  "none",
                  "auto",
                  "required"
                ]
              },
              {
                "type": "object"
              }
            ]
          },
          "parallel_tool_calls": {
            "type": "boolean"
          },
          "response_format": {
            "type": "object",
            "properties": {
              "type": {
                "enum": [
                  "text",
                  "json_object",
                  "json_schema"
                ]
              },
              "json_schema": {
                "type": "object"
              }
            }
          },
          "reasoning_effort": {
            "enum": [
              "low",
              "high"
            ],
            "description": "Core Apex: turns thinking on"
          },
          "temperature": {
            "type": "number"
          },
          "top_p": {
            "type": "number"
          },
          "max_tokens": {
            "type": "integer"
          },
          "stop": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "seed": {
            "type": "integer"
          },
          "n": {
            "type": "integer",
            "minimum": 1,
            "maximum": 4,
            "default": 1,
            "description": "Answers to give. Each is billed as its own answer, prompt included. Streamed chunks carry each answer’s index"
          },
          "presence_penalty": {
            "type": "number"
          },
          "frequency_penalty": {
            "type": "number"
          }
        }
      },
      "ChatResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "chat.completion"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "const": "assistant"
                    },
                    "content": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "tool_calls": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ToolCall"
                      }
                    },
                    "reasoning_content": {
                      "type": "string"
                    }
                  }
                },
                "finish_reason": {
                  "enum": [
                    "stop",
                    "length",
                    "tool_calls"
                  ]
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "completion_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            }
          }
        }
      },
      "EmbeddingRequest": {
        "type": "object",
        "required": [
          "model",
          "input"
        ],
        "properties": {
          "model": {
            "enum": [
              "core-embed"
            ]
          },
          "input": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 2048
              }
            ]
          },
          "dimensions": {
            "type": "integer",
            "minimum": 32,
            "maximum": 4096
          },
          "encoding_format": {
            "enum": [
              "float",
              "base64"
            ]
          }
        }
      },
      "EmbeddingResponse": {
        "type": "object",
        "properties": {
          "object": {
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "object": {
                  "const": "embedding"
                },
                "index": {
                  "type": "integer"
                },
                "embedding": {
                  "oneOf": [
                    {
                      "type": "array",
                      "items": {
                        "type": "number"
                      }
                    },
                    {
                      "type": "string"
                    }
                  ]
                }
              }
            }
          },
          "model": {
            "type": "string"
          },
          "usage": {
            "type": "object",
            "properties": {
              "prompt_tokens": {
                "type": "integer"
              },
              "total_tokens": {
                "type": "integer"
              }
            }
          }
        }
      }
    }
  }
}