Hi, I am trying a slightly modified version of your OpenAiService demo with an OpenAI API key that I just created and confirmed is loading correctly into my code. Any idea why I might be getting "Incorrect API key provided"? The main difference below is that I chose a more recent model and used my own prompt (which I did not include here). The same API key and prompt work for me in Python.
String apiKey = properties.getProperty("OPENAI_API_KEY");
System.out.println(apiKey);
var service = new OpenAiService(apiKey);
var completionRequest = CompletionRequest.builder()
.model("gpt-3.5-turbo-1106")
.prompt("My prompt here")
.echo(true)
.build();
service.createCompletion(completionRequest)
.getChoices()
.forEach(System.out::println);
Hi, I am trying a slightly modified version of your OpenAiService demo with an OpenAI API key that I just created and confirmed is loading correctly into my code. Any idea why I might be getting "Incorrect API key provided"? The main difference below is that I chose a more recent model and used my own prompt (which I did not include here). The same API key and prompt work for me in Python.
Thanks for your help.