> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# [LEGACY] Create completion

> Create text completion from a single prompt
.



## OpenAPI

````yaml /openapi.json post /completions
openapi: 3.0.3
info:
  title: AnyAPI API
  description: >-
    Universal API Integration Platform - Connect any API to any API with
    intelligent data transformation and workflow orchestration.
  version: 1.0.0
  contact:
    name: AnyAPI Support
    email: support@anyapi.ai
    url: https://anyapi.ai/support
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.anyapi.ai/v1
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: Text
    description: Generate text completions
  - name: Images
    description: Generate and manipulate images
  - name: Audio
    description: Generate speech and transcribe audio
  - name: Music
    description: List and retrieve model information
  - name: Video
    description: Create vector embeddings for text
  - name: Vision
    description: Create vector embeddings for text
  - name: 3D Models
    description: Create vector embeddings for text
  - name: Embeddings
    description: Create vector embeddings for text
  - name: Files
    description: Files
  - name: Batches
    description: Batches
  - name: Moderation
    description: Moderation
  - name: Other
    description: Other models
paths:
  /completions:
    post:
      tags:
        - Text
      summary: '[LEGACY] Create completion'
      description: |-
        Create text completion from a single prompt
        .
      operationId: createCompletion
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCompletionRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateCompletionResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreateCompletionRequest:
      type: object
      properties:
        model:
          type: string
          description: ID of the model to use
        prompt:
          description: The prompt(s) to generate completions for
      required:
        - model
        - prompt
    CreateCompletionResponse:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          enum:
            - text_completion
        created:
          type: integer
        model:
          type: string
        choices:
          type: array
          items:
            $ref: '#/components/schemas/CompletionChoice'
        usage:
          $ref: '#/components/schemas/CompletionUsage'
      required:
        - id
        - object
        - created
        - model
        - choices
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            param:
              type: string
            type:
              type: string
          required:
            - message
            - type
      required:
        - error
    CompletionChoice:
      type: object
      properties:
        text:
          type: string
        index:
          type: integer
        logprobs:
          type: object
          properties:
            tokens:
              type: array
              items:
                type: string
            token_logprobs:
              type: array
              items:
                type: number
            top_logprobs:
              type: array
              items:
                type: object
                additionalProperties:
                  type: number
            text_offset:
              type: array
              items:
                type: integer
        finish_reason:
          type: string
          enum:
            - stop
            - length
            - content_filter
      required:
        - text
        - index
        - finish_reason
    CompletionUsage:
      type: object
      properties:
        completion_tokens:
          type: integer
          description: Number of tokens in the generated completion
        prompt_tokens:
          type: integer
          description: Number of tokens in the prompt
        total_tokens:
          type: integer
          description: Total number of tokens used in the request
      required:
        - completion_tokens
        - prompt_tokens
        - total_tokens
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer token authentication. Get your API key from the dashboard.

````