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

# Create completion

> Generate a text completion response from a deployed model.



## OpenAPI

````yaml post /v1/inference/completions
openapi: 3.1.0
info:
  title: SeekrFlow API
  description: SeekrFlow API Documentation
  termsOfService: http://www.seekr.com/support
  contact:
    name: Seekr API Support
    url: http://www.seekr.com/contact
    email: contact@seekr.com
  version: 5.48.1
servers:
  - url: https://flow.seekr.com
    description: SeekrBuild server base URL
security: []
paths:
  /v1/inference/completions:
    post:
      tags:
        - Inference
      summary: Create a completion
      operationId: route_completion_v1_inference_completions_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompletionRequest'
            example:
              model: meta-llama/Llama-3.1-8B-Instruct
              prompt: The capital of France is
              max_tokens: 32
              temperature: 0.7
              stream: false
        required: true
      responses:
        '200':
          description: Successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompletionResponse'
            text/event-stream:
              schema:
                allOf:
                  - $ref: '#/components/schemas/CompletionStreamResponse'
                description: >-
                  Sent as server-sent events. The body is a sequence of `data:
                  <chunk>` lines separated by blank lines and terminated by
                  `data: [DONE]`, where each `<chunk>` is an object of the shape
                  below.
        '400':
          description: Malformed request body, or `model` missing.
          content:
            application/json:
              schema:
                oneOf:
                  - properties:
                      error:
                        properties:
                          message:
                            type: string
                          type:
                            type: string
                          code:
                            type: integer
                          param:
                            type: string
                            nullable: true
                        type: object
                        required:
                          - message
                    type: object
                    required:
                      - error
                    title: StructuredError
                  - properties:
                      error:
                        type: string
                    type: object
                    required:
                      - error
                    title: SimpleError
                title: ErrorResponse
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                oneOf:
                  - properties:
                      error:
                        properties:
                          message:
                            type: string
                          type:
                            type: string
                          code:
                            type: integer
                          param:
                            type: string
                            nullable: true
                        type: object
                        required:
                          - message
                    type: object
                    required:
                      - error
                    title: StructuredError
                  - properties:
                      error:
                        type: string
                    type: object
                    required:
                      - error
                    title: SimpleError
                title: ErrorResponse
        '403':
          description: >-
            The requested model is not a base model and is not deployed for your
            team.
          content:
            application/json:
              schema:
                oneOf:
                  - properties:
                      error:
                        properties:
                          message:
                            type: string
                          type:
                            type: string
                          code:
                            type: integer
                          param:
                            type: string
                            nullable: true
                        type: object
                        required:
                          - message
                    type: object
                    required:
                      - error
                    title: StructuredError
                  - properties:
                      error:
                        type: string
                    type: object
                    required:
                      - error
                    title: SimpleError
                title: ErrorResponse
        '422':
          description: Deployment not found, or the request is unprocessable.
          content:
            application/json:
              schema:
                oneOf:
                  - properties:
                      error:
                        properties:
                          message:
                            type: string
                          type:
                            type: string
                          code:
                            type: integer
                          param:
                            type: string
                            nullable: true
                        type: object
                        required:
                          - message
                    type: object
                    required:
                      - error
                    title: StructuredError
                  - properties:
                      error:
                        type: string
                    type: object
                    required:
                      - error
                    title: SimpleError
                title: ErrorResponse
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                oneOf:
                  - properties:
                      error:
                        properties:
                          message:
                            type: string
                          type:
                            type: string
                          code:
                            type: integer
                          param:
                            type: string
                            nullable: true
                        type: object
                        required:
                          - message
                    type: object
                    required:
                      - error
                    title: StructuredError
                  - properties:
                      error:
                        type: string
                    type: object
                    required:
                      - error
                    title: SimpleError
                title: ErrorResponse
        '502':
          description: Backend disconnected before sending a response.
          content:
            application/json:
              schema:
                oneOf:
                  - properties:
                      error:
                        properties:
                          message:
                            type: string
                          type:
                            type: string
                          code:
                            type: integer
                          param:
                            type: string
                            nullable: true
                        type: object
                        required:
                          - message
                    type: object
                    required:
                      - error
                    title: StructuredError
                  - properties:
                      error:
                        type: string
                    type: object
                    required:
                      - error
                    title: SimpleError
                title: ErrorResponse
        '503':
          description: No healthy backend available for the requested model.
          content:
            application/json:
              schema:
                oneOf:
                  - properties:
                      error:
                        properties:
                          message:
                            type: string
                          type:
                            type: string
                          code:
                            type: integer
                          param:
                            type: string
                            nullable: true
                        type: object
                        required:
                          - message
                    type: object
                    required:
                      - error
                    title: StructuredError
                  - properties:
                      error:
                        type: string
                    type: object
                    required:
                      - error
                    title: SimpleError
                title: ErrorResponse
      security:
        - APIKeyHeader: []
