File size: 422 Bytes
6ad5c5c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)