Get Started with Sub2API
Welcome to Sub2API! This guide will help you make your first API call in minutes.
What is Sub2API?
Sub2API is a unified API gateway that provides access to leading AI models from OpenAI, Anthropic, Google, and other providers through a single, OpenAI-compatible endpoint.
Base URL
All API requests should be made to:
https://api.tokenlio.ai/v1Three Steps to Your First API Call
1. Create Your Account
- Visit app.tokenlio.ai and sign up with your email
- Verify your email address
- You'll automatically be logged into your personal workspace
2. Top Up Your Balance
- Navigate to Billing in the console
- Click Top Up Balance
- Enter amount (minimum $10 USD)
- Complete payment via Stripe
- Your balance will be available immediately
3. Create an API Key
- Go to API Keys in the console
- Click Create New Key
- Give your key a descriptive name (e.g., "Development", "Production")
- Copy the key immediately - it will only be shown once
- Store it securely (environment variable, secrets manager, etc.)
Your First Request
Once you have your API key, you can make requests using any OpenAI-compatible client:
bash
curl https://api.tokenlio.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-4-turbo",
"messages": [
{
"role": "user",
"content": "Hello! How are you?"
}
]
}'python
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.tokenlio.ai/v1"
)
response = client.chat.completions.create(
model="gpt-4-turbo",
messages=[
{"role": "user", "content": "Hello! How are you?"}
]
)
print(response.choices[0].message.content)javascript
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'YOUR_API_KEY',
baseURL: 'https://api.tokenlio.ai/v1',
});
async function main() {
const response = await client.chat.completions.create({
model: 'gpt-4-turbo',
messages: [
{ role: 'user', content: 'Hello! How are you?' }
],
});
console.log(response.choices[0].message.content);
}
main();Check Your Usage
After making requests:
- Go to Usage in the console to see token consumption
- View Request Logs for detailed per-request information
- Check Billing for costs and remaining balance
Security Best Practices
- Never commit API keys to version control
- Store keys in environment variables or secrets managers
- Use separate keys for development and production
- Rotate keys regularly
- Disable unused keys immediately
What's Next?
- Quick Start Guide - Complete walkthrough with examples
- Authentication - API key usage details
- Available Models - See all supported models and pricing
- Chat API Reference - Full API documentation
Need Help?
- Check our FAQ
- Email support@tokenlio.ai
- Visit the Contact page