POST
/project/p-{Project_Id}/genai/sarvam_translate/v1/chat/completions
curl --request POST \ --url 'https://api.e2enetworks.com/myaccount/api/v1/gpu/project/p-{Project_Id}/genai/sarvam_translate/v1/chat/completions?project_id=<PROJECT_ID>&apikey=<API_KEY>' \ --header 'Authorization: Bearer <API_TOKEN>' \ --header 'Content-Type: application/json' \ --data '{ "temperature": 0.5, "max_tokens": 300, "top_p": 1, "frequency_penalty": 0, "presence_penalty": 1, "stream": false, "model": "sarvam_translate", "messages": [ { "role": "system", "content": "Translate the text below to Hindi." }, { "role": "user", "content": "Can you write a poem about open source machine learning?" } ]}'import requests
response = requests.post( "https://api.e2enetworks.com/myaccount/api/v1/gpu/project/p-{Project_Id}/genai/sarvam_translate/v1/chat/completions", params={"project_id": "<PROJECT_ID>", "apikey": "<API_KEY>"}, headers={"Authorization": "Bearer <API_TOKEN>"}, json={ "temperature": 0.5, "max_tokens": 300, "top_p": 1, "frequency_penalty": 0, "presence_penalty": 1, "stream": False, "model": "sarvam_translate", "messages": [ { "role": "system", "content": "Translate the text below to Hindi.", }, { "role": "user", "content": "Can you write a poem about open source machine learning?", }, ], },)print(response.json())const url = new URL("https://api.e2enetworks.com/myaccount/api/v1/gpu/project/p-{Project_Id}/genai/sarvam_translate/v1/chat/completions");url.search = new URLSearchParams({ project_id: "<PROJECT_ID>", apikey: "<API_KEY>" });
const response = await fetch(url, { method: "POST", headers: { "Authorization": "Bearer <API_TOKEN>", "Content-Type": "application/json" }, body: JSON.stringify({ "temperature": 0.5, "max_tokens": 300, "top_p": 1, "frequency_penalty": 0, "presence_penalty": 1, "stream": false, "model": "sarvam_translate", "messages": [ { "role": "system", "content": "Translate the text below to Hindi." }, { "role": "user", "content": "Can you write a poem about open source machine learning?" } ] }),});console.log(await response.json());Sarvam Translate is a multilingual translation model specializing in Indian languages, enabling seamless translation across multiple language pairs.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Project_Id
required
string
Path parameter Project_Id.
Query Parameters
Section titled “Query Parameters”project_id
required
integer
Project ID
Request Body
Section titled “Request Body”Media typeapplication/json
object
temperature
number
Example
0.5max_tokens
integer
Example
300top_p
number
Example
1frequency_penalty
number
Example
0presence_penalty
number
Example
1stream
boolean
Example
falsemodel
string
Example
sarvam_translatemessages
Array<object>
object
role
string
Example
systemcontent
string
Example
Translate the text below to Hindi.Example
[ { "role": "system", "content": "Translate the text below to Hindi." }, { "role": "user", "content": "Can you write a poem about open source machine learning?" }]Responses
Section titled “Responses”default
Section titled “default”Successful response (Non-streaming)
Media typeapplication/json
object
id
string
object
string
created
integer
model
string
choices
Array<object>
object
index
integer
message
object
role
string
reasoning_content
string
content
The translated text
string
tool_calls
Array<string>
logprobs
string
finish_reason
string
stop_reason
string
usage
object
prompt_tokens
integer
total_tokens
integer
completion_tokens
integer
prompt_tokens_details
string
prompt_logprobs
string
kv_transfer_params
string
Example
{ "id": "chatcmpl-5bf016be-7107-4157-98d7-badbf5293e95", "object": "chat.completion", "created": 1770614476, "model": "sarvam_translate", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "क्या आप ओपन सोर्स मशीन लर्निंग के बारे में कविता लिख सकते हैं?", "tool_calls": [] }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 28, "total_tokens": 43, "completion_tokens": 15 }}