Quickstart: your first call
Make a key and get an answer in two minutes, with curl, JavaScript or Python.
1. Make a key
Open Create, Developers (sign up first if you have no account) and press New key. Copy it now: it is shown once. Your account starts with 2,000 free credits, enough for hundreds of calls.
Keep the key out of your code. Put it in an environment variable:
export TENGOCHAT_API_KEY="tc_live_..."setx TENGOCHAT_API_KEY "tc_live_..."2. Make a call
curl https://tengochat.com/api/v1/chat/completions \
-H "Authorization: Bearer $TENGOCHAT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "tengo-1", "messages": [{"role": "user", "content": "Say hello in three languages"}]}'const res = await fetch("https://tengochat.com/api/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TENGOCHAT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "tengo-1",
messages: [{ role: "user", content: "Say hello in three languages" }],
}),
});
const data = await res.json();
console.log(data.choices[0].message.content);import os, requests
res = requests.post(
"https://tengochat.com/api/v1/chat/completions",
headers={"Authorization": f"Bearer {os.environ['TENGOCHAT_API_KEY']}"},
json={"model": "tengo-1", "messages": [{"role": "user", "content": "Say hello in three languages"}]},
)
print(res.json()["choices"][0]["message"]["content"])The answer has the text in choices[0].message.content, and what it used in usage: tokens, and the credits it cost.
3. Where to go next
- Use the OpenAI libraries: your existing code works with a new base URL.
- Build an agent that uses tools, connectors and your files.
- Stream answers so text shows as it is written.