Skip to content

Hardcoreyoyo/llm-gemini

Repository files navigation

Gemini 2.0 Playground



Deno Deployment

  • Login/Register at https://dash.deno.com/
  • Create a project at https://dash.deno.com/new_project
  • Select this project, enter project name (please choose carefully as it affects the auto-assigned domain)
  • Set Entrypoint to src/deno_index.ts, leave other fields empty
  • Click Deploy Project
  • After successful deployment, you'll get a domain name. The site is ready to use, and the domain can also be used as a Chat API proxy.



## Cloudflare Worker Deployment

2. Login to your Cloudflare account 3. Enter Account ID and API Token 4. Fork this project, enable Github Action 5. Deploy, open dash.cloudflare.com to view the deployed worker



Local Development

Install Deno on Windows:

irm https://deno.land/install.ps1 | iex

Install Deno on Mac/Linux:

curl -fsSL https://deno.land/install.sh | sh

Start the project:

cd project_directory
deno run --allow-net --allow-read src/deno_index.ts



Usage


Multimodal Chat

Enter API Key, click Connect button to start chatting. The three buttons are for:

  • Enable microphone
  • Enable camera
  • Share screen

API Proxy

The API has been proxied to OpenAI format and can be used directly with OpenAI format API. Remember to replace the domain and Gemini API Key.

Curl:

Available models:

curl --location 'http://your.domain.com/v1/models' \
--header 'Authorization: Bearer YOUR-GEMINI-API-KEY'

Chat:

curl --location 'https://your.domain.com/v1/chat/completions' \
--header 'Authorization: Bearer YOUR-GEMINI-API-KEY' \
--header 'Content-Type: application/json' \
--data '{
    "messages": [
        {
            "role": "system",
            "content": "You are a test assistant."
        },
        {
            "role": "user",
            "content": "Testing. Just say hi and nothing else."
        }
    ],
    "model": "gemini-2.0-flash-exp"
}'

Gemini to OpenAI format conversion:

Author: PublicAffairs
Project: https://github.com/PublicAffairs/openai-gemini
MIT License : https://github.com/PublicAffairs/openai-gemini/blob/main/LICENSE

About

llm gemini 2.0 Multimodal Chat playground

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published