运维
Generate image assets from Codex with API Stock
Connect Codex to API Stock over MCP and add a generated image to your app with an estimate, spending ceiling and resumable task.
Codex
codex mcp add api-stock --url https://api.api-stock.com/mcpcodex mcp login api-stock在终端中运行这些命令,并在浏览器中批准访问。如果添加服务器时已完成登录,请跳过 login 命令。重启 Codex,然后使用 /mcp 检查连接。
Ask Codex to create an image for the app it is editing. API Stock supplies media-generation tools over MCP. Codex's coding model and its existing file-editing permissions stay under your control.
Connect Codex
Run the add and login commands above. If the add command already starts authentication, complete that flow. Otherwise the login command opens browser sign-in. Review the requested access on API Stock.
Codex CLI and its IDE extension share MCP configuration. Restart the
session after setup. Use /mcp in the terminal interface to check the
server, or codex mcp list in your shell to inspect configured entries.
Use a current client version. This is a remote MCP tool connection, so you do not need to change Codex's model provider or enter an API key in the MCP configuration.
Check the tools first
Use the API Stock MCP tools to call get_account and list_models.Report the balance and available image models. Do not generate anything.
An entry in the configuration proves only that the entry was saved. Authenticated tool calls establish account access; a successful generation is a separate step.
Add one image to an existing screen
Use the app asset brief.
It asks Codex to quote one image, wait for approval, retrieve the completed
file and integrate it into an existing screen. Inspect the model with
get_model; public input parameters differ between models.
For an approved generation, set maxCostUsd and retain the
idempotencyKey and returned task id. Retry the same logical submission
with the same key after an uncertain response. Poll get_task until
completion before downloading its result.
Save the download in the project without forwarding API Stock OAuth credentials to its file URL. A returned remote task id is not a local image. Ask Codex to report the changed file and the terminal task status.
Resume or disconnect
After restarting Codex, supply the saved task id and ask it to inspect that task before starting anything new. Stopping your local session does not cancel an accepted remote request.
If sign-in expires, repeat the login command. You can revoke access in Dashboard → Connectors. Read the MCP reference for tool scopes.
Setup follows the official Codex MCP documentation. Local protocol checks do not establish that every model or a paid production workflow works in your environment.
