Get started
Libraries & SDKs
TNSA endpoints mirror the OpenAI API layout. Reuse the official OpenAI SDKs by changing the base URL, or call the native REST API directly from any language.
OpenAI client — Python
Point base_url at https://api.tnsaai.com/v1 and send your TNSA key in the x-api-key header.
python
import os
from openai import OpenAI
key = os.environ["TNSA_API_KEY"]
client = OpenAI(
base_url="https://api.tnsaai.com/v1",
api_key=key,
default_headers={"x-api-key": key},
)
completion = client.chat.completions.create(
model="NGen-4.3-Pro",
messages=[{"role": "user", "content": "Explain quantum physics"}],
)
print(completion.choices[0].message.content)OpenAI client — Node.js
javascript
const { OpenAI } = require("openai");
const client = new OpenAI({
baseURL: "https://api.tnsaai.com/v1",
apiKey: process.env.TNSA_API_KEY,
defaultHeaders: { "x-api-key": process.env.TNSA_API_KEY },
});
async function run() {
const completion = await client.chat.completions.create({
model: "NGen-4 Mini",
messages: [{ role: "user", content: "What is WebSearch-1?" }],
});
console.log(completion.choices[0].message.content);
}
run();Two ways to call TNSA
The OpenAI-compatible endpoint (
/v1) is ideal for reusing existing code. The native endpoints (/infer, /generate-image,/stt, …) expose the full platform, including streaming reasoning tokens, tools and audio.Direct REST access
No SDK required — the API is plain HTTPS + JSON at https://api.tnsaai.com, authenticated with x-api-key.
Conventions
- Requests use
POSTwith a JSON (or multipart) body. - Authenticate every request with the
x-api-keyheader. - Text completions stream by default; set
stream: falsefor a single JSON response.
bash
curl https://api.tnsaai.com/infer \
-H "x-api-key: $TNSA_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "NGen-4.3-Pro", "prompt": "Hello", "stream": false }'