OpenAPI Specification
openapi: 3.1.0
info:
title: Cerebras Inference Chat Completions API
description: 'OpenAI-compatible REST API for ultra-low-latency inference on open-weight
large language models hosted on Cerebras wafer-scale silicon. Supports
chat completions, text completions, and model discovery via Bearer
token authentication. Generated as a best-effort spec from public
Cerebras inference documentation; verify against the official API
reference at https://inference-docs.cerebras.ai before production use.
'
version: 1.0.0
contact:
name: Cerebras Inference
url: https://inference-docs.cerebras.ai
license:
name: Cerebras Terms of Service
url: https://www.cerebras.ai/terms
servers:
- url: https://api.cerebras.ai/v1
description: Cerebras Inference Cloud
security:
- bearerAuth: []
tags:
- name: Completions
description: Text completions.
paths:
/completions:
post:
tags:
- Completions
summary: Create a text completion
description: Generates a text completion for the given prompt.
operationId: createCompletion
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CompletionRequest'
responses:
'200':
description: Text completion response.
content:
application/json:
schema:
$ref: '#/components/schemas/CompletionResponse'
'400':
$ref: '#/components/responses/ErrorResponse'
'401':
$ref: '#/components/responses/ErrorResponse'
'429':
$ref: '#/components/responses/ErrorResponse'
components:
responses:
ErrorResponse:
description: Error response.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
TimeInfo:
type: object
properties:
queue_time:
type: number
prompt_time:
type: number
completion_time:
type: number
total_time:
type: number
CompletionRequest:
type: object
required:
- model
properties:
model:
type: string
prompt:
oneOf:
- type: string
- type: array
items:
type: string
max_tokens:
type: integer
temperature:
type: number
minimum: 0
maximum: 1.5
top_p:
type: number
minimum: 0
maximum: 1
stream:
type: boolean
stop:
oneOf:
- type: string
- type: array
items:
type: string
seed:
type: integer
logprobs:
type: integer
minimum: 0
maximum: 20
echo:
type: boolean
user:
type: string
Error:
type: object
properties:
error:
type: object
properties:
message:
type: string
type:
type: string
code:
type: string
param:
type: string
Usage:
type: object
properties:
prompt_tokens:
type: integer
completion_tokens:
type: integer
total_tokens:
type: integer
CompletionResponse:
type: object
properties:
id:
type: string
object:
type: string
example: text_completion
created:
type: integer
model:
type: string
choices:
type: array
items:
type: object
properties:
text:
type: string
index:
type: integer
finish_reason:
type: string
enum:
- stop
- length
- content_filter
logprobs:
type: object
nullable: true
usage:
$ref: '#/components/schemas/Usage'
time_info:
$ref: '#/components/schemas/TimeInfo'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: API Key
description: Provision a CEREBRAS_API_KEY at https://cloud.cerebras.ai