Details der API-Schnittstelle für Abfragen
Pollinations bietet eine umfangreiche API-Schnittstelle, die völlig kostenlos genutzt werden kann. Entwickler können durch eine einfache Anfrage eine Vielzahl von KI-Funktionen nutzen.
Zu den wichtigsten API-Endpunkten gehören:
- Bilderzeugung::
GET https://image.pollinations.ai/prompt/{prompt} - Textgenerierung::
GET https://text.pollinations.ai/{prompt} - Audio-Erzeugung::
GET https://text.pollinations.ai/{prompt}?model=openai-audio&voice={voice} - Modell Liste::
GET https://text.pollinations.ai/models
Beispiel für einen Python-Aufruf::
Wenn Sie die erzeugten Bilder über Python herunterladen müssen:
import requests
url = "https://pollinations.ai/p/夜晚星空"
response = requests.get(url)
with open("image.jpg", "wb") as f:
f.write(response.content)
Methoden der React-Integration::
Zuerst installieren:npm install @pollinations/react
Dann:
import { usePollinationsImage } from '@pollinations/react';
const imageUrl = usePollinationsImage("巴黎夜景", { width: 800 });
Diese Antwort stammt aus dem ArtikelPollinations: kostenlose große Modelldienste in Form von URL-Splicing und APIsDie































