talk-to-javascript-openai-workers  by craigsdennis

Cloudflare Worker app for OpenAI API key protection

created 7 months ago
309 stars

Top 88.0% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This project demonstrates secure client-side tool calling with OpenAI's API by using Cloudflare Workers to proxy API requests and protect the OpenAI API key. It's targeted at developers looking to build interactive applications that leverage AI capabilities without exposing sensitive credentials directly in the frontend.

How It Works

The application utilizes Cloudflare Workers as a backend to handle requests to the OpenAI Realtime API. A frontend JavaScript application communicates with the Worker, which then securely interacts with OpenAI. This architecture shields the OpenAI API key by storing it as an environment secret within the Cloudflare Worker environment, preventing direct exposure in the browser.

Quick Start & Requirements

  • Install dependencies: npm install
  • Run local server: npm run dev
  • Deploy: npx wrangler secret put OPENAI_API_API_KEY and npm run deploy
  • Prerequisites: Node.js, npm, Wrangler CLI.

Highlighted Details

  • Leverages Cloudflare Workers for secure API key management.
  • Implements client-side tool calling via OpenAI's Realtime API.
  • Uses Hono framework for routing within the Worker.
  • Includes reverse-engineered code for a HiWonder AI Hand robot.

Maintenance & Community

No specific community channels or maintenance details are provided in the README.

Licensing & Compatibility

The license is not specified in the README.

Limitations & Caveats

The project is presented as a demonstration, and its suitability for production environments without further hardening is not detailed. The reverse-engineered robot code is a separate component and may have its own dependencies or limitations.

Health Check
Last commit

5 months ago

Responsiveness

1+ week

Pull Requests (30d)
0
Issues (30d)
0
Star History
27 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.