cloudflare/cloudflare-typescript

Public

mirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v3.0.0-beta.10

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

examples/demo.ts

17lines · modecode

1#!/usr/bin/env -S npm run tsn -T
2
3import Cloudflare from 'cloudflare';
4
5// gets API Key from environment variable CLOUDFLARE_API_KEY & CLOUDFLARE_EMAIL
6const client = new Cloudflare();
7
8async function main() {
9 const accountId = '<your accound ID>';
10
11 const response = await client.ai.run(accountId, '@cf/meta/llama-2-7b-chat-int8', {
12 prompt: 'Tell me about Workers AI',
13 });
14 console.log(response);
15}
16
17main();
18