API template library

OpenAI mock API and live sandbox

A WireMock simulation of OpenAI's REST API — covering the Chat Completions API, assistants, audio, message batches, embeddings, and evals.

Vendor
OpenAI
Functionality
Chat, assistants, audio, embeddings
Spec version
2.3.0
Endpoints
237
Stubs
421
Protocol
REST
Validation
AI-validated Before publication, an AI agent exercised these endpoints against the real OpenAI API through WireMock's recording proxy, and the recorded traffic was used to verify each stub's request and response shapes.

Live sandbox · no signup, no API key

OpenAI

A running WireMock Cloud instance of this template, callable right now from a terminal, a script, or an AI agent.

Base URL
https://o9d7e.wiremockapi.cloud

GET List available OpenAI models

curl -s -X GET 'https://o9d7e.wiremockapi.cloud/models'

POST Create a chat completion

curl -s -X POST 'https://o9d7e.wiremockapi.cloud/chat/completions' \
  -H 'Content-Type: application/json' \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hello"}]}'
Method Path Summary
GET /assistants Returns a list of assistants.
POST /assistants Create an assistant with a model and instructions.
DELETE /assistants/{assistant_id} Delete an assistant.
GET /assistants/{assistant_id} Retrieves an assistant.
POST /assistants/{assistant_id} Modifies an assistant.
POST /audio/speech Generates audio from the input text. Returns the audio file content, or a stream of audio events.
POST /audio/transcriptions Transcribes audio into the input language. Returns a transcription object in json, diarized_json, or verbose_json format, or a stream of transcript events.
POST /audio/translations Translates audio into English.
GET /audio/voice_consents Returns a list of voice consent recordings.
POST /audio/voice_consents Upload a voice consent recording.
DELETE /audio/voice_consents/{consent_id} Deletes a voice consent recording.
GET /audio/voice_consents/{consent_id} Retrieves a voice consent recording.
POST /audio/voice_consents/{consent_id} Updates a voice consent recording (metadata only).
POST /audio/voices Creates a custom voice.
GET /batches List your organization's batches.
POST /batches Creates and executes a batch from an uploaded file of requests
GET /batches/{batch_id} Retrieves a batch.
POST /batches/{batch_id}/cancel Cancels an in-progress batch. The batch will be in status cancelling for up to 10 minutes, before changing to cancelled, where it will have partial results (if any) available in the output file.
GET /chat/completions List stored Chat Completions. Only Chat Completions that have been stored with the store parameter set to true will be returned.
POST /chat/completions Creates a model response for the given chat conversation.
DELETE /chat/completions/{completion_id} Delete a stored chat completion. Only Chat Completions that have been created with the store parameter set to true can be deleted.
GET /chat/completions/{completion_id} Get a stored chat completion. Only Chat Completions that have been created with the store parameter set to true will be returned.
POST /chat/completions/{completion_id} Modify a stored chat completion.
GET /chat/completions/{completion_id}/messages Get the messages in a stored chat completion. Only Chat Completions that have been created with the store parameter set to true will be returned.
POST /chatkit/sessions Create a ChatKit session.
POST /chatkit/sessions/{session_id}/cancel Cancel an active ChatKit session and return its most recent metadata. Cancelling prevents new requests from using the issued client secret.
GET /chatkit/threads List ChatKit threads with optional pagination and user filters.
DELETE /chatkit/threads/{thread_id} Delete a ChatKit thread along with its items and stored attachments.
GET /chatkit/threads/{thread_id} Retrieve a ChatKit thread by its identifier.
GET /chatkit/threads/{thread_id}/items List items that belong to a ChatKit thread.
POST /completions Creates a completion for the provided prompt and parameters. Returns a completion object, or a sequence of completion objects if the request is streamed.
GET /containers List Containers
POST /containers Create Container
DELETE /containers/{container_id} Delete Container
GET /containers/{container_id} Retrieve Container
GET /containers/{container_id}/files List Container files
POST /containers/{container_id}/files Create a Container File You can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID.
DELETE /containers/{container_id}/files/{file_id} Delete Container File
GET /containers/{container_id}/files/{file_id} Retrieve Container File
GET /containers/{container_id}/files/{file_id}/content Retrieve Container File Content
POST /conversations Create a conversation.
DELETE /conversations/{conversation_id} Delete a conversation. Items in the conversation will not be deleted.
GET /conversations/{conversation_id} Get a conversation
POST /conversations/{conversation_id} Update a conversation
GET /conversations/{conversation_id}/items List all items for a conversation with the given ID.
POST /conversations/{conversation_id}/items Create items in a conversation with the given ID.
DELETE /conversations/{conversation_id}/items/{item_id} Delete an item from a conversation with the given IDs.
GET /conversations/{conversation_id}/items/{item_id} Get a single item from a conversation with the given IDs.
POST /embeddings Creates an embedding vector representing the input text.
GET /evals List evaluations for a project.
POST /evals Create the structure of an evaluation that can be used to test a model's performance.
DELETE /evals/{eval_id} Delete an evaluation.
GET /evals/{eval_id} Get an evaluation by ID.
POST /evals/{eval_id} Update certain properties of an evaluation.
GET /evals/{eval_id}/runs Get a list of runs for an evaluation.
POST /evals/{eval_id}/runs Kicks off a new run for a given evaluation, specifying the data source, and what model configuration to use to test.
DELETE /evals/{eval_id}/runs/{run_id} Delete an eval run.
GET /evals/{eval_id}/runs/{run_id} Get an evaluation run by ID.
POST /evals/{eval_id}/runs/{run_id} Cancel an ongoing evaluation run.
GET /evals/{eval_id}/runs/{run_id}/output_items Get a list of output items for an evaluation run.

