Featherless AI Chat API

OpenAI-compatible chat completions.

OpenAPI Specification

featherless-chat-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Featherless AI Chat API
  description: OpenAI-compatible REST API for the Featherless AI serverless inference platform. A single Bearer-authenticated interface serves thousands of open-weight Hugging Face models for chat completions, legacy text completions, embeddings, and model discovery. Pricing is a flat monthly subscription with unlimited tokens rather than per-token billing.
  termsOfService: https://featherless.ai/terms
  contact:
    name: Featherless AI Support
    url: https://featherless.ai
  version: '1.0'
servers:
- url: https://api.featherless.ai/v1
  description: OpenAI-compatible base URL for Featherless AI inference.
security:
- bearerAuth: []
tags:
- name: Chat
  description: OpenAI-compatible chat completions.
paths:
  /chat/completions:
    post:
      operationId: createChatCompletion
      tags:
      - Chat
      summary: Create a chat completion
      description: 'Generates a model response for the given chat conversation. OpenAI compatible. Set `stream: true` to receive the response as Server-Sent Events. Vision is supported by passing image_url content parts in messages, and tool calling by supplying `tools`.'
      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: 'When `stream` is true, a sequence of `data:` SSE events each carrying a `chat.completion.chunk` object, terminated by `data: [DONE]`.'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    CreateChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          enum:
          - 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
                nullable: true
        usage:
          $ref: '#/components/schemas/Usage'
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
    ChatMessage:
      type: object
      required:
      - role
      - content
      properties:
        role:
          type: string
          enum:
          - system
          - user
          - assistant
          - tool
        content:
          description: String content, or an array of content parts (text and image_url) for vision-capable models.
          oneOf:
          - type: string
          - type: array
            items:
              type: object
    CreateChatCompletionRequest:
      type: object
      required:
      - model
      - messages
      properties:
        model:
          type: string
          description: Hugging Face model identifier, e.g. `Qwen/Qwen2.5-7B-Instruct`.
        messages:
          type: array
          description: A list of messages comprising the conversation so far.
          items:
            $ref: '#/components/schemas/ChatMessage'
        temperature:
          type: number
          nullable: true
          description: Sampling temperature.
        top_p:
          type: number
          nullable: true
          description: Nucleus sampling probability mass.
        top_k:
          type: integer
          nullable: true
          description: Limits sampling to the top-k tokens.
        min_p:
          type: number
          nullable: true
          description: Minimum token probability relative to the most likely token.
        presence_penalty:
          type: number
          nullable: true
        frequency_penalty:
          type: number
          nullable: true
        repetition_penalty:
          type: number
          nullable: true
        max_tokens:
          type: integer
          nullable: true
          description: Maximum number of tokens to generate.
        min_tokens:
          type: integer
          nullable: true
        stop:
          oneOf:
          - type: string
          - type: array
            items:
              type: string
          nullable: true
        seed:
          type: integer
          nullable: true
          description: Random seed; not guaranteed reproducible across servers.
        tools:
          type: array
          description: A list of tools (functions) the model may call.
          items:
            type: object
        stream:
          type: boolean
          default: false
          description: If true, partial deltas are streamed as Server-Sent Events.
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
              nullable: true
  responses:
    TooManyRequests:
      description: Concurrency limit for the account's plan exceeded. Featherless meters concurrent connections rather than tokens.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Featherless API key
      description: 'Set `Authorization: Bearer <FEATHERLESS_API_KEY>`. Keys are created in the Featherless dashboard.'