Noh | エンジニア向け情報共有コミュニティ
Signup / Login

Comparison of Translation Fees for DeepL API, OpenAI API, and Google Cloud Translation API

投稿日: 2024/06/13

更新日: 2024/07/02

This article is a translation of the following article.

https://noh.ink/articles/3fqRO48iVY4OSDb8s6oJ

Hello I am yosi.

Taxes and insurance premiums are too high, so I've reached a point where I honestly don't care much about operating costs for services I'm developing myself or inflation. However, I compared the DeepL API, OpenAI API, and Google Cloud Translation API for personal development use, so I'll make a note of it.

It can be quite cumbersome to compare the billing units for translation services, as they may be based on input character counts, token counts of the input/output strings, or other metrics. Additionally, the currencies used for pricing also vary from service to service, making comparisons even more challenging.
The goal this time is to summarize these aspects in an easier-to-understand manner.

I have a sense of which one is cheaper even before starting, but I'm not sure how much of a difference there is, so I thought I would investigate it.
I wrote it as a translation fee comparison edition, but since the DeepL API and Google Cloud Translation API can only translate, there are no other editions.

Premise

  • In this article, we will only focus on translation.
  • We will not discuss the accuracy of each translation or the time it takes for translation.
  • The pricing criteria for each service are completely different, so the price will vary greatly depending on the content of the translated text. Also, although I have written this after researching to some extent, there may be mistakes, so please confirm it yourself if you refer to it.
  • We will consider the translation of simple sentences. We will not consider translations of formats like HTML or XML.

Survey Method

DeepL API and Google Cloud Translation API have varying charges based on the number of input characters, while the OpenAI API's charges are determined by the total number of input and output tokens and the number of prompt tokens required for translation. Additionally, the charges may vary depending on the language being translated. Therefore, we will create equivalent sentences in Japanese and English, and measure the translation costs in three levels: few, normal, and many, based on the amount of text to be translated (meaning we will measure 6 patterns of text). We will calculate the cost required for translating equivalent sentences.

We will calculate the cost based on the number of characters for DeepL API and Google Cloud Translation API.

