openapi: 3.0.1 info: title: AI - Chat Completions description: |- OpenAI-compatible chat completion endpoints for AI inference with support for streaming, tool calling, and multi-modal inputs. Parameters: - `workspaceID`: The ID of the workspace to use for billing and routing - `teamID`: To access services in a team (query param or `x-teamid` header) Authentication: API Key (Bearer token) sent via the `Authorization` header. termsOfService: '#' contact: email: info@liara.ir version: 1.0.0 externalDocs: description: Find out more about Liara AI url: https://liara.ir servers: - url: https://ai.liara.ir security: - apiKey: [] tags: - name: Chat Completions description: Generate chat completions with various AI models - name: Models description: List available AI models for inference paths: /api/{workspaceID}/v1/chat/completions: post: tags: - Chat Completions summary: Create a chat completion description: |- Creates a model response for the given conversation. Supports streaming via SSE, tool calling, and multi-modal input (text, images, files). operationId: createChatCompletion parameters: - name: workspaceID in: path required: true description: The workspace ID schema: type: string pattern: '^[a-f0-9]{24}$' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ChatCompletionRequest' responses: 200: description: "Successful response (non-streaming)" content: application/json: schema: $ref: '#/components/schemas/ChatCompletionResponse' 400: description: Bad request content: {} 401: description: Missing authentication content: {} 402: description: Payment required - insufficient balance content: {} 403: description: Forbidden - workspace frozen or key disabled content: {} 503: description: "Service unavailable (feature disabled)" content: {} x-codegen-request-body-name: body /api/{workspaceID}/v1/models: get: tags: - Models summary: List available models description: Lists all AI models available for inference in an OpenAI-compatible format. operationId: listInferenceModels parameters: - name: workspaceID in: path required: true description: The workspace ID schema: type: string pattern: '^[a-f0-9]{24}$' responses: 200: description: List of models content: application/json: schema: $ref: '#/components/schemas/ModelsListResponse' 401: description: Missing authentication content: {} components: schemas: ChatCompletionRequest: type: object required: - model - messages properties: model: type: string description: "Model ID" example: openai/gpt-5 messages: type: array description: Array of conversation messages items: $ref: '#/components/schemas/ChatMessage' stream: type: boolean default: false description: Enable SSE streaming stream_options: type: object properties: include_usage: type: boolean description: Include usage stats in streaming response max_tokens: type: integer description: Maximum tokens to generate max_completion_tokens: type: integer description: Maximum completion tokens (OpenAI-style) temperature: type: number description: "Sampling temperature (0-2)" top_p: type: number description: Nucleus sampling parameter top_k: type: number description: Top-K sampling parameter frequency_penalty: type: number description: "Frequency penalty (-2 to 2)" presence_penalty: type: number description: "Presence penalty (-2 to 2)" repetition_penalty: type: number description: Repetition penalty seed: type: integer description: Random seed for deterministic output n: type: integer minimum: 1 description: Number of completions to generate stop: description: Stop sequences oneOf: - type: string - type: array items: type: string maxItems: 4 logit_bias: type: object description: Token ID to bias mapping additionalProperties: type: number logprobs: type: boolean description: Return log probabilities top_logprobs: type: integer description: Number of top log probabilities to return min_p: type: number description: Minimum probability parameter top_a: type: number description: Top-A sampling parameter reasoning: type: object description: Reasoning configuration reasoning_effort: type: string description: Reasoning effort level modalities: type: array items: type: string enum: [image, text] description: Output modalities functions: type: array description: Legacy function definitions items: type: object tools: type: array description: Tool definitions for function calling items: type: object tool_choice: oneOf: - type: string enum: [none, auto, required] - type: object properties: type: type: string enum: [function] function: type: object properties: name: type: string parallel_tool_calls: type: boolean default: true description: Allow parallel tool calls response_format: type: object description: Response format specification prediction: type: object description: Predicted output for latency optimization metadata: description: Additional metadata store: type: boolean description: Store the completion service_tier: type: string description: Service tier user: type: string description: End-user identifier ChatMessage: type: object required: - role properties: role: type: string enum: [user, assistant, system, developer, tool] content: oneOf: - type: string - type: array items: $ref: '#/components/schemas/ContentPart' name: type: string description: Name of the participant tool_calls: type: array description: Tool calls made by the assistant items: type: object tool_call_id: type: string description: ID of the tool call this message responds to refusal: type: string description: Refusal message from the assistant ContentPart: oneOf: - type: object description: Text content required: - type - text properties: type: type: string enum: [text] text: type: string - type: object description: Image URL content required: - type - image_url properties: type: type: string enum: [image_url] image_url: type: object required: - url properties: url: type: string format: uri - type: object description: File content required: - type - file properties: type: type: string enum: [file] file: type: object required: - filename - file_data properties: filename: type: string file_data: type: string ChatCompletionResponse: type: object properties: id: type: string description: Log ID model: type: string description: Model ID used object: type: string enum: [chat.completion] created: type: integer format: unix-timestamp choices: type: array items: type: object properties: index: type: integer message: $ref: '#/components/schemas/ChatMessage' finish_reason: type: string usage: type: object properties: prompt_tokens: type: integer completion_tokens: type: integer total_tokens: type: integer total_cost_toman: type: number total_cost: type: number ModelsListResponse: type: object properties: object: type: string enum: [list] data: type: array items: $ref: '#/components/schemas/ModelItem' ModelItem: type: object properties: id: type: string description: Model ID name: type: string description: Display name description: type: string context_length: type: integer architecture: type: object properties: input_modalities: type: array items: type: string output_modalities: type: array items: type: string pricing: type: object properties: prompt: type: string completion: type: string top_provider: type: object properties: context_length: type: integer max_completion_tokens: type: integer supported_parameters: type: array items: type: string securitySchemes: apiKey: type: apiKey description: 'Enter the API key with the `Bearer: ` prefix, e.g. "Bearer "' name: Authorization in: header