Spaces:
Running
Running
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) |