概要
Ninja AIは、NinjaTech AIが2024年5月に発表した生成AIサービスだ。よくあるAIチャットWebサービスのように、
- 各社の生成AIモデルを用いてWebチャット
- GPTとかClaudeとかGeminiとかね
- 自社提供の生成AIモデルを用いてWebチャット
- Ninja AIのばあい、高速で安価な「Turbo 1.0」、複数LLMの分析結果を等号して判断する「Apex 1.0」、論理思考に長けた「Reasoning 2.0」、DeepResearchできる「Deep Research 2.0」がある
を提供している。ここで、後者の自社提供モデルにアクセスできるAPIを使った際のコツ・注意点をまとめた。
コツ
コツ1:公式サンプルを参考にしよう
当然じゃないかと思われるかもしれないが、「文法は概ねOpenAI APIなんだからテキトーでいいでしょ」と思ってコードを書くと実行時エラーになりやすい。前述した資料をよく読んで実装しよう。AIコーディングさせる際は、サンプルコードをそのままリファレンスとして食わせてもいい。
コツ2:Web検索が内蔵されているのはDeep Researchだけ
これは後述する「注意点3:モデルによってはWeb検索が使えない」の裏返しだが、逆に言うとWeb検索込みの実行が簡単だということだ。大いに活用しよう。
コツ3:「Step」「出典表記」「メッセージ」「使用トークン量」はそれぞれ別扱い
前述した資料のPythonのサンプルコードにあるように、ストリームをONにして流れてくるチャンクが
- Deep Researchする際のステップ実行の段落における思考
- Deep Researchする際の参考にしたWebサイトのURL
- 上記以外で、出力してくれるメッセージ
- 使用した入力トークン量、および出力トークン量
とそれぞれ別扱いなので、活用したい人にとっては嬉しいのかなと。
注意点
注意点1:初期クレジットが30ドル必要
Ninja AIのAPI利用のために、まず「クレジット」(イメージとしては利用権のそれ)をチャージしておく必要がある。ただ、Ninja AIの場合、「クレジットだけチャージする」ことができず、必ず「Auto-pay」を設定する必要がある。この金額が妙に高くて、次のような設定だ。
- オートチャージが発動するクレジットの下限:25ドル
- オートチャージする際のチャージ金額の下限:30ドル
つまり、初期状態はクレジット額が0ドルなことと合わせると、「最初に30ドルチャージしないとAPIは使わせねーよ」と言っているに等しい。チャージ後は Auto-pay をOFFにできるが、再度チャージする際はまた Auto-pay をONにしなければならない。
なお、向こう曰く、「This ensures you won’t run out of credits or have your API key stop working」……つまり「自動設定しておくとクレジット切れで使えなくなることはなくなるよ!」らしい。その言葉に嘘はないが、 チャージ手段がAuto-payしかない ことを考えると白々しいことこの上ない。
注意点2:「OpenAI互換」に隠された罠
先ほど挙げた資料には「The Ninja API follows the OpenAI API spec closely.」とある通り、OpenAI APIに近しい文法で処理を実行できる。各種言語向けのサンプルも書かれているのでそこは親切だ。
# cURLで実行する場合
curl -N https://api.myninja.ai/v1/chat/completions \
-H "Authorization: Bearer PUT_YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"model": "ninja-super-agent:turbo",
"messages": [
{
"role": "user",
"content": "なぜ虹は七色に輝いて見えるのでしょうか?"
}
],
"stream": true,
"stream_options": {
"include_usage": true
}
}'
ただ、「じゃあ"role":"system"
も追加してみようか」と試行すると、次のように弾かれる。
# 出力が分かりやすいのでPython版サンプルで試した結果
openai.UnprocessableEntityError: Error code: 422 - {'detail': [{'type': 'value_error', 'loc': ['body', 'messages'],
'msg': 'Value error, Invalid message role order: system at index 0', 'input': [{'role': 'system', 'content': '(略)'}, {'role': 'user', 'content': '(略)'}], 'ctx': {'error': {}}}]}
「ん、じゃあ"role":"user"
をもう1つ付け加えるか」と試行すると、次のように弾かれる。
# 出力が分かりやすいのでPython版サンプルで試した結果
openai.UnprocessableEntityError: Error code: 422 - {'detail': [{'type': 'value_error', 'loc': ['body', 'messages'],
'msg': 'Value error, Invalid message role order: user at index 1', 'input': [{'role': 'user', 'content': '(略)'}, {'role': 'user', 'content': '(略)'}], 'ctx': {'error': {}}}]}
つまり、ハナから「"role": "user" が1つだけ
」しか捌けない仕様なのだ。そのため、「OpenAI互換だな、よし他のツールに突っ込むぞ!」すると エラーで何故か使えない ってことになる。そんな重大なことはマニュアルに書いておけよ!
注意点3:モデルによってはWeb検索が使えない
これについては、本家OpenAIも、Chat Completionsでは専用モデルを用意しているぐらいなので、対応できていなくても不思議はない。
……が、何故か「Deep Research 2.0 (ninja-deep-research)」だとWeb検索してくれる。例えば「機動戦士Gundam GQuuuuuuXはどんな作品ですか? 日本語で回答してください」と話題を振ると、キッチリ回答してくれるのだ。
(補足:[Step 1]
などとあるのは、Ninja AIの場合、Webサイト版でも、Deep Researchの際は、調査をステップごとに実行して、途中の進捗を報告してくれるため。公式は明言していないが、[Step 12]
をもって調査を打ち切る仕様になっていると思われる)
[Initial plan]
I have worked out a plan of action that I will follow to solve the task.
[Step 1]
I need to search for information about "機動戦士Gundam GQuuuuuuX". This appears to be a title in the Gundam anime/manga franchise, but the unusual "GQuuuuuuX" part makes me wonder if this is a real title or possibly a typo. Let me start with a web search to find information about this specific title.
[Step 2]
I've found multiple search results for "機動戦士Gundam GQuuuuuuX," which appears to be a legitimate Gundam series with the reading "ジークアクス" (GQuuuuuuX = G-Quuux). Let me visit the official website to gather more detailed information about this series.
[Step 3]
I got a 404 error for the official page. The link might be incorrect or the page might have been taken down. Let me
try to visit the Wikipedia page to get more information about this Gundam series.
[Step 4]
I've found valuable information from the Wikipedia page. Let me continue reading the content by scrolling down to get more details about the plot and characters of "機動戦士Gundam GQuuuuuuX".
[Updated plan]
I have updated my plan of action based on the new information I have gathered.
[Step 5]
Let me continue reading the Wikipedia page to gather more information about "機動戦士Gundam GQuuuuuuX". Let's look for information about the voice cast, theme songs, and reception by scrolling down further.
[Step 6]
I've gathered a significant amount of information about "機動戦士Gundam GQuuuuuuX" from the Wikipedia page. Let me continue scrolling to get more information about other characters and production details.
[Step 7]
I've gathered extensive information about the series, its characters, plot, and setting. Let me search for specific
information about the theme songs and merchandise related to the series to complete my overview.
[Step 8]
I now have enough information to provide a comprehensive answer about "機動戦士Gundam GQuuuuuuX". I've learned about the plot, characters, setting, production details, and even the theme songs. Let me formulate a complete answer in
Japanese.
[Citations]
1. https://ja.wikipedia.org/wiki/%E6%A9%9F%E5%8B%95%E6%88%A6%E5%A3%ABGundam_GQuuuuuuX
2. https://www.gundam.info/feature/gquuuuuux/
3. https://x.com/g_gquuuuuux
4. https://bandai-hobby.net/site/gquuuuuux/
5. https://www.amazon.co.jp/%E6%A9%9F%E5%8B%95%E6%88%A6%E5%A3%ABGundam-GQuuuuuuX%EF%BC%88%E3%82%B8%E3%83%BC%E3%82%AF%E3%82%A2%E3%82%AF%E3%82%B9%EF%BC%89/dp/B0CY9PBKXV
6. https://www.gundam.info/feature/gquuuuuux/mecha/46/
7. https://www.pixiv.net/artworks/133006025
8. https://abema.tv/video/title/13-197
9. https://bandai-hobby.net/series/gquuuuuux/
10. https://www.youtube.com/playlist?list=PLKPsuBIKuejN_R7amWhDvTK4Wn9mGeVFy
11. https://www.gundam.info/feature/gquuuuuux/music/theme-song/
12. https://www.youtube.com/watch?v=2aFgfKtg3V4
13. https://www.youtube.com/watch?v=nmc8wiQrqyc
14. https://www.musicman.co.jp/artist/671945
15. https://x.com/g_gquuuuuux
16. https://www.gundam.info/news/video-music/01_17647.html
17. https://www.youtube.com/watch?v=dcxhZTb_6zs
18. https://ticketjam.jp/magazine/music/anison/123918
19. https://news.yahoo.co.jp/articles/8fe58bd66b92c374b39d8875e88b5c59aa9cae59
20. https://www.youtube.com/watch?v=Rd3Gu4pQURY&pp=0gcJCfwAo7VqN5tD
# 機動戦士Gundam GQuuuuuuXに関する研究レポート
## 概要
『機動戦士Gundam GQuuuuuuX』(きどうせんしガンダム ジークアクス)は、2025年4月から6月まで日本テレビ系列『火曜プラチ
ナイトアニメ』枠ほかにて放送された、全12話のテレビアニメ作品です[citation:1]。「ガンダムシリーズ」の一作品であり、こ
れまで多くのガンダム作品を手掛けてきたサンライズ(バンダイナムコフィルムワークスの作品ブランド)と、『新世紀エヴァン
ゲリオン』で知られるスタジオカラーが初めて共同で制作するという画期的な作品となりました[citation:1]。キャッチコピーは
「カラー×サンライズ 夢が、交わる。」です[citation:1]。
## 制作背景
(中略)
| Input tokens: 494 | Output tokens: 7,097 | Elapsed: 241.9 seconds |
補足:価格帯性能について
Ninja AI API は、2025/07/25現在で次のような料金体系だ。NInja AI (Webサイトの方) は無料会員 (Basicプラン) でも、こちらに課金することはできる、といった塩梅である。
Model | Input price / per million tokens | Output price / per million tokens |
---|---|---|
Turbo 1.0 | $0.11 | $0.42 |
Apex 1.0 | $0.88 | $7.00 |
Reasoning 2.0 | $0.38 | $1.53 |
Deep Research 2.0 | $1.40 | $5.60 |
これが競合他社と比べて安いのかだが、例えばOpenAI APIの場合、Turbo 1.0に近い価格なのはGPT-4.1 nanoで、Apex 1.0に近い価格なのはGPT-4.1やOpenAI o3辺りだ。ここに、
- Webサイトの方と違い、TurboやApexやReasoningがWeb検索できない
- 特に Apex 1.0 について、競合と比較しても優秀であることをアピールしている
- Deep ResearchできるREST APIは、OpenAI Deep Research APIやPerplexity AI Sonar Pro APIなどがあるが、それらと比べても安く、Simple QAもPerplexityに迫る性能
ことを考慮しつ、自分にとってベターな選択をしよう。