# Get Started

Although Sakana Fugu is a multi-agent system, it can be used like a standard LLM through the Sakana API, similar to GPT, Gemini, or Claude. The API supports both **Chat Completions** and **Responses** endpoints, with the Responses API providing broader compatibility with modern tooling and integrations.

All API endpoints are available at:

```
https://api.sakana.ai
```

## Create an API key

Before using Sakana Fugu from Codex or a custom workflow, create an [API key](https://console.sakana.ai/api-keys) and copy the generated key. The key is shown only once, so store it somewhere secure before closing the dialog. For details on billing modes and rates, see [Pricing](https://console.sakana.ai/pricing).

To verify that your API key is working and that you can successfully interact with a Sakana Fugu model, run:

```
export SAKANA_API_KEY={your api key}

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"}]}'
```

The `fugu` model routes across all supported providers by default. If you need to opt out of a provider for `fugu` routing, enable **Fugu custom model pool** while creating or editing the API key, then leave only the providers you want `fugu` to use. Leave the setting off to use the full default pool.

## Using Sakana Fugu in Codex

Sakana Fugu plugs into the Codex CLI through a small provider configuration. To quickly get started, you can install Fugu into Codex with a single command:

```
curl -fsSL https://sakana.ai/fugu/install | bash
```

Then launch it with:

```
codex-fugu
```

See the [command reference](https://github.com/SakanaAI/fugu/blob/main/docs/commands_details.md) in our [official repository](https://github.com/SakanaAI/fugu/) for additional flags and options. The one-line install supports Ubuntu and macOS. On Windows, or if the install does not complete with your local environments, see [Manually Setting Up Codex](https://console.sakana.ai/get-started#manually-setting-up-codex).

## Using Sakana Fugu in Custom Workflows

Sakana Fugu is compatible with the standard OpenAI SDK interface. The following Python example uses the [Responses API](https://console.sakana.ai/models#responses-api) to query `fugu-ultra`.

```
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)
```

> **Note:** Both models (`model="fugu"` and `model="fugu-ultra"`) accept two reasoning effort levels: `high` and `xhigh` (also accepted as `max` for compatibility, `xhigh` and `max` currently map to the same level), set via the `reasoning.effort` parameter (for example, `effort="high"`). Any other value is rejected.

> **Note:** For complex tasks, especially when using `fugu-ultra`, you may need to increase client-side timeouts.

Sakana Fugu also supports more advanced configurations, such as [built-in tools like web search](https://console.sakana.ai/models#built-in-tools) and the [Chat Completions](https://console.sakana.ai/models#chat-completions) API.

## Manually Setting Up Codex

Prefer to write the files yourself, or just inspect what the installer does? The steps below produce the same setup.

The Sakana Fugu provider block in `config.toml` adds three stream-resilience keys on top of a plain provider definition, marked clearly below:

```
stream_idle_timeout_ms = 7200000   # 2h: don't drop slow turns at Codex's ~5-min idle default
stream_max_retries = 5             # reconnect a dropped stream instead of failing the turn
request_max_retries = 4            # retry a transient HTTP failure instead of failing the turn
```

### 1. Install Codex (optional)

If you don't already have it, install the Codex CLI version pinned by the Sakana Fugu bundle (the `BUNDLE_CODEX_VERSION` value in [bundle.sh](https://github.com/SakanaAI/fugu/blob/main/configs/bundle.sh)):

```
# Standalone installer (macOS / Linux, no Node required):
curl -fsSL https://chatgpt.com/codex/install.sh | sh -s -- --release <version>

# or via npm:
npm i -g @openai/codex@<version>
```

### 2. Model catalog

Save the following to `~/.codex/fugu.json`. The `base_instructions` carry Sakana Fugu's shipped agent-conduct safety guards (the canonical copy lives at [SakanaAI/fugu](https://github.com/SakanaAI/fugu/blob/main/configs/files/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": []
    }
  ]
}
```

### 3. Profile

Copy the following to `~/.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
```

### 4. Provider block

Copy the following to `~/.codex/config.toml`.

You can also save it to:

```
{your_workspace}/.codex/config.toml
```
instead of your home directory.

The last three keys are the stream-resilience hardening (verified safe; Sakana Fugu is stateless, so retries are idempotent):

```
[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
```

### 5. Start Codex

It defaults to Sakana Fugu. Switch models with `/model`:

```
# It defaults to fugu; you can switch models using the /model command.
SAKANA_API_KEY={your api key} codex -p fugu
```
