API குறிப்பு
GatifyAI OpenAI SDK-க்கு இணக்கமான chat completions endpoint-ஐ வழங்குகிறது — உங்களிடம் ஏற்கனவே உள்ள OpenAI client-ஐ GatifyAI-க்கு காட்டினால் போதும், தனி client library தேவையில்லாமல் அது வேலை செய்யும்.
Base URL
ஒவ்வொரு request-உம் இங்கு செல்கிறது:
https://gatifyai.com/api/v1Authentication
API keys பக்கத்தில் key ஒன்றை உருவாக்கி, அதை Authorization header-இல் bearer token ஆக அனுப்பவும். உங்கள் key-இன் hash மட்டும் சேமிக்கப்படும் — உருவாக்கும் போதே அதை copy செய்யவும், ஏனெனில் GatifyAI அதை மீண்டும் காட்ட முடியாது.
விரைவு தொடக்கம்
curl, Python அல்லது TypeScript-இல் குறைந்தபட்ச request:
curl https://gatifyai.com/api/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_NAME",
"messages": [{"role": "user", "content": "Hello!"}]
}'ஒரு key-ஐ குறிப்பிட்ட models-க்கு மட்டும் கட்டுப்படுத்துதல்
இயல்பாக, புதிய key GatifyAI-ன் எந்த free model-ஐயும் பயன்படுத்தலாம்; ஒன்று கிடைக்காவிட்டால் web chat பயன்படுத்தும் அதே automatic fallover இருக்கும். அதற்கு பதிலாக, key-ஐ ஒரு குறிப்பிட்ட model அல்லது குறுகிய list-க்கு கட்டுப்படுத்தலாம் — அப்போது request எந்த model-ஐ கேட்டாலும், key அந்த list-இல் உள்ள models-ஐ நீங்கள் கொடுத்த வரிசையிலேயே மட்டும் பயன்படுத்தும். அந்த list-க்கு வெளியே model கேட்டால், key உண்மையில் பயன்படுத்த அனுமதிக்கப்பட்ட models-ஐக் கூறும் 400 error திரும்பும்.
Persona ஆக chat செய்தல்
community gallery-இல் வெளியிடப்பட்ட persona ஆக chat செய்ய model: "persona/<slug>" அனுப்பவும் — அதன் personality மற்றும் preferred models தானாகப் பயன்படுத்தப்படும்; நீங்கள் key-க்கு allowed models அமைத்திருந்தால் அவற்றால் இன்னும் கட்டுப்படுத்தப்படும். Persona-வின் slug மற்றும் தயாரான example அதன் சொந்த page-இல், API tab-இல் கிடைக்கும்.
{
"model": "persona/senior-engineer",
"messages": [{"role": "user", "content": "Review my code."}]
}Streaming vs. non-streaming
tokens உருவாகும் போதே பெற stream: true அமைக்கவும், OpenAI streaming format போலவே (Server-Sent Events, [DONE] மூலம் முடியும்). முழு reply-ஐ காத்திருந்து ஒரு JSON response பெற இதை விடுங்கள் அல்லது false அமைக்கவும் — இதுவே default.
Errors
Errors OpenAI error shape-ஐப் பின்பற்றும்: {"error": {"message": "...", "type": "..."}}. 401 என்பது key இல்லை, invalid அல்லது revoked என்பதை குறிக்கும். 400 என்பது request தானே invalid — பெரும்பாலும் unrecognized model, unpublished/unknown persona slug அல்லது உங்கள் key-ன் allowed list-க்கு வெளியே உள்ள model. 502 என்பது எந்த candidate model-மும் பதிலளிக்கவில்லை என்பதாகும்.
{
"error": {
"message": "This API key may only use: llama-3.1-8b:free",
"type": "invalid_request_error"
}
}Rate limits
API requests web app-இன் அதே per-account chat rate limit-இல் எண்ணப்படும் — இப்போது API traffic-க்கு தனி quota இல்லை.