Connect OpenAI to VS Code

Call models, embeddings, files, and vector stores. Add Toolspoke to VS Code once and it can use 10 OpenAI actions. Your OpenAI credential stays in Toolspoke, and you choose which actions VS Code may call.

Set it up in VS Code

Three steps, the first one once for every toolkit you will ever add.

  1. Add Toolspoke to VS Code

    .vscode/mcp.json, or the MCP: Add Server command

    { "servers": { "toolspoke": { "type": "http", "url": "https://toolspoke.com/mcp" } } }

    Approve the authorization request when VS Code opens it.

  2. 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
  3. Choose what VS Code may do

    All 10 actions start on. Switch off any of the 2 actions that change something in OpenAI, and VS Code gets a refusal if it tries.

What you can ask VS Code 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 VS Code 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 VS Code: questions

Does VS Code see my OpenAI credential?

No. The credential is stored encrypted in Toolspoke, and the gateway adds it to each call. VS Code only ever talks to Toolspoke, and the dashboard shows the last four characters of the credential and nothing more.

Can I stop VS Code 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 VS Code can only read.

Will 10 actions crowd VS Code's context?

No. Toolspoke shows VS Code five bridge tools, plus a guide where a toolkit has one, and VS Code searches for the OpenAI action it needs when it needs it. Adding more toolkits does not add more tools to its list.

Where do the tools show up in VS Code?

In chat, in agent mode, which is where VS Code uses MCP servers. Add the block to .vscode/mcp.json for one workspace, or use the MCP: Add Server command.

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 VS Code

Free to start, and tool calls cost nothing on any plan.