openapi: 3.0.1 info: title: Sarvam AI Chat API description: REST API for Sarvam AI, India's full-stack sovereign AI platform. Provides chat completions over Sarvam's Indic LLMs, speech-to-text and speech-to-text-translate, text-to-speech, text translation, transliteration, and language identification across Indian languages. All requests authenticate with an api-subscription-key header. termsOfService: https://www.sarvam.ai/terms-of-service contact: name: Sarvam AI Support url: https://www.sarvam.ai version: '1.0' servers: - url: https://api.sarvam.ai security: - ApiSubscriptionKey: [] tags: - name: Chat paths: /v1/chat/completions: post: operationId: createChatCompletion tags: - Chat summary: Create a chat completion description: Generates a model response for a conversation using Sarvam's Indic LLMs (sarvam-m, sarvam-30b, sarvam-105b). Supports streaming via Server-Sent Events when stream is true, tool use, and reasoning effort. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/ChatCompletionRequest' responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/ChatCompletionResponse' text/event-stream: schema: type: string '401': $ref: '#/components/responses/Unauthorized' '429': $ref: '#/components/responses/TooManyRequests' components: schemas: ChatCompletionRequest: type: object required: - model - messages properties: model: type: string description: Sarvam LLM identifier. enum: - sarvam-m - sarvam-30b - sarvam-105b example: sarvam-m messages: type: array items: $ref: '#/components/schemas/ChatMessage' temperature: type: number default: 0.7 top_p: type: number default: 1 max_tokens: type: integer stream: type: boolean default: false description: When true, partial deltas are streamed as Server-Sent Events. reasoning_effort: type: string enum: - low - medium - high frequency_penalty: type: number presence_penalty: type: number n: type: integer default: 1 stop: type: array items: type: string seed: type: integer wiki_grounding: type: boolean description: Ground responses with Wikipedia knowledge. tools: type: array items: type: object tool_choice: oneOf: - type: string - type: object response_format: type: object ChatMessage: type: object required: - role - content properties: role: type: string enum: - system - user - assistant - tool content: type: string Error: type: object properties: error: type: object properties: message: type: string code: type: string ChatCompletionResponse: type: object properties: id: type: string object: type: string example: chat.completion 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: type: object properties: prompt_tokens: type: integer completion_tokens: type: integer total_tokens: type: integer responses: Unauthorized: description: Missing or invalid api-subscription-key. content: application/json: schema: $ref: '#/components/schemas/Error' TooManyRequests: description: Rate limit exceeded. content: application/json: schema: $ref: '#/components/schemas/Error' securitySchemes: ApiSubscriptionKey: type: apiKey in: header name: api-subscription-key description: API subscription key created in the Sarvam AI dashboard.