Files
puter/tests
iamsrishanth 4fe255347a feat: Add Anthropic Messages API compatibility layer (#2704)
* feat: add Anthropic Messages API compatibility layer

Add a new endpoint at /puterai/anthropic/v1/messages that implements the
Anthropic Messages API wire format, allowing clients using the Anthropic
SDK to point directly at Puter.

- New router translates between Anthropic format and Puter's internal
  svcAiChat.complete() pipeline
- Supports non-streaming, SSE streaming (proper Anthropic event sequence),
  and tool use round-trips
- Translates system field, tool definitions (input_schema -> parameters),
  and tool_result content blocks
- Integration tests covering non-streaming, streaming, tool use,
  Anthropic SDK compatibility, and system parameter

Closes #2554

* Fix authentication middleware

---------

Co-authored-by: ProgrammerIn-wonderland <30693865+ProgrammerIn-wonderland@users.noreply.github.com>
2026-03-24 06:08:25 -04:00
..

Table of Contents

Summary

End-to-end tests for puter-js and http API.

How to use

Initialize the Client Config

  1. Start a backend server:

    npm start
    
  2. Copy example-client-config.yaml and edit the auth_token field. (auth_token can be obtained by logging in on the webpage and typing puter.authToken in Developer Tools's console)

    cp ./tests/example-client-config.yaml ./tests/client-config.yaml
    

Run API-Tester (test http API)

node ./tests/api-tester/apitest.js --unit --stop-on-failure

Run Playwright (test puter-js API with browser environment)

cd ./tests/playwright
npm install
npx playwright install --with-deps
npx playwright test

Run Vitest (test puter-js API with node environment)

npm run test:puterjs-api