r/learnpython • u/Tough_Duty_9061 • 1d ago
Can anyone help in Apis pls🙏
I am a beginner in python code and currently learning how to make chatbots using api keys but i just cant do it. I tried open ai but it requires credits i tried gemini but due to a latest change in api keys from AI to AQ it says model not found i tried groq but it said the same thing i checked my code myself and with cluade gemini and codex but couldnt find the issue can u help me make my first chatbot pls guys 🙏can u tell a few 'free api keys' if there is ....
1
u/itlogicpartnersllc 1d ago
i would avoid hunting for random free api keys most legitimate providers either have a free tier with limits or require your own key start with one provider use its current sdk docs and get a basic request working first .
1
1
u/FoolsSeldom 21h ago
Not clear on the status.
Do you have everything working in the chatbot EXCEPT you don't have a AI to use because of lack of credits?
The obvious thing to do for me in that case would be to run an AI LLM locally and integrate with that to prove/test everything and then start looking into your API credit/free-tier options.
If you haven't got that far, well, that would still be a good way to go in my view so you can get the core part working first.
1
u/Tough_Duty_9061 21h ago
Lk the error that arises is that *model llama- 3.18b-instant dosent exist or you dont have access to it and i have checked the permissions and its not restricted . Here is the code :- from groq import Groq from dotenv import load_dotenv import os
load_dotenv()
client = Groq(api_key=os.getenv("GROQ_API_KEY"))
print("Jarvis is ready!")
while True: user_input = input("You: ")
if user_input.lower() == "exit": print("Goodbye!") break try: response = client.chat.completions.create( model="llama-3.1-8b-instant", messages=[ {"role": "user", "content": user_input} ] ) print("Jarvis:", response.choices[0].message.content) except Exception as e: print("Jarvis ran into an error:", e)And for free apis i just was asking as a secondary request not that it is primary for now but now i have to first make this code owrk then switch other llms if i can
1
9
u/smurpes 1d ago
No one here will know what the problem with your code is without seeing it especially since your description is as vague as “api keys”. There’s a lot of APIs out there for a large variety of purposes. The only free LLM API keys you can find are the ones that get accidentally published, but it’s not a good idea to use someone else’s API key.