Zum Hauptinhalt springen
LIVE
CVSS 6.9CVE-2026-138088 | A vulnerability has been found in SchneeHertz exhentai-manga-manager up to 1.6.16. Affected is the function mangaToLANraragiArchive of the file index.js of the component LAN Browsing Service. Such manipulation leads to missing authentication. The attack may be launched remotely. The exploit has been disclosed to the public and may be used. The reported GitHub issue was closed with the reason "completed". However, it was not possible to determine the PR or coCVSS 6.9CVE-2026-138087 | A flaw has been found in linhaojun857 aurora up to 07e9524caacf6ceb021f3408e73f900f230d05f2. This impacts the function generalKey of the file aurora-springboot/src/main/resources/application-prod.yml of the component JWT Token Service. This manipulation of the argument secret causes use of hard-coded cryptographic key . The attack may be initiated remotely. The exploit has been published and may be used. This product uses a rolling release model to deliverCVSS 6.9CVE-2026-138086 | A security vulnerability has been detected in wonderunit storyboarder 3.0.0. The impacted element is the function MobileServer of the file src/js/express-app/app.js. The manipulation leads to missing authentication. The attack can be initiated remotely. The exploit has been disclosed publicly and may be used. The project was informed of the problem early through an issue report but has not responded yet.CVSS 5.3CVE-2026-138085 | A weakness has been identified in ThingsBoard up to 4.2.2.7/4.3.1.7/4.4.0. The affected element is the function downloadTestReport of the file application/src/main/java/org/thingsboard/server/controller/DashboardReportController.java of the component Report Service. Executing a manipulation of the argument userId can lead to authorization bypass. It is possible to launch the attack remotely. The exploit has been made available to the public and could be usedCVSS 5.3CVE-2026-138084 | A security flaw has been discovered in DefaultFuction Sales and Inventory Management System Project In PHP 1.0. Impacted is an unknown function of the file /pages/emp_edit.php. Performing a manipulation of the argument ID results in sql injection. It is possible to initiate the attack remotely. The exploit has been released to the public and may be used for attacks. The project was informed of the problem early through an issue report but has not responded yCVSS 6.9CVE-2026-138083 | A vulnerability was found in 2227324689 gpmall up to c5dd5bacb052e2d4afda5ed1f7f07c17428192d5. This issue affects the function creatJwtToken/freeJwt of the file user-service/user-provider/src/main/java/com/gpmall/user/utils/JwtTokenUtils.java. Performing a manipulation results in use of hard-coded cryptographic key . The attack is possible to be carried out remotely. The exploit has been made public and could be used. This product adopts a rolling release sCVSS 10.0CVE-2026-138082 | A vulnerability has been found in Tenda AC10U 15.03.06.48_multi_TDE01. This vulnerability affects the function ate_ifconfig_set of the file /bin/httpd of the component ATE Service. Such manipulation leads to os command injection. The attack can be executed remotely. The exploit has been disclosed to the public and may be used.CVSS 5.3CVE-2026-138081 | A flaw has been found in alexta69 MeTube up to 2026.09.23. This affects the function _read_json_request of the file /add of the component State-Changing HTTP Endpoint. This manipulation causes cross-site request forgery. Remote exploitation of the attack is possible. The exploit has been published and may be used. Upgrading to version 2026.09.25 is able to mitigate this issue. You should upgrade the affected component.
Alle im Drawer
Intelligence View
⚡ tsecurity.de Intelligence

How to Use the NanoGPT API with Python.

Before you gain knowledge: This is my first post on here and I am trying to leave a good first impression, I would be more than happy to get reviews on this…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
CVE & Threat-Kontext · 7 Min. Lesezeit
Quelle: dev.to
Rubrik: Sichere Programmierung

Before you gain knowledge: This is my first post on here and I am trying to leave a good first impression, I would be more than happy to get reviews on this and what could be changed or optimised to make good tutorials on here! :)

Happy reading!





How to Use the NanoGPT API with Python



If you've been looking for a private, OpenAI-compatible API that doesn't hoard your prompts for training data, NanoGPT is worth checking out. It speaks the same language as OpenAI's API, meaning most of your existing code works with minimal changes, but your data stays yours.



In this guide, I'll walk you through everything: installation, auth, making basic requests, streaming responses, and handling errors properly. By the end, you'll have a working Python client you can drop into any project.





Why NanoGPT?



Before we write any code, let's talk about why you'd pick this over just hitting OpenAI directly:





  • Privacy-first: Your prompts and completions aren't used for model training


  • OpenAI-compatible: Drop-in replacement for most tools and libraries


  • Model variety: Access to models like MiniMax M2.7 and others without managing infrastructure


  • Simple pricing: Pay-per-token, no enterprise contracts required



