Skip to main content

Codex Image Generator

通过 codex-proxy 提供图片生成能力的 MCP 服务。

安装

pipx install codex-image-generator

或者使用 uv:

uvx codex-image-generator

配置

设置环境变量:

# Windows
set CODEX_PROXY_URL=http://10.10.17.52:8080/v1
set CODEX_PROXY_API_KEY=codex-proxy-xxx

# Linux/macOS
export CODEX_PROXY_URL=http://10.10.17.52:8080/v1
export CODEX_PROXY_API_KEY=codex-proxy-xxx

然后写入 Codex 配置:

codex-image-generator --write-config

这会向 ~/.codex/config.toml 追加 MCP 服务配置。

手动配置

如果 --write-config 不适用,可以手动在 ~/.codex/config.toml 中添加:

[mcp_servers.image_generator]
type = "stdio"
command = 'codex-image-generator'
startup_timeout_sec = 120

使用

重启 Codex 后,在对话中让 Codex 生成图片即可,例如:

生成一张白色背景上的红色圆形图片

前提条件

  • codex-proxy 已部署并可通过 CODEX_PROXY_URL 访问
  • 连接的 OpenAI 账号为 ChatGPT Plus 及以上(free 账号不支持图片生成)

支持参数

工具 generate_image 支持以下参数:

  • prompt(必填):图片生成提示词
  • size(可选):图片尺寸,默认 1024x1024
  • output_path(可选):输出路径,默认 output.png

Release files for codex-image-generator 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codex-image-generator 0.1.0
File Size Uploaded
codex_image_generator-0.1.0.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for codex-image-generator 0.1.0
File Interpreter ABI Platform
codex_image_generator-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / codex_image_generator-0.1.0.tar.gz

Download URL codex_image_generator-0.1.0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9947ff2cddcc4d266ec5b199c6a79f0779b12fee84e0f4aeac1c1f8b5f07b2e7
BLAKE2b-256 checksum
How to use checksums
37b77de822148aaecbe8752debdbf470c18da7f11f40f62af6a722ae3653a074
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / codex_image_generator-0.1.0-py3-none-any.whl

Download URL codex_image_generator-0.1.0-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0c065bb1a6cb719f7f1942464a920419e671b5fba92e04e262e07c4d26155908
BLAKE2b-256 checksum
How to use checksums
4eab88fc72891782e08ffd426c1bd16218e52149c8eb9ec7302d8309c801b79b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page