API Documentation
Integrate NexusAI's endpoints into your own applications.
All endpoints require your OpenAI API key passed in the request body. No server-side authentication needed.
POST /api/chat
Send a message and receive a response from GPT models. Supports streaming.
Request Body
{
"api_key": "sk-...",
"messages": [
{"role": "user", "content": "Hello!"}
],
"model": "gpt-4o-mini", // optional, default: gpt-4o-mini
"temperature": 0.7, // optional, 0–2, default: 0.7
"stream": true // optional, default: false
}
Response (non-stream)
{
"content": "Hello! How can I help you today?",
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}
Response (stream)
Returns Server-Sent Events. Each event is a JSON object with a content field. Stream ends with data: [DONE].
POST /api/models
Fetch all GPT models available for your API key.
Request Body
{"api_key": "sk-..."}
Response
{"models": ["gpt-4o", "gpt-4o-mini", "gpt-3.5-turbo", ...]}
POST /api/image
Generate an image with DALL·E.
Request Body
{
"api_key": "sk-...",
"prompt": "A futuristic cityscape at sunset",
"size": "1024x1024", // 1024x1024 | 1792x1024 | 1024x1792
"model": "dall-e-3" // dall-e-3 | dall-e-2
}
Response
{
"url": "https://oaidalleapiprodscus.blob.core.windows.net/...",
"revised_prompt": "A neon-lit futuristic cityscape..."
}
POST /api/transcribe
Transcribe audio with Whisper. Send as multipart form data.
Form Fields
api_key: sk-...
audio: [audio file — mp3, mp4, wav, webm, m4a]
Response
{"text": "Transcribed text here..."}
Error Response Format
{"error": "Human-readable error message"}