DEV Community

Cover image for Using livekit for Video Conferencing in ChatGPT
justme
justme

Posted on

Using livekit for Video Conferencing in ChatGPT

Using livekit for Video Conferencing in ChatGPT
Detailed Document:https://github.com/dairoot/chatgpt-livekit/tree/main

Usage

Modify the token value in the file, then execute the command. The output URL will be generated. Open it in your browser.

python main.py
Enter fullscreen mode Exit fullscreen mode

main.py file

import uuid

import requests

chatgpt_token = None


def get_livekit_url():
    headers = {
        "content-type": "application/json",
        "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
        "authorization": "Bearer {}".format(chatgpt_token),
    }

    res = requests.post("https://chatgpt.com/voice/get_token", headers=headers, cookies={'__cf_bm': ''}, json={
        "voice": "cove",
        "voice_mode": "standard",
        "parent_message_id": str(uuid.uuid4()),
        "model_slug": "auto",
        "voice_training_allowed": False,
        "enable_message_streaming": False,
        "language": "zh",
        "video_training_allowed": False,
        "voice_session_id": str(uuid.uuid4())
    }).json()

    # livekit url
    livekit_url = "https://meet.livekit.io"
    url = "{}/custom?liveKitUrl={}&token={}#{}".format(livekit_url, res["url"], res["token"], res["e2ee_key"])
    return url


if not chatgpt_token:
    print("Get ChatGPT Token: https://chatgpt.com/api/auth/session")
else:
    print(get_livekit_url())
Enter fullscreen mode Exit fullscreen mode

show

If you don't have a ChatGPT Token and want to try it out, you can directly visit: https://chatgpt.dairoot.cn and click on 免费体验

Top comments (0)