Documentation
Build against one stable API.
The gateway accepts OpenAI-compatible JSON and streams server-sent events.
Quickstart
Set the base URL, pass a bearer key, and choose a documented model ID.
curl https://api.aiforpros.dev/v1/chat/completions \
-H "Authorization: Bearer sk-aifp-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"top-tools-ai","messages":[{"role":"user","content":"Explain SSE in one paragraph."}]}'Authentication
Send your API key in the Authorization header. Keys use the sk-aifp- prefix and are shown once when created.
Authorization: Bearer sk-aifp-YOUR_API_KEYModels
Call GET /v1/models with your key to receive the models available to your account. The public catalog lists all 22 model IDs.
Chat completions
Send messages to POST /v1/chat/completions. Messages can include system, user, assistant, and tool roles.
Streaming
Set stream to true. The response uses text/event-stream and ends with the provider completion marker.
curl https://api.aiforpros.dev/v1/chat/completions \
-H "Authorization: Bearer sk-aifp-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"top-tools-ai","stream":true,"messages":[{"role":"user","content":"Write one sentence."}]}'Tool calls
Pass OpenAI-compatible function definitions in the tools array. Tool arguments arrive in the assistant response or streamed deltas.
{
"model": "top-tools-ai",
"messages": [{ "role": "user", "content": "Weather in Paris" }],
"tools": [{
"type": "function",
"function": { "name": "get_weather", "parameters": { "type": "object", "properties": { "city": { "type": "string" } } } }
}]
}Vision
For models marked vision, include image URL content parts beside text content.
{
"model": "top-tools-ai",
"messages": [{ "role": "user", "content": [
{ "type": "text", "text": "Describe this image." },
{ "type": "image_url", "image_url": { "url": "https://example.com/image.jpg" } }
] }]
}Image generation
Use the image generations endpoint with a model that includes image generation access.
curl https://api.aiforpros.dev/v1/images/generations \
-H "Authorization: Bearer sk-aifp-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"top-tools-ai","prompt":"A precise technical cutaway drawing"}'Limits
Standard accounts allow 45 requests per minute and 5 concurrent requests. API Limits Plus allows 75 requests per minute and 15 concurrent requests. A sixth concurrent request on a standard account returns 429.
Errors
Error responses use stable codes: invalid keys return 401, access denial returns 403, request limits return 429, provider failures return 502, and internal gateway failures return 500.