Connect OpenAI to Codex
Call models, embeddings, files, and vector stores. Add Toolspoke to Codex once and it can use 10 OpenAI actions. Your OpenAI credential stays in Toolspoke, and you choose which actions Codex may call.
Set it up in Codex
Three steps, the first one once for every toolkit you will ever add.
Add Toolspoke to Codex
~/.codex/config.toml
[mcp_servers.toolspoke] url = "https://toolspoke.com/mcp"Codex signs in to Toolspoke on its own the first time it connects, so there is no key to paste.
Install OpenAI and connect it
Add OpenAI to a project in your Toolspoke workspace.
API key. You provide it once, when you install the connector. Toolspoke encrypts it at rest and decrypts it only for the length of a single call, and the gateway attaches it to the outbound request itself, so it is never part of the arguments an agent sends.
- API key
- platform.openai.com → API keys
Choose what Codex may do
All 10 actions start on. Switch off any of the 2 actions that change something in OpenAI, and Codex gets a refusal if it tries.
What you can ask Codex for
A few of the OpenAI actions that only read, so they are safe to try first.
- List the models this API key can call
- Create embedding vectors for one or more strings, for similarity search or clustering
- Classify text (and image URLs) against OpenAI's safety categories before you publish or forward it
- List files uploaded to this OpenAI account, newest first
What Codex can do in OpenAI
8 actions read and 2 write.
Reads
List models
List the models this API key can call. Use before `responses` or `embeddings` when you are unsure a model id exists for this account. Optionally filter by substring; returns at most `limit` entries.
Embeddings
Create embedding vectors for one or more strings, for similarity search or clustering. Defaults to 256 dimensions to keep the response readable, raise `dimensions` when you are storing the vectors.
Moderate
Classify text (and image URLs) against OpenAI's safety categories before you publish or forward it. Returns per-input `flagged`, category booleans, and confidence scores.
List files
List files uploaded to this OpenAI account, newest first. Use it to find the file id for retrieve_file or to check what a vector store was built from.
Retrieve file
Fetch one file's metadata: name, bytes, purpose, and status. Call download_file to read its contents.
Download file
Download a file's contents as text, truncated to 10000 characters. Only useful for text formats such as .txt, .md, .json, or .jsonl, call retrieve_file first for its name, size, and purpose.
List vector stores
List the vector stores on this account with their file counts and sizes. Use it to find the vector_store_id that search_vector_store needs.
Search vector store
Semantic search over the files in one vector store. Returns the matching chunks with their scores and source filenames, use this to ground an answer in the account's own documents.
Writes
Responses
Generate a model response with the Responses API. Use for text generation, structured JSON output, reasoning, and built-in tools like web_search. Returns the full response object plus a flattened output_text field. Streaming is not supported here.
Generate image
Generate images from a text prompt. The default dall-e-3 returns a temporary URL, which is cheap to pass around; gpt-image-* models return base64 bytes, which are omitted unless you set return_base64.
OpenAI in Codex: questions
Does Codex see my OpenAI credential?
No. The credential is stored encrypted in Toolspoke, and the gateway adds it to each call. Codex only ever talks to Toolspoke, and the dashboard shows the last four characters of the credential and nothing more.
Can I stop Codex from changing things in OpenAI?
Yes. Each of the 10 actions can be switched off for a project. Turn off the 2 that change something and Codex can only read.
Will 10 actions crowd Codex's context?
No. Toolspoke shows Codex five bridge tools, plus a guide where a toolkit has one, and Codex searches for the OpenAI action it needs when it needs it. Adding more toolkits does not add more tools to its list.
Does the same work in ChatGPT?
ChatGPT and Codex share one OpenAI account. In ChatGPT, add a custom MCP connector in its settings and paste the same address.
What does it cost?
Tool calls are free on every plan, and a OpenAI call does not run in a sandbox, so it bills nothing.
Try OpenAI in Codex
Free to start, and tool calls cost nothing on any plan.