Quick Start
Getting Your API Key
- 1Visit the dashboard to create your API key
- 2Copy your API key and store it safely
- 3Set the base URL to
https://api.axcessai.dev/v1 - 4Start making requests just like you would with OpenAI
Supported Models & Pricing
AxcessAI supports all major AI models with transparent pricing. Browse the Models page to see all 200+ available models.
Popular Models
GPT-4 Turbo: $10 input / $30 output
Claude 3 Opus: $15 input / $75 output
Gemini Flash: $0.075 input / $0.30 output
GPT-4o Mini: $0.15 input / $0.60 output
Code Examples
curl https://api.axcessai.dev/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4-turbo",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'Base URL Configuration
To use AxcessAI with your existing OpenAI SDK, simply change the base URL:
Default OpenAI
AxcessAI (OpenAI Compatible API)
API Endpoints
Chat Completions
Generate text responses from language models.
POST /v1/chat/completions{
"model": "openai/gpt-4-turbo",
"messages": [
{"role": "user", "content": "Hello!"}
],
"temperature": 0.7,
"max_tokens": 2048
}Image Generation
Generate images from text prompts using DALL-E, Flux, and other models.
POST /v1/images/generations{
"model": "openai/dall-e-3",
"prompt": "A serene landscape with mountains",
"size": "1024x1024",
"quality": "standard",
"n": 1
}Embeddings
Convert text into embeddings for semantic search and similarity comparison.
POST /v1/embeddings{
"model": "openai/text-embedding-3-small",
"input": "The quick brown fox jumps over the lazy dog"
}Text-to-Speech
Convert text to audio using various voices and models.
POST /v1/audio/speech{
"model": "openai/tts-1",
"input": "Hello, welcome to AxcessAI!",
"voice": "nova",
"response_format": "mp3"
}API Response Format
AxcessAI returns responses in the exact same format as OpenAI:
{
"id": "chatcmpl-8mq3m1",
"object": "chat.completion",
"created": 1699638019,
"model": "openai/gpt-4-turbo",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm ready to help."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 12,
"total_tokens": 22
}
}Authentication & Security
API Key Management
- Keep your API key secret and never commit it to version control
- Use environment variables to store your API key
- Rotate your keys periodically for enhanced security
- You can revoke keys anytime from the dashboard
- API keys are only shown once at creation—save it immediately
Environment Variable Setup
Node.js / JavaScript
AXCESSAI_API_KEY=sk_your_key_herePython
export OPENAI_API_KEY=sk_your_key_hereRate Limiting
Rate Limit Tiers
| Limit Type | Value | Description |
|---|---|---|
| Hard Limit | 60 requests/minute | Maximum requests per minute per API key |
| Soft Limit | 1M tokens/day | Warning issued when approaching this |
| Timeout | 60 seconds | Maximum request duration |
Rate Limit Headers: Response headers include X-RateLimit-Limit-Requests and X-RateLimit-Limit-Tokens. Check these to monitor your usage in real-time.
Error Handling
Common Error Codes
| Code | Status | Description |
|---|---|---|
| invalid_api_key | 401 | API key is missing or invalid |
| rate_limit_exceeded | 429 | Too many requests. Retry after delay |
| invalid_request_error | 400 | Request format is invalid |
| model_not_found | 404 | Requested model is not available |
| insufficient_quota | 429 | Daily token limit exceeded |
| server_error | 500 | Internal server error. Retry with backoff |
Error Response Format
{
"error": {
"type": "invalid_request_error",
"message": "model parameter is required",
"param": "model"
}
}Usage Tracking & Monitoring
Dashboard Metrics
Your dashboard tracks several key metrics for each API key:
- Requests: Total number of API requests made
- Tokens: Total input and output tokens used
- Last Used: Timestamp of the most recent request
- Created: When the API key was generated
- Daily Usage: Tracked tokens for the current day
Accessing Usage Info Programmatically
Response headers contain usage information:
X-RateLimit-Limit-Requests: 60
X-RateLimit-Limit-Tokens: 1000000
X-RateLimit-Remaining-Requests: 59
X-RateLimit-Remaining-Tokens: 999988Best Practices
Request Optimization
- Use batch requests when processing multiple inputs to reduce overhead
- Choose appropriate models for your use case (cheaper models for simple tasks)
- Implement request caching to avoid duplicate API calls
- Use streaming for long responses to reduce latency
- Set reasonable timeout values (30-60 seconds typical)
Error Recovery
- Implement exponential backoff for rate limit errors (429)
- Retry failed requests with increased delay between attempts
- Log errors for debugging and monitoring purposes
- Use circuit breakers to avoid cascading failures
- Monitor rate limit headers to proactively manage traffic
Cost Management
- Monitor daily token usage to stay within limits
- Use the Models page to compare pricing before choosing a model
- Create separate API keys for different projects to track costs per project
- Set up alerts when approaching daily token limits
- Review usage patterns in the dashboard regularly
Troubleshooting
Common Issues & Solutions
401 Unauthorized
Check that you're using the correct API key and it's being passed in the Authorization header as "Bearer YOUR_KEY"
429 Rate Limited
You've exceeded the 60 requests per minute limit. Implement exponential backoff and retry after 1-5 seconds
Invalid Model Error
Check the Models page to see available models and use the exact model name (e.g., "openai/gpt-4-turbo")
Timeout Errors
Requests that take longer than 60 seconds will timeout. Break large requests into smaller chunks or use streaming
CORS Issues
Make requests from the backend, not directly from browser JavaScript. Use a server-side proxy if needed