Cloud Api banner
nearai nearai

Cloud Api

AI community

Description

OpenAI-compatible API for private, TEE-verifiable AI inference, powering cloud.near.ai

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

NEAR AI Cloud API

A Rust-based cloud API for AI model inference, conversation management, and organization administration. Part of the NEAR AI platform alongside the Chat API.

Quick Start

Prerequisites

  • Rust (latest stable version)
  • Docker & Docker Compose (for local development)
  • PostgreSQL (for production or local testing without Docker)

Development Setup

  1. **Clone the repository**:

    git clone 
    cd cloud-api
  2. **Start services with Docker Compose**:

    docker-compose up -d

    This starts:

    • PostgreSQL database on port 5432
    • NEAR AI Cloud API on port 3000
  3. **Run without Docker**:

    make dev

    This automatically:

    • Runs all database migrations
    • Seeds the database with development data
    • Starts the API server on http://localhost:3000

For an end-to-end walkthrough — mock auth, creating an org/workspace/API key, and exercising chat completions with `curl` — see [`docs/local-development.md`](docs/local-development.md).

Testing

Prerequisites for Testing

  • PostgreSQL database running
  • Database must be accessible with the credentials specified in test configuration

Run Tests

# Run unit tests only
make test-unit

# Run integration/e2e tests only (requires database)
make test-integration

# Run both unit and integration tests
make test

Test Database Setup

Tests use the same environment variables as the main application (from `env.example`). If environment variables are not set, tests use sensible defaults for local testing.

Option 1: Using Docker (Recommended)

# Start test database
docker run --name test-postgres \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=platform_api \
  -p 5432:5432 \
  -d postgres:latest

# Run tests with default values (or override with env vars)
make test-integration

# Or with custom database settings
DATABASE_HOST=localhost \
DATABASE_PORT=5432 \
DATABASE_NAME