https://github.com/craigsdennis/talk-to-javascript-openai-workers
Demonstrates how to protect your OpenAI API Key using a Cloudflare Worker and then do client side tool calling
https://github.com/craigsdennis/talk-to-javascript-openai-workers
client-side function-calling openai realti robot-hand tool-calling voice-assistant voice-control
Last synced: about 1 month ago
JSON representation
Demonstrates how to protect your OpenAI API Key using a Cloudflare Worker and then do client side tool calling
- Host: GitHub
- URL: https://github.com/craigsdennis/talk-to-javascript-openai-workers
- Owner: craigsdennis
- Created: 2024-12-17T18:22:24.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-02-05T06:55:18.000Z (8 months ago)
- Last Synced: 2025-02-05T07:29:04.460Z (8 months ago)
- Topics: client-side, function-calling, openai, realti, robot-hand, tool-calling, voice-assistant, voice-control
- Language: JavaScript
- Homepage: https://platform.openai.com/docs/guides/realtime
- Size: 29.3 KB
- Stars: 203
- Watchers: 4
- Forks: 62
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Client Side Tool Calling with the OpenAI WebRTC Realtime API
This project is a [Cloudflare Workers](https://developers.cloudflare.com) app using [Hono](https://honojs.dev) to relay the [OpenAI Realtime API](https://platform.openai.com/docs/api-reference/realtime) over WebRTC. The main files are just [static assets](https://developers.cloudflare.com/workers/static-assets/).
[
](https://youtu.be/TcOytsfva0o "Client Side Tool Calling with the OpenAI WebRTC Realtime API")
## Develop
Copy [.dev.vars.example](./.dev.vars.example) to `.dev.vars` and fill out your OpenAI API Key.
Install your dependencies
```bash
npm install
```Run local server
```bash
npm run dev
```## Deploy
Upload your secret
```bash
npx wrangler secret put OPENAI_API_KEY
``````bash
npm run deploy
```The hand is a [HiWonder AI Hand](https://www.hiwonder.com/products/aihand?variant=41022039654487). AI and I reverse-engineered the mobile app to make it work over Bluetooth, see [the code in hand.js](./public/hand.js)