REST Client

Quick example showcasing how to make http queries to openia.com without writing a single line of code

{
  "type": "rest",
  "id": "http-open-ai",
  "host": "https://api.openai.com"
}
{
  "type": "rest",
  "id": "chat-gpt-call-http",
  "connection": "http-open-ai",
  "path": "/v1/chat/completions",
  "method": "POST",
  "body": {
    "model": "gpt-3.5-turbo",
    "messages": [
      {
        "role": "user",
        "content": ":prompt :query"
      }
    ]
  },
  "headers": [
    {
      "name": "Authorization",
      "value": "Bearer :openAiToken"
    },
    {
      "name": "Content-Type",
      "value": "application/json"
    }
  ],
  "params": [
    {
      "name": "query",
      "required": true
    },
    {
      "name": "prompt",
      "required": true
    },
    {
      "name": "openAiToken",
      "serverValue": "$.config.openAiToken",
      "required": true
    }
  ]
}
{
  "openAiToken": "sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
Last modified April 16, 2024: content fix (a2d9b96)