source code
source code
h>
#include <HTTPClient.h>
void setup() {
Serial.begin(9600);
WiFi.mode(WIFI_STA);
WiFi.disconnect();
while(!Serial);
void loop() {
HTTPClient https;
Serial.print("[HTTPS] begin...\n");
if (https.begin("https://api.openai.com/v1/completions")) { // HTTPS
https.addHeader("Content-Type", "application/json");
String token_key = String("Bearer ") + chatgpt_token;
https.addHeader("Authorization", token_key);
Serial.print("[HTTPS] POST...\n");