Sarvam AI Chat API

The Chat API from Sarvam AI — 1 operation(s) for chat.

Operations 1

POST /v1/chat/completions Create a chat completion #

Documentation

Specifications

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/sarvam-ai-chat-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

sarvam-ai-chat-api-openapi.yml Raw ↑
openapi: 3.2.0
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:
  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'
  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
    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
    ChatMessage:
      type: object
      required:
      - role
      - content
      properties:
        role:
          type: string
          enum:
          - system
          - user
          - assistant
          - tool
        content:
          type: string
  securitySchemes:
    ApiSubscriptionKey:
      type: apiKey
      in: header
      name: api-subscription-key
      description: API subscription key created in the Sarvam AI dashboard.