### Start Codex with Sakana Fugu Source: https://console.sakana.ai/get-started Run this command to start Codex, defaulting to the Sakana Fugu model. Replace `{your api key}` with your actual Sakana API key. You can switch models using the `/model` command. ```bash # It defaults to fugu; you can switch models using the /model command. SAKANA_API_KEY={your api key} codex -p fugu ``` -------------------------------- ### Query fugu-ultra with OpenAI SDK Source: https://console.sakana.ai/get-started Use the Responses API to query the `fugu-ultra` model. Ensure you have the OpenAI SDK installed and replace 'YOUR_API_KEY' with your actual API key. Consider increasing client-side timeouts for complex tasks. ```python 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) ``` -------------------------------- ### Install Sakana Fugu for Codex Source: https://console.sakana.ai/get-started Install Sakana Fugu into the Codex CLI using a single command. This command is compatible with Ubuntu and macOS. ```bash curl -fsSL https://sakana.ai/fugu/install | bash ``` -------------------------------- ### Launch Sakana Fugu in Codex Source: https://console.sakana.ai/get-started Launch the Sakana Fugu integration within the Codex CLI after installation. Refer to the official repository for additional flags and options. ```bash codex-fugu ``` -------------------------------- ### Install Codex via npm Source: https://console.sakana.ai/get-started Install Codex version 0.141.0 using npm. This command installs the package globally. ```bash # or via npm: npm i -g @openai/codex@0.141.0 ``` -------------------------------- ### Install Codex Standalone Source: https://console.sakana.ai/get-started Install Codex version 0.141.0 using the standalone installer script for macOS or Linux. This method does not require Node.js. ```bash # Standalone installer (macOS / Linux, no Node required): curl -fsSL https://chatgpt.com/codex/install.sh | sh -s -- --release 0.141.0 ``` -------------------------------- ### Configure Sakana Provider Block Source: https://console.sakana.ai/get-started Save this TOML to `~/.codex/config.toml` or `{your_workspace}/.codex/config.toml` to configure the Sakana API provider. It includes stream resilience settings for improved stability. ```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 ``` -------------------------------- ### Configure Sakana Fugu Profile Source: https://console.sakana.ai/get-started Save this TOML to `~/.codex/fugu.config.toml` to set the default model, reasoning effort, and provider. It also disables image generation and apps by default. ```toml model = "fugu" model_reasoning_effort = "high" model_provider = "sakana" model_catalog_json = "~/.codex/fugu.json" [features] image_generation = false apps = false ``` -------------------------------- ### Configure Sakana Fugu Model Catalog Source: https://console.sakana.ai/get-started Save this JSON to `~/.codex/fugu.json` to define the Sakana Fugu model. It includes base instructions for safety guards and model capabilities. ```json { "models": [ { "slug": "fugu", "display_name": "Fugu", "context_window": 1000000, "supported_reasoning_levels": [ { "effort": "high", "description": "Deep reasoning 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" } ], "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": [] } ] } ``` -------------------------------- ### Set Sakana API Key Source: https://console.sakana.ai/get-started Set your Sakana API key as an environment variable. This is required for authenticating API requests. ```bash export SAKANA_API_KEY={your api key} ``` -------------------------------- ### Test Sakana API Connection Source: https://console.sakana.ai/get-started Use curl to send a POST request to the Sakana API's chat completions endpoint to verify your API key and connection. The `fugu` model is used by default. ```bash 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"}]}' ``` -------------------------------- ### Chat Completions Endpoint Source: https://console.sakana.ai/get-started This endpoint allows you to interact with Sakana Fugu models using a chat-based interface, similar to other LLM APIs. It supports sending messages and receiving completions. ```APIDOC ## POST /v1/chat/completions ### Description Sends a request to the Sakana Fugu API to get chat completions from a specified model. ### Method POST ### Endpoint https://api.sakana.ai/v1/chat/completions ### Parameters #### Headers - **Content-Type** (string) - Required - Application JSON - **Authorization** (string) - Required - Bearer $SAKANA_API_KEY #### Request Body - **model** (string) - Required - The model to use for completions (e.g., "fugu"). - **messages** (array) - Required - An array of message objects, where each object has a 'role' (e.g., "user") and 'content' (the message text). ### Request Example { "model": "fugu", "messages": [ { "role": "user", "content": "How many r in word strawberry" } ] } ### Response #### Success Response (200) - **(response structure not detailed in source)** #### Response Example { "example": "(response body not detailed in source)" } ``` -------------------------------- ### Configure Stream Resilience for Codex Source: https://console.sakana.ai/get-started These settings in `config.toml` enhance stream resilience for Codex, adjusting idle timeouts and retry counts for dropped streams and transient HTTP failures. ```toml 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 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.