Skip to main content
Pinecone Local, the in-memory emulator, reached end of life on October 7, 2026. If you used it for testing, the mock in this guide covers request and error-handling tests. It doesn’t cover tests that write data and read it back, or tests that need real search results.
You can run a local mock of the Pinecone API from Pinecone’s public OpenAPI specs using Prism, an open-source mock server. The mock checks each request against the spec, rejecting bad request bodies and missing headers, and answers with the example response from the spec. Use it in unit tests and CI to confirm that your code builds valid requests and handles responses and errors, without a Pinecone account or calls to Pinecone. The mock doesn’t store anything, and every call returns the same canned response no matter what you send. If you upsert a document and then fetch or search for it, you get the spec’s example document, not yours. So you can’t use the mock to test a write followed by a read, or to test search relevance. Run those tests against a separate project in your Pinecone account.

Before you begin

Ensure you have the following:

Run the mock

1

Get the API specs

Clone the repository that holds Pinecone’s OpenAPI specs. Each API version has its own directory, such as 2026-07.
Terminal
2

Define the mock services

The Pinecone API is split across three specs, so you run one Prism container for each. In the directory that contains pinecone-api, create a docker-compose.yaml file with the following content:
docker-compose.yaml
This guide uses the 2026-07 specs, the API version that the Pinecone Python SDK v10 and Pinecone Node.js SDK v9 send.Prism publishes images only for Intel and AMD processors (linux/amd64), with no ARM build. On a Mac with Apple silicon, Docker runs them under emulation. The platform setting makes that explicit and silences Docker’s platform warning.
Pin the Prism image to a version that starts. Every 5.15 image, including the 5 and latest tags, exits on startup with TypeError: Cannot read properties of undefined (reading 'isPrimary') on both Intel and Apple silicon. 5.14.3 is the newest version that works.
3

Start the mock

Start the three containers in the background:
Terminal
Prism takes several seconds to load each spec. When all three are ready, docker compose logs shows a line like this for each port:
Output
4

Point the SDK at the mock

Set the client’s host to the control-plane mock, and target the index by host with the data-plane mock. Any API key works, but the SDK requires one. In Python, use the HTTP client, not the gRPC client, because the mock doesn’t serve gRPC.Don’t target the index by name. The SDK would describe the index to look up its host, and the mock returns the spec’s example host on pinecone.io, not the mock.
All three calls succeed, and all three return the spec’s examples instead of results based on your request. The index you described is named my-index, the upsert reports two documents even though you sent one, and the top match is doc-1:
Output
The Vectors API methods, such as upsert, query, and fetch, work against the mock the same way.

Mock inference calls

The Pinecone Inference endpoints, such as embed and rerank, are in a separate spec, so they’re served from a separate port. Create a second client with the inference mock as its host:
The top result’s score is the spec’s example score:
Output

Test error handling

To test how your code handles API errors, ask Prism for a specific status code with the Prefer header. Prism returns that code for every request from a client that sets the header. Data-plane endpoints return any 4xx or 5xx code. Control-plane and inference endpoints return only the codes their spec lists. For any other code, Prism responds with a 404 that says the requested status code isn’t defined. For more on handling errors, see Error handling.

Example

Return 503 Service Unavailable from a document search to test your retry handling:
Both SDKs retry a 503 three times before they raise an error, so this test takes a few seconds. The Python SDK raises ServiceError, and the Node.js SDK raises PineconeMaxRetriesExceededError.

Run the mock in CI

In a GitHub Actions workflow, start the mock with Docker Compose as a step before your tests run. GitHub’s services containers can’t pass Prism its mock command or mount the specs, so you can’t use them here. The following workflow assumes your repository has the docker-compose.yaml file from this guide at its root and your tests in a tests directory. It clones the specs, starts the mock, waits until all three ports respond, and runs the tests:
.github/workflows/test.yaml

Limitations

Some calls fail against the mock even though they work against Pinecone:
  • Upserting records into a legacy integrated index: The legacy Records API methods, upsert_records and upsertRecords, send newline-delimited JSON, which Prism can’t parse, so the mock rejects them with a 422. Searching a legacy integrated index works, and so does upserting into a document index.
  • Embedding with the Node.js SDK: The mock’s embed response doesn’t include a valid vector_type for each embedding, so inference.embed() throws No variant of Embedding exists with 'vectorType=undefined'. Embedding works with the Python SDK, and reranking works with both.

Stop the mock

Stop and remove the containers:
Terminal