AIやパソコンの専門知識がなくても大丈夫。上から順番に進めれば、Sakana AI の「Fugu」を Codex で使えるようになります。
このガイドでできるようになること
所要時間の目安:だいたい15〜30分。難しい用語は、その都度やさしく説明します。
最初に、このガイドに出てくる4つの言葉だけ押さえておきましょう。完璧に覚える必要はありません。
| 言葉 | やさしい説明 |
|---|---|
| Fugu(フグ) | Sakana AI が作った AI。ChatGPT や Claude の仲間で、文章を書いたり、質問に答えたり、プログラムを手伝ったりできます。 |
| Codex(コーデックス) | パソコンの中で AI に作業を頼める道具。本来は別の AI で動きますが、設定を変えると「Fugu」で動かせます。今回これを目指します。 |
| API キー | Fugu を使うための「あなた専用の鍵」。長い文字列です。これがないと Fugu は反応しません。パスワードと同じくらい大事に扱います。 |
| ターミナル | 文字でパソコンに命令する黒い画面。Mac は「ターミナル」、Windows は「PowerShell」や「WSL(Ubuntu)」がこれにあたります。 |
この3つだけです。途中の「確認テスト」や「Python から使う」は、やりたい人向けの寄り道なので飛ばしても構いません。
Fugu を使うための「鍵」を発行します。
鍵がちゃんと働くか、軽くテストできます。飛ばしても問題ありませんが、最初に確認しておくと安心です。
ターミナルを開き、まず鍵を登録します。{your api key} の部分を、さっき保存した自分の鍵に置き換えてください(波カッコ { } は消します)。
export SAKANA_API_KEY={your api key}
続けて、次のコマンドを貼り付けて Enter を押します。Fugu に「strawberry に r はいくつ?」と質問しています。
curl -X POST https://api.sakana.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $SAKANA_API_KEY" \
-d '{"model":"fugu","messages":[{"role":"user","content":"How many r in word strawberry"}]}'
AI からの返事(文章)が表示されれば、鍵は正しく使えています。
export は Mac / Linux / WSL 用の書き方です。Windows の PowerShell では、代わりに次のように書きます:$env:SAKANA_API_KEY = "ここに鍵"。迷ったら WSL(Ubuntu)の中で上のコマンドを使うのが簡単です。
いよいよ本番です。やり方は2通りあります。まずは A のかんたんインストールを試し、うまくいかない場合や Windows の場合は B の手動セットアップに進んでください。
ターミナルに、次の1行を貼り付けて Enter を押すだけです。Fugu 用の Codex が自動で入ります。
curl -fsSL https://sakana.ai/fugu/install | bash
インストールが終わったら、次のコマンドで起動します。
codex-fugu
追加のオプションは、Sakana の公式リポジトリ(配布元)のコマンド一覧で確認できます。
設定ファイルを自分で用意する方法です。少し手数は増えますが、中身をコピーして貼り付けるだけなので、内容を理解できなくても進められます。全部で5つの手順です。
Codex 本体がまだ無ければ入れます。<version> の部分は、Sakana Fugu が指定するバージョン番号(配布元の bundle.sh 内 BUNDLE_CODEX_VERSION)に置き換えます。
# インストーラーを使う場合(macOS / Linux、Node 不要):
curl -fsSL https://chatgpt.com/codex/install.sh | sh -s -- --release <version>
# または npm を使う場合:
npm i -g @openai/codex@<version>
次の内容を、まるごと ~/.codex/fugu.json という名前で保存します。長いですが、意味は分からなくて構いません。全部そのままコピーしてください。
{
"models": [
{
"slug": "fugu",
"display_name": "Fugu",
"context_window": 1000000,
"supported_reasoning_levels": [
{
"effort": "high",
"description": "Deep reasoning for complex problems"
},
{
"effort": "xhigh",
"description": "Go Brrrr for complex problems"
}
],
"shell_type": "shell_command",
"visibility": "list",
"supported_in_api": true,
"priority": 0,
"base_instructions": "Before recommending or running any command that could stop, restart, or replace the environment you are running in — e.g. `wsl --shutdown` / `wsl --terminate`, host or VM reboot, `systemctl`/service restarts of your runtime, or killing your own shell, container, or session processes — first determine whether you are executing inside that same environment. If you might be, do not run it yourself: warn the user explicitly that the command will end this session and your ability to help until it is restarted, give the exact recovery steps, and let the user run it manually when they are ready.\n\nNever force-kill processes by raw PID against arbitrary or unknown PID lists (e.g. `kill -9`, `Stop-Process -Force`, `taskkill /F`): the agent runtime depends on its own child processes, and force-killing them can permanently break the session. To stop a dev server or free a port, stop the owning task by name; otherwise ask the user before terminating any PID.",
"supports_reasoning_summaries": false,
"default_reasoning_summary": "none",
"support_verbosity": false,
"default_verbosity": null,
"apply_patch_tool_type": "freeform",
"input_modalities": [
"text",
"image"
],
"truncation_policy": {
"mode": "tokens",
"limit": 10000
},
"supports_parallel_tool_calls": true,
"experimental_supported_tools": []
},
{
"slug": "fugu-ultra",
"display_name": "Fugu Ultra",
"context_window": 1000000,
"supported_reasoning_levels": [
{
"effort": "high",
"description": "Deep reasoning for complex problems"
},
{
"effort": "xhigh",
"description": "Go Brrrr for complex problems"
}
],
"shell_type": "shell_command",
"visibility": "list",
"supported_in_api": true,
"priority": 1,
"base_instructions": "Before recommending or running any command that could stop, restart, or replace the environment you are running in — e.g. `wsl --shutdown` / `wsl --terminate`, host or VM reboot, `systemctl`/service restarts of your runtime, or killing your own shell, container, or session processes — first determine whether you are executing inside that same environment. If you might be, do not run it yourself: warn the user explicitly that the command will end this session and your ability to help until it is restarted, give the exact recovery steps, and let the user run it manually when they are ready.\n\nNever force-kill processes by raw PID against arbitrary or unknown PID lists (e.g. `kill -9`, `Stop-Process -Force`, `taskkill /F`): the agent runtime depends on its own child processes, and force-killing them can permanently break the session. To stop a dev server or free a port, stop the owning task by name; otherwise ask the user before terminating any PID.",
"supports_reasoning_summaries": true,
"default_reasoning_summary": "none",
"support_verbosity": false,
"default_verbosity": null,
"apply_patch_tool_type": "freeform",
"input_modalities": [
"text",
"image"
],
"truncation_policy": {
"mode": "tokens",
"limit": 10000
},
"supports_parallel_tool_calls": true,
"experimental_supported_tools": []
}
]
}
次の内容を ~/.codex/fugu.config.toml として保存します。
model = "fugu"
model_reasoning_effort = "high"
model_provider = "sakana"
model_catalog_json = "~/.codex/fugu.json"
[features]
image_generation = false
apps = false
次の内容を ~/.codex/config.toml として保存します。
[model_providers.sakana]
name = "Sakana API"
base_url = "https://api.sakana.ai/v1"
env_key = "SAKANA_API_KEY"
wire_api = "responses"
stream_idle_timeout_ms = 7200000
# keep slow turns alive past Codex's ~5-min idle default
stream_max_retries = 5
# reconnect a dropped stream rather than failing the turn
request_max_retries = 4
# retry a transient HTTP failure rather than failing the turn
stream_idle_timeout_ms など)は、通信が途切れにくくする工夫です。AI が長く考えているときに途中で止まらないようにし、もし途切れても自動でつなぎ直します。Fugu は何度送り直しても安全な作りなので、入れておいて問題ありません。{作業フォルダ}/.codex/config.toml として置くこともできます。
準備完了です。次のコマンドで起動します({your api key} は自分の鍵に置き換え)。
SAKANA_API_KEY={your api key} codex -p fugu
起動すると、最初から Fugu が選ばれています。あとは、やってほしいことを日本語や英語で書いて伝えるだけです。
/model と打ちます。| モデル名 | 特徴 |
|---|---|
fugu | ふだん使い向け。複数のサービスを自動で使い分けて答えます。 |
fugu-ultra | より深く考えるタイプ。難しい問題向け。返事に時間がかかることがあります。 |
high(高)と xhigh(さらに高、別名 max)の2段階で指定できます。難しい作業ほど深い方が向いていますが、その分ゆっくりになります。
自分でプログラムを書く人向けの寄り道です。不要なら飛ばして大丈夫です。
Fugu は ChatGPT などと同じ「OpenAI 形式」に対応しているので、よく知られた書き方でそのまま呼び出せます。
from openai import OpenAI
api_key = "YOUR_API_KEY"
client = OpenAI(
base_url="https://api.sakana.ai/v1",
api_key=api_key
)
response = client.responses.create(
model="fugu-ultra",
input="Write a concise explanation of how TLS works",
timeout=120.0,
)
print(response.output_text)
fugu-ultra のような重い作業では、待ち時間(タイムアウト)を長めにしておくと安心です(例では120秒)。考える深さは reasoning.effort(例:effort="high")で指定できます。
{ } を消し忘れていないかも確認します。| 用語 | 意味 |
|---|---|
| API | ソフト同士がデータをやりとりするための窓口。ここでは Fugu に質問を送り、答えを受け取る仕組み。 |
| API キー | その窓口を使うための、あなた専用の鍵(長い文字列)。他人に見せない。 |
| ベース URL | 接続先の住所。Fugu では https://api.sakana.ai/v1。 |
| ターミナル / シェル | 文字で命令を打つ画面。Mac=ターミナル、Windows=PowerShell や WSL。 |
| WSL | Windows の中で Linux(Ubuntu)を動かすしくみ。Mac / Linux 向けの手順を Windows で使えるようになる。 |
| curl(カール) | ターミナルから通信して、データを送受信する道具。動作確認に使う。 |
| responses / chat completions | Fugu との会話のやり方(規格)の名前。新しい連携には responses が向く。 |