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

# 완성 생성

> Classic OpenAI-compatible text completion for single-prompt generation workloads that do not require a multi-message chat schema.



## OpenAPI

````yaml api-reference/openapi.json POST /v1/completions
openapi: 3.1.0
info:
  title: DGrid AI Gateway API
  description: >-
    A single, unified API to access 200+ leading AI models. OpenAI-, Claude-,
    and Gemini-compatible endpoints for chat, completions, embeddings, images,
    audio, and moderations.
  version: 1.0.0
  contact:
    name: DGrid AI
    url: https://dgrid.ai
servers:
  - url: https://api.dgrid.ai
    description: DGrid AI Gateway
security:
  - bearerAuth: []
paths:
  /v1/completions:
    post:
      tags:
        - Completions
      summary: Create completion
      description: >-
        Classic OpenAI-compatible text completion for single-prompt generation
        workloads that do not require a multi-message chat schema.
      operationId: createCompletion
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  description: Target model ID.
                prompt:
                  description: Prompt text or prompt array.
                  oneOf:
                    - type: string
                    - type: array
                      items:
                        type: string
                suffix:
                  type: string
                  description: Optional suffix for insertion use cases.
                max_tokens:
                  type: integer
                  default: 16
                  description: Maximum completion length.
                temperature:
                  type: number
                  default: 1
                  description: Sampling temperature.
                top_p:
                  type: number
                  default: 1
                  description: Nucleus sampling value.
                'n':
                  type: integer
                  default: 1
                  description: Number of completions to return.
                stream:
                  type: boolean
                  default: false
                  description: Enable streaming.
                logprobs:
                  type: integer
                  description: Number of log probability values to return.
                echo:
                  type: boolean
                  default: false
                  description: Include the prompt in the output.
                stop:
                  description: Stop sequence string or array.
                  oneOf:
                    - type: string
                    - type: array
                      items:
                        type: string
                presence_penalty:
                  type: number
                  default: 0
                frequency_penalty:
                  type: number
                  default: 0
                best_of:
                  type: integer
                  default: 1
                  description: Server-side reranking count.
                logit_bias:
                  type: object
                  description: Token bias map.
                user:
                  type: string
                  description: End-user identifier.
            example:
              model: openai/gpt-4o
              prompt: Say hello to DGrid.
      responses:
        '200':
          description: Text completion result.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Completion identifier.
                  object:
                    type: string
                    description: Always `text_completion`.
                  created:
                    type: integer
                    description: Creation timestamp.
                  model:
                    type: string
                    description: Model used for generation.
                  choices:
                    type: array
                    items:
                      type: object
                      properties:
                        text:
                          type: string
                          description: Generated text.
                        index:
                          type: integer
                          description: Choice index.
                        logprobs:
                          type: object
                          description: Log probability output when requested.
                        finish_reason:
                          type: string
                          description: Finish reason.
                  usage:
                    $ref: '#/components/schemas/Usage'
        '400':
          $ref: '#/components/responses/BadRequest'
components:
  schemas:
    Usage:
      type: object
      description: Token usage breakdown.
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
        prompt_tokens_details:
          type: object
          properties:
            cached_tokens:
              type: integer
            text_tokens:
              type: integer
            audio_tokens:
              type: integer
            image_tokens:
              type: integer
        completion_tokens_details:
          type: object
          properties:
            text_tokens:
              type: integer
            audio_tokens:
              type: integer
            reasoning_tokens:
              type: integer
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            param:
              type: string
            code:
              type: string
  responses:
    BadRequest:
      description: Invalid request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your DGrid API key. All endpoints use `Authorization: Bearer
        <DGRID_API_KEY>`.

````