Gradient Chat API

Chat completion

OpenAPI Specification

gradient-chat-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Gradient Cloud AI Chat 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: Chat
  description: Chat completion
paths:
  /ai/chat/completions:
    post:
      tags:
      - Chat
      operationId: createChatCompletion
      summary: Chat completion
      description: Create a chat completion request, supporting both streaming and non-streaming responses.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            example:
              model: qwen/qwen3-coder-480b-instruct-fp8
              messages:
              - role: user
                content: Hello, how are you?
              temperature: 0.7
              max_tokens: 100
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletion'
            text/event-stream:
              schema:
                type: string
                description: 'Server-sent event stream of chat.completion.chunk objects, 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:
    ChatCompletionRequest:
      type: object
      required:
      - model
      - messages
      properties:
        model:
          type: string
          description: The ID of the model to use
        messages:
          type: array
          items:
            $ref: '#/components/schemas/ChatMessage'
        stream:
          type: boolean
          default: false
        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
        stop:
          oneOf:
          - type: string
          - type: array
            items:
              type: string
        presence_penalty:
          type: number
          default: 0
          minimum: -2
          maximum: 2
        frequency_penalty:
          type: number
          default: 0
          minimum: -2
          maximum: 2
        logit_bias:
          type: object
        user:
          type: string
    Usage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
    ChatCompletion:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
        created:
          type: integer
        model:
          type: string
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              message:
                $ref: '#/components/schemas/ChatMessage'
              finish_reason:
                type: string
        usage:
          $ref: '#/components/schemas/Usage'
    ChatMessage:
      type: object
      required:
      - role
      - content
      properties:
        role:
          type: string
          enum:
          - system
          - user
          - assistant
        content:
          type: string
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
  securitySchemes:
    AccessKey:
      type: http
      scheme: bearer
      description: 'Access Key passed as `Authorization: Bearer <access-key>`.'