Integration Guide
Using claw.zip with Node.js
Node.js applications can integrate claw.zip with a single configuration change — no code refactoring required. OpenClaw users in particular will find this the fastest path to significant cost savings on their Claude API usage.
Difficulty:Easy
Time:2 minutes
Before You Start
Prerequisites
- →Node.js 18+
- →An OpenClaw API key
- →A claw.zip account and API key
Step-by-Step
Integration Steps
Step 1
Install the Anthropic SDK
Add the Anthropic SDK to your Node.js project.
bash
npm install @anthropic-ai/sdkStep 2
Configure the client
Point the Anthropic client at claw.zip by changing the base URL.
javascript
const Anthropic = require('@anthropic-ai/sdk');
const client = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
baseURL: 'https://api.claw.zip',
defaultHeaders: {
'x-api-key': process.env.CLAWZIP_API_KEY,
},
});Step 3
Use with Express
Here is an example using claw.zip with an Express.js server.
javascript
const express = require('express');
const app = express();
app.use(express.json());
app.post('/api/chat', async (req, res) => {
const { message } = req.body;
const response = await client.messages.create({
model: 'claude-sonnet-4-20250514',
max_tokens: 1024,
messages: [{ role: 'user', content: message }],
});
res.json(response);
});
app.listen(3000);Step 4
Use with streaming
claw.zip fully supports streaming responses. No changes needed.
javascript
const stream = await client.messages.stream({
model: 'claude-sonnet-4-20250514',
max_tokens: 1024,
messages: [{ role: 'user', content: message }],
});
for await (const event of stream) {
process.stdout.write(event.type);
}Done
You Are All Set
Your Node.js application is now compressing all prompts through claw.zip. Streaming, tool use, and all other OpenClaw features work exactly the same.
More Guides