
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@composio/cloudflare
Advanced tools
The Cloudflare AI provider for Composio SDK, providing seamless integration with Cloudflare's AI capabilities and Workers AI.
The Cloudflare AI provider for Composio SDK, providing seamless integration with Cloudflare's AI capabilities and Workers AI.
npm install @composio/cloudflare
# or
yarn add @composio/cloudflare
# or
pnpm add @composio/cloudflare
import { Composio } from '@composio/core';
import { CloudflareProvider } from '@composio/cloudflare';
// Initialize Composio with Cloudflare provider
const composio = new Composio({
apiKey: 'your-composio-api-key',
provider: new CloudflareProvider({
accountId: 'your-cloudflare-account-id',
apiToken: 'your-cloudflare-api-token',
}),
});
// Get available tools
const tools = await composio.tools.get('user123', {
toolkits: ['gmail', 'googlecalendar'],
limit: 10,
});
import { Composio } from '@composio/core';
import { CloudflareProvider } from '@composio/cloudflare';
import { Ai } from '@cloudflare/ai';
// Initialize Composio
const composio = new Composio({
apiKey: process.env.COMPOSIO_API_KEY,
provider: new CloudflareProvider(),
});
// In your Worker
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
const ai = new Ai(env.AI);
const tools = await composio.tools.get('user123', {
toolkits: ['gmail'],
});
const messages = [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'What can you do?' },
];
const stream = await ai.run('@cf/meta/llama-2-7b-chat-int8', {
messages,
tools,
stream: true,
});
return new Response(stream, {
headers: {
'content-type': 'text/event-stream',
},
});
},
};
import { Composio } from '@composio/core';
import { CloudflareProvider } from '@composio/cloudflare';
import { Ai } from '@cloudflare/ai';
// Initialize Composio
const composio = new Composio({
apiKey: process.env.COMPOSIO_API_KEY,
provider: new CloudflareProvider(),
});
// In your Worker
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
const ai = new Ai(env.AI);
const tools = await composio.tools.get('user123', {
toolkits: ['gmail'],
});
// Image analysis
const imageResponse = await ai.run('@cf/microsoft/resnet-50', {
image: await request.arrayBuffer(),
});
// Use image analysis in chat
const messages = [
{ role: 'system', content: 'You are a helpful assistant.' },
{
role: 'user',
content: 'What do you see in this image?',
context: { image_analysis: imageResponse },
},
];
const stream = await ai.run('@cf/meta/llama-2-7b-chat-int8', {
messages,
tools,
stream: true,
});
return new Response(stream, {
headers: {
'content-type': 'text/event-stream',
},
});
},
};
The CloudflareProvider
class extends BaseComposioProvider
and provides Cloudflare-specific functionality.
executeToolCall(tool: ToolCall): Promise<string>
Executes a tool call and returns the result.
const result = await composio.provider.executeToolCall(toolCall);
We welcome contributions! Please see our Contributing Guide for more details.
ISC License
For support, please visit our Documentation or join our Discord Community.
FAQs
The Cloudflare AI provider for Composio SDK, providing seamless integration with Cloudflare's AI capabilities and Workers AI.
We found that @composio/cloudflare demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.