youtube-whisper / demo.py
hadxu's picture
add openrouter api
6ad5c5c
raw
history blame contribute delete
422 Bytes
from openai import OpenAI
from os import getenv
# gets API Key from environment variable OPENAI_API_KEY
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key=getenv(""),
)
completion = client.chat.completions.create(
model="google/gemini-pro",
messages=[
{
"role": "user",
"content": "how to learn rust programming language",
},
],
)
print(completion.choices[0].message.content)