Quickstart
Send your first API request to the Chamelingo AI tutor in under 2 minutes.
2 min read
Create an API Key#
Log into your Chamelingo dashboard and navigate to Settings > API Keys, or use the API directly:
bash
curl -X POST https://api.chamelingo.com/api/v1/keys \
-H "Cookie: better-auth.session_token=YOUR_SESSION" \
-H "Content-Type: application/json" \
-d '{"name": "My Language Agent", "scopes": ["tutor", "decks", "progress"]}'
Tip
Save the key field from the response immediately β it is shown only once and cannot be retrieved later.
Send Your First Message#
bash
curl -N -X POST https://api.chamelingo.com/api/v1/chat \
-H "Authorization: Bearer ck_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"message": "How do I say hello in Korean?"}'
Python
import requests
response = requests.post(
"https://api.chamelingo.com/api/v1/chat",
headers={"Authorization": "Bearer ck_live_YOUR_KEY_HERE"},
json={"message": "How do I say hello in Korean?"},
stream=True,
)
for line in response.iter_lines():
if line:
print(line.decode())
TypeScript
const response = await fetch("https://api.chamelingo.com/api/v1/chat", {
method: "POST",
headers: {
Authorization: "Bearer ck_live_YOUR_KEY_HERE",
"Content-Type": "application/json",
},
body: JSON.stringify({ message: "How do I say hello in Korean?" }),
});
const reader = response.body!.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
console.log(decoder.decode(value));
}
The cURL -N flag disables output buffering so you can see the SSE stream in real time.
Handle the SSE Response#
The response is a Server-Sent Events stream with three event types:
event: chunk
data: {"type":"chunk","content":"In Korean, "}
event: chunk
data: {"type":"chunk","content":"'hello' is "}
event: chunk
data: {"type":"chunk","content":"μλ
νμΈμ (annyeonghaseyo)!"}
event: done
data: {"type":"done","conversation_id":"clxyz...","corrections":[],"usage":{"input_tokens":234,"output_tokens":89}}
The done event contains a conversation_id β save this to continue the conversation in follow-up requests.
Continue the Conversation#
bash
curl -N -X POST https://api.chamelingo.com/api/v1/chat \
-H "Authorization: Bearer ck_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"message": "How about goodbye?", "conversation_id": "clxyz..."}'
Python
response = requests.post(
"https://api.chamelingo.com/api/v1/chat",
headers={"Authorization": "Bearer ck_live_YOUR_KEY_HERE"},
json={
"message": "How about goodbye?",
"conversation_id": "clxyz...",
},
stream=True,
)
TypeScript
const response = await fetch("https://api.chamelingo.com/api/v1/chat", {
method: "POST",
headers: {
Authorization: "Bearer ck_live_YOUR_KEY_HERE",
"Content-Type": "application/json",
},
body: JSON.stringify({
message: "How about goodbye?",
conversation_id: "clxyz...",
}),
});
Check Your Usage#
bash
curl https://api.chamelingo.com/api/v1/usage \
-H "Authorization: Bearer ck_live_YOUR_KEY_HERE"
JSON
{
"tier": "pro",
"features": {
"ai_text_messages": {
"used": 2,
"limit": 500,
"remaining": 498,
"resets_at": "2026-03-21T00:00:00.000Z"
}
}
}
Next Steps#
- Authentication β API key scopes, quotas, and limits
- Making Requests β Base URL, headers, error handling
- Building a Study Bot β End-to-end tutorial