API Endpoints
Complete reference for all ARKA AI API endpoints.
Base URL
All API requests should be made to:
https://api.arka-ai.com/v1Chat Completions
Generate AI responses using various models.
Create Completion
POST /v1/chat/completionsRequest Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model to use (e.g., "gpt-4o", "claude-3-5-sonnet") |
| messages | array | Yes | Array of message objects with role and content |
| temperature | number | No | 0-2, controls randomness (default: 1) |
| max_tokens | number | No | Maximum tokens in response |
| stream | boolean | No | Stream response as SSE (default: false) |
Example Request
curl https://api.arka-ai.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Explain quantum computing in simple terms."
}
],
"temperature": 0.7,
"max_tokens": 500
}'Example Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Quantum computing uses quantum bits..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 20,
"completion_tokens": 150,
"total_tokens": 170
}
}Presets
Use pre-configured AI templates for common tasks.
List Presets
GET /v1/presetsQuery Parameters
| Parameter | Type | Description |
|---|---|---|
| category | string | Filter by category (optional) |
| limit | number | Number of results (default: 50) |
Execute Preset
POST /v1/presets/:presetId/executeExample Request
curl https://api.arka-ai.com/v1/presets/blog-writer/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Write about the future of AI",
"model": "gpt-4o"
}'File Upload
Upload files for processing with AI.
Upload File
POST /v1/filesRequest (multipart/form-data)
curl https://api.arka-ai.com/v1/files \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@document.pdf" \
-F "purpose=document-analysis"Integrations
Manage and execute integrations via API.
List Connected Integrations
GET /v1/integrationsExecute Integration Action
POST /v1/integrations/:integration/executeExample: Post to Slack
curl https://api.arka-ai.com/v1/integrations/slack/execute \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"action": "post_message",
"channel": "#general",
"text": "Hello from ARKA AI API!"
}'Usage & Billing
Get Token Usage
GET /v1/usageQuery Parameters
| Parameter | Type | Description |
|---|---|---|
| start_date | string | ISO 8601 date (optional) |
| end_date | string | ISO 8601 date (optional) |
Example Response
{
"period": {
"start": "2024-01-01",
"end": "2024-01-31"
},
"tokens_used": 1234567,
"tokens_included": 3000000,
"tokens_remaining": 1765433,
"overage_tokens": 0,
"estimated_overage_cost": 0,
"breakdown_by_model": {
"gpt-4o": 500000,
"gpt-4o-mini": 734567
}
}Available Models
| Model ID | Provider | Context Window | Best For |
|---|---|---|---|
| gpt-4o-mini | OpenAI | 128K | Fast, cost-effective tasks |
| gpt-4o | OpenAI | 128K | Balanced performance |
| gpt-4-turbo | OpenAI | 128K | Complex reasoning |
| claude-3-5-sonnet | Anthropic | 200K | Coding, creative writing |
| claude-3-opus | Anthropic | 200K | Complex tasks, research |
Error Handling
All errors follow this format:
{
"error": {
"message": "Invalid model specified",
"type": "invalid_request_error",
"param": "model",
"code": "model_not_found"
}
}