Skip to content

Code Server

Universal API provides a cloud-based VS Code environment (powered by code-server) that runs on a dedicated EC2 instance. Your Knowledge files are automatically mounted, giving you a full development environment with direct access to your data.

Requirements

  • Active subscription (Starter or Professional plan)
  • Code Server is not available on the Free tier

Features

  • 🖥️ Full VS Code — Complete VS Code experience in your browser at code.universalapi.co
  • 📁 Knowledge Files Mounted — Your Knowledge storage is automatically mounted via S3 Mountpoint at ~/knowledge/
  • 🔒 Secure Access — Traffic is routed through CloudFront with per-user isolation — no password needed
  • ⏱️ Auto-Stop — Instances automatically stop after 1 hour of inactivity to save costs
  • 💰 Pay-per-Use — Billed at 2–10 credits per minute depending on instance size
  • 🛠️ Setup Script — Save and run a bash setup script to configure your instance (git clone, install deps, etc.)
  • 🔑 Credential Injection — Your API Keys (GitHub PAT, AWS keys) are automatically injected as environment variables
  • 📊 Billing Visibility — Credit charges appear in your Request Logs every 5 minutes so you can monitor spend

Instance Types

Choose your instance size when launching. You can change sizes by terminating and re-launching.

Instance TypevCPUsRAMCredits/MinBest For
t3.small (default)22 GB2Light editing, small installs
t3.medium24 GB3Development, SAM CLI, builds
t3.large28 GB5Docker, large builds
t3.xlarge416 GB10ML, heavy workloads

All instances include:

  • Amazon Linux 2023 OS
  • 8 GB root volume (ephemeral — deleted on terminate)
  • 2 GB swap space to prevent OOM lockups during heavy operations
  • S3 Mountpoint for Knowledge files (persistent, scoped to your user prefix)
  • 1 instance per user limit

How It Works

1. Launch

From the Code Server page in the sidebar, select your instance type and click Launch Code Server. This creates a new EC2 instance with code-server pre-installed and your Knowledge files mounted.

Launch takes approximately 3–5 minutes while the instance boots and configures.

2. Connect

Once the instance is running, click Open Code Server to open VS Code in a new browser tab at code.universalapi.co. You'll be taken directly into VS Code — no password required.

3. Work

Your Knowledge files are available at ~/knowledge/ in the VS Code file explorer. Any files you create or modify there are persisted to your Knowledge storage in S3.

4. Auto-Stop

If no active connections are detected for 1 hour, the instance automatically stops. This prevents runaway costs.

5. Restart

When you need your environment again, go back to the Code Server page and click Start. Starting a stopped instance is faster than launching a new one (~30 seconds). The "Last Started" timestamp updates each time you start.

Lifecycle

Launch → Running → (idle 1hr) → Stopped → Start → Running → ...

                            Terminate (manual)
  • Running — Instance is active, code-server accessible, billing active
  • Stopped — Instance is stopped, no billing, Knowledge files preserved in S3
  • Terminated — Instance destroyed, no billing, Knowledge files still preserved in S3

TIP

Your Knowledge files are stored in S3, not on the instance's local disk. Terminating an instance does not delete your files.

Billing

Credits are deducted every 5 minutes while your instance is running. The rate depends on your instance type:

StateCost
Running (t3.small)2 credits/minute
Running (t3.medium)3 credits/minute
Running (t3.large)5 credits/minute
Running (t3.xlarge)10 credits/minute
StoppedFree
TerminatedFree

Monitoring Your Spend

Every 5 minutes, a billing log entry is written to your Request Logs showing:

  • Credits charged for the billing period
  • Minutes billed and rate
  • Remaining credit balance

You can also see Code Server management operations (launch, start, stop) in your logs.

WARNING

If your credit balance reaches zero while an instance is running, the instance will be automatically stopped. You'll see an auto-stop entry in your Request Logs.

Minimum Credits

You need at least 10 minutes' worth of credits to launch or start an instance. For example, a t3.medium requires at least 30 credits (10 min × 3 credits/min).

Setup Script

You can write a bash setup script that configures your instance — clone repos, install dependencies, set up git credentials, etc. The script is saved to your account and can be re-run anytime.

Credential Injection

Your credentials from the API Keys page are automatically injected as environment variables when the setup script runs:

VariableSource
$GITHUB_PATGitHub Personal Access Token from your API Keys
$AWS_ACCESS_KEY_IDAWS Access Key from your API Keys
$AWS_SECRET_ACCESS_KEYAWS Secret Key from your API Keys
$AWS_REGIONAWS Region (defaults to us-east-1)
$USER_ALIASYour Universal API username
$USER_EMAILYour alias-based email (alias@universalapi.co)

TIP

Add your GitHub PAT and AWS keys on the API Keys page before running your setup script. The Code Server page shows which credentials are available.

Example Setup Script

bash
#!/bin/bash

# Configure git with your credentials
git config --global user.name "$USER_ALIAS"
git config --global user.email "$USER_EMAIL"
git config --global credential.helper store
echo "https://$GITHUB_PAT@github.com" > ~/.git-credentials

# Clone your project
cd /home/ec2-user
git clone https://github.com/your-org/your-repo.git

# Install dependencies
cd your-repo
npm install

# Configure AWS CLI (for SAM, CDK, etc.)
aws configure set aws_access_key_id "$AWS_ACCESS_KEY_ID"
aws configure set aws_secret_access_key "$AWS_SECRET_ACCESS_KEY"
aws configure set region "$AWS_REGION"

How to Use

  1. Go to the Code Server page in the sidebar
  2. Scroll down to the Setup Script card (visible when you have an active instance)
  3. Write your bash script in the editor (up to 8,000 characters)
  4. Click Save Script to persist it to your account
  5. Click Run Setup to execute it on your running instance

The script runs as root on the EC2 instance via SSM. Status is shown as a chip: ✅ Completed, ⏳ Running, or ❌ Failed (with error output).

Pre-installed Tools

All instances come with these tools pre-installed for Task Board integration:

  • Claude Code CLI — AI coding assistant
  • Cline CLI 2.7.0 — AI coding agent
  • tmux — Terminal multiplexer for parallel tasks
  • jq — JSON processor
  • git — Version control
  • Node.js 22 (via nvm)

Security

  • Each instance runs in an isolated VPC with security groups that only allow traffic from CloudFront
  • Your Knowledge mount is scoped to your user prefix — you cannot access other users' files
  • Access is controlled by CloudFront + Lambda@Edge — each user is routed only to their own instance
  • All traffic is encrypted via HTTPS through CloudFront

API Reference

See the Code Server API Reference for programmatic control of your instances.

Universal API - The agentic entry point to the universe of APIs