> ## Documentation Index
> Fetch the complete documentation index at: https://developer.watson-orchestrate.ibm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Chat Completion



## OpenAPI

````yaml post /v1/completions/chat
openapi: 3.1.0
info:
  title: WxO Server API
  summary: API for the next gen watsonx Orchestrate stack
  description: >+

    The watsonx Orchestrate Server provides a set of APIs to power the watsonx
    Orchestrate AI assistant. This includes the following core services:


    * Orchestrate Assistant - a built-in AI assistant that powers the
    Orchestrate end-user experience.

    * Custom Assistants - a service layer for interacting with existing AI
    assistatns (such as those in watsonx Assistant).

    * Message Threads - a chat history and async message tracking store.

    * Document Store - manage collections of documents in nearly any format
    including text, pdf, html and many more.

    * Information Extraction - automatically extract clean text and images from
    any document in the Document Store.  Also extract other useful metadata like
    questions answered, keywords, and named entities.

    * Embedding - generate vector embeddings for text and images in the Document
    Store.

    * Vector Index and Retrieval - automatically index documents with rich
    metadata for vector search or hybrid search.

    * Search Engine - create a Gen AI powered search engine that works like Bing
    or Google.

    * Query Engine - configure your own RAG (Retrieval Augmented Generation)
    engine supporting advanced retrieval patterns and automated data management.

    * Model Proxy - create your own LLM model endpoints for chat completions and
    embeddings.  Supports IBM watsonx.ai, IBM BAM, OpenAI, MistralAI, or Ollama
    for local models.


    WxO API Server utilizes the following open source projects:


    * [PostgreSQL](https://www.postgresql.org/)

    * [PGVector](https://github.com/pgvector/pgvector)

    * [LlamaIndex](https://docs.llamaindex.ai/en/stable/)

    * [LangChain](https://python.langchain.com/docs/get_started/introduction)

    * [FastAPI](https://fastapi.tiangolo.com/)

    * [Unstructured](https://unstructured.io/)

    * [Celery](https://docs.celeryproject.org/en/stable/)

  version: 0.1.0
servers:
  - url: https://{api_endpoint}
    description: version
security: []
paths:
  /v1/completions/chat:
    post:
      tags:
        - Completions
      summary: Create Chat Completion
      operationId: Create_Chat_Completion_v1_completions_chat_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompletionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ChatCompletionRequest:
      properties:
        model:
          type: string
          title: Model
        messages:
          items:
            $ref: '#/components/schemas/ChatMessage'
          type: array
          title: Messages
        frequency_penalty:
          anyOf:
            - type: number
            - type: 'null'
          title: Frequency Penalty
          default: 0
        presence_penalty:
          anyOf:
            - type: number
            - type: 'null'
          title: Presence Penalty
          default: 0
        logit_bias:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Logit Bias
        temperature:
          anyOf:
            - type: number
            - type: 'null'
          title: Temperature
          default: 1
        'n':
          anyOf:
            - type: integer
            - type: 'null'
          title: 'N'
          default: 1
        seed:
          anyOf:
            - type: integer
            - type: 'null'
          title: Seed
        stop:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Stop
        stream:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Stream
          default: false
        top_p:
          anyOf:
            - type: number
            - type: 'null'
          title: Top P
          default: 1
        max_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Tokens
        tools:
          anyOf:
            - items:
                $ref: '#/components/schemas/Tool'
              type: array
            - type: 'null'
          title: Tools
        tool_choice:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Choice
          default: auto
        user:
          anyOf:
            - type: string
            - type: 'null'
          title: User
        extra_model_args:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Extra Model Args
      type: object
      required:
        - model
        - messages
      title: ChatCompletionRequest
    CompletionResponse:
      properties:
        content:
          type: string
          title: Content
        response_metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Response Metadata
      type: object
      required:
        - content
      title: CompletionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ChatMessage:
      properties:
        role:
          type: string
          title: Role
        content:
          type: string
          title: Content
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
      type: object
      required:
        - role
        - content
      title: ChatMessage
    Tool:
      properties:
        type:
          $ref: '#/components/schemas/ToolType'
          default: function
        function:
          $ref: '#/components/schemas/Function'
      type: object
      required:
        - function
      title: Tool
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ToolType:
      type: string
      enum:
        - function
      title: ToolType
    Function:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        parameters:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Parameters
          default: {}
      type: object
      required:
        - name
      title: Function
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````