Thoughts IT AI Service Share
Seamlessly connect your websites, apps, and backend services to next-generation AI. Powered by proprietary Thoughts IT models with enterprise rate-limiting, comprehensive usage tracking, and unified developer endpoints.
1. Overview
The Thoughts IT AI Gateway allows external applications, ecommerce stores, customer portals, and automation scripts to harness world-class AI capabilities. Requests are authenticated through client API keys issued by the Thoughts IT Admin, and tokens/costs are accounted for in real time.
2. Authentication & Localhost Setup
Every request must be authenticated with your unique Client API Key issued from the Thoughts IT Admin dashboard (tit_ai_...).
Bearer Token (OpenAI SDK Standard)
Authorization: Bearer tit_ai_your_key
Custom Header
X-AI-API-Key: tit_ai_your_key
Query / Body Parameter
?api_key=tit_ai_your_key
Localhost বা অন্য প্রজেক্ট থেকে AI ব্যবহার করার নিয়ম (Why "0 Bill / 0 Request" Happens)
আপনি যখন নিজের কম্পিউটারে Localhost-এ কোনো প্রজেক্ট চালাচ্ছেন, তখন রিকোয়েস্টটি যেন অবশ্যই Thoughts IT লাইভ সার্ভারে যায়:
- API Base URL:
https://thoughtsit.com/api/v1(কখনইhttp://localhost/...দেবেন না, কারণ তাহলে রিকোয়েস্ট লাইভ সার্ভারে পৌঁছাবে না)। - Full Endpoint:
https://thoughtsit.com/api/v1/ai/chatবাhttps://thoughtsit.com/api/v1/chat/completions - Header:
Authorization: Bearer tit_ai_...অথবাX-AI-API-Key: tit_ai_... - Payload:
{"prompt": "Hello"}অথবা{"messages": [{"role": "user", "content": "Hello"}]}
curl -X POST "https://thoughtsit.com/api/v1/ai/chat" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"prompt": "Hello AI!", "model": "thoughtsit-model-alpha"}'
3. AI Billing Mechanics & Pricing (4X Markup)
আমাদের এআই গেটওয়ে প্রতিটি সফল API কলের জন্য ব্যবহৃত টোকেন (Input ও Output) নিখুঁতভাবে গণনা করে। ইঞ্জিন পাইকারি খরচের (Wholesale Google Cost) উপর ৪.০ গুণ (4.0x) রিটেইল রেট প্রয়োগ করে ক্লায়েন্ট বিল হিসাব করে। এর মধ্যে ৩ গুণ (3.0x) কোম্পানির নিট মুনাফা হিসেবে সংরক্ষিত হয়।
| মডেলের নাম | ইঞ্জিন টিয়ার | পাইকারি খরচ (Google / 1M) | ক্লায়েন্ট বিল (4X Markup / 1M) | কোম্পানির লাভ (3X Net) |
|---|---|---|---|---|
| thoughtsit-model-alpha | Flash Tier | In: $0.15 · Out: $0.60 | In: $0.60 · Out: $2.40 | +$0.45 / +$1.80 |
| thoughtsit-model-maxan | Pro Flagship | In: $1.25 · Out: $10.00 | In: $5.00 · Out: $40.00 | +$3.75 / +$30.00 |
| thoughtsit-model-lite | Ultra-Lite | In: $0.075 · Out: $0.30 | In: $0.30 · Out: $1.20 | +$0.225 / +$0.90 |
| thoughtsit-model-embed | Vector Embed | In: $0.006 | In: $0.024 | +$0.018 |
১. রিয়েল-টাইম বিল রিটার্ন
প্রতিটি API রেসপন্সে usage.cost_usd এবং usage.cost_bdt ফিল্ডে সেই রিকোয়েস্টের বিল তৎক্ষণাৎ ফেরত পাওয়া যায়।
২. ১ USD = ১২০ BDT রেট
আন্তর্জাতিক ডলার খরচের সাথে বাংলাদেশি টাকার হিসাব সহজে ট্র্যাক করার জন্য ১ ডলার = ১২০ টাকা স্থির বিনিময় হারে হিসাব প্রদর্শিত হয়।
৩. ড্যাশবোর্ড ট্র্যাকিং
অ্যাডমিন প্যানেলে ক্লায়েন্ট কত টাকা খরচ করেছে এবং কোম্পানির কত টাকা নিট প্রফিট হয়েছে তা পৃথক কলামে রিয়েল-টাইমে দৃশ্যমান হয়।
4. Available Models & Smart Aliases
Specify any of the following branded model identifiers in your API calls:
thoughtsit-model-maxan
FlagshipDeep reasoning, multi-step problem solving, coding, and complex logic generation.
thoughtsit-model-alpha
BalancedUltra-fast general purpose reasoning, conversational assistants, and copy creation.
thoughtsit-model-lite
FastestHigh throughput, ultra-low latency, optimal for classification and summarization.
thoughtsit-model-vision
MultimodalImage inspection, product photo analysis, OCR, and document extraction.
thoughtsit-model-embed
EmbeddingDense 768-dimensional vector representations for semantic search and RAG retrieval.
/api/v1/ai/chat or /api/v1/chat/completions
Generate text, answers, or conversational completions. Fully compatible with both Thoughts IT native format, Google Gemini SDKs, and OpenAI SDKs.
Request Body (JSON) — Accepts multiple formats:
{
// Accepted Models: "thoughtsit-model-alpha", "alpha", "gemini-2.5-flash", "gpt-4o", "maxan"
"model": "thoughtsit-model-alpha",
// Format 1: Simple text prompt
"prompt": "Write a compelling product description for wireless earbuds.",
// OR Format 2: OpenAI-style multi-turn messages
"messages": [
{ "role": "user", "content": "Hello!" },
{ "role": "assistant", "content": "Hi! How can I help you today?" },
{ "role": "user", "content": "Explain microservices in 2 sentences." }
],
// OR Format 3: Google Gemini-style contents
// "contents": [{ "role": "user", "parts": [{ "text": "Hello Gemini!" }] }]
}
Response (200 OK) — Unified Multi-SDK Schema:
{
"id": "chatcmpl-a9f8b7e2c140",
"object": "chat.completion",
"model": "ThoughtsIT Model Alpha",
// Direct String Access (Fast & Easy):
"content": "Microservices are an architectural style where an application is divided into small, independent services communicating via APIs...",
"text": "Microservices are an architectural style where an application is divided into small, independent services communicating via APIs...",
// OpenAI SDK Compatible Structure:
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Microservices are an architectural style where an application is divided into small, independent services communicating via APIs..."
},
"finish_reason": "stop"
}
],
// Real-Time Token & 4X Client Billing Breakdown:
"usage": {
"prompt_tokens": 34,
"completion_tokens": 82,
"total_tokens": 116,
"cost_usd": 0.000162,
"cost_bdt": 0.0194,
"wholesale_cost_usd": 0.000040
},
"cost_usd": 0.000162,
"cost_bdt": 0.0194
}
content এবং OpenAI choices[0].message.content উভয়ই প্রদান করা হয়, ফলে আপনি যেকোনো সাধারণ cURL বা অফিশিয়াল OpenAI ক্লায়েন্ট দিয়ে কোনো এরর ছাড়াই তাৎক্ষণিক ডাটা ও খরচ রিড করতে পারবেন।
/api/v1/ai/embed
Generate 768-dimensional float embeddings for vector search.
Request Body (JSON)
{
"text": "Wireless noise cancelling headphones with deep bass"
}
Response (200 OK)
{
"embedding": [0.0124, -0.0431, 0.0891, ...],
"model": "thoughtsit-model-embed",
"dimensions": 768
}
/api/v1/ai/models
Retrieve the list of models your specific API key has permission to use.
/api/v1/ai/usage
Check your account's quota consumption, request counts, daily remaining tokens, and total spend (USD & BDT).
Request Headers
GET https://thoughtsit.com/api/v1/ai/usage X-AI-API-Key: tit_ai_your_key_here
Response (200 OK)
{
"client": "ZetCommerce Store",
"domain": "zetcommerce.com",
"limits": {
"rate_limit_rpm": 60,
"rate_limit_tpd": 1000000
},
"today": {
"requests": 142,
"tokens_used": 68450,
"tokens_remaining": 931550,
"spend_usd": 0.0958,
"spend_bdt": 11.50
},
"this_month": {
"requests": 2840,
"tokens_used": 1420500,
"spend_usd": 1.9887,
"spend_bdt": 238.64
},
"all_time": {
"total_requests": 9500,
"total_tokens": 4820000,
"total_spend_usd": 6.7480,
"total_spend_bdt": 809.76
}
}
• spend_usd & spend_bdt: Query this endpoint anytime to display up-to-date AI spend directly inside your own portal or application.
• tokens_remaining: How many tokens remain for the current calendar day before the midnight (12:00 AM UTC) quota reset.
5. Code Examples
OpenAI SDK Official OpenAI Client Library (Python & Node.js Compatible)
Drop-in replacement for OpenAI APIfrom openai import OpenAI
# Simply change base_url to Thoughts IT Gateway!
client = OpenAI(
api_key="tit_ai_your_key_here",
base_url="https://thoughtsit.com/v1" # or "https://thoughtsit.com/api/v1"
)
response = client.chat.completions.create(
model="alpha", # auto-resolves to thoughtsit-model-alpha
messages=[
{"role": "user", "content": "Explain cloud architecture in 2 lines."}
]
)
print(response.choices[0].message.content)
# Access real-time billing directly from usage:
print(f"Cost: ${response.usage.cost_usd} (≈ ৳{response.usage.cost_bdt})")
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: "tit_ai_your_key_here",
baseURL: "https://thoughtsit.com/v1"
});
const completion = await openai.chat.completions.create({
model: "alpha",
messages: [{ role: "user", content: "Hello Thoughts IT AI!" }]
});
console.log(completion.choices[0].message.content);
console.log(`Billed: $${completion.usage.cost_usd} (৳${completion.usage.cost_bdt})`);
PHP Raw PHP with Native cURL (Recommended)
No frameworks or composer needed<?php
/**
* Raw Native PHP - Thoughts IT AI Gateway Client
* Works on any standard PHP 7.4+ or 8.x web hosting without Composer
*/
$apiKey = 'tit_ai_your_key_here';
$apiUrl = 'https://thoughtsit.com/api/v1/ai/chat';
// 1. Prepare your prompt or chat messages
$payload = [
'model' => 'thoughtsit-model-alpha', // or 'thoughtsit-model-maxan'
'prompt' => 'Write an attractive product description for wireless noise cancelling earbuds.',
// Optional chat history:
// 'messages' => [
// ['role' => 'user', 'content' => 'Hello!'],
// ['role' => 'assistant', 'content' => 'Hi, how can I help?'],
// ['role' => 'user', 'content' => 'Explain quantum computing in 2 lines.']
// ]
];
// 2. Initialize cURL request
$ch = curl_init($apiUrl);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey, // or 'X-AI-API-Key: ' . $apiKey
],
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_TIMEOUT => 30, // seconds
CURLOPT_SSL_VERIFYPEER => true,
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curlError = curl_error($ch);
curl_close($ch);
// 3. Parse and process response
if ($curlError) {
echo "cURL Connection Error: " . $curlError;
} elseif ($httpCode === 200) {
$data = json_decode($response, true);
// AI generated text (available directly via content/text or OpenAI choices)
$aiText = $data['content'] ?? $data['text'] ?? ($data['choices'][0]['message']['content'] ?? '');
echo "<h3>AI Response:</h3>\n";
echo nl2br(htmlspecialchars($aiText)) . "\n\n";
// Real-Time Token & 4X Billing Cost Breakdown
if (isset($data['usage'])) {
echo "<hr>";
echo "<strong>Tokens:</strong> " . $data['usage']['total_tokens'] . " (In: " . $data['usage']['prompt_tokens'] . ", Out: " . $data['usage']['completion_tokens'] . ")<br>";
echo "<strong>Billed Cost:</strong> $" . $data['usage']['cost_usd'] . " (≈ ৳" . $data['usage']['cost_bdt'] . ")<br>";
}
} else {
$err = json_decode($response, true);
echo "Request Failed (HTTP {$httpCode}): " . ($err['message'] ?? $err['error'] ?? $response);
}
PHP (No cURL) Raw PHP with file_get_contents (Stream Context)
Zero external extensions needed<?php
/**
* Alternative: Stream context without requiring cURL extension
*/
$apiKey = 'tit_ai_your_key_here';
$apiUrl = 'https://thoughtsit.com/api/v1/ai/chat';
$payload = json_encode([
'model' => 'thoughtsit-model-alpha',
'prompt' => 'Write a welcome email for a new SaaS user.'
]);
$options = [
'http' => [
'method' => 'POST',
'header' => "Content-Type: application/json\r\n" .
"Authorization: Bearer {$apiKey}\r\n",
'content' => $payload,
'timeout' => 30,
'ignore_errors' => true // allows reading error response body on 4xx/5xx
]
];
$context = stream_context_create($options);
$response = file_get_contents($apiUrl, false, $context);
$result = json_decode($response, true);
if (isset($result['content']) || isset($result['text'])) {
echo $result['content'] ?? $result['text'];
if (isset($result['usage'])) {
echo "\n\n[Cost: $" . $result['usage']['cost_usd'] . " (≈ ৳" . $result['usage']['cost_bdt'] . ")]";
}
} else {
echo "Error: " . ($result['message'] ?? $result['error'] ?? 'Unknown error');
}
PHP Raw PHP: Check Your Quota & Live Spend
GET /api/v1/ai/usage<?php
// Query your client account quota, remaining daily tokens, and live spend
$apiKey = 'tit_ai_your_key_here';
$url = 'https://thoughtsit.com/api/v1/ai/usage';
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey, // or 'X-AI-API-Key: ' . $apiKey
],
CURLOPT_TIMEOUT => 15,
]);
$response = curl_exec($ch);
curl_close($ch);
$usage = json_decode($response, true);
echo "Client: " . ($usage['client'] ?? 'N/A') . "\n";
echo "Daily Tokens Remaining: " . number_format($usage['today']['tokens_remaining'] ?? 0) . "\n";
echo "Today Spend: $" . ($usage['today']['spend_usd'] ?? 0) . " (≈ ৳" . ($usage['today']['spend_bdt'] ?? 0) . ")\n";
echo "Month Spend: $" . ($usage['this_month']['spend_usd'] ?? 0) . " (≈ ৳" . ($usage['this_month']['spend_bdt'] ?? 0) . ")\n";
echo "Total Spend: $" . ($usage['all_time']['total_spend_usd'] ?? 0) . " (≈ ৳" . ($usage['all_time']['total_spend_bdt'] ?? 0) . ")\n";
Laravel / Modern PHP (Http Client)
// Laravel Http Client
use Illuminate\Support\Facades\Http;
$apiKey = 'tit_ai_your_key_here';
$response = Http::withToken($apiKey) // or withHeaders(['X-AI-API-Key' => $apiKey])
->post('https://thoughtsit.com/api/v1/ai/chat', [
'model' => 'thoughtsit-model-alpha',
'prompt' => 'Provide 3 catchy marketing slogans for Thoughts IT.',
]);
$data = $response->json();
echo $data['content'] ?? $data['text'];
// Real-time cost & usage
if (isset($data['usage'])) {
echo "\nCost: $" . $data['usage']['cost_usd'] . " (≈ ৳" . $data['usage']['cost_bdt'] . ")";
}
JavaScript / Node.js (fetch)
const response = await fetch('https://thoughtsit.com/api/v1/ai/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer tit_ai_your_key_here' // or 'X-AI-API-Key': 'tit_ai_your_key_here'
},
body: JSON.stringify({
model: 'thoughtsit-model-alpha',
messages: [
{ role: 'user', content: 'Write a quicksort implementation in Python.' }
]
})
});
const result = await response.json();
console.log(result.content || result.text);
if (result.usage) {
console.log(`Billed: $${result.usage.cost_usd} (≈ ৳${result.usage.cost_bdt})`);
}
Python (requests)
import requests
url = "https://thoughtsit.com/api/v1/ai/chat"
headers = {
"Authorization": "Bearer tit_ai_your_key_here",
"Content-Type": "application/json"
}
payload = {
"model": "thoughtsit-model-alpha",
"prompt": "Summarize the latest developments in generative AI."
}
response = requests.post(url, json=payload, headers=headers)
data = response.json()
print(data.get("content") or data.get("text"))
if "usage" in data:
print(f"Cost: ${data['usage']['cost_usd']} (≈ ৳{data['usage']['cost_bdt']})")