openapi: 3.1.0
info:
  title: Verboo Code API
  version: 1.0.0
  description: |
    OpenAI Chat Completions-compatible API for models available through Verboo Code.
    Advanced parameters and capabilities can vary by model and provider.
  contact:
    name: Verboo Code
    url: https://code.verboo.ai/pt/docs
  license:
    name: Verboo Code Terms of Use
    url: https://code.verboo.ai/pt/terms
servers:
  - url: https://code.verboo.ai/router/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Models
    description: Discover model IDs and capabilities available to an API key.
  - name: Chat
    description: Generate chat completions using an available model.
paths:
  /models:
    get:
      operationId: listModels
      summary: List available models
      description: Returns the models and capabilities available to the authenticated API key.
      tags: [Models]
      responses:
        '200':
          description: Model list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelList'
              examples:
                default:
                  value:
                    object: list
                    data:
                      - id: model-id
                        object: model
                        created: 1786752000
                        owned_by: verboo
                        display_name: Model name
                        context_window: 131072
                        vision: true
                        reasoning:
                          effort_levels: [low, medium, high]
                          default_effort: medium
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '428':
          $ref: '#/components/responses/TermsRequired'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/Unavailable'
  /chat/completions:
    post:
      operationId: createChatCompletion
      summary: Create a chat completion
      description: |
        Creates a model response from an ordered message history. The core request and
        response follow the OpenAI Chat Completions shape. Optional fields can vary by
        model and upstream provider.
      tags: [Chat]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              basic:
                value:
                  model: model-id
                  messages:
                    - role: user
                      content: Explain why low latency matters for developer tools.
              streaming:
                value:
                  model: model-id
                  messages:
                    - role: user
                      content: Explain why low latency matters for developer tools.
                  stream: true
      responses:
        '200':
          description: Completion or SSE stream, depending on the stream request field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletion'
            text/event-stream:
              schema:
                type: string
                description: SSE data frames ending with data followed by [DONE].
              example: |-
                data: {"choices":[{"delta":{"content":"Hello"}}]}

                data: {"choices":[],"usage":{"prompt_tokens":10,"completion_tokens":1,"total_tokens":11}}

                data: [DONE]
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '428':
          $ref: '#/components/responses/TermsRequired'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '502':
          $ref: '#/components/responses/BadGateway'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Verboo API key
      description: API key created in the Verboo Code dashboard.
  headers:
    RateLimitLimit:
      description: Configured request allowance for the current window.
      schema:
        type: integer
    RateLimitRemaining:
      description: Remaining request allowance.
      schema:
        type: integer
    RateLimitReset:
      description: Unix timestamp when the rate-limit window resets.
      schema:
        type: integer
    RetryAfter:
      description: Delay in seconds before retrying.
      schema:
        type: integer
  schemas:
    ModelList:
      type: object
      required: [object, data]
      properties:
        object:
          type: string
          const: list
        data:
          type: array
          items:
            $ref: '#/components/schemas/Model'
    Model:
      type: object
      required: [id, object, created, owned_by, vision]
      properties:
        id:
          type: string
          description: Public model identifier to send in chat completion requests.
        object:
          type: string
          const: model
        created:
          type: integer
          format: int64
        owned_by:
          type: string
        display_name:
          type: string
        context_window:
          type: integer
          minimum: 1
        vision:
          type: boolean
        reasoning:
          oneOf:
            - $ref: '#/components/schemas/ReasoningCapability'
            - type: 'null'
      additionalProperties: true
    ReasoningCapability:
      type: object
      required: [effort_levels, default_effort]
      properties:
        effort_levels:
          type: array
          minItems: 1
          items:
            type: string
        default_effort:
          type: string
    ChatCompletionRequest:
      type: object
      required: [model, messages]
      properties:
        model:
          type: string
          description: Exact model ID returned by GET /models.
        messages:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/ChatMessage'
        stream:
          type: boolean
          default: false
        stream_options:
          type: object
          properties:
            include_usage:
              type: boolean
          additionalProperties: true
        temperature:
          type: number
          description: Provider-dependent sampling value.
        max_tokens:
          type: integer
          minimum: 1
        max_completion_tokens:
          type: integer
          minimum: 1
        tools:
          type: array
          items:
            $ref: '#/components/schemas/Tool'
        tool_choice:
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
        reasoning_effort:
          type: string
          description: Must match an effort level returned for the selected model.
        response_format:
          $ref: '#/components/schemas/ResponseFormat'
      additionalProperties: true
    ChatMessage:
      type: object
      required: [role]
      properties:
        role:
          type: string
          enum: [system, developer, user, assistant, tool]
        content:
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/ContentPart'
            - type: 'null'
        name:
          type: string
        tool_call_id:
          type: string
        tool_calls:
          type: array
          items:
            $ref: '#/components/schemas/ToolCall'
      additionalProperties: true
    ContentPart:
      oneOf:
        - type: object
          required: [type, text]
          properties:
            type:
              type: string
              const: text
            text:
              type: string
          additionalProperties: true
        - type: object
          required: [type, image_url]
          properties:
            type:
              type: string
              const: image_url
            image_url:
              type: object
              required: [url]
              properties:
                url:
                  type: string
                detail:
                  type: string
              additionalProperties: true
          additionalProperties: true
        - type: object
          additionalProperties: true
    Tool:
      type: object
      required: [type, function]
      properties:
        type:
          type: string
          const: function
        function:
          type: object
          required: [name, parameters]
          properties:
            name:
              type: string
            description:
              type: string
            parameters:
              type: object
              additionalProperties: true
          additionalProperties: true
      additionalProperties: true
    ToolCall:
      type: object
      required: [id, type, function]
      properties:
        id:
          type: string
        type:
          type: string
          const: function
        function:
          type: object
          required: [name, arguments]
          properties:
            name:
              type: string
            arguments:
              type: string
      additionalProperties: true
    ResponseFormat:
      oneOf:
        - type: object
          required: [type]
          properties:
            type:
              type: string
              const: json_object
          additionalProperties: true
        - type: object
          required: [type, json_schema]
          properties:
            type:
              type: string
              const: json_schema
            json_schema:
              type: object
              required: [name, schema]
              properties:
                name:
                  type: string
                strict:
                  type: boolean
                schema:
                  type: object
                  additionalProperties: true
              additionalProperties: true
          additionalProperties: true
    ChatCompletion:
      type: object
      required: [id, object, created, model, choices]
      properties:
        id:
          type: string
        object:
          type: string
        created:
          type: integer
          format: int64
        model:
          type: string
        choices:
          type: array
          items:
            type: object
            required: [index, message]
            properties:
              index:
                type: integer
              message:
                $ref: '#/components/schemas/ChatMessage'
              finish_reason:
                oneOf:
                  - type: string
                  - type: 'null'
            additionalProperties: true
        usage:
          $ref: '#/components/schemas/Usage'
      additionalProperties: true
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
      additionalProperties: true
    Error:
      type: object
      required: [error]
      properties:
        error:
          oneOf:
            - type: string
            - type: object
              required: [message]
              properties:
                message:
                  type: string
                type:
                  type: string
                code:
                  type: string
              additionalProperties: true
        code:
          type: string
      additionalProperties: true
    TermsError:
      type: object
      required: [error]
      properties:
        error:
          type: string
          const: terms_acceptance_required
        versionId:
          type: string
        version:
          type: string
        enforcementAt:
          type: string
          format: date-time
        acceptUrl:
          type: string
      additionalProperties: true
  responses:
    BadRequest:
      description: Invalid request body, parameters, model, or context.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing, invalid, expired, or revoked API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PaymentRequired:
      description: Insufficient prepaid balance.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The key, plan, or model cannot use the requested feature.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Model not available to the key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PayloadTooLarge:
      description: Request payload exceeds the accepted limit.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TermsRequired:
      description: The current terms must be accepted before using the API.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/TermsError'
    RateLimited:
      description: Rate limit reached.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/RateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/RateLimitReset'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Unexpected internal error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadGateway:
      description: Invalid or failed upstream provider response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unavailable:
      description: Capacity, billing data, or an upstream dependency is unavailable.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
