This is how I run ChatGPT in Ninox app

Hello friends :)

Please find code below, allows to run OpenAI ChatGPT in your Ninox apps. It is connected to button OpenAi. After click it sends content of yourPrompt to ChatGPT and display raw result in apiResponse and clean answer in chatAnswer.

Works like a charm in cloud. Doesn't work at all in standalone databases - this is limitation of free app.

You have to generate API key for yourself at https://platform.openai.com, probably you have to pay some amount of money for it. But for only for one person it is sooooo cheap. I pay 10 USD few month ago, and still have few bucks for playing with AI :)

I didn't test other models - I have a mess in head with all endpoints. So, if 3.5 turbo is ok...

There is one a super-ugly piece of code, but I can't do this prettier -> where I digg in json data. Generally: this code can be done much much better - I'm not a programmer - we all are open for suggestions :)

Here is the code:

let myPrompt := yourPrompt;
let urlAI := "https://api.openai.com/v1/chat/completions";
let modelAI := "gpt-3.5-turbo";
let tempAI := 0.7;
let response := do as server
        http("POST", urlAI, {
            Authorization: "Bearer " + keyAI,
            'content-type': "application/json"
        }, {
            model: modelAI,
            temperature: tempAI,
            messages: [{
                    role: "user",
                    content: myPrompt
apiResponse := text(response.result);
let json := parseJSON(text(response.result));
let answerfirst := first(response.result.choices);
let answersec := first(answerfirst.message);
let answer := first(answersec.content);
chatAnswer := answer + " finish!"

I think this can be  helpful :)

Regards from Poland

2 replies

    • szormpas
    • 9 days ago
    • Reported - view


    Thank you so much for sharing!

    Let's see what our members can create with the help of AI.

    I was wondering if in the future Ninox is considering incorporating some of the AI capabilities. For example as an aid to scripting, have you heard anything about that?

      • Tomasz_Winiarski
      • 9 days ago
      • Reported - view

       no idea! I hope for it.

      I use AI a lot in my work and, if you know what you want, AI is the best tool ever :) and no, it doesn't steal me job - for now it brings me a lot of new opportunities :))

Content aside

  • 9 days agoLast active
  • 2Replies
  • 81Views
  • 2 Following