User Guide

Complete API reference and getting started guide for using Cxmpute services

Welcome to Cxmpute! This guide will help you get started using our AI services through our simple, OpenAI-compatible APIs.

Overview

Cxmpute provides an inference and related services powered by a global network of nodes run by providers. We offer:

  • LLM inference with dozens of popular models
  • Text embeddings for semantic search and RAG applications
  • Text-to-speech with natural voice synthesis
  • Web scraping with intelligent content extraction
  • Tool use and JSON mode for structured outputs

Learn more about specific use cases:

Getting Started

1. Create Your Account

Go to the Cxmpute Dashboard to create your account.

2. Get Your API Key

When your account is created, you'll see your base user API key. This key has no limits in terms of usage and accessible services during our testnet phase.

⚠️ Important: Practice good key management. Never expose your API keys in client-side code or public repositories. If your key has been compromised, refresh it immediately in the dashboard.

3. Create Virtual API Keys (Optional)

You can create virtual API keys with specific limitations:

  • Spend limits: Set maximum credit usage
  • Service restrictions: Limit access to specific endpoints
  • Usage tracking: Monitor usage per key

Authentication

All API requests require authentication using your API key:

Shell
Authorization: Bearer YOUR_API_KEY
X-User-Id: YOUR_USER_ID

Required Headers

  • Authorization: Your API key in Bearer token format
  • X-User-Id: Your user ID from the dashboard
  • Content-Type: application/json (for POST requests)

Optional Headers

  • X-Title: Service title for analytics
  • HTTP-Referer: Service URL for analytics

Base URL

All API endpoints use the base URL:

https://cxmpute.cloud/api

API Reference

Chat Completions

OpenAI-compatible endpoint for text generation and conversations.

HTTP
POST /v1/chat/completions

Request Body

JSON
{
  "model": "llama3.1:8b",
  "messages": [
    {"role": "user", "content": "Hello, how are you?"}
  ],
  "stream": false,
  "temperature": 0.7,
  "max_tokens": 1000
}

Parameters

ParameterTypeRequiredDescription
modelstringYesModel name (see model catalog)
messagesarrayYesArray of message objects with role and content
streambooleanNoEnable streaming responses (default: false)
temperaturenumberNoSampling temperature 0-2 (default: 0.7)
max_tokensnumberNoMaximum tokens to generate
top_pnumberNoNucleus sampling parameter
response_formatstring/objectNoResponse format (see JSON mode)
toolsarrayNoAvailable tools for function calling

Response

Non-streaming:

JSON
{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "llama3.1:8b",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Hello! I'm doing well, thank you for asking. How can I help you today?"
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 20,
    "total_tokens": 30
  }
}

Streaming:

data: {"choices":[{"delta":{"content":"Hello"}}]} data: {"choices":[{"delta":{"content":"!"}}]} data: [DONE]

Example

Shell
curl -X POST https://cxmpute.cloud/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-User-Id: YOUR_USER_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama3.1:8b",
    "messages": [
      {"role": "user", "content": "Write a haiku about AI"}
    ],
    "temperature": 0.8
  }'

Embeddings

Generate vector embeddings for text.

HTTP
POST /v1/embeddings

Request Body

JSON
{
  "model": "nomic-embed-text",
  "input": "Your text to embed",
  "truncate": true
}

Parameters

ParameterTypeRequiredDescription
modelstringYesEmbedding model name
inputstring/arrayYesText(s) to embed
truncatebooleanNoTruncate input to model's max length

Response

JSON
{
  "object": "list",
  "data": [{
    "object": "embedding",
    "embedding": [0.1, -0.2, 0.3, ...],
    "index": 0
  }],
  "model": "nomic-embed-text",
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}

Example

Shell
curl -X POST https://cxmpute.cloud/api/v1/embeddings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-User-Id: YOUR_USER_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nomic-embed-text",
    "input": "This is a sample text for embedding"
  }'

Text-to-Speech

Convert text to natural speech.

HTTP
POST /v1/tts

Request Body

JSON
{
  "text": "Hello, this is a test of text to speech.",
  "voice": "af_bella"
}

Parameters

ParameterTypeRequiredDescription
textstringYesText to convert to speech
voicestringNoVoice model (default: "af_bella")

Response

Returns audio data in WAV format with Content-Type: audio/wav.

Example

Shell
curl -X POST https://cxmpute.cloud/api/v1/tts \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-User-Id: YOUR_USER_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Welcome to Cxmpute!",
    "voice": "af_bella"
  }' \
  --output speech.wav

Web Scraping

Extract content from web pages.

HTTP
POST /v1/scrape

Request Body

JSON
{
  "urls": ["https://example.com"],
  "format": "markdown"
}

Parameters

ParameterTypeRequiredDescription
urlsarrayYesArray of URLs to scrape
formatstringNoOutput format: "markdown", "text", "html"

Response

JSON
{
  "results": [{
    "url": "https://example.com",
    "content": "# Example Page\n\nThis is the content...",
    "success": true,
    "metadata": {
      "title": "Example Page",
      "description": "An example webpage"
    }
  }]
}

Example

Shell
curl -X POST https://cxmpute.cloud/api/v1/scrape \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-User-Id: YOUR_USER_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": ["https://docs.cxmpute.cloud"],
    "format": "markdown"
  }'

OpenAI Compatibility

Our /v1/chat/completions endpoint is fully OpenAI-compatible! You can use existing OpenAI libraries by simply changing the base URL:

Python (OpenAI Library)

Python
import openai

client = openai.OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://cxmpute.cloud/api/v1",
    default_headers={"X-User-Id": "YOUR_USER_ID"}
)

response = client.chat.completions.create(
    model="llama3.1:8b",
    messages=[
        {"role": "user", "content": "Hello!"}
    ]
)

JavaScript

JavaScript
import OpenAI from 'openai';

const openai = new OpenAI({
  apiKey: 'YOUR_API_KEY',
  baseURL: 'https://cxmpute.cloud/api/v1',
  defaultHeaders: {
    'X-User-Id': 'YOUR_USER_ID'
  }
});

const completion = await openai.chat.completions.create({
  messages: [{ role: 'user', content: 'Hello!' }],
  model: 'llama3.1:8b',
});

Model Catalog

Explore our full model list at cxmpute.cloud/models.

Popular models include:

  • llama3.1:8b - Fast, capable general-purpose model
  • llama3.1:70b - Larger model for complex tasks
  • nomic-embed-text - High-quality text embeddings
  • codellama:13b - Specialized for code generation

Visit specific model pages in our catalog to see their request formats and capabilities.

Testnet & Rewards

🎉 During our testnet phase, all services are currently free! You also earn rewards based on usage and referrals.

Learn more about our rewards program →

Error Handling

HTTP Status Codes

  • 200 - Success
  • 400 - Bad Request (missing/invalid parameters)
  • 401 - Unauthorized (invalid API key)
  • 429 - Rate Limited
  • 503 - Service Unavailable (no healthy providers)
  • 500 - Internal Server Error

Error Response Format

JSON
{
  "error": "Error description"
}

Common Errors

Invalid API Key:

JSON
{
  "error": "Invalid API key"
}

Missing Model:

JSON
{
  "error": "Missing required parameter: model or messages"
}

No Providers Available:

JSON
{
  "error": "No provisions available for the requested model"
}

Rate Limits

During testnet, there are no strict rate limits. However, fair usage policies apply to ensure service availability for all users.

Support

Need help? We're here for you:

Next Steps