Spaces:
Sleeping

chatAI / app.py
amineelh's picture
Update app.py
214a9a9 verified
Raw History Blame Contribute Delete
538 Bytes
from openai import OpenAI
# Initialize the OpenAI client
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key="sk-or-v1-667a54ccc7364be8d56e257d4ac294cc813af8a9e696e19f6d7bed8521e1f6b",
)
# Create a chat completion
completion = client.chat.completions.create(
extra_body={},
model="deepseek/deepseek-v3-base:free",
messages=[
{
"role": "user",
"content": "What is the meaning of life?"
}
]
)
# Print the response
print(completion.choices[0].message.content)