Reference
API reference
All endpoints share the base URL https://api.tnsaai.com and authenticate with the x-api-key header. Below is the complete endpoint list with example payloads for the most common calls.
Endpoints
| Method | Path | Purpose | Auth |
|---|---|---|---|
| GET | /health | Service health and active request counts. | No |
| GET | /models | List available text generation models. | No |
| POST | /infer | Text generation, reasoning and streaming completions. | Yes |
| POST | /vision | Analyze an uploaded image with a multimodal model. | Yes |
| POST | /generate-image | Generate images from a text prompt. | Yes |
| POST | /image-edit | Inpaint / edit an image using a mask. | Yes |
| POST | /stt | Transcribe audio to text. | Yes |
| POST | /tts | Synthesize text to speech. | Yes |
| POST | /audio-text-speech-pro | Conversational voice in a single call. | Yes |
| POST | /github/push | Commit files to a connected GitHub repository. | Yes |
POST /infer
The primary text endpoint. Request body:
json
{
"model": "NGen-4.3-Pro", // required — model name
"prompt": "Hello", // required — user message
"chat_id": "sess_123", // optional — persists context server-side
"history": [ // optional — explicit conversation turns
{ "role": "system", "content": "You are helpful." }
],
"images": [], // optional — base64 images for vision models
"max_tokens": 1024, // default 1024
"temperature": 0.7, // default 0.7
"top_p": 0.95, // default 0.95
"stream": true // default true
}Returns an SSE text/event-stream when stream is true, otherwise a JSON completion. See Streaming for event formats.
GET /health
json
{
"status": "healthy",
"active_requests": { "count": 2 },
"timestamp": 1706789012.345
}GET /models
json
{
"models": ["NGen-4.3-Pro", "NGen-4.1-Pro", "NGen-4.1-Lite", "NGen-4", "NGen-4 Mini", "NGen3.9-Pro"]
}POST /generate-image
json
{
"prompt": "An oil painting of a space elevator at sunset",
"model": "IGen-1 Nano",
"width": 512,
"height": 512,
"num_inference_steps": 20,
"guidance_scale": 7.5,
"negative_prompt": "blurry, low quality"
}