components:
  schemas:
    CompletionRequest:
      additionalProperties: true
      properties:
        model:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Model
        prompt:
          anyOf:
            - items:
                minimum: 0
                type: integer
              type: array
            - items:
                items:
                  minimum: 0
                  type: integer
                type: array
              type: array
            - type: string
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          title: Prompt
        echo:
          anyOf:
            - type: boolean
            - type: 'null'
          default: false
          title: Echo
        frequency_penalty:
          anyOf:
            - type: number
            - type: 'null'
          default: 0
          title: Frequency Penalty
        logit_bias:
          anyOf:
            - additionalProperties:
                type: number
              type: object
            - type: 'null'
          default: null
          title: Logit Bias
        logprobs:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: Logprobs
        max_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          default: 16
          title: Max Tokens
        'n':
          default: 1
          title: 'N'
          type: integer
        presence_penalty:
          anyOf:
            - type: number
            - type: 'null'
          default: 0
          title: Presence Penalty
        seed:
          anyOf:
            - maximum: 9223372036854776000
              minimum: -9223372036854776000
              type: integer
            - type: 'null'
          default: null
          title: Seed
        stop:
          anyOf:
            - type: string
            - items:
                type: string
              type: array
            - type: 'null'
          default: []
          title: Stop
        stream:
          anyOf:
            - type: boolean
            - type: 'null'
          default: false
          title: Stream
        stream_options:
          anyOf:
            - $ref: '#/components/schemas/StreamOptions'
            - type: 'null'
          default: null
        suffix:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Suffix
        temperature:
          anyOf:
            - type: number
            - type: 'null'
          default: null
          title: Temperature
        top_p:
          anyOf:
            - type: number
            - type: 'null'
          default: null
          title: Top P
        user:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: User
        use_beam_search:
          default: false
          title: Use Beam Search
          type: boolean
        top_k:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: Top K
        min_p:
          anyOf:
            - type: number
            - type: 'null'
          default: null
          title: Min P
        repetition_penalty:
          anyOf:
            - type: number
            - type: 'null'
          default: null
          title: Repetition Penalty
        length_penalty:
          default: 1
          title: Length Penalty
          type: number
        stop_token_ids:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          default: []
          title: Stop Token Ids
        include_stop_str_in_output:
          default: false
          title: Include Stop Str In Output
          type: boolean
        ignore_eos:
          default: false
          title: Ignore Eos
          type: boolean
        min_tokens:
          default: 0
          title: Min Tokens
          type: integer
        skip_special_tokens:
          default: true
          title: Skip Special Tokens
          type: boolean
        spaces_between_special_tokens:
          default: true
          title: Spaces Between Special Tokens
          type: boolean
        truncate_prompt_tokens:
          anyOf:
            - maximum: 9223372036854776000
              minimum: -1
              type: integer
            - type: 'null'
          default: null
          title: Truncate Prompt Tokens
        truncation_side:
          anyOf:
            - enum:
                - left
                - right
              type: string
            - type: 'null'
          default: null
          description: >-
            Which side to truncate from when truncate_prompt_tokens is active.
            'right' keeps the first N tokens. 'left' keeps the last N tokens.
          title: Truncation Side
        allowed_token_ids:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          default: null
          title: Allowed Token Ids
        prompt_logprobs:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: Prompt Logprobs
        logprob_token_ids:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          default: null
          description: >-
            Specific vocab token IDs to return logprobs for at each generated
            position, in addition to the sampled token. Requires `logprobs` to
            be set.
          title: Logprob Token Ids
        bad_words:
          items:
            type: string
          title: Bad Words
          type: array
        add_special_tokens:
          default: true
          description: >-
            If true (the default), special tokens (e.g. BOS) will be added to
            the prompt.
          title: Add Special Tokens
          type: boolean
        response_format:
          anyOf:
            - $ref: '#/components/schemas/ResponseFormat'
            - $ref: '#/components/schemas/StructuralTagResponseFormat'
            - $ref: '#/components/schemas/LegacyStructuralTagResponseFormat'
            - type: 'null'
          default: null
          description: >-
            Similar to chat completion, this parameter specifies the format of
            output. Only {'type': 'json_object'}, {'type': 'json_schema'},
            {'type': 'structural_tag'}, or {'type': 'text'} is supported.
          title: Response Format
        structured_outputs:
          anyOf:
            - $ref: '#/components/schemas/StructuredOutputsParams'
            - type: 'null'
          default: null
          description: Additional kwargs for structured outputs
        priority:
          default: 0
          description: >-
            The priority of the request (lower means earlier handling; default:
            0). Any priority other than 0 will raise an error if the served
            model does not use priority scheduling.
          maximum: 9223372036854776000
          minimum: -9223372036854776000
          title: Priority
          type: integer
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            The request_id related to this request. If the caller does not set
            it, a random uuid will be generated.
          title: Request Id
        return_tokens_as_token_ids:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          description: >-
            If specified with 'logprobs', tokens are represented as strings of
            the form 'token_id:{token_id}' so that tokens that are not
            JSON-encodable can be identified.
          title: Return Tokens As Token Ids
        return_token_ids:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          description: >-
            If specified, the result will include token IDs alongside the
            generated text.
          title: Return Token Ids
        cache_salt:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            If specified, the prefix cache will be salted with the provided
            string to prevent an attacker from guessing prompts in multi-user
            environments.
          title: Cache Salt
        kv_transfer_params:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          default: null
          description: KVTransfer parameters used for disaggregated serving.
          title: Kv Transfer Params
        vllm_xargs:
          anyOf:
            - additionalProperties:
                anyOf:
                  - type: string
                  - type: integer
                  - type: number
                  - items:
                      anyOf:
                        - type: string
                        - type: integer
                        - type: number
                    type: array
              type: object
            - type: 'null'
          default: null
          description: >-
            Additional request parameters with (list of) string or numeric
            values, used by custom extensions.
          title: Vllm Xargs
        repetition_detection:
          anyOf:
            - $ref: '#/components/schemas/RepetitionDetectionParams'
            - type: 'null'
          default: null
          description: >-
            Parameters for detecting repetitive N-gram patterns in output
            tokens. If such repetition is detected, generation ends early.
        thinking_token_budget:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          description: >-
            Maximum number of tokens allowed for thinking operations (reasoning
            models). Non-negative integer sets the limit; -1 means unlimited
            (treated as unset).
          title: Thinking Token Budget
      title: CompletionRequest
      type: object
    CompletionResponse:
      additionalProperties: true
      properties:
        id:
          type: string
          title: Id
        object:
          const: text_completion
          default: text_completion
          title: Object
          type: string
        created:
          type: integer
          title: Created
        model:
          title: Model
          type: string
        choices:
          items:
            $ref: '#/components/schemas/CompletionResponseChoice'
          title: Choices
          type: array
        service_tier:
          anyOf:
            - enum:
                - auto
                - default
                - flex
                - scale
                - priority
              type: string
            - type: 'null'
          default: null
          title: Service Tier
        system_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: System Fingerprint
        usage:
          $ref: '#/components/schemas/UsageInfo'
        kv_transfer_params:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          default: null
          title: Kv Transfer Params
        metrics:
          anyOf:
            - $ref: '#/components/schemas/PerRequestTimingMetrics'
            - type: 'null'
          default: null
      required:
        - id
        - created
        - model
        - choices
        - usage
      title: CompletionResponse
      type: object
    CompletionStreamResponse:
      additionalProperties: true
      properties:
        id:
          type: string
          title: Id
        object:
          default: text_completion
          title: Object
          type: string
        created:
          type: integer
          title: Created
        model:
          title: Model
          type: string
        choices:
          items:
            $ref: '#/components/schemas/CompletionResponseStreamChoice'
          title: Choices
          type: array
        usage:
          anyOf:
            - $ref: '#/components/schemas/UsageInfo'
            - type: 'null'
          default: null
        system_fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: System Fingerprint
        metrics:
          anyOf:
            - $ref: '#/components/schemas/PerRequestTimingMetrics'
            - type: 'null'
          default: null
      required:
        - id
        - created
        - model
        - choices
      title: CompletionStreamResponse
      type: object
    StreamOptions:
      additionalProperties: true
      properties:
        include_usage:
          anyOf:
            - type: boolean
            - type: 'null'
          default: false
          title: Include Usage
        continuous_usage_stats:
          anyOf:
            - type: boolean
            - type: 'null'
          default: false
          title: Continuous Usage Stats
      title: StreamOptions
      type: object
    ResponseFormat:
      additionalProperties: true
      properties:
        type:
          enum:
            - text
            - json_object
            - json_schema
          title: Type
          type: string
        json_schema:
          anyOf:
            - $ref: '#/components/schemas/JsonSchemaResponseFormat'
            - type: 'null'
          default: null
      required:
        - type
      title: ResponseFormat
      type: object
    StructuralTagResponseFormat:
      additionalProperties: true
      properties:
        type:
          const: structural_tag
          title: Type
          type: string
        format:
          title: Format
      required:
        - type
        - format
      title: StructuralTagResponseFormat
      type: object
    LegacyStructuralTagResponseFormat:
      additionalProperties: true
      properties:
        type:
          const: structural_tag
          title: Type
          type: string
        structures:
          items:
            $ref: '#/components/schemas/LegacyStructuralTag'
          title: Structures
          type: array
        triggers:
          items:
            type: string
          title: Triggers
          type: array
      required:
        - type
        - structures
        - triggers
      title: LegacyStructuralTagResponseFormat
      type: object
    StructuredOutputsParams:
      additionalProperties: true
      description: Structured-output constraints. Exactly one constraint may be set.
      properties:
        json:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
            - type: 'null'
          default: null
          title: Json
        regex:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Regex
        choice:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          default: null
          title: Choice
        grammar:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Grammar
        json_object:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          title: Json Object
        disable_any_whitespace:
          default: false
          title: Disable Any Whitespace
          type: boolean
        disable_additional_properties:
          default: false
          title: Disable Additional Properties
          type: boolean
        whitespace_pattern:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Whitespace Pattern
        structural_tag:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Structural Tag
      title: StructuredOutputsParams
      type: object
    RepetitionDetectionParams:
      additionalProperties: true
      description: Parameters for detecting repetitive N-gram patterns in output tokens.
      properties:
        max_pattern_size:
          default: 0
          description: >-
            Maximum size of N-gram pattern to detect for sequence repetition.
            Set to 0 to disable. Must be used together with min_count.
          title: Max Pattern Size
          type: integer
        min_pattern_size:
          default: 0
          description: >-
            Minimum N-gram pattern size to check for sequence repetition. If set
            to 0, it defaults to 1. Must be <= max_pattern_size.
          title: Min Pattern Size
          type: integer
        min_count:
          default: 0
          description: >-
            Minimum number of times an N-gram pattern must repeat to trigger
            detection. Must be >= 2.
          title: Min Count
          type: integer
      title: RepetitionDetectionParams
      type: object
    CompletionResponseChoice:
      additionalProperties: true
      properties:
        index:
          type: integer
          title: Index
        text:
          title: Text
          type: string
        logprobs:
          anyOf:
            - $ref: '#/components/schemas/CompletionLogProbs'
            - type: 'null'
          default: null
        finish_reason:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Finish Reason
        stop_reason:
          anyOf:
            - type: integer
            - type: string
            - type: 'null'
          default: null
          description: >-
            The stop string or token id that caused the completion to stop, null
            if the completion finished for some other reason including
            encountering the EOS token
          title: Stop Reason
        token_ids:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          default: null
          title: Token Ids
        prompt_logprobs:
          anyOf:
            - items:
                anyOf:
                  - additionalProperties: true
                    type: object
                  - type: 'null'
              type: array
            - type: 'null'
          default: null
          title: Prompt Logprobs
        prompt_token_ids:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          default: null
          title: Prompt Token Ids
      required:
        - index
        - text
      title: CompletionResponseChoice
      type: object
    UsageInfo:
      additionalProperties: true
      properties:
        prompt_tokens:
          default: 0
          title: Prompt Tokens
          type: integer
        total_tokens:
          default: 0
          title: Total Tokens
          type: integer
        completion_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          default: 0
          title: Completion Tokens
        prompt_tokens_details:
          anyOf:
            - $ref: '#/components/schemas/PromptTokenUsageInfo'
            - type: 'null'
          default: null
      title: UsageInfo
      type: object
    PerRequestTimingMetrics:
      additionalProperties: true
      properties:
        time_to_first_token_ms:
          anyOf:
            - type: number
            - type: 'null'
          default: null
          title: Time To First Token Ms
        generation_time_ms:
          anyOf:
            - type: number
            - type: 'null'
          default: null
          title: Generation Time Ms
        queue_time_ms:
          anyOf:
            - type: number
            - type: 'null'
          default: null
          title: Queue Time Ms
        mean_itl_ms:
          anyOf:
            - type: number
            - type: 'null'
          default: null
          title: Mean Itl Ms
        tokens_per_second:
          anyOf:
            - type: number
            - type: 'null'
          default: null
          title: Tokens Per Second
      title: PerRequestTimingMetrics
      type: object
    CompletionResponseStreamChoice:
      additionalProperties: true
      properties:
        index:
          type: integer
          title: Index
        text:
          title: Text
          type: string
        logprobs:
          anyOf:
            - $ref: '#/components/schemas/CompletionLogProbs'
            - type: 'null'
          default: null
        finish_reason:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Finish Reason
        stop_reason:
          anyOf:
            - type: integer
            - type: string
            - type: 'null'
          default: null
          title: Stop Reason
        prompt_token_ids:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          default: null
          title: Prompt Token Ids
        token_ids:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          default: null
          title: Token Ids
      required:
        - index
        - text
      title: CompletionResponseStreamChoice
      type: object
    JsonSchemaResponseFormat:
      additionalProperties: true
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Description
        schema:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          default: null
          title: Schema
        strict:
          anyOf:
            - type: boolean
            - type: 'null'
          default: null
          title: Strict
      required:
        - name
      title: JsonSchemaResponseFormat
      type: object
    LegacyStructuralTag:
      additionalProperties: true
      properties:
        begin:
          title: Begin
          type: string
        schema:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          default: null
          title: Schema
        end:
          title: End
          type: string
      required:
        - begin
        - end
      title: LegacyStructuralTag
      type: object
    CompletionLogProbs:
      additionalProperties: true
      properties:
        text_offset:
          items:
            type: integer
          title: Text Offset
          type: array
        token_logprobs:
          items:
            anyOf:
              - type: number
              - type: 'null'
          title: Token Logprobs
          type: array
        tokens:
          items:
            type: string
          title: Tokens
          type: array
        top_logprobs:
          items:
            anyOf:
              - additionalProperties:
                  type: number
                type: object
              - type: 'null'
          title: Top Logprobs
          type: array
      title: CompletionLogProbs
      type: object
    PromptTokenUsageInfo:
      additionalProperties: true
      properties:
        cached_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: Cached Tokens
        created_cache_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: Created Cache Tokens
        multimodal_tokens:
          anyOf:
            - additionalProperties:
                type: integer
              type: object
            - type: 'null'
          default: null
          description: >-
            Prompt tokens contributed by each input modality, keyed by modality
            name (e.g. `image`, `audio`, `video`). A breakdown of the multimodal
            placeholder tokens already counted in `prompt_tokens`; null when the
            request has no multimodal input.
          title: Multimodal Tokens
      title: PromptTokenUsageInfo
      type: object
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      description: >-
        Your Seekr API key, sent in the Authorization header with no 'Bearer'
        prefix.
      in: header
      name: Authorization

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.