API template library

Anthropic Claude mock API and live sandbox

A WireMock simulation of Anthropic's REST API — covering the Messages API, models, message batches, files, and skills.

Vendor
Anthropic
Functionality
Messages, batches, files, models
Spec version
2023-06-01
Endpoints
24
Stubs
31
Protocol
REST
Validation
AI-validated Before publication, an AI agent exercised these endpoints against the real Anthropic 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

Anthropic

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

Base URL
https://2284d.wiremockapi.cloud

GET List available Claude models

curl -s -X GET 'https://2284d.wiremockapi.cloud/v1/models'

POST Create a message (Claude chat completion)

curl -s -X POST 'https://2284d.wiremockapi.cloud/v1/messages' \
  -H 'Content-Type: application/json' \
  -d '{"model":"claude-opus-4-20250514","max_tokens":256,"messages":[{"role":"user","content":"Hello, Claude"}]}'
Method Path Summary
POST /v1/complete Create a Text Completion
GET /v1/files List Files
POST /v1/files Upload File
DELETE /v1/files/{file_id} Delete File
GET /v1/files/{file_id} Get File Metadata
GET /v1/files/{file_id}/content Download File
POST /v1/messages Create a Message
GET /v1/messages/batches List Message Batches
POST /v1/messages/batches Create a Message Batch
DELETE /v1/messages/batches/{message_batch_id} Delete a Message Batch
GET /v1/messages/batches/{message_batch_id} Retrieve a Message Batch
POST /v1/messages/batches/{message_batch_id}/cancel Cancel a Message Batch
GET /v1/messages/batches/{message_batch_id}/results Retrieve Message Batch results
POST /v1/messages/count_tokens Count tokens in a Message
GET /v1/models List Models
GET /v1/models/{model_id} Get a Model
GET /v1/skills List Skills
POST /v1/skills Create Skill
DELETE /v1/skills/{skill_id} Delete Skill
GET /v1/skills/{skill_id} Get Skill
GET /v1/skills/{skill_id}/versions List Skill Versions
POST /v1/skills/{skill_id}/versions Create Skill Version
DELETE /v1/skills/{skill_id}/versions/{version} Delete Skill Version
GET /v1/skills/{skill_id}/versions/{version} Get Skill Version

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

What's inside the Anthropic template

The template mirrors Anthropic's REST surface as published in spec version 2023-06-01. Its core is the Messages endpoint, and the stub answers with everything a production reply carries — assistant content blocks, a stop reason, and a per-request usage object with input and output token counts — so client code written against real Claude responses parses these without modification.

  • Messages & token counting — chat requests, plus count_tokens for pre-flight sizing
  • Models — a catalog of current Claude model ids you can feed straight back into requests
  • Message Batches — the full create, poll, cancel, and results lifecycle
  • Files — upload, metadata, download, and delete
  • Skills — create, read, and delete, with per-skill version management
  • Text Completions — the legacy /v1/complete endpoint, for older client code

Example implementation using the Anthropic SDK

The official Anthropic SDKs accept a base-URL override, so redirecting a client takes two constructor arguments — the calls themselves don't change:

Agents and tools that use the SDK internally can be redirected the same way through the ANTHROPIC_BASE_URL environment variable — no code changes at all. Swap in your own mock's URL once you've created one in WireMock Cloud.

Because every response is deterministic, this fills the gap for CI suites that can't depend on live model availability, for developing agent loops without burning tokens, and for demoing a Claude-integrated feature when no real key is in the room.

import anthropic

# the sandbox URL, or your own mock's —
# the api_key is accepted but never validated
client = anthropic.Anthropic(
    base_url="https://2284d.wiremockapi.cloud",
    api_key="any-value",
)

reply = client.messages.create(
    model="claude-opus-4-6",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello, Claude"}],
)
print(reply.content[0].text)

Frequently asked questions

No. The mock accepts any x-api-key value and never validates it. Don't send a real key to the shared sandbox, though — it's a public, unauthenticated endpoint, and no live credential should ever travel to it.

No model runs behind the mock. Each reply is a recorded example: production structure, fixed text. That fixedness is the feature — assertions never flake because Claude phrased an answer differently between runs.

Not in the sandbox — a request with stream set to true gets the complete JSON message rather than server-sent events. Test the non-streaming path here, or shape a custom SSE stub in your own WireMock Cloud copy.

The sandbox serves happy paths only. In your WireMock Cloud copy, add stubs that return Anthropic-shaped error bodies — a rate_limit_error with a 429, an overloaded_error with a 529 — and point your retry logic at them: a scenario you can't trigger on demand against the real API.

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