Download app.py from amineelh/chatAI: direct link, hf CLI and curl.
- Browser
- Download file 538 Bytes
-
https://huggingface.co/spaces/amineelh/chatAI/resolve/main/app.py
- Command line
-
hf download hf://spaces/amineelh/chatAI/app.py
-
curl -L -o app.py https://huggingface.co/spaces/amineelh/chatAI/resolve/main/app.py
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) |