Reference · LLM providers
AvailableLast verified
Providers, routes, and wire formats
The provider is detected from the request path. Every route normalizes the request into one shape, evaluates the same fixtures, and renders the winner back in that provider's JSON, SSE, NDJSON, or binary event-stream format.
In this guide
- Every served route and its base URL
- Streaming format per provider
- Reasoning and structured-output rendering
- Errors, headers, and unmatched requests
Prerequisites
- An LLM DotMock workspace, or a local dotmock.yaml served by dotmock serve
- The workspace ID in $API_ID and its runtime URL in $MOCK_URL (SDK base URL $MOCK_URL/v1 for OpenAI-compatible clients)
On this page
Served routes
All routes live on the mock host ($MOCK_URL, or http://127.0.0.1:8080/<subdomain> in local mode). The provider value in the list is what the provider match field, the provider condition, and the journal record.
- openai — POST /v1/chat/completions (also /v1/chat): Chat Completions, SSE when stream is true
- openai (Responses) — POST /v1/responses: Responses API, named SSE events when stream is true
- openai (embeddings) — POST /v1/embeddings: embeddings; unmatched input returns deterministic SHA-256 vectors (dimensions default 1536, max 8192; encoding_format base64 supported)
- openai — GET /v1/models and /v1/models/{id}: model list; Anthropic shape when anthropic-version is sent, Gemini shape when x-goog-api-key is sent
- anthropic — POST /v1/messages: Messages API, SSE when stream is true
- anthropic — POST /v1/messages/count_tokens: returns { input_tokens }
- gemini — POST /v1beta/models/{model}:generateContent and :streamGenerateContent (also /v1/models/{model}:…); GET /v1beta/models
- bedrock — POST /model/{id}/converse, /converse-stream, /invoke, /invoke-with-response-stream
- azure — POST /openai/deployments/{deployment}/chat/completions and …/embeddings; the deployment ID is the default model
- ollama — POST /api/chat and /api/generate
- cohere — POST /v2/chat
- WebSocket — any path with Upgrade: websocket, conventionally WS /v1/responses and WS /v1/chat
Base URL per SDK
Set the SDK base URL to the value below. Any non-empty API key works unless the mock requires x-api-key.
OPENAI_BASE_URL="$MOCK_URL/v1" # OpenAI SDKs, Vercel AI SDK, LangChain, LlamaIndex
ANTHROPIC_BASE_URL="$MOCK_URL" # Anthropic SDKs
GOOGLE_GEMINI_BASE_URL="$MOCK_URL" # google-genai http_options.base_url
AZURE_OPENAI_ENDPOINT="$MOCK_URL" # Azure OpenAI SDKs
AWS_ENDPOINT_URL_BEDROCK_RUNTIME="$MOCK_URL" # boto3 / AWS SDK endpoint_url
OLLAMA_HOST="$MOCK_URL" # Ollama clients
CO_API_URL="$MOCK_URL" # Cohere clientsStreaming format per provider
Chunking and pacing come from the fixture's streaming settings; only the envelope differs by provider.
- OpenAI Chat — data: chunk objects terminated by data: [DONE]; with stream_options.include_usage a usage chunk is included
- OpenAI Responses — response.created, response.in_progress, response.output_item.added, reasoning summary events, response.content_part.added, response.output_text.delta/.done, response.function_call_arguments.delta/.done, response.output_item.done, then response.completed (or response.incomplete); every event carries sequence_number
- Anthropic — message_start, ping, content_block_start/delta/stop (text_delta, thinking_delta, signature_delta, input_json_delta), message_delta, message_stop
- Gemini — ?alt=sse returns SSE; otherwise a streamed JSON array
- Bedrock — AWS binary event-stream (application/vnd.amazon.eventstream) with :event-type, :content-type, and :message-type headers; converse-stream emits messageStart, contentBlockStart (tool use), contentBlockDelta, contentBlockStop, messageStop, metadata; invoke-with-response-stream emits chunk events with base64 Claude Messages bytes
- Ollama — NDJSON (application/x-ndjson); stream defaults to true as in Ollama
- Cohere — message-start, content-start/delta/end, tool-plan-delta, tool-call-start/delta/end, message-end
Request normalization
Message content may be a string, null, a single part, or an array of parts; text, input_text, and output_text parts are joined with newlines and images are ignored for matching. Tools are accepted in the nested function shape or the flat shape, and tool arguments as a string or an object.
For the Responses API, input may be a string or a list of message, function_call, and function_call_output items (the last become tool results), and instructions becomes the system prompt. The system prompt used for matching is the first system or developer message.
Reasoning and structured outputs by provider
A fixture's response.reasoning text is rendered as each provider's native reasoning field. When a fixture has no content and no tool calls, DotMock synthesizes a schema-valid answer: forced-tool arguments from the tool's parameter schema, or content from the requested output schema, or {} for a plain JSON request.
- OpenAI Chat — reasoning_content; schema from response_format, forced tool from tool_choice
- Responses API — a reasoning item with summary_text; schema from text.format
- Anthropic — a thinking block with a signature; forced tool only
- Gemini — thought parts and thoughtsTokenCount; schema from responseMimeType with responseSchema or responseJsonSchema, forced tool from toolConfig mode ANY
- Bedrock — reasoningContent.reasoningText; forced tool only
- Ollama — thinking; schema from format
- Cohere — a thinking content block on non-streamed responses; schema from response_format.json_schema, forced tool from tool_choice REQUIRED
Errors, headers, and unmatched requests
A fixture error is rendered in the provider's error envelope: OpenAI { error: { message, type, code } }, Anthropic { type: "error", error }, Gemini { error: { code, message, status } }, Bedrock { message } with x-amzn-ErrorType, Ollama { error }, and Cohere { message }. Statuses outside 400–599 become 500, and a 429 adds Retry-After.
When nothing matches and no VCR fallback is configured, the response is 404 with code no_fixture_matched.
- Every response: x-request-id, request-id, x-dotmock-fixture-id, x-dotmock-fixture-name
- OpenAI and Azure: openai-version, openai-processing-ms, x-ratelimit-*
- Anthropic: anthropic-ratelimit-*; Bedrock: x-amzn-requestid
- VCR responses: x-dotmock-vcr: proxy or replay