curl --request POST 'https://restapi.scalingtensor.com/api/chat/completion' \
--header 'apiKey: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"messages": [
{
"role": "user",
"content": "Hello"
}
],
"max_tokens": 2048,
"model": "anthropic/claude-opus-4.7"
}'
const response = await fetch("https://restapi.scalingtensor.com/api/chat/completion", {
method: "POST",
headers: {
apiKey: process.env.SCALINGTENSOR_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"messages": [
{
"role": "user",
"content": "Hello"
}
],
"max_tokens": 2048,
"model": "anthropic/claude-opus-4.7"
}),
});
const result = await response.json();
if (!response.ok || result.code !== 0) {
throw new Error(result.msg || `Request failed: ${response.status}`);
}
console.log(result.data); // Read content, tokensIn, tokensOut and costMicros
import os
import requests
payload = {
"messages": [
{
"role": "user",
"content": "Hello",
},
],
"max_tokens": 2048,
"model": "anthropic/claude-opus-4.7",
}
response = requests.post(
"https://restapi.scalingtensor.com/api/chat/completion",
headers={"apiKey": os.environ["SCALINGTENSOR_API_KEY"]},
json=payload,
timeout=60,
)
result = response.json()
if result["code"] != 0:
raise RuntimeError(result["msg"])
print(result["data"]) # Read content, tokensIn, tokensOut and costMicros