Game particle effects in OpenAI Codex

Connect the Codex CLI or IDE extension to the ParticleFX MCP server in config.toml, then have Codex build an explosion and export a TexturePacker atlas for PixiJS.

Updated

The Codex CLI, the IDE extension and the ChatGPT desktop app read MCP servers from the same config.toml, so one entry gives all of them the ParticleFX tools. Codex can then make an effect, check the renders, and download the export into your repository like any other file it creates.

Connect Codex

  1. Sign in at particlefx.studio and make an API key on your billing page. Any account can, the free one included. The key starts with pfx_live_, is shown once, and can be revoked there at any time.
  2. Put the key in an environment variable. Codex sends it as a bearer token, so it never sits in the config file.
  3. Add the server with codex mcp add, or by hand in ~/.codex/config.toml. In the IDE extension you can also use the gear menu: MCP servers, Add server, Streamable HTTP.
  4. Run codex mcp list to see it, or /mcp inside a Codex session.
Terminal
export PFX_API_KEY=pfx_live_your_key
codex mcp add particlefx --url https://mcp.particlefx.studio/mcp --bearer-token-env-var PFX_API_KEY
~/.codex/config.toml
[mcp_servers.particlefx]
url = "https://mcp.particlefx.studio/mcp"
bearer_token_env_var = "PFX_API_KEY"

To connect with your ParticleFX account instead of a key, add the server without --bearer-token-env-var and run codex mcp login particlefx. It opens particlefx.studio to sign in and allow the connection.

Example: a ship explosion for PixiJS

Prompt
Use the particlefx MCP tools. Start from the Ship Explosion library effect, name it
ship-explosion, make the debris spread a little wider, check the render, then export a
spritesheet with TexturePacker JSON, transparent, 30 fps, into src/assets/fx/. Add an
explode(x, y) helper that plays it once with PixiJS.

What happens, tool by tool:

  1. list_presets finds Ship Explosion (shmup/shipExplosion) in the library.
  2. create_effect copies it into your account as ship-explosion. From here on it is your effect: it shows up on My effects and open_in_studio gives a link to it.
  3. edit_effect applies the change you asked for as edit ops, the same edit language the studio and its own agent use.
  4. render_preview returns a labelled contact sheet of moments across the loop. Codex looks at it, and edits again if something reads badly. analyze_effect checks that the loop closes and counts particles over it.
  5. export_effect with format: "sheet", sheet_meta: "texturepacker", transparent: true and fps: 30 renders the real thing at full size and returns a download link that works for 1 hour.
  6. Codex downloads the zip and unpacks it into src/assets/fx/: ship-explosion.png and ship-explosion.json. Fetching the link is a network command, which the default sandbox blocks, so Codex asks you to approve it.

To let downloads through without a prompt each time, turn on network access for the sandbox in config.toml:

~/.codex/config.toml
[sandbox_workspace_write]
network_access = true

The JSON lists the frames under animations["ship-explosion"], which PixiJS turns into textures for an AnimatedSprite:

PixiJS v8
import { AnimatedSprite, Assets } from 'pixi.js';

const sheet = await Assets.load('assets/fx/ship-explosion.json');

export function explode(x, y) {
  const fx = new AnimatedSprite(sheet.animations['ship-explosion']);
  fx.anchor.set(0.5);
  fx.position.set(x, y);
  fx.animationSpeed = 30 / 60; // exported at 30 fps, the ticker runs at 60
  fx.loop = false;
  fx.onComplete = () => fx.destroy();
  app.stage.addChild(fx);
  fx.play();
}
  • Glow: export with transparent: false and black_background: true, then set fx.blendMode = 'add'.
  • Pixel art: load the texture with scaleMode: 'nearest'.
  • More detail on the atlas: Spritesheets with TexturePacker JSON.

What it costs

Connecting costs nothing, and neither do searching the library, reading the reference, analysing an effect, or any edit after the first. Paid steps use builds, the same builds as on the website:

  • Create the effect from a library preset (create_effect): 1 build.
  • Edits and the loop check (edit_effect, analyze_effect): free.
  • Previews (render_preview): the first 20 of each UTC day free, then 1 build per 4, at most 200 a day.
  • Export (export_effect, TexturePacker atlas): 1 build, and the TexturePacker JSON needs a paid plan.

So this example takes 2 builds of work if the previews stay inside the free ones: 1 for the new effect and 1 for the export. The free sign-up and daily builds are for the website and never pay for MCP calls. On a free account and on Starter, MCP calls are paid from pack builds, from $4.99 for 150 that never expire. Creator at +50%, Studio at +25%, Studio Max one for one can spend plan builds instead, and fall back to pack builds when those run out. Work that fails on our side is refunded.

The TexturePacker JSON is a plan feature, as in the studio: any plan, from $7.99 a month (Starter), unlocks it. Without a plan the same build exports a GIF, WebP, APNG, PNG frames, or the sheet as an image only (sheet_meta: "none").

If you would rather our own effects agent did the creative work, build_effect takes a description and costs 1 build (Basic) or 10 (Pro). Full price list: MCP tools and keys, limits and billing.

Next

Every tool and its parameters are in the tools reference. Setup for the other clients is on Coding agents, and any of the free effects can be the starting point for Codex.

Questions

Does the Codex IDE extension use the same MCP setup as the CLI?

Yes. The CLI, the IDE extension and the ChatGPT desktop app share ~/.codex/config.toml, so a server added with codex mcp add is available in all of them.

How does Codex send the API key?

With bearer_token_env_var = "PFX_API_KEY" Codex reads the key from that environment variable and sends it as an Authorization: Bearer header, so the key is not written into config.toml.

Why did Codex ask before downloading the export?

Exports come back as a download link, and fetching it is a network command. The default workspace-write sandbox has network access off, so Codex asks you to approve the command. Set network_access = true under [sandbox_workspace_write] in config.toml to allow it.

Can I use the effects in a commercial game?

Yes. Exported effects, including ones started from the library or changed by your agent, may be used in any project, commercial games included, with no credit required. Reselling the library itself as an effect pack is not allowed.

More coding agents