Skip to content

Translation ​

The translation models plamo-3.0-translate and plamo-3.0-translate-trial translate without any special prompt. Put the source text in the last user message of messages, and the target language in target_lang of chat_template_kwargs. 53 languages are supported, including Japanese and English (Supported Languages). The other request parameters are the same as Chat Completions.

Request ​

bash
# Put the source text in the last user message and the target language in target_lang
$ curl \
    -H "Authorization: Bearer ${PLAMO_API_KEY}" \
    -H "Content-Type: application/json" \
    "https://api.platform.preferredai.jp/v1/chat/completions" \
    -d @- << EOF
{
  "model": "plamo-3.0-translate",
  "messages": [
    {"role": "user", "content": "プロジェクトの管理画面を開いてください。"}
  ],
  "chat_template_kwargs": {"source_lang": "ja", "target_lang": "en"},
  "temperature": 0
}
EOF
bash
# Earlier source (user) and translation (assistant) pairs keep terms and style consistent; only the last user message is translated
$ curl \
    -H "Authorization: Bearer ${PLAMO_API_KEY}" \
    -H "Content-Type: application/json" \
    "https://api.platform.preferredai.jp/v1/chat/completions" \
    -d @- << EOF
{
  "model": "plamo-3.0-translate",
  "messages": [
    {"role": "user", "content": "プロジェクトの管理画面を開きます。"},
    {"role": "assistant", "content": "Open the project dashboard."},
    {"role": "user", "content": "進行中のタスクがすべて表示されます。"},
    {"role": "assistant", "content": "It lists all active tasks."},
    {"role": "user", "content": "オーナーでフィルタリングすることもできます。"}
  ],
  "chat_template_kwargs": {"source_lang": "ja", "target_lang": "en"},
  "temperature": 0
}
EOF
bash
# Put the background of the source text in context and terms with fixed translations in glossary
$ curl \
    -H "Authorization: Bearer ${PLAMO_API_KEY}" \
    -H "Content-Type: application/json" \
    "https://api.platform.preferredai.jp/v1/chat/completions" \
    -d @- << EOF
{
  "model": "plamo-3.0-translate",
  "messages": [
    {"role": "user", "content": "オーナーでフィルタリングすることもできます。"}
  ],
  "chat_template_kwargs": {
    "source_lang": "ja",
    "target_lang": "en",
    "context": "プロジェクト管理ツールのヘルプページです。",
    "glossary": [{"source": "オーナー", "target": "assignee"}]
  },
  "temperature": 0
}
EOF
bash
# When translating into Japanese, choose plain or polite style with form
$ curl \
    -H "Authorization: Bearer ${PLAMO_API_KEY}" \
    -H "Content-Type: application/json" \
    "https://api.platform.preferredai.jp/v1/chat/completions" \
    -d @- << EOF
{
  "model": "plamo-3.0-translate",
  "messages": [
    {"role": "user", "content": "Click Save to apply your changes."}
  ],
  "chat_template_kwargs": {"source_lang": "en", "target_lang": "ja", "form": "polite"},
  "temperature": 0
}
EOF
python
from openai import OpenAI

client = OpenAI(base_url="https://api.platform.preferredai.jp/v1")

# With the OpenAI SDK, put chat_template_kwargs in extra_body
completion = client.chat.completions.create(
    model="plamo-3.0-translate",
    messages=[
        # Earlier source texts and their translations
        {"role": "user", "content": "プロジェクトの管理画面を開きます。"},
        {"role": "assistant", "content": "Open the project dashboard."},
        {"role": "user", "content": "進行中のタスクがすべて表示されます。"},
        {"role": "assistant", "content": "It lists all active tasks."},
        # Source text to translate
        {"role": "user", "content": "オーナーでフィルタリングすることもできます。"},
    ],
    temperature=0,
    extra_body={
        "chat_template_kwargs": {
            "source_lang": "ja",
            "target_lang": "en",
            "context": "プロジェクト管理ツールのヘルプページです。",
            "glossary": [{"source": "オーナー", "target": "assignee"}],
        }
    },
)
print(completion.choices[0].message.content)
# Example output: You can also filter by assignee.
  • messages must start with user, alternate between user and assistant, and end with user. system cannot be used as role.
  • If max_tokens is omitted, it is 1.5 × the number of input tokens + 256.
  • Input and output tokens are limited to 32,768 in total; output beyond that is cut off.

chat_template_kwargs ​

KeyTypeRequiredDescription
target_langstringrequiredThe language code of the target language (Supported Languages).
source_langstringoptionalThe language code of the source text. If omitted, the model decides.
contextstringoptionalContext for interpreting the source text, such as the surrounding text or a description of the situation.
glossaryarray of objectoptionalA glossary. List {"source": "source term", "target": "translation"} for each term. Each entry must contain only source and target.
formstringoptionalThe style of a Japanese translation: plain (da/dearu) or polite (desu/masu). Only with target_lang ja.
  • context is used as context for all of messages. glossary and form apply only when translating the content of the last user message.
  • Write language codes in lowercase (e.g. zh-hans). Region subtags such as en-US are not supported.
  • A 400 error is returned in the following cases.
    • target_lang is missing, or a language code is malformed.
    • There is a system message.
    • messages does not end with user.
    • user and assistant do not alternate.
    • tools is specified.
    • content is an empty string.
    • source or target in glossary is an empty string.
    • A message or a value in chat_template_kwargs contains <|plamo:.

Supported Languages ​

LanguageCodeLanguageCode
JapanesejaEnglishen
Chinese (Simplified)zh-hansChinese (Traditional)zh-hant
KoreankoArabicar
AzerbaijaniazBelarusianbe
BulgarianbgBengalibn
CatalancaCebuanoceb
GermandeSpanishes
EstonianetBasqueeu
PersianfaFrenchfr
GujaratiguHebrewhe
HindihiCroatianhr
HungarianhuArmenianhy
IndonesianidItalianit
JavanesejvGeorgianka
KazakhkkKhmerkm
LithuanianltLatvianlv
MalayalammlMarathimr
MalaymsBurmesemy
NepalineDutchnl
PunjabipaPolishpl
RussianruSinhalasi
SlovakskSloveniansl
SerbiansrSwahilisw
TamiltaTelugute
ThaithTagalogtl
UrduurUzbekuz
Vietnamesevi

Models on Hugging Face ​

The model is published on Hugging Face as PLaMo 3 Translate, so you can also run it in your own environment. messages and chat_template_kwargs are processed with the chat template published on Hugging Face as is. For translation accuracy, refer to the tech blog.