Skip to content

invalid_api_key using OpenAI API #5941

Closed Answered by natbutter
natbutter asked this question in Q&A
Discussion options

You must be logged in to vote

Okay.... it must not have been finding the correct base.
This works. Start with the api and set a key:

bash start_linux.sh --api  --api-key 1234

Then call from Python with:

from openai import OpenAI
llm = OpenAI(api_key='1234',base_url='http://127.0.0.1:5000/v1')
response = llm.chat.completions.create(
    model='deepseek-coder-33b-instruct.Q5_K_M.gguf',
    messages=[{"role": "user","content": "What is the latest iphone model?"}]
    )
print(response)

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by natbutter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant