openapi: 3.1.0 info: title: Cerebras Inference 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. - name: Completions description: Text completions. - name: Models description: Discover available models. 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' /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' /models: get: tags: [Models] summary: List available models description: Returns an array of models hosted on Cerebras Inference. operationId: listModels responses: '200': description: List of available models. content: application/json: schema: $ref: '#/components/schemas/ModelList' '401': $ref: '#/components/responses/ErrorResponse' components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: API Key description: Provision a CEREBRAS_API_KEY at https://cloud.cerebras.ai responses: ErrorResponse: description: Error response. content: application/json: schema: $ref: '#/components/schemas/Error' schemas: 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 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 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' 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 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' ModelList: type: object properties: object: type: string example: list data: type: array items: $ref: '#/components/schemas/Model' Model: type: object properties: id: { type: string } object: { type: string, example: model } created: { type: integer } owned_by: { type: string } Usage: type: object properties: prompt_tokens: { type: integer } completion_tokens: { type: integer } total_tokens: { type: integer } TimeInfo: type: object properties: queue_time: { type: number } prompt_time: { type: number } completion_time: { type: number } total_time: { type: number } Error: type: object properties: error: type: object properties: message: { type: string } type: { type: string } code: { type: string } param: { type: string }