ChatyfAI API Reference
Access all AI models through a single, OpenAI-compatible API. Pay per token with CYT.
Base URL
https://api.chatyfai.com/v1Authentication
All API requests require a Bearer token in the Authorization header. API keys start with sk-cyf-.
curl https://api.chatyfai.com/v1/chat/completions \
-H "Authorization: Bearer sk-cyf-live-your-api-key-here" \
-H "Content-Type: application/json"Security: Never share your API key. Use environment variables. Keys starting with sk-cyf-test- are for sandbox (no billing).
Chat Completions
/v1/chat/completionsCreates a chat completion. Compatible with the OpenAI API format.
Request
{
"model": "gpt-5",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"stream": false,
"temperature": 0.7,
"max_tokens": 1000
}Response
{
"id": "cyf-cmpl-abc123",
"object": "chat.completion",
"model": "gpt-5",
"choices": [{
"index": 0,
"message": {"role": "assistant", "content": "Hello! How can I help?"},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 12,
"total_tokens": 36,
"chatyfai_tokens": {
"input_cyt": 1,
"output_cyt": 2,
"total_cyt": 3,
"balance_remaining_cyt": "99997"
}
}
}Available Models
| Model | Provider | Input CYT/1K | Output CYT/1K |
|---|---|---|---|
| gpt-5 | OpenAI | 25 | 100 |
| gpt-5-mini | OpenAI | 2 | 6 |
| claude-sonnet-4-20250514 | Anthropic | 30 | 150 |
| claude-3-haiku-20240307 | Anthropic | 3 | 12 |
| gemini-2.0-flash | 1 | 4 | |
| mistral-large-latest | Mistral | 20 | 60 |
| deepseek-chat | DeepSeek | 1 | 3 |
List Models
/v1/modelsReturns a list of all available models with their capabilities and CYT pricing.
curl https://api.chatyfai.com/v1/models \
-H "Authorization: Bearer sk-cyf-live-xxx"Usage & Balance
/v1/balanceCheck your current CYT balance and monthly usage.
/v1/usage?from=2026-01-01&to=2026-03-01Detailed usage breakdown by model and provider.
/v1/billing/transactionsCYT transaction history (top-ups, consumption, refunds).
CYT Token System
ChatyfAI uses CYT (ChatyfAI Tokens) as a universal billing unit. Each AI model has its own CYT rate per 1,000 tokens.
How billing works
Cost = (input_tokens / 1000 x input_cyt_rate) + (output_tokens / 1000 x output_cyt_rate)
Example: 500 input + 200 output tokens with GPT-5 = (500/1000 x 25) + (200/1000 x 100) = 12.5 + 20 = 33 CYT
Error Handling
| Status | Code | Description |
|---|---|---|
| 401 | invalid_api_key | Missing or invalid API key |
| 402 | insufficient_balance | Not enough CYT balance |
| 429 | rate_limit_exceeded | Too many requests per minute |
| 400 | invalid_request | Invalid request parameters |
| 503 | model_unavailable | Model temporarily unavailable |
Code Examples
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="sk-cyf-live-your-key",
base_url="https://api.chatyfai.com/v1"
)
response = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)Node.js (OpenAI SDK)
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'sk-cyf-live-your-key',
baseURL: 'https://api.chatyfai.com/v1',
});
const response = await client.chat.completions.create({
model: 'gpt-5',
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(response.choices[0].message.content);cURL
curl -X POST https://api.chatyfai.com/v1/chat/completions \
-H "Authorization: Bearer sk-cyf-live-your-key" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-20250514",
"messages": [{"role": "user", "content": "Explain AI"}],
"max_tokens": 500
}'