lanthei-cli 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
lanthei/__init__.py ADDED
File without changes
lanthei/cli.py ADDED
@@ -0,0 +1,38 @@
1
+ import os
2
+ import sys
3
+ from pathlib import Path
4
+ from openai import OpenAI
5
+
6
+ CONFIG_PATH = Path.home() / ".lanthei_key.txt"
7
+
8
+ def get_api_key():
9
+ if CONFIG_PATH.exists():
10
+ return CONFIG_PATH.read_text().strip()
11
+ key = input("Enter your Gemini API key (get one free at aistudio.google.com): ").strip()
12
+ CONFIG_PATH.write_text(key)
13
+ print(f"Saved. (stored locally at {CONFIG_PATH})")
14
+ return key
15
+
16
+ def main():
17
+ api_key = get_api_key()
18
+ client = OpenAI(
19
+ api_key=api_key,
20
+ base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
21
+ )
22
+
23
+ if len(sys.argv) > 1:
24
+ question = " ".join(sys.argv[1:])
25
+ else:
26
+ question = input("Ask me anything: ")
27
+
28
+ try:
29
+ response = client.chat.completions.create(
30
+ model="gemini-2.5-flash",
31
+ messages=[{"role": "user", "content": question}],
32
+ )
33
+ print(response.choices[0].message.content)
34
+ except Exception as e:
35
+ print(f"Error: {e}")
36
+
37
+ if __name__ == "__main__":
38
+ main()
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.4
2
+ Name: lanthei-cli
3
+ Version: 0.1.0
4
+ Summary: A simple CLI that chats with Gemini using your own API key
5
+ Requires-Python: >=3.9
6
+ Requires-Dist: openai
@@ -0,0 +1,6 @@
1
+ lanthei/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ lanthei/cli.py,sha256=WPYMWFjRXHBvhwUI51z7qcIUDwmJ3c-xKdeJAKHcK8A,1059
3
+ lanthei_cli-0.1.0.dist-info/METADATA,sha256=e-zRtf6R356f3d2Y0756B6iiMWlZhhWsoNfiT8swUnE,168
4
+ lanthei_cli-0.1.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
5
+ lanthei_cli-0.1.0.dist-info/entry_points.txt,sha256=cPAiFAsvCHElu1_c85YMJCp0BgMMc7e1Q0o6Fyj3_rs,45
6
+ lanthei_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.31.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ lanthei = lanthei.cli:main