Cortensor
  • Home
  • Abstract
    • Value Proposition
    • Whitepaper
      • Page 1: Introduction and Vision
      • Page 2: Architecture and Technical Overview
      • Page 3: Incentive Structure and Tokenomics
      • Page4: Development Roadmap and Phases
      • Page5: Summary
  • Introduction
    • What is Cortensor?
    • Key Features & Benefits
    • Vision & Mission
    • Team
  • Getting Started
    • Quick Start Guide
    • System Requirements
    • Installation & Setup
      • Getting Test ETH
      • Setup Own RPC Endpoint
      • Router Node Setup
        • Router API Reference
        • Dedicated Ephemeral Node Setup
        • Reverse Proxy Setup
  • Core Concepts
    • Decentralized AI Inference
      • Community-Powered Network
      • Gamification and Quality Control
      • Incentive Structure
    • Universal AI Accessibility
    • Multi-layer Blockchain Architecture
  • Technical Architecture
    • Design Principles
    • Node Roles
    • Node Lifecycle
      • Ephemeral Node State
    • Node Reputation
    • Network & Flow
    • Type of Services
    • Coordination & Orchestration
      • Multi-Oracle Node Reliability & Leadership Rotation
    • AI Inference
      • Open Source Models
        • Centralized vs Decentralized Models
      • Quantization
      • Performance and Scalability
    • Consensus & Validation
      • Proof of Inference (PoI) & Proof of Useful Work (PoUW
      • aka Mining
      • Proof of Useful Work (PoUW)
      • Proof of Useful Work (PoUW) State Machine
        • Miner & Oracle Nodes in PoUW State Machine
      • Sampling in Large Distributed Systems
      • Parallel Processing
      • Embedding Vector Distance
    • Multi-Layered Blockchain Architecture
    • Modular Architecture and Smart Contract Interactions
      • Session Queue
      • Node Pool
      • Session Payment
    • Mining Overview
    • User Interaction & Node Communication
      • Session, Session Queue, Router, and Miner in Cortensor
    • Data Management
      • IPFS Integration
    • Security & Privacy
    • Dashboard
    • Development Previews
      • Multiple Miners Collaboration with Oracle Node
      • Web3 SDK Client & Session/Session Queue Interaction
    • Technical Threads
      • AI Agents and Cortensor's Decentralized AI Inference
    • Infographic Archive
  • Community & Ecosystem
    • Tokenomics
      • Network Incentive Allocation
      • Token Allocations & Safe Wallet Management
    • Developer Ecosystem
    • Staking Pool Overview
    • Contributing to Cortensor
    • Incentives & Reward System
    • Governance & Compliance
    • Safety Measures and Restricted Addresses
    • Buyback Program
    • Liquidity Additions
    • Partnerships
      • Partnership Offering for Demand-Side Partnerships
    • Community Testing
      • Closed Alpha Testing Phase #1
        • Closed Alpha Testing Phase #1 Contest: Closing & Winners Announcement
      • Closed Alpha Testing Phase #2
      • Closed Alpha Testing Phase #3
      • Closed Alpha Testing Phase #4
      • Discord Roles & Mainnet Privileges
      • DevNet Mapping
      • DevNet Modules & Parameters
    • Jobs
      • Technical Writer
      • Communication & Social Media Manager
      • Web3 Frontend Developer
      • Distributed Systems Engineer
  • Integration Guide
    • Web2
      • REST API
      • WebSocket
      • Client SDK
    • Web3
      • Web3 SDK
  • Use Cases
  • Roadmap
    • Technical Roadmap: Launch to Next 365 Days Breakdown
    • Long-term Vision: Beyond Inference
  • Glossary
  • Legal
    • Terms of Use
    • Privacy Policy
    • Disclaimer
    • Agreement for Sale of Tokens
Powered by GitBook
On this page
  • WIP - THIS IS EARLY DRAFT
  • Authentication
  • Endpoints
  • Notes
  1. Getting Started
  2. Installation & Setup
  3. Router Node Setup

Router API Reference

WIP - THIS IS EARLY DRAFT

This document outlines the available RESTful API endpoints provided by a Cortensor Router Node. These endpoints enable interaction with sessions, tasks, and miners, making it easier to integrate AI inference functionality with traditional Web2 applications.


Authentication

All endpoints require API key authentication using a Bearer token in the Authorization header.

Header Format:

Authorization: Bearer <api_key>

Default Dev Token: default-dev-token


Endpoints

GET /api/v1/info

Returns basic router node metadata.

Example:

curl -X GET http://<router_host>:5010/api/v1/info \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <api_key>"

GET /api/v1/status

Returns current router node status and health.

Example:

curl -X GET http://<router_host>:5010/api/v1/status \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <api_key>"

GET /api/v1/miners

Lists all connected miners.

Example:

curl -X GET http://<router_host>:5010/api/v1/miners \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <api_key>"

GET /api/v1/sessions

Lists all currently active sessions.

Example:

curl -X GET http://<router_host>:5010/api/v1/sessions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <api_key>"

GET /api/v1/sessions/{sessionId}

Retrieves details about a specific session.

Path Parameter:

  • sessionId: Numeric ID of the session

Example:

curl -X GET http://<router_host>:5010/api/v1/sessions/0 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <api_key>"

GET /api/v1/tasks/{sessionId}/{taskId}

Returns details of a specific task within a session.

Path Parameters:

  • sessionId: Numeric ID of the session

  • taskId: Numeric ID of the task

Example:

curl -X GET http://<router_host>:5010/api/v1/tasks/0/0 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <api_key>"

GET /api/v1/tasks/{sessionId}

Lists all tasks submitted under a specific session.

Path Parameter:

  • sessionId: Numeric ID of the session

Example:

curl -X GET http://<router_host>:5010/api/v1/tasks/0 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <api_key>"

POST /api/v1/completions/{sessionId}

Submits a prompt for AI inference using a specified session ID in the URL.

Path Parameter:

  • sessionId: Numeric ID of the session

Request Body:

{
  "prompt": "Hello, how are you?",
  "stream": false,
  "timeout": 60
}

Example:

curl -X POST http://<router_host>:5010/api/v1/completions/0 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <api_key>" \
  -d '{"prompt": "Hello, how are you?", "stream": false, "timeout": 60}'

POST /api/v1/completions

Submits a prompt with the session ID in the JSON payload instead of the URL.

Request Body:

{
  "session_id": 0,
  "prompt": "Hello, how are you?",
  "stream": false,
  "timeout": 60
}

Example:

curl -X POST http://<router_host>:5010/api/v1/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <api_key>" \
  -d '{"session_id": 0, "prompt": "Hello, how are you?", "stream": false, "timeout": 60}'

Notes

  • The stream field enables real-time token-level streaming of AI completions.

  • All endpoints are compatible with OpenAI-style interfaces, making integration intuitive for developers.

  • Use this API to serve private inference traffic through your self-hosted Router Node

PreviousRouter Node SetupNextDedicated Ephemeral Node Setup

Last updated 21 days ago