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 start
cd examples/anthropic
pnpm install
pnpm run build
pnpm run start
MAX_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 pnpm
cp wrangler_example.toml wrangler.toml
Customize the wrangler.toml file with your own values.
pnpm install
wrangler login
wrangler deploy -e production