Build with deMac
Connect with the OpenAI SDK, choose a model, and send your first request.
Base URL
https://api.demac.example/v1
Quick start
Install your preferred SDK and point it to deMac. Create an API key below, then add it to the example.
# No installation needed
export DEMAC_API_KEY="<YOUR_API_KEY>"
export DEMAC_BASE_URL="https://api.demac.example/v1"Replace the model placeholder with an ID returned by /v1/models. Availability depends on connected providers.
API Keys
All keys draw from your shared account balance. A key's spend cap is a sub-limit on that balance, not extra funds.
This console uses one active key (saved in this browser) for its own chat and test calls. It's provisioned automatically; you can also point it at a new key below.
Connect your wallet to create and manage API keys.
Endpoint reference
Request formats, responses, and authentication requirements.
Requires an Authorization: Bearer <api_key> header.
Request
{
"model": "<model-id-from-/v1/models>",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"stream": true,
"max_tokens": 1024
}Response
{
"id": "chatcmpl-...",
"object": "chat.completion.chunk",
"model": "<model-id-from-/v1/models>",
"choices": [{
"index": 0,
"delta": {"role": "assistant", "content": "Hello"},
"finish_reason": null
}]
}Supports streaming (SSE) and non-streaming responses. All prompts are end-to-end encrypted. Response headers include provider attestation metadata (x-provider-attested, x-provider-trust-level, x-provider-chip).
Requires an Authorization: Bearer <api_key> header.
Request
{
"model": "<model-id-from-/v1/models>",
"input": "Explain how decentralized inference works.",
"stream": true,
"max_output_tokens": 1024
}Response
{
"id": "resp_...",
"object": "response",
"model": "<model-id-from-/v1/models>",
"output": [{
"type": "message",
"role": "assistant",
"content": [{
"type": "output_text",
"text": "Decentralized inference distributes..."
}]
}],
"usage": {
"input_tokens": 12,
"output_tokens": 256
}
}OpenAI Responses API format. Accepts 'input' (string or array) instead of 'messages'. Uses input_tokens/output_tokens for usage. Supports streaming. Same routing, encryption, and billing as chat completions.
Requires an Authorization: Bearer <api_key> header.
Response
{
"data": [
{
"id": "<model-id-from-/v1/models>",
"object": "model",
"name": "Gemma 4 26B",
"hugging_face_id": "<model-id-from-/v1/models>",
"created": 1735689600,
"description": "Balanced general-purpose model.",
"input_modalities": ["text"],
"output_modalities": ["text"],
"quantization": "int8",
"context_length": 262144,
"max_output_length": 16384,
"pricing": {
"prompt": "0.00000005",
"completion": "0.0000002",
"image": "0",
"request": "0",
"input_cache_read": "0"
},
"supported_sampling_parameters": ["temperature", "top_p", "top_k", "stop", "seed", "max_tokens"],
"supported_features": ["tools", "reasoning"],
"metadata": {
"model_type": "chat",
"provider_count": 2,
"trust_level": "hardware",
"display_name": "Gemma 4 26B"
}
}
]
}OpenAI-compatible model list. Top-level fields include per-token USD pricing strings, modalities, and supported features. deMac-native fields such as trust_level and provider_count live under metadata.
Response
{
"providers_online": 3,
"providers_total": 5,
"models_available": 4,
"requests_24h": 1250,
"tokens_24h": 850000,
"attested_providers": 3
}Response
{
"providers": [{
"provider_id": "...",
"chip_name": "Apple M4 Max",
"hardware_model": "Mac16,1",
"trust_level": "hardware",
"status": "online",
"secure_enclave": true,
"sip_enabled": true,
"secure_boot_enabled": true,
"mdm_verified": true,
"mda_verified": true,
"se_public_key": "..."
}]
}Publicly accessible — no authentication required. Hardware serials, UDIDs, and raw Apple certificate chains stay private to the provider and coordinator.
Response
{
"prices": [
{"model": "<model-id-from-/v1/models>", "input_price": 50000, "output_price": 200000, "input_usd": "$0.05", "output_usd": "$0.20"}
]
}Requires an Authorization: Bearer <api_key> header.
Response
{
"balance_micro_usd": 5000000,
"balance_usd": 5.00
}Requires an Authorization: Bearer <api_key> header.
Response
{
"usage": [
{
"request_id": "...",
"model": "<model-id-from-/v1/models>",
"prompt_tokens": 150,
"completion_tokens": 500,
"cost_micro_usd": 420,
"timestamp": "2026-04-11T22:00:00Z"
}
]
}Request examples
Chat completions
Stream a response, continue a conversation, or set a system message.
curl -X POST https://api.demac.example/v1/chat/completions \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "<model-id-from-/v1/models>",
"messages": [{"role": "user", "content": "Explain quantum computing"}],
"stream": true,
"max_tokens": 1024
}'List models
Find model IDs and current provider coverage before sending a request.
from openai import OpenAI
client = OpenAI(base_url="https://api.demac.example/v1", api_key="<YOUR_API_KEY>")
models = client.models.list()
for model in models.data:
print(f"{model.id}")Need to change your example URL?
Open settings