API Stock

Betrieb

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.

2 Min. Lesezeit4 Abschnitte

Codex

codex mcp add api-stock --url https://api.api-stock.com/mcp
codex mcp login api-stock

Führen Sie diese Befehle im Terminal aus und bestätigen Sie den Zugriff im Browser. Wenn Sie beim Hinzufügen des Servers bereits angemeldet wurden, überspringen Sie den login-Befehl. Starten Sie Codex neu und prüfen Sie die Verbindung mit /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

text
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.

Mit dem eigenen Schlüssel ausführen

Wählen Sie ein Modell im API Stock-Katalog, prüfen Sie den Preis und testen Sie es im Browser oder per API.

Weiterlesen