REST Client
Quick example showcasing how to make http queries to openia.com without writing a single line of code
Create file ./connections/http-open-ai.json
{
"type": "rest",
"id": "http-open-ai",
"host": "https://api.openai.com"
}
Create file ./queries/chat-gpt-call-http.json
{
"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
}
]
}
Create file ./config.json
{
"openAiToken": "sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
Last modified April 16, 2024: content fix (a2d9b96)