This is a mock service for multiple AI services.
/openai/v1/chat/completions(streaming supported)/openai/v1/images/generations/openai/v1/models/openai/v1/models/:id/anthropic/v1/messages(streaming supported)
If you set answer in the request body, the service will echo the answer back.
request_delay: Delay the response time.answer: Echo the answer back.
cd examples/openai
pnpm install
pnpm run build
pnpm run startcd examples/anthropic
pnpm install
pnpm run build
pnpm run startMAX_COMPLETION_TOKENS: The maximum number of tokens in the response.MAXIMUM_REQUEST_DELAY: The maximum request delay.RATELIMITING_ENABLED: Whether to enable rate limiting.ENV: The environment name.DOC_URL: The documentation URL.
npm install -g pnpmcp wrangler_example.toml wrangler.tomlCustomize the wrangler.toml file with your own values.
pnpm install
wrangler login
wrangler deploy -e production