Gradient Completions API

Text completion

OpenAPI Specification

gradient-completions-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Gradient Cloud AI Chat Completions API
  version: v1
  description: OpenAI-compatible inference API for Gradient Cloud — the enterprise inference service of Gradient's Open Intelligence Stack, serving open models across a distributed compute network (Parallax) over Gradient's peer-to-peer data motion engine (Lattica). The API implements OpenAI-compatible interfaces for model listing, chat completion, and text completion (streaming and non-streaming). Generated by the API Evangelist enrichment pipeline from the provider's published API Reference Documentation; not an official provider OpenAPI. Verify against the live docs before production use.
  contact:
    name: Gradient
    url: https://docs.gradient.network/enterprise-solutions/gradient-cloud/api-reference-documentation
  x-apievangelist-generated: true
  x-apievangelist-source: https://docs.gradient.network/enterprise-solutions/gradient-cloud/api-reference-documentation.md
servers:
- url: https://apis.gradient.network/api/v1
  description: Gradient Cloud production
security:
- AccessKey: []
tags:
- name: Completions
  description: Text completion
paths:
  /ai/completions:
    post:
      tags:
      - Completions
      operationId: createCompletion
      summary: Text completion
      description: Create a text completion request, supporting both streaming and non-streaming responses.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompletionRequest'
            example:
              model: qwen/qwen3-coder-480b-instruct-fp8
              prompt: Once upon a time
              temperature: 0.7
              max_tokens: 100
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Completion'
            text/event-stream:
              schema:
                type: string
                description: 'Server-sent event stream, terminated by `data: [DONE]`.'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: Billing Check Failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Model Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate Limit Exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
    Completion:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
        created:
          type: integer
        model:
          type: string
        choices:
          type: array
          items:
            type: object
            properties:
              text:
                type: string
              index:
                type: integer
              finish_reason:
                type: string
        usage:
          $ref: '#/components/schemas/Usage'
    CompletionRequest:
      type: object
      required:
      - model
      - prompt
      properties:
        model:
          type: string
        prompt:
          oneOf:
          - type: string
          - type: array
            items:
              type: string
        suffix:
          type: string
        max_tokens:
          type: integer
        temperature:
          type: number
          default: 1
          minimum: 0
          maximum: 2
        top_p:
          type: number
          default: 1
          minimum: 0
          maximum: 1
        n:
          type: integer
          default: 1
        stream:
          type: boolean
          default: false
  securitySchemes:
    AccessKey:
      type: http
      scheme: bearer
      description: 'Access Key passed as `Authorization: Bearer <access-key>`.'