If you're building something where user data privacy matters — and honestly, when doesn't it? this is a solid choice. For more context on private AI tools, check out ai-privacy-tools.vercel.app.





Installation



Start by installing the official nanogpt package:




pip install nanogpt






Or, if you prefer working with raw HTTP (no judgment — sometimes you want to see exactly what's going on), you can use requests or httpx instead. The API is standard REST + SSE, so any HTTP client works.



If you want the full OpenAI SDK experience, install the OpenAI package and point it at NanoGPT's base URL:




pip install openai






Both approaches work. I'll show you both below.






Authentication



Grab your API key from nano-gpt.com and set it as an environment variable:




export NANOGPT_API_KEY="your-api-key-here"






Never hardcode your API key in source code. Seriously. I've seen production repos with API keys in them and it's always a bad day.






Basic Chat Completion



Let's start with a simple request using the requests library:




import requests
import json

BASE_URL = "https://nano-gpt.com/api/v1"
API_KEY = os.environ.get("NANOGPT_API_KEY")

headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}

payload = {
"model": "minimax/minimax-m2.7",
"messages": [
{"role": "system", "content": "You are a helpful coding assistant."},
{"role": "user", "content": "Write a Python function to flatten a nested list."}
],
"temperature": 0.7,
"max_tokens": 1024
}

response = requests.post(f"{BASE_URL}/chat/completions", headers=headers, json=payload)
data = response.json()

print(data["choices"][0]["message"]["content"])






That's it. If you've worked with OpenAI's API before, this should look completely familiar. Same endpoint structure, same request/response format.






Using the OpenAI SDK



Here's the same thing using the official OpenAI Python SDK pointed at NanoGPT:




from openai import OpenAI
import os

client = OpenAI(
api_key=os.environ.get("NANOGPT_API_KEY"),
base_url="https://nano-gpt.com/api/v1"
)

response = client.chat.completions.create(
model="minimax/minimax-m2.7",
messages=[
{"role": "system", "content": "You are a helpful coding assistant."},
{"role": "user", "content": "Write a Python function to flatten a nested list."}
],
temperature=0.7,
max_tokens=1024
)

print(response.choices[0].message.content)






This approach is great because any existing code that uses the OpenAI SDK can be migrated to NanoGPT by just changing two lines the API key and the base URL.






Streaming Responses



For longer responses, streaming makes a huge difference in perceived performance. Here's how to do it:




import requests
import json

BASE_URL = "https://nano-gpt.com/api/v1"
API_KEY = os.environ.get("NANOGPT_API_KEY")

headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
"Accept": "text/event-stream"
}

payload = {
"model": "minimax/minimax-m2.7",
"messages": [
{"role": "user", "content": "Explain the difference between TCP and UDP."}
],
"stream": True,
"max_tokens": 1024
}

response = requests.post(
f"{BASE_URL}/chat/completions",
headers=headers,
json=payload,
stream=True
)

for line in response.iter_lines():
if line:
line = line.decode("utf-8")
if line.startswith("data: "):
chunk = line[6:]
if chunk.strip() == "[DONE]":
break
data = json.loads(chunk)
delta = data["choices"][0]["delta"]
if "content" in delta:
print(delta["content"], end="", flush=True)

print() # Newline after streaming






The key things here: set "stream": True in the payload, add "Accept": "text/event-stream" to headers, and use requests.post(..., stream=True) so it doesn't buffer the entire response. Then iterate over lines and parse the SSE chunks.



With the OpenAI SDK, streaming is even simpler:




stream = client.chat.completions.create(
model="minimax/minimax-m2.7",
messages=[{"role": "user", "content": "Explain TCP vs UDP."}],
stream=True
)

for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)









Error Handling



Don't skip this part. Here's a practical error handling wrapper you can actually use in production:




import requests
from requests.exceptions import RequestException
import time

class NanoGPTClient:
def __init__(self, api_key, base_url="https://nano-gpt.com/api/v1"):
self.base_url = base_url
self.headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}

def chat(self, messages, model="minimax/minimax-m2.7", max_retries=3, **kwargs):
payload = {
"model": model,
"messages": messages,
"max_tokens": kwargs.get("max_tokens", 1024),
"temperature": kwargs.get("temperature", 0.7)
}

for attempt in range(max_retries):
try:
response = requests.post(
f"{self.base_url}/chat/completions",
headers=self.headers,
json=payload,
timeout=30
)

if response.status_code == 200:
return response.json()["choices"][0]["message"]["content"]

if response.status_code == 429:
retry_after = int(response.headers.get("Retry-After", 2 ** attempt))
print(f"Rate limited. Retrying in {retry_after}s...")
time.sleep(retry_after)
continue

