cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
generated-2c44b1b60a

Branches

Tags

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

Clone

HTTPS

Download ZIP

examples/demo.ts

17lines · modepreview

#!/usr/bin/env -S npm run tsn -T

import Cloudflare from 'cloudflare';

// gets API Key from environment variable CLOUDFLARE_API_KEY & CLOUDFLARE_EMAIL
const client = new Cloudflare();

async function main() {
  const accountId = '<your accound ID>';

  const response = await client.ai.run(accountId, '@cf/meta/llama-2-7b-chat-int8', {
    prompt: 'Tell me about Workers AI',
  });
  console.log(response);
}

main();