You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
String payload = String("{\"model\":\"deepseek/deepseek-chat-v3.1:free\",\"messages\":[{\"role\":\"user\",\"content\":") + res + String("}]}");
Serial.print("Sending Payload: ");
Serial.println(payload);
int httpCode = https.POST(payload);
if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
Serial.println("Response received. Reading payload...");
// Read the response dynamically until the entire payload is received
String response = "";
WiFiClient* stream = https.getStreamPtr();
unsigned long lastReadTime = millis();
const unsigned long timeoutPeriod = 15000; // 15s timeout
while (true) {
while (stream->available()) {
char c = stream->read();
response += c;
lastReadTime = millis(); // reset timeout
}
if (millis() - lastReadTime > timeoutPeriod) {
break; // exit if no new data for timeoutPeriod
}
}
response = response.substring(4);
Serial.println("Complete Payload:");
Serial.println(response);
JsonDocument doc;
DeserializationError error = deserializeJson(doc, response);
if (error) {
Serial.print("deserializeJson() failed: ");
Serial.println(error.c_str());
return;
}
String Answer = doc["choices"][0]["message"]["content"];
// Answer = Answer.substring(2);
Serial.print("Answer = ");
Serial.println(Answer);
} else {
Serial.printf("[HTTPS] POST failed, error: %s\n", https.errorToString(httpCode).c_str());
}
https.end();
} else {
Serial.println("[HTTPS] Unable to connect");
}
Serial.println("Wait 10s before next round...");
res = "";
delay(10000);
}
I wrote this code before but my favorite arduino ide saying to me:
Hardware Configuration
Oh
Version
v3.1.2
Type
Question
IDE Name
Oh
Operating System
Window11
Flash frequency
I don't think you have to know
PSRAM enabled
no
Upload speed
921600
Description
wifi:can not get wifi protocol under WiFi band mode WIFI_BAND_MODE_AUTO, please use esp_wifi_get_protocols instead
I should solve it. And why this words is blocking me?
Sketch
?
Debug Message
?
Other Steps to Reproduce
?
I have checked existing issues, online documentation and the Troubleshooting Guide
I confirm I have checked existing issues, online documentation and Troubleshooting guide.
This discussion was converted from issue #11837 on September 15, 2025 15:12.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Board
esp32 c5 dev module
Device Description
#include <Arduino.h>
#include <string.h>
#include <WiFiMulti.h>
#include <ArduinoJson.h>
#include <HTTPClient.h>
#include <WiFi.h>
const char* ssid = "Consered";
const char* password = "Consered";
const char* deepseek_API = "Mostly Consered Hmm";
String res = "";
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.disconnect();
while (!Serial);
// Connect to WiFi
WiFi.begin(ssid, password);
Serial.print("Connecting to ");
Serial.println(ssid);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println("\nConnected to WiFi");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
Serial.print("Ask your Question : ");
while (!Serial.available());
while (Serial.available()) {
char add = Serial.read();
res += add;
delay(1);
}
int len = res.length();
res = res.substring(0, len - 2);
res = """ + res + """;
Serial.println(res);
HTTPClient https;
if (https.begin("https://openrouter.ai/api/v1")) { // HTTPS
https.addHeader("Content-Type", "application/json");
String token_key = String("Bearer ") + deepseek_API;
https.addHeader("Authorization", token_key);
} else {
Serial.println("[HTTPS] Unable to connect");
}
Serial.println("Wait 10s before next round...");
res = "";
delay(10000);
}
I wrote this code before but my favorite arduino ide saying to me:
Hardware Configuration
Oh
Version
v3.1.2
Type
Question
IDE Name
Oh
Operating System
Window11
Flash frequency
I don't think you have to know
PSRAM enabled
no
Upload speed
921600
Description
wifi:can not get wifi protocol under WiFi band mode WIFI_BAND_MODE_AUTO, please use esp_wifi_get_protocols instead
I should solve it. And why this words is blocking me?
Sketch
Debug Message
Other Steps to Reproduce
?
I have checked existing issues, online documentation and the Troubleshooting Guide
Beta Was this translation helpful? Give feedback.
All reactions