if response.status_code == 401:
raise ValueError("Invalid API key. Check your NANOGPT_API_KEY.")

response.raise_for_status()

except RequestException as e:
if attempt == max_retries - 1:
raise
print(f"Request failed: {e}. Retrying ({attempt + 1}/{max_retries})...")
time.sleep(2 ** attempt)

raise RuntimeError("Max retries exceeded.")






This handles the common pain points:





  • Rate limiting (429): Respects the Retry-After header with exponential backoff


  • Auth errors (401): Gives you a clear message instead of a cryptic stack trace


  • Network failures: Retries with exponential backoff


  • Timeouts: Configurable via the timeout parameter






Putting It All Together



Here's a complete example that ties everything together — a simple CLI chatbot:




import os
from openai import OpenAI

client = OpenAI(
api_key=os.environ.get("NANOGPT_API_KEY"),
base_url="https://nano-gpt.com/api/v1"
)

def chat():
messages = [{"role": "system", "content": "You are a helpful assistant. Be concise."}]

print("NanoGPT Chat (type 'quit' to exit)\n")

while True:
user_input = input("You: ").strip()
if user_input.lower() in ("quit", "exit"):
break

messages.append({"role": "user", "content": user_input})

stream = client.chat.completions.create(
model="minimax/minimax-m2.7",
messages=messages,
stream=True
)

print("AI: ", end="")
assistant_response = ""
for chunk in stream:
if chunk.choices[0].delta.content:
text = chunk.choices[0].delta.content
print(text, end="", flush=True)
assistant_response += text
print("\n")

messages.append({"role": "assistant", "content": assistant_response})

if __name__ == "__main__":
chat()









Quick Reference
































What Value
Base URL https://nano-gpt.com/api/v1
Auth header Authorization: Bearer YOUR_KEY
Chat endpoint /chat/completions
Default model minimax/minimax-m2.7
Streaming Set "stream": true in payload





Wrapping Up



If you were already using OpenAI's Python SDK, migrating to NanoGPT is genuinely a two-line change. If you're starting fresh, you get a clean API that respects your privacy out of the box.



The real win here is that you're not locked into a single provider. Since NanoGPT is OpenAI-compatible, you can swap between providers without rewriting your application code. That's the kind of flexibility worth building on.



Got questions or hit a snag? Drop a comment below. Happy coding.

Information ergänzen Fachhinweis, Update, Korrektur oder Quelle zur Meldung beitragen
Gäste-Hinweise werden kurz redaktionell geprüft und danach hier angezeigt.

Community-Hinweise zur Meldung

0 freigegeben
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!
Informations-Bewertung:

💬 Community-Diskussion & Kommentare

🌐 Zum Hauptchat

Starte die Diskussion im Social-Chat Broadcast Stream oder reiche oben über „Information ergänzen“ einen Fachbeitrag ein.

Cyber Threat Intelligence & Forensik

ATT&CK-Navigator · IoC-Radar & Graph

MITRE ATT&CK Matrix Navigator
1 belegte Technik
T1195TA0011 · Command and Control
Supply Chain Compromise
Mitigation: M1045 Code Signing
Quelle: Kontext-Klassifikation des Artikeltextes · Konfidenz 88%
SBOM/Abhängigkeiten mit Dependency-Check/Trivy inventarisieren, Artefakte per Sigstore (cosign) signieren und verifizieren, Update-Kanäle auf Kompromittierung überwachen.
Command and Control
CTI Threat Relationship Graph
Akteure · Techniken · Beziehungen
4 Knoten · 3 Relationen
CVE / Incident Threat Actor Software MITRE ATT&CK CWE Weakness IoC
Community Rating & Social Proof
⭐ Leser-Wertung
–
Ø / 5.0
Noch keine Leser-Bewertungen
War dieser Artikel hilfreich?
0
Jetzt Bewertung abgeben
Detail-Bewertung (optional)
Inhalt & Qualität
Quelle & Glaubwürdigkeit
Aktualität
Security Briefing Kostenlos · 1-Klick-Abmeldung

Intelligence Digest — kostenlos

Täglich die wichtigsten Security-News · jederzeit abbestellbar

Verwandte Story-Cluster & Quellen (Vektor-KI)

1 Cluster
2 Quellen
Samsung zieht eigener App am 31. März 2027 den Stecker
Giga.de vor 10 Std.
1 weitere Quelle
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to Use the NanoGPT API with Python.

Thematisch verwandte Begriffe: NanoGPT, with, Python · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
Widgets & Themen
Widgets werden geladen…
Nächster Beitrag