Control AI API Documentation
Integrate powerful AI capabilities into your applications with our simple and flexible API.
Getting Started
1. Get Your API Key
To use the Control AI API, you'll need an API key. You can get one by signing up for an account and creating an API key in your dashboard.
Sign Up for API Access2. Make Your First Request
Once you have your API key, you can start making requests to the Control AI API. Here's a simple example:
// Using fetch API
const response = await fetch('https://api.control.ai/api/ai', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
api_key: 'ctrl-xxxxxxxxxxxxxxxx',
prompt: 'Explain how to use the Control API',
options: {
model: 'openai/gpt-4',
max_tokens: 500,
temperature: 0.7
}
})
});
const data = await response.json();
console.log(data.response);
3. Authentication
All API requests require authentication. You can authenticate by including your API key in the request body.
{
"api_key": "ctrl-xxxxxxxxxxxxxxxx",
"prompt": "Your prompt here"
}
API Reference
Endpoints
POST
/api/ai
Generate AI responses based on your prompt.
Request Body
{
"api_key": "ctrl-xxxxxxxxxxxxxxxx", // Your API key
"prompt": "Your prompt here", // The prompt to generate a response for
"options": { // Optional parameters
"model": "openai/gpt-4", // AI model to use
"max_tokens": 500, // Maximum tokens in the response
"temperature": 0.7, // Randomness of the response (0-1)
"top_p": 1, // Nucleus sampling parameter
"stop": ["\n", "User:"] // Sequences where the API will stop generating
}
}
Response
{
"id": "resp-xxxxxxxxxxxxxxxx", // Response ID
"response": "Generated text here", // The generated response
"model": "openai/gpt-4", // Model used for generation
"tokens_used": 125, // Number of tokens used
"created_at": "2025-09-26T10:15:30Z" // Timestamp
}
GET
/api/models
Get a list of available AI models.
Request Parameters
{
"api_key": "ctrl-xxxxxxxxxxxxxxxx" // Your API key (as query parameter)
}
Response
{
"models": [
{
"id": "openai/gpt-4",
"name": "GPT-4",
"provider": "OpenAI",
"max_tokens": 8192,
"pricing": {
"input": 0.03,
"output": 0.06
}
},
{
"id": "openai/gpt-3.5-turbo",
"name": "GPT-3.5 Turbo",
"provider": "OpenAI",
"max_tokens": 4096,
"pricing": {
"input": 0.0015,
"output": 0.002
}
},
// More models...
]
}
Rate Limits
API rate limits vary based on your subscription plan:
Plan | Requests per Minute | Monthly Token Quota |
---|---|---|
Free | 10 | 10,000 |
Pro | 60 | 1,000,000 |
Pay-as-you-go | 30 | Unlimited (billed per use) |
Error Handling
The API uses standard HTTP response codes to indicate the success or failure of requests.
Code | Description |
---|---|
200 - OK | The request was successful. |
400 - Bad Request | The request was invalid or missing required parameters. |
401 - Unauthorized | Invalid or missing API key. |
403 - Forbidden | The API key doesn't have permission to perform the request. |
429 - Too Many Requests | Rate limit exceeded. |
500 - Server Error | Something went wrong on our end. |
Need Help?
Our support team is ready to assist you with any questions or issues you may have.
Contact Support