2
respostas

You exceed your current quota

estou recebendo o seguinte erro

2024-04-08T19:57:03.874-03:00  INFO 24737 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-04-08T19:57:03.894-03:00 ERROR 24737 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Failed to execute CommandLineRunner
    at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:774) ~[spring-boot-3.1.1.jar:3.1.1]
    at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:755) ~[spring-boot-3.1.1.jar:3.1.1]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:319) ~[spring-boot-3.1.1.jar:3.1.1]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-3.1.1.jar:3.1.1]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-3.1.1.jar:3.1.1]
    at br.com.alura.screenmatch.ScreenmatchApplication.main(ScreenmatchApplication.java:12) ~[classes/:na]
Caused by: com.theokanning.openai.OpenAiHttpException: You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.
    at com.theokanning.openai.service.OpenAiService.execute(OpenAiService.java:326) ~[service-0.14.0.jar:na]
    at com.theokanning.openai.service.OpenAiService.createCompletion(OpenAiService.java:121) ~[service-0.14.0.jar:na]
    at br.com.alura.screenmatch.service.ConsultaChatGPT.obterTraducao(ConsultaChatGPT.java:19) ~[classes/:na]
    at br.com.alura.screenmatch.model.Serie.<init>(Serie.java:23) ~[classes/:na]
    at br.com.alura.screenmatch.principal.Principal.lambda$listarSeriesBuscadas$0(Principal.java:86) ~[classes/:na]
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
    at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
    at br.com.alura.screenmatch.principal.Principal.listarSeriesBuscadas(Principal.java:87) ~[classes/:na]
    at br.com.alura.screenmatch.principal.Principal.exibeMenu(Principal.java:46) ~[classes/:na]
    at br.com.alura.screenmatch.ScreenmatchApplication.run(ScreenmatchApplication.java:18) ~[classes/:na]
    at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:771) ~[spring-boot-3.1.1.jar:3.1.1]
    ... 5 common frames omitted
Caused by: retrofit2.adapter.rxjava2.HttpException: HTTP 429 
    at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:57) ~[adapter-rxjava2-2.9.0.jar:na]
    at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:38) ~[adapter-rxjava2-2.9.0.jar:na]
    at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:48) ~[adapter-rxjava2-2.9.0.jar:na]
    at io.reactivex.Observable.subscribe(Observable.java:10151) ~[rxjava-2.0.0.jar:2.0.0]
    at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:35) ~[adapter-rxjava2-2.9.0.jar:na]
    at io.reactivex.Observable.subscribe(Observable.java:10151) ~[rxjava-2.0.0.jar:2.0.0]
    at io.reactivex.internal.operators.observable.ObservableSingleSingle.subscribeActual(ObservableSingleSingle.java:35) ~[rxjava-2.0.0.jar:2.0.0]
    at io.reactivex.Single.subscribe(Single.java:2517) ~[rxjava-2.0.0.jar:2.0.0]
    at io.reactivex.Single.blockingGet(Single.java:2001) ~[rxjava-2.0.0.jar:2.0.0]
    at com.theokanning.openai.service.OpenAiService.execute(OpenAiService.java:317) ~[service-0.14.0.jar:na]
    ... 20 common frames omitted

meu codigo do ConsultaChatGPT

public class ConsultaChatGPT {
    public static String obterTraducao(String texto) {
        OpenAiService service = new OpenAiService("chaveAPI");


        CompletionRequest requisicao = CompletionRequest.builder()
                .model("gpt-3.5-turbo-instruct")
                .prompt("traduza para o português o texto: " + texto)
                .maxTokens(1000)
                .temperature(0.7)
                .build();


        var resposta = service.createCompletion(requisicao);
        return resposta.getChoices().get(0).getText();
    }
}
2 respostas

minha serie:

public Serie(DadosSerie dadosSerie){
        this.titulo = dadosSerie.titulo();
        this.totalTemporadas = dadosSerie.totalTemporadas();
        this.avaliacao = OptionalDouble.of(Double.valueOf(dadosSerie.avaliacao())).orElse(0);
        this.genero = Categoria.fromString(dadosSerie.genero().split(",")[0].trim());
        this.atores = dadosSerie.atores();
        this.poster = dadosSerie.poster();
        this.sinopse = ConsultaChatGPT.obterTraducao(dadosSerie.sinopse()).trim();
    }

já criei outra conta no chat gpt com outro numero e nada, mudei pro gpt-3.5 tb

Oi João! Tudo bem?

Pode ser que o número que você utilizou para criar outra conta já tivesse associado a outra conta, isso aconteceu comigo recentemente. Para resolver, você pode criar mais uma conta com um número totalmente novo. Também verifique a validade da sua chave, às vezes ela expirou e você não notou, e por isso aparece o erro.

Qualquer coisa, estou por aqui.

Abraços e bons estudos!