API reference
Documentation
Send prompts to connected LLM workers on the P2PClouds compute network.
Base URL
https://distributed.p2pclouds.net/v1/apiAuthentication
Pass your API key as a Bearer token on every request. Create a key from your API keys page.
Authorization: Bearer your_api_keyPOST
/v1/api/query
Dispatch a prompt to a connected LLM worker.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Query text |
| mode | "high" | "medium" | "low" | No | Select worker by spec tier |
Example
{
"prompt": "what is ai in 1 line",
"mode": "high"
}Success response
{
"model": "gemma3:4b",
"prompt": "what is ai in 1 line",
"response": "AI is the simulation of human intelligence by machines.",
"tokens": {
"prompt": 8,
"response": 12,
"total": 20
}
}Token counts are estimated from text. If the agent returns Ollama token fields (prompt_eval_count, eval_count), those are used instead.
Error responses
| Status | Body |
|---|---|
| 400 | { "error": "prompt is required" } |
| 400 | { "error": "mode must be one of: high, medium, low" } |
| 503 | { "error": "No LLM workers available" } |
| 503 | { "error": "No LLM workers available for mode: high" } |
| 503 | { "error": "Worker is busy: ..." } |
| 504 | { "error": "Query timed out waiting for LLM worker response" } |
Example request
curl -X POST "https://distributed.p2pclouds.net/v1/api/query" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_api_key" \
-d '{
"prompt": "what is ai in 1 line",
"mode": "high"
}'