Requesty Chat API

OpenAI-compatible chat completions routed across providers.

OpenAPI Specification

requesty-chat-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Requesty Router API Keys Chat API
  description: OpenAI-compatible LLM gateway that routes a single API across 300+ models from providers such as OpenAI, Anthropic, DeepSeek, and Together AI, adding intelligent routing, automatic fallbacks, response caching, spend controls, and per-request cost observability. This specification covers the documented inference (chat completions, embeddings, models) and management (API keys, usage/analytics) endpoints of the Requesty Router.
  termsOfService: https://www.requesty.ai/terms
  contact:
    name: Requesty Support
    email: support@requesty.ai
  version: '1.0'
servers:
- url: https://router.requesty.ai/v1
  description: Global router
- url: https://router.eu.requesty.ai/v1
  description: EU data residency router
security:
- bearerAuth: []
tags:
- name: Chat
  description: OpenAI-compatible chat completions routed across providers.
paths:
  /chat/completions:
    post:
      operationId: createChatCompletion
      tags:
      - Chat
      summary: Create a chat completion
      description: 'Creates a model response for the given chat conversation. Requesty routes the request to the best available provider for the requested model, applying fallbacks and caching. OpenAI-compatible. Set `stream: true` to receive the response as Server-Sent Events.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateChatCompletionRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateChatCompletionResponse'
            text/event-stream:
              schema:
                type: string
                description: Server-Sent Events stream of chat completion chunks when stream=true.
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '429':
          description: Too many requests
components:
  schemas:
    ChatMessage:
      type: object
      required:
      - role
      - content
      properties:
        role:
          type: string
          enum:
          - system
          - user
          - assistant
          - tool
        content:
          description: The contents of the message; string or array of content parts.
          oneOf:
          - type: string
          - type: array
            items:
              type: object
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
        cost:
          type: number
          description: Requesty USD cost for the request.
    CreateChatCompletionResponse:
      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:
                $ref: '#/components/schemas/ChatMessage'
              finish_reason:
                type: string
        usage:
          $ref: '#/components/schemas/Usage'
    CreateChatCompletionRequest:
      type: object
      required:
      - messages
      properties:
        model:
          type: string
          description: Routed model identifier, e.g. `openai/gpt-4o-mini` or `anthropic/claude-sonnet-4-20250514`. Defaults to `openai/gpt-4o-mini`.
          default: openai/gpt-4o-mini
        messages:
          type: array
          description: A list of messages comprising the conversation so far.
          items:
            $ref: '#/components/schemas/ChatMessage'
        max_tokens:
          type: integer
          description: Maximum number of tokens to generate.
        temperature:
          type: number
          description: Sampling temperature between 0 and 2.
          default: 1
        top_p:
          type: number
          description: Nucleus sampling probability mass.
        stream:
          type: boolean
          description: If true, partial deltas are streamed as Server-Sent Events.
          default: false
        tools:
          type: array
          description: A list of tools the model may call, such as custom functions or built-in web_search.
          items:
            type: object
        tool_choice:
          description: Controls which (if any) tool is called by the model.
          oneOf:
          - type: string
          - type: object
        response_format:
          type: object
          description: An object specifying the format the model must output (e.g. JSON / structured outputs), where supported by the routed model.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Requesty API key passed as a Bearer token in the Authorization header.