Hello,
I am using BetterChatGPT Plus with a custom API endpoint (e.g., https://api.zukijourney.com/v1/chat/completions) and specifying the model as gpt-4o-mini. The client code is based exactly on the official OpenAI Python library:
from openai import OpenAI
client = OpenAI(base_url="https://api.zukijourney.com/v1", api_key='your-api-key-here')
response = client.chat.completions.create(
model="zukigm-1", # or gpt-4o-mini, claude-3-haiku, gemini-1.5-flash, etc...
messages=[{"role": "user", "content": "Hello, AI!"}]
)
print(response.choices[0].message.content)
The issue is that only a partial response is received, and then the following error occurs:
Cannot read properties of undefined (reading '0')
This suggests that response.choices might be undefined or empty at some point, which breaks the code. I have confirmed that the API endpoint is correctly set and that the model name is valid.
Could you please help investigate this issue or provide guidance on how to resolve it? Any suggestions or workarounds would be greatly appreciated!
Thank you in advance for your support.