Developers
API Documentation
Programmatic access to our AI solver for developers. Add step-by-step homework solving to your own applications.
API pricing
Pay as you go with prepaid credits: one successful solve uses one credit. Failed solves are never charged, credits never expire, and there is no monthly fee.
100 Credits
$5.00
$50.00 per 1,000 solves
1,000 Credits
$25.00
$25.00 per 1,000 solves
Need more than 10,000 solves a month? Contact us for volume pricing.
Authentication
How to get your API token
- Sign in and buy a credit pack on your Credits page
- Navigate to your Dashboard
- Click "Create New Token" in the API Tokens section
- Give your token a descriptive name
- Copy the token immediately (it will only be shown once!)
Using your token
Include your API token in the Authorization header of all requests:
Authorization: Bearer YOUR_API_TOKEN
Security warning: Never expose your API token in client-side code or public repositories. Store it securely and only use it in server-side applications.
Base URL
https://aipictureanswer.com/api/v1
All API requests should use Content-Type: application/json
API endpoints
/api/v1/solve
Solve a homework problem using EITHER a text question OR an image (not both).
Important: You must provide exactly one of these fields. Sending both question and image together will result in a validation error.
Request Body (Option 1: Text Question)
{
"question": "Solve: 2x + 5 = 15"
}
Request Body (Option 2: Image Only)
{
"image": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."
}
Note: Images must be base64 encoded with the data URI prefix (e.g., data:image/jpeg;base64,...)
Response (200 OK)
{
"success": true,
"data": {
"answer": "Step 1: Subtract 5 from both sides...",
"conversation_id": 12345
},
"usage": {
"requests_today": 15,
"is_unlimited": true
}
}
Error Responses
/api/v1/usage
Get your API usage statistics and account information.
Response (200 OK)
{
"success": true,
"data": {
"total_requests": 150,
"credit_balance": 892,
"free_requests_today": 2,
"free_requests_limit": 10,
"active_tokens": 2
}
}
Code examples
cURL
curl -X POST https://aipictureanswer.com/api/v1/solve \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"question": "Solve: 2x + 5 = 15"
}'
JavaScript (Node.js)
const fetch = require('node-fetch');
const apiToken = 'YOUR_API_TOKEN';
async function solveProblem(question) {
const response = await fetch('https://aipictureanswer.com/api/v1/solve', {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ question })
});
const data = await response.json();
return data;
}
// Usage
solveProblem('Solve: 2x + 5 = 15')
.then(result => console.log(result.data.answer))
.catch(error => console.error(error));
Python
import requests
import base64
api_token = "YOUR_API_TOKEN"
base_url = "https://aipictureanswer.com/api/v1"
def solve_problem(question=None, image_path=None):
"""
Solve a problem using EITHER question OR image (not both)
"""
headers = {
"Authorization": f"Bearer {api_token}",
"Content-Type": "application/json"
}
payload = {}
# Add either question OR image (not both)
if question and image_path:
raise ValueError("Cannot provide both question and image. Choose one.")
elif question:
payload["question"] = question
elif image_path:
with open(image_path, "rb") as image_file:
encoded = base64.b64encode(image_file.read()).decode()
payload["image"] = f"data:image/jpeg;base64,{encoded}"
else:
raise ValueError("Must provide either question or image_path")
response = requests.post(
f"{base_url}/solve",
headers=headers,
json=payload
)
return response.json()
# Usage examples:
# Text question only:
result = solve_problem(question="Solve: 2x + 5 = 15")
# OR image only:
# result = solve_problem(image_path="problem.jpg")
print(result["data"]["answer"])
PHP
<?php
$apiToken = 'YOUR_API_TOKEN';
$baseUrl = 'https://aipictureanswer.com/api/v1';
function solveProblem($question = null, $imagePath = null) {
global $apiToken, $baseUrl;
// Ensure exactly one parameter is provided
if (($question && $imagePath) || (!$question && !$imagePath)) {
throw new Exception('Must provide EITHER question OR image, not both or neither');
}
$payload = [];
// Add either question OR image
if ($question) {
$payload['question'] = $question;
} else {
$imageData = base64_encode(file_get_contents($imagePath));
$payload['image'] = 'data:image/jpeg;base64,' . $imageData;
}
$ch = curl_init($baseUrl . '/solve');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $apiToken,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
// Usage examples:
// Text question only:
$result = solveProblem('Solve: 2x + 5 = 15');
// OR image only:
// $result = solveProblem(null, 'problem.jpg');
echo $result['data']['answer'];
?>
Rate limits & best practices
Pay per successful solve
Each successful API solve uses one credit. Failed requests are free and credits never expire.
Secure token storage
Store your API tokens securely using environment variables or secrets management.
HTTPS only
All API requests must use HTTPS for security.
Error handling
Always implement proper error handling for failed requests.
Don't expose tokens
Never expose your API tokens in client-side code, public repositories, or browser JavaScript.
Need help?
If you have questions about the API or need assistance with integration, we're here to help!