I measured the token count using the Playground for the OpenAI API. At that time, for the system, I instructed to provide prompts like Please translate into English. and Please translate into Japanese. The total token count was determined, so I used a tokenizer to estimate the input and output token counts (since gpt-4o is not supported as of June 2024, I used the same tokenizer as gpt-3.5 & gpt-4 for the calculation. It shouldn't be very different).

The calculation of estimated input and output token counts didn't align perfectly, so please consider it as a rough reference to grasp the idea.

By the way, the calculation is based on 1 dollar being 155.89 yen (as of 2024/06/13).

The text to be translated uses a story written by ChatGPT. The English version was translated using DeepL.

I will show you below. You are welcome to read it if you have time, but it's fine to skip it.

27文字日本語

異世界プログラム:RubyとTypeScriptの冒険

56文字英語

Otherworldly Programs: Adventures in Ruby and TypeScript

244文字日本語

異世界プログラム:RubyとTypeScriptの冒険 プロローグ ある日、プログラマーのYutaは自分のデスクでコードを書いていた。そのとき、不思議な光に包まれ、意識を失った。目を覚ますと、Yutaは見知らぬ場所に立っていた。目の前には「JavaScriptの世界へようこそ!」と書かれた看板があり、周囲には不思議なエネルギーが漂っていた。Yutaは気がつくと、手元に赤い宝石のようなものを持っていた。その宝石は、かつて彼が愛用していたプログラミング言語「Ruby」の力を宿していた。

482文字英語

Otherworldly Programs: Adventures in Ruby and TypeScript Prologue One day, programmer Yuta was writing code at his desk. At that moment, he was enveloped by a strange light and lost consciousness. When he woke up, he found himself standing in a strange place. In front of him was a sign that read "Welcome to the world of JavaScript! Yuta found himself holding what looked like a red jewel in his hand. The gem contained the power of his former favorite programming language, Ruby.

1641文字日本語

異世界プログラム:RubyとTypeScriptの冒険 プロローグ ある日、プログラマーのYutaは自分のデスクでコードを書いていた。そのとき、不思議な光に包まれ、意識を失った。目を覚ますと、Yutaは見知らぬ場所に立っていた。目の前には「JavaScriptの世界へようこそ!」と書かれた看板があり、周囲には不思議なエネルギーが漂っていた。Yutaは気がつくと、手元に赤い宝石のようなものを持っていた。その宝石は、かつて彼が愛用していたプログラミング言語「Ruby」の力を宿していた。 出会い Yutaは宝石を握りしめ、「Rubyよ、力を貸してくれ!」と叫んだ。すると、目の前に赤髪の少女が現れた。彼女はまるで宝石のように輝く赤い瞳を持ち、優雅な身のこなしで微笑んだ。 「こんにちは、私はRuby。あなたが私を呼び出したのね。よろしくね、マスター!」 そのとき、背後からもう一人の人物が現れた。彼は青い髪を持ち、冷静沈着な表情でYutaを見つめた。 「初めまして。僕はTypeScript。君がこの世界に迷い込んだのは偶然ではないようだね。」 冒険の始まり こうして、RubyとTypeScript、そしてYutaの冒険が始まった。彼らはJavaScriptの世界を旅しながら、数々の困難に立ち向かうことになる。 Rubyは、その優れた直感力と柔軟な思考で仲間を助けた。彼女の特技は、問題を簡潔に解決する力だった。例えば、複雑なアルゴリズムを瞬時にシンプルなコードに変える能力だ。彼女はどんな状況でも素早く対応できる柔軟性を持っていた。 一方、TypeScriptはその厳密な型システムと論理的な思考で、チームの安全を守った。彼の特技は、バグを未然に防ぐ能力だ。どんなに複雑なコードでも、TypeScriptの手にかかれば型エラーを事前に発見し、修正することができた。 Yutaは、彼ら二人に新しいコードを提供する役割を果たした。彼のプログラムの知識と創造力で、RubyとTypeScriptはより強力な力を発揮することができた。Yutaはまた、戦略を立てたり、必要なときに迅速な判断を下すことで、冒険を成功に導いた。 初めての試練 ある日、彼らは巨大な迷宮に足を踏み入れた。そこには「バグの魔王」が待ち受けていた。魔王は強力なエラーを操り、プログラムを破壊する力を持っていた。 「今だ、Yuta!」Yutaが叫び、キーボードを叩いた。 その一瞬、新しいコードがRubyの手に届き、彼女は素早く動き、魔王の弱点を突くシンプルなコードを編み出した。 しかし、それだけでは魔王を完全に倒すことはできなかった。そのとき、Yutaは新たなアイデアを思いついた。 「任せて!」Yutaが叫び、キーボードを叩くと、新しいコードがRubyに届いた。 「了解!」Rubyが素早く動き、新しいコードを実行し、強力な一撃を放った。その力で、魔王はついに崩れ落ちた。 絆 試練を乗り越えた三人の絆は深まった。Rubyの柔軟性とTypeScriptの厳密性、そしてYutaの創造力が見事に融合し、三人は互いに欠けた部分を補完し合う最高のチームとなった。 「ありがとう、二人とも。君たちのおかげで勝てたよ。」Yutaは微笑んだ。 「ううん、Yuta。あなたがいてくれたからこそ、私たちも全力を出せたんだよ。」Rubyも微笑み返した。 「そうだね、Yuta。君のコードは本当に素晴らしかった。」TypeScriptも同意した。 エピローグ こうして、Yuta、Ruby、TypeScriptの冒険は続く。彼らはJavaScriptの世界で数々の試練を乗り越え、仲間と共に成長していく。未来にはまだまだ多くの困難が待ち受けているが、三人が力を合わせれば、どんな試練も乗り越えられるだろう。 そして、いつの日か彼らが元の世界に戻れる日が来るのを信じて。冒険は終わらない。

3596文字英語

Otherworldly Programs: Adventures in Ruby and TypeScript Prologue One day, programmer Yuta was writing code at his desk. At that moment, he was enveloped by a strange light and lost consciousness. When he woke up, he found himself standing in a strange place. In front of him was a sign that read "Welcome to the world of JavaScript! Yuta found himself holding what looked like a red jewel in his hand. The gem contained the power of his former favorite programming language, Ruby. Encounter Yuta clutched her jewelry, "Ruby, give me strength! he shouted. Then a red-haired girl appeared before him. She had red eyes that shone like jewels, and she smiled with a graceful gesture. Hello, I'm Ruby, you called me. Nice to meet you, Master!" At that moment, another figure appeared behind her. He had blue hair and looked at Yuta with a calm and collected expression. Nice to meet you, I'm TypeScript. I am TypeScript, and it is no coincidence that you have wandered into this world. The Beginning of an Adventure Thus began the adventure of Ruby, TypeScript, and Yuta. They faced many challenges as they traveled through the world of JavaScript. Ruby helped her friends with her great intuition and flexible thinking. One of her specialties was her ability to solve problems succinctly. For example, her ability to turn complex algorithms into simple code in an instant. She had the flexibility to adapt quickly to any situation. TypeScript, on the other hand, kept the team safe with his strict type system and logical thinking. His special skill is his ability to prevent bugs before they happen. No matter how complex the code was, TypeScript was able to find and fix type errors before they occurred. Yuta was responsible for providing them both with new code. With his programming knowledge and creativity, Ruby and TypeScript were able to become more powerful, and Yuta also helped make the adventure a success by strategizing and making quick decisions when needed. Their first ordeal One day, they stepped into a huge labyrinth. There, the "Demon King of Bugs" was waiting for them. He had the power to manipulate powerful errors and destroy programs. Yuta shouted and tapped on his keyboard, "Now, Yuta! In that instant, a new code arrived in Ruby's hands, and she moved quickly, weaving a simple code that exploited the Demon King's weakness. However, it was not enough to completely defeat the Demon King. It was then that Yuta came up with a new idea. Leave it to me!" Yuta shouted, tapped the keyboard, and the new code arrived in Ruby. Got it!" Ruby moved quickly, executed the new code, and delivered a powerful blow. With the force of the blow, the Demon King finally collapsed. The Bond The three of them bonded over the ordeal: Ruby's flexibility, TypeScript's rigor, and Yuta's creativity merged beautifully, making the three of them a great team that complemented each other's deficiencies. Thanks, both of you," said Yuta. We couldn't have won without you guys." Yuta smiled. No, Yuta, it's because of you that we were able to give it our all," Ruby smiled back. Ruby smiled back. Your code was really great. TypeScript agreed. Epilogue And so the adventures of Yuta, Ruby, and TypeScript continued. They overcome many challenges in the JavaScript world and grow together with their friends. There are still many challenges awaiting them in the future, but if the three of them work together, they will be able to overcome any obstacle. And, they believe that one day they will be able to return to the world they came from. The adventure will never end.

Price list for each service

The cost of the DeepL API is calculated at 0.0025 yen per character input.
The basic fee of 630 yen per month is not taken into account. The free plan is also not considered.
DeepL API Free and DeepL API Pro

The Google Cloud Translation API utilizes NMT 500,000 characters or more.
Google Cloud Translation API (NMT 500,000 characters or more) - $0.00002 per character
https://cloud.google.com/translate/pricing?hl=en

We will use the following two models:
GPT-4o - Input $5.00 / 1M tokens, Output $15.00 / 1M tokens
gpt-3.5-turbo-0125 - Input $0.50 / 1M tokens, Output $1.50 / 1M tokens
https://openai.com/api/pricing/

Comparison

The following two tables show how much content in each service corresponds to the same meaning. This is just a summary for calculation purposes, so feel free to skip reading it.

Correspondence table for few, normal, many (ja -> en)
Translation from Japanese to English

-fewnormalmany
DeepL API input character count27 characters244 characters1641 characters
Google Cloud Translation API input character count27 characters244 characters1641 characters
gpt-3.5-turbo-16 total input/output token count46 tokens (estimated input 36 tokens/estimated output 10 tokens)358 tokens (estimated input 242 tokens/estimated output 116 tokens)2331 tokens (estimated input 1600 tokens/estimated output 731 tokens)
gpt-4o total input/output token count39 tokens (estimated input 29 tokens/estimated output 10 tokens)306 tokens (estimated input 190 tokens/estimated output 116 tokens)1981 tokens (estimated input 1250 tokens/estimated output 731 tokens)

Correspondence table for few, normal, many (en -> ja)
English to Japanese translation

-fewnormalmany
DeepL API input characters56 characters482 characters3596 characters
Google Cloud Translation API input characters56 characters482 characters3596 characters
gpt-3.5-turbo-16 total token count47 tokens (estimated input 26 tokens/estimated output 21 tokens)344 tokens (estimated input 119 tokens/estimated output 225 tokens)2340 tokens (estimated input 778 tokens/estimated output 1562 tokens)
gpt-4o total token counttokens (estimated input 26 tokens/estimated output 20 tokens)331 tokens (estimated input 119 tokens/estimated output 212 tokens)2349 tokens (estimated input 778 tokens/estimated output 1571 tokens)

The main mission.
It is a comparison of translation fees when translated by a service that writes sentences with the same meaning.

Cost for translation from Japanese to English (ja -> en)

Service \ Target Amount of Charactersfewnormalmany
DeepL API0.068 yen (0.000436 dollars)0.61 yen (0.00391 dollars)4.10 yen (0.0263 dollars)
Google Cloud Translation API0.00054 dollars (0.084 yen)0.00488 dollars (0.76 yen)0.033 dollars (5.14 yen)
gpt-3.5-turbo-160.000033 dollars (0.0051 yen)0.000295 dollars (0.046 yen)0.0018965 dollars (0.30 yen)
gpt-4o0.000295 dollars (0.046 yen)0.00269 dollars (0.42 yen)0.018965 dollars (2.96 yen)

And the cost of translation from English to Japanese (en -> ja)

Service \ Amount of Textfewnormalmany
DeepL API0.14 yen (0.000898 dollars)1.21 yen (0.00776 dollars)8.99 yen (0.0577 dollars)
Google Cloud Translation API0.00112 dollars (0.17 yen)0.00964 dollars (1.50 yen)0.07192 dollars (11.21 yen)
gpt-3.5-turbo-160.0000445 dollars (0.0069 yen)0.000397 dollars (0.062 yen)0.002732 dollars (0.43 yen)
gpt-4o0.00043 dollars (0.067 yen)0.003775 dollars (0.59 yen)0.027455 dollars (4.28 yen)

Graph comparing translation APIs

Summary

Personally, I had the impression that the DeepL API was more affordable than the OpenAI API, so the result was surprising.
In fact, gpt-4-turbo is twice the price of gpt-4o, and gpt-4-32k is nearly ten times the price of gpt-4o, so I probably had this impression compared to the prices in this range.

ModelInputOutput
gpt-4-turbo$10.00 / 1M tokens$30.00 / 1M tokens
gpt-4-32k$60.00 / 1M tokens$120.00 / 1M tokens

Using gpt-3.5-turbo for translation is particularly cost-effective.
Overall, translating from English to Japanese tends to be more expensive, but translations using the OpenAI API have relatively stable pricing across different languages.

Also, we used very simple prompts with the OpenAI API, but when used in practice, prompts should be added to improve translation accuracy. In such cases, the fee will increase for each additional prompt. Furthermore, the OpenAI API is a natural language processor, so it is difficult to ensure stable translation.

This time, we did not consider factors such as processing speed when comparing, but if it meets the requirements, the motivation to use the OpenAI API for translation in terms of cost-performance has increased. The DeepL API also has its advantages, such as the ability to handle difficult markdown translation tasks.
There are challenges as well because sometimes it may ignore the prompts.

This time, I compared the costs of translation services, which have different units of fees for each service (It was very hard).
If there are any mistakes, please point them out. Thank you.

※ The result showed that the DeepL API is cheaper than the Google Cloud Translation API, but I believe this is largely due to the impact of exchange rates. While other services require payment in USD, only the DeepL API accepts payment in JPY. It is important to consider the potential impact of exchange rates on prices in the future.

Table of Contents