OpenAPI Specification
openapi: 3.1.0
info:
title: Cerebras Inference Chat 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: Chat
description: OpenAI-compatible chat completions.
paths:
/chat/completions:
post:
tags:
- Chat
summary: Create a chat completion
description: 'Generates a model response for the given chat conversation. Supports
streaming via server-sent events and tool/function calling. Drop-in
compatible with the OpenAI client libraries.
'
operationId: createChatCompletion
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionRequest'
responses:
'200':
description: Chat completion response.
content:
application/json:
schema:
$ref: '#/components/schemas/ChatCompletionResponse'
text/event-stream:
schema:
type: string
description: Server-sent events stream of chat completion chunks.
'400':
$ref: '#/components/responses/ErrorResponse'
'401':
$ref: '#/components/responses/ErrorResponse'
'429':
$ref: '#/components/responses/ErrorResponse'
components:
schemas:
ChatMessage:
type: object
required:
- role
properties:
role:
type: string
enum:
- system
- user
- assistant
- developer
- tool
content:
oneOf:
- type: string
- type: array
items:
type: object
name:
type: string
tool_call_id:
type: string
tool_calls:
type: array
items:
type: object
TimeInfo:
type: object
properties:
queue_time:
type: number
prompt_time:
type: number
completion_time:
type: number
total_time:
type: number
ChatCompletionResponse:
type: object
properties:
id:
type: string
object:
type: string
example: chat.completion
created:
type: integer
model:
type: string
system_fingerprint:
type: string
choices:
type: array
items:
type: object
properties:
index:
type: integer
finish_reason:
type: string
enum:
- stop
- length
- tool_calls
- content_filter
message:
$ref: '#/components/schemas/ChatMessage'
logprobs:
type: object
nullable: true
usage:
$ref: '#/components/schemas/Usage'
time_info:
$ref: '#/components/schemas/TimeInfo'
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
ChatCompletionRequest:
type: object
required:
- model
- messages
properties:
model:
type: string
description: Model identifier (e.g. llama3.1-8b, qwen-3-235b-a22b-instruct-2507, gpt-oss-120b).
messages:
type: array
items:
$ref: '#/components/schemas/ChatMessage'
temperature:
type: number
minimum: 0
maximum: 1.5
top_p:
type: number
minimum: 0
maximum: 1
max_completion_tokens:
type: integer
stream:
type: boolean
default: false
stop:
oneOf:
- type: string
- type: array
items:
type: string
seed:
type: integer
frequency_penalty:
type: number
presence_penalty:
type: number
logprobs:
type: boolean
top_logprobs:
type: integer
tools:
type: array
items:
type: object
tool_choice:
oneOf:
- type: string
- type: object
parallel_tool_calls:
type: boolean
response_format:
type: object
user:
type: string
reasoning_effort:
type: string
responses:
ErrorResponse:
description: Error response.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: API Key
description: Provision a CEREBRAS_API_KEY at https://cloud.cerebras.ai