{
  "openapi": "3.0.3",
  "info": {
    "title": "API Route core API",
    "version": "1.0.0",
    "description": "Core HTTP API reference for API Route. Covers model discovery, three inference protocols, and the public raw pricing catalog; it is not a complete reference for every supported endpoint or model feature. Model support and pricing are dynamic. This document is not an MCP server or a plugin installation manifest.",
    "contact": {
      "name": "API Route support",
      "email": "support@api-route.com",
      "url": "https://www.api-route.com/"
    }
  },
  "externalDocs": {
    "description": "Client setup and first-call guide",
    "url": "https://www.api-route.com/docs/quickstart"
  },
  "servers": [
    {
      "url": "https://global.api-route.com",
      "description": "Model API root. OpenAI SDK base_url is https://global.api-route.com/v1; Anthropic SDK base_url is https://global.api-route.com."
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Models",
      "description": "Model IDs available to the authenticated key."
    },
    {
      "name": "Inference",
      "description": "Model requests consume account credit."
    },
    {
      "name": "Public pricing",
      "description": "Public website pricing data, separate from the model API host."
    }
  ],
  "paths": {
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "summary": "List model IDs available to this API key",
        "tags": [
          "Models"
        ],
        "description": "Use Bearer authorization for the OpenAI-compatible list response documented here. No hardcoded model list is guaranteed to remain available.",
        "responses": {
          "200": {
            "description": "OpenAI-compatible model list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelList"
                }
              }
            }
          },
          "default": {
            "description": "Request failed. HTTP status and the protocol-specific error body describe authentication, model access, validation, rate limits or upstream availability.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "summary": "Create an OpenAI-compatible chat completion",
        "tags": [
          "Inference"
        ],
        "description": "This operation performs model inference and consumes account credit. The schema documents common fields; optional capabilities depend on the selected model and route. See the client setup guide and current pricing before sending requests.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatRequest"
              },
              "example": {
                "model": "gpt-6.1-sol",
                "messages": [
                  {
                    "role": "user",
                    "content": "Hello"
                  }
                ],
                "stream": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated response, or a protocol-specific event stream when stream is true. Inference consumes account credit at the current applicable rates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "description": "Request failed. HTTP status and the protocol-specific error body describe authentication, model access, validation, rate limits or upstream availability.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/v1/responses": {
      "post": {
        "operationId": "createResponse",
        "summary": "Create an OpenAI-compatible response",
        "tags": [
          "Inference"
        ],
        "description": "This operation performs model inference and consumes account credit. The schema documents common fields; optional capabilities depend on the selected model and route. See the client setup guide and current pricing before sending requests.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResponsesRequest"
              },
              "example": {
                "model": "gpt-6.1-sol",
                "input": "Hello",
                "stream": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated response, or a protocol-specific event stream when stream is true. Inference consumes account credit at the current applicable rates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponsesResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "description": "Request failed. HTTP status and the protocol-specific error body describe authentication, model access, validation, rate limits or upstream availability.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "operationId": "createMessage",
        "summary": "Create an Anthropic-compatible message",
        "tags": [
          "Inference"
        ],
        "description": "This operation performs model inference and consumes account credit. The schema documents common fields; optional capabilities depend on the selected model and route. See the client setup guide and current pricing before sending requests.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessagesRequest"
              },
              "example": {
                "model": "claude-sonnet-5-5",
                "max_tokens": 128,
                "messages": [
                  {
                    "role": "user",
                    "content": "Hello"
                  }
                ],
                "stream": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated response, or a protocol-specific event stream when stream is true. Inference consumes account credit at the current applicable rates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagesResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "default": {
            "description": "Request failed. HTTP status and the protocol-specific error body describe authentication, model access, validation, rate limits or upstream availability.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "anthropic-version",
            "required": false,
            "description": "Anthropic protocol version header used by the client.",
            "schema": {
              "type": "string"
            },
            "example": "2023-06-01"
          }
        ]
      }
    },
    "/api/dist/site/pricing": {
      "servers": [
        {
          "url": "https://www.api-route.com",
          "description": "Public website business API; do not use this host as the model API Base URL."
        }
      ],
      "get": {
        "operationId": "getPublicPricing",
        "summary": "Get the current public raw pricing catalog",
        "tags": [
          "Public pricing"
        ],
        "security": [],
        "description": "Returns raw configured prices, billing expressions and group multipliers. Raw ratios are not final USD token rates. See https://www.api-route.com/pricing for computed display prices, billing units and tiers, and request logs for actual charges.",
        "responses": {
          "200": {
            "description": "Current raw pricing configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PricingCatalog"
                }
              }
            }
          },
          "default": {
            "description": "Request failed. HTTP status and the protocol-specific error body describe authentication, model access, validation, rate limits or upstream availability.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API Route API key as Authorization: Bearer YOUR_API_KEY. Never use an account password or publish a real key in this document."
      },
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "API Route API key for the Anthropic-compatible Messages endpoint."
      }
    },
    "schemas": {
      "ModelList": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "object": {
            "type": "string",
            "enum": [
              "list"
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Model"
            }
          }
        },
        "additionalProperties": true,
        "required": [
          "object",
          "data"
        ]
      },
      "Model": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string"
          },
          "created": {
            "type": "integer"
          },
          "owned_by": {
            "type": "string"
          }
        },
        "additionalProperties": true,
        "required": [
          "id"
        ]
      },
      "ChatRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "minLength": 1,
            "description": "An available model ID allowed by your API key. Discover IDs with GET /v1/models; availability and supported parameters vary by model and route."
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChatMessage"
            },
            "minItems": 1
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "When true, the response uses server-sent events instead of a single JSON object."
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "Output limit in tokens; supported limits depend on the model."
          },
          "max_completion_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "Output limit in tokens; supported limits depend on the model."
          },
          "temperature": {
            "type": "number"
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": true,
        "required": [
          "model",
          "messages"
        ]
      },
      "ChatMessage": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "developer",
              "user",
              "assistant",
              "tool",
              "function"
            ]
          },
          "content": {
            "oneOf": [
              {
                "type": "string",
                "nullable": true
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            ],
            "description": "Text or typed content blocks. Tool-call assistant messages may have null content."
          },
          "tool_call_id": {
            "type": "string"
          },
          "tool_calls": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": true,
        "required": [
          "role"
        ]
      },
      "ChatResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string"
          },
          "created": {
            "type": "integer"
          },
          "model": {
            "type": "string"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "message": {
                  "$ref": "#/components/schemas/ChatMessage"
                },
                "finish_reason": {
                  "type": "string",
                  "nullable": true
                }
              },
              "additionalProperties": true
            }
          },
          "usage": {
            "type": "object",
            "description": "Protocol-specific token and billing usage reported for the request.",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "ResponsesRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "minLength": 1,
            "description": "An available model ID allowed by your API key. Discover IDs with GET /v1/models; availability and supported parameters vary by model and route."
          },
          "input": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            ],
            "description": "Input text or protocol input items. Provide input for a normal generation request."
          },
          "instructions": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            ]
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "When true, the response uses server-sent events instead of a single JSON object."
          },
          "max_output_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "Output limit in tokens; supported limits depend on the model."
          },
          "previous_response_id": {
            "type": "string"
          },
          "reasoning": {
            "type": "object",
            "additionalProperties": true
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": true,
        "required": [
          "model"
        ]
      },
      "ResponsesResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "output": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "usage": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "MessagesRequest": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "minLength": 1,
            "description": "An available model ID allowed by your API key. Discover IDs with GET /v1/models; availability and supported parameters vary by model and route."
          },
          "max_tokens": {
            "type": "integer",
            "minimum": 1,
            "description": "Output limit in tokens; supported limits depend on the model."
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnthropicMessage"
            },
            "minItems": 1
          },
          "system": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            ]
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "When true, the response uses server-sent events instead of a single JSON object."
          },
          "thinking": {
            "type": "object",
            "description": "Model-specific thinking configuration. Supported modes differ by model; do not assume manual thinking is supported by every Claude model.",
            "additionalProperties": true
          },
          "output_config": {
            "type": "object",
            "additionalProperties": true
          },
          "tools": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        },
        "additionalProperties": true,
        "required": [
          "model",
          "max_tokens",
          "messages"
        ]
      },
      "AnthropicMessage": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "user",
              "assistant"
            ]
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": true
                }
              }
            ]
          }
        },
        "additionalProperties": true,
        "required": [
          "role",
          "content"
        ]
      },
      "MessagesResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "content": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string"
                }
              },
              "additionalProperties": true
            }
          },
          "stop_reason": {
            "type": "string",
            "nullable": true
          },
          "usage": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      },
      "PricingCatalog": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "model_name": {
                  "type": "string"
                },
                "enable_groups": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "additionalProperties": true
            }
          },
          "group_ratio": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            }
          }
        },
        "additionalProperties": true,
        "required": [
          "success",
          "data",
          "group_ratio"
        ]
      }
    }
  }
}