+177 more endpoints in the full spec.

Unauthenticated WireMock Cloud demo sandbox for OpenAI — not an official OpenAI sandbox, and it returns simulated example data only.

What's inside the OpenAI template

OpenAI's platform is far more than chat, and the template reflects that: it is generated from the platform's own OpenAPI description, version 2.3.0, and spans a couple hundred endpoints. Post to /chat/completions and the stub replies with the full completion object — a choices array carrying the assistant message, a finish_reason, and a usage block totalling prompt and completion tokens — the exact structure the openai client libraries deserialize, so nothing downstream needs a special code path for mock mode.

  • Chat Completions — completion creation, plus list, get, update, and delete for stored completions
  • Assistants — full CRUD over assistant configurations
  • Audio — speech synthesis, transcription, translation, and custom voices
  • Batches — create and execute a batch, poll its status, cancel it mid-run
  • Embeddings — vector generation for arbitrary input text
  • Evals — evaluation definitions, runs, and per-run output items
  • Conversations & ChatKit — conversation items alongside ChatKit sessions and threads
  • Containers — container and container-file management

Example implementation using the OpenAI SDK

The official openai libraries take a base_url at construction, so the swap is a single argument — plus a key the mock will never actually check:

The same redirect works without touching code: the library reads the OPENAI_BASE_URL environment variable, which is the practical route for pointing a whole agent stack or a third-party tool at the mock.

What you get in exchange is repeatability. Test suites stop failing because a model answered differently, integration branches can hammer the API without a usage bill, and a demo laptop needs no secrets at all.

from openai import OpenAI

# point the client at the sandbox,
# or at your own mock's URL
client = OpenAI(
    base_url="https://o9d7e.wiremockapi.cloud",
    api_key="any-value",
)

reply = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)

Frequently asked questions

It won't — any Authorization header passes, including none. Treat that as a reason to keep production secrets away from the shared sandbox entirely: it's an open endpoint, and a real sk- key has no business in requests to it.

You get the complete chat-completion JSON in one response rather than a token-by-token SSE stream. Non-streaming client code works as-is; to exercise genuine event-by-event delivery, stub a server-sent-events response in a private copy of the template.

No — replies are pre-recorded bodies with production-correct structure. The model id in your request is accepted, but the content string is fixed, which is exactly what makes the mock usable in CI: the same input yields the same bytes every run.

The shared sandbox only serves success responses. Copy the template into WireMock Cloud and add stubs returning OpenAI's error envelope — insufficient_quota on a 429, or a 500 with error.type set to server_error — then aim your retry and backoff logic at those.

Vendor names identify APIs represented by WireMock template sources. This page does not imply vendor endorsement, certification, partnership, or official integration status.