An open API service indexing awesome lists of open source software.

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

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)