# AI Completion Source: https://docs.orgo.ai/api-reference/ai/completion POST /ai Access 400+ AI models through OpenRouter integration. Requires OpenRouter to be connected in account settings. # List Available Models Source: https://docs.orgo.ai/api-reference/ai/list-models GET /ai Get list of all available AI models from OpenRouter # Authentication Source: https://docs.orgo.ai/api-reference/authentication API key setup ## Overview All API requests require a Bearer token in the `Authorization` header. ## Get Your API Key 1. Go to [orgo.ai/projects](https://www.orgo.ai/projects) 2. Click "Generate API Key" 3. Copy your key (format: `sk_live_...`) **Important**: Store your API key securely. Don't commit it to version control. ## Usage Include the header in every request: ```bash theme={null} Authorization: Bearer sk_live_your_api_key_here ``` ## Examples ### cURL ```bash theme={null} curl https://www.orgo.ai/api/projects \ -H "Authorization: Bearer sk_live_abc123..." ``` ### Python ```python theme={null} import requests headers = { "Authorization": "Bearer sk_live_abc123...", "Content-Type": "application/json" } response = requests.get( "https://www.orgo.ai/api/projects", headers=headers ) ``` ### JavaScript ```javascript theme={null} fetch('https://www.orgo.ai/api/projects', { headers: { 'Authorization': 'Bearer sk_live_abc123...', 'Content-Type': 'application/json' } }) ``` ## Environment Variables Store your key as an environment variable: ```bash theme={null} export ORGO_API_KEY=sk_live_abc123... ``` Then reference it in your code: ```python theme={null} import os api_key = os.environ.get("ORGO_API_KEY") ``` ## Error Responses **Invalid key:** ```json theme={null} { "error": "Invalid API key" } ``` **Missing key:** ```json theme={null} { "error": "Authentication failed" } ``` Both return `401 Unauthorized`. ## Security * Keep your API key private * Rotate keys if compromised * Use environment variables, not hardcoded values * Don't share keys in public repositories ## Need Help? Contact [support](mailto:spencer@orgo.ai) if you lose access to your API key. # Execute Bash Command Source: https://docs.orgo.ai/api-reference/computers/bash POST /computers/{id}/bash # Click Mouse Source: https://docs.orgo.ai/api-reference/computers/click POST /computers/{id}/click # Create Computer Source: https://docs.orgo.ai/api-reference/computers/create POST /projects/{project_name}/computers Create a new computer within a project. The computer name must be unique within the project. ## Example ```json theme={null} { "name": "dev-machine", "os": "linux", "ram": 4, "cpu": 2 } ``` # Delete Computer Source: https://docs.orgo.ai/api-reference/computers/delete DELETE /computers/{id} Permanently delete a computer. This action cannot be undone. ## Behavior * Computer will be stopped if currently running * All data on the computer will be lost * Returns 200 status code on successful deletion ## Example ```bash theme={null} curl -X DELETE https://www.orgo.ai/api/computers/550e8400-e29b-41d4-a716-446655440000 \ -H "Authorization: Bearer sk_live_..." ``` # Mouse Drag Source: https://docs.orgo.ai/api-reference/computers/drag POST /computers/{id}/drag # Execute Python Code Source: https://docs.orgo.ai/api-reference/computers/exec POST /computers/{id}/exec # Get Computer Source: https://docs.orgo.ai/api-reference/computers/get GET /computers/{id} Retrieve details about a specific computer by its ID. ## Example Response ```json theme={null} { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "dev-machine", "project_name": "my-project", "os": "linux", "ram": 4, "cpu": 2, "status": "running", "url": "https://dev-machine.example.com", "created_at": "2024-01-15T10:30:00Z" } ``` # Press Key Source: https://docs.orgo.ai/api-reference/computers/key POST /computers/{id}/key # List Computers Source: https://docs.orgo.ai/api-reference/computers/list GET /projects/{project_name}/computers Get all computers within a project. ## Example Response ```json theme={null} { "computers": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "dev-machine", "project_name": "my-project", "os": "linux", "ram": 4, "cpu": 2, "status": "running", "url": "https://dev-machine.example.com", "created_at": "2024-01-15T10:30:00Z" } ] } ``` # Restart Computer Source: https://docs.orgo.ai/api-reference/computers/restart POST /computers/{id}/restart Restart a computer. Performs a graceful shutdown followed by a fresh start. ## Use Cases * Recovering from a hung or unresponsive state * Applying system updates that require a reboot * Resetting the environment to a clean state ## Example ```bash theme={null} curl -X POST https://www.orgo.ai/api/computers/550e8400-e29b-41d4-a716-446655440000/restart \ -H "Authorization: Bearer sk_live_..." ``` # Take Screenshot Source: https://docs.orgo.ai/api-reference/computers/screenshot GET /computers/{id}/screenshot # Scroll Page Source: https://docs.orgo.ai/api-reference/computers/scroll POST /computers/{id}/scroll # Start Computer Source: https://docs.orgo.ai/api-reference/computers/start POST /computers/{id}/start Start a stopped computer. ## Behavior * Idempotent operation - succeeds if computer is already running * Computer becomes accessible within moments ## Example ```bash theme={null} curl -X POST https://www.orgo.ai/api/computers/550e8400-e29b-41d4-a716-446655440000/start \ -H "Authorization: Bearer sk_live_..." ``` # Stop Computer Source: https://docs.orgo.ai/api-reference/computers/stop POST /computers/{id}/stop Stop a running computer to save costs when not in use. ## Behavior * Computer is gracefully shut down * Idempotent operation - succeeds if already stopped * Stopped computers do not incur compute charges ## Example ```bash theme={null} curl -X POST https://www.orgo.ai/api/computers/550e8400-e29b-41d4-a716-446655440000/stop \ -H "Authorization: Bearer sk_live_..." ``` # Start Stream Source: https://docs.orgo.ai/api-reference/computers/stream-start POST /computers/{id}/stream/start ## Description Start streaming the computer's display to an RTMP server. This allows you to spectate your agent's computer in real-time through platforms like Twitch, YouTube Live, or custom RTMP servers. ## Prerequisites Before using this endpoint, you must: 1. Configure an RTMP connection in your [account settings](https://www.orgo.ai/settings) 2. Provide the connection name when starting the stream ## Usage Example ```python theme={null} # Start streaming to a configured connection result = computer.start_stream("my-twitch-1") # The computer's display is now being streamed # Do your automation/demo computer.type("Hello viewers!") computer.bash("ls -la") # Stop streaming when done computer.stop_stream() ``` ## Connection Configuration RTMP connections are configured in your account settings with: * A unique name (used in this API call) * RTMP server URL * Stream key (encrypted and stored securely) * Optional settings (bitrate, resolution, etc.) ## Response The response includes information about the streaming process: ```json theme={null} { "success": true, "status": "streaming", "pid": 12345, "start_time": "2024-01-20T10:30:00Z" } ``` ## Common Use Cases * Live demonstrations of AI agents * Recording automation workflows * Debugging and monitoring agent behavior * Creating content for tutorials or showcases # Get Stream Status Source: https://docs.orgo.ai/api-reference/computers/stream-status GET /computers/{id}/stream/status ## Description Check the current streaming status of a computer. This endpoint allows you to verify if a stream is active, when it started, and get the process information. ## Usage Example ```python theme={null} # Check if streaming is active status = computer.stream_status() if status['status'] == 'streaming': print(f"Stream active since: {status['start_time']}") print(f"Process ID: {status['pid']}") elif status['status'] == 'idle': print("No active stream") ``` ## Response Format ### When Streaming ```json theme={null} { "status": "streaming", "start_time": "2024-01-20T10:30:00Z", "pid": 12345 } ``` ### When Idle ```json theme={null} { "status": "idle" } ``` ### When Terminated ```json theme={null} { "status": "terminated", "message": "Stream process was terminated unexpectedly" } ``` ## Status Values * `idle` - No active stream * `streaming` - Stream is currently active * `terminated` - Stream process ended unexpectedly ## Common Use Cases * Monitoring stream health * Verifying stream started successfully * Detecting unexpected stream termination * Building stream status dashboards # Stop Stream Source: https://docs.orgo.ai/api-reference/computers/stream-stop POST /computers/{id}/stream/stop ## Description Stop an active stream on the computer. This gracefully terminates the streaming process and releases resources. ## Usage Example ```python theme={null} # Stop the active stream result = computer.stop_stream() if result['success']: print("Stream stopped successfully") ``` ## Response Format ```json theme={null} { "success": true, "message": "Stream stopped successfully" } ``` ## Error Handling If no stream is active, the endpoint will return an appropriate message: ```json theme={null} { "success": false, "error": "No active stream to stop" } ``` ## Best Practices 1. Always stop streams when done to free resources 2. Check stream status before stopping if unsure 3. Handle cases where stream might have already terminated ## Example Workflow ```python theme={null} # Complete streaming workflow try: # Start streaming computer.start_stream("my-connection") # Perform your automation computer.type("Running automated demo...") computer.bash("python my_script.py") # Always stop the stream computer.stop_stream() except Exception as e: # Ensure stream is stopped even on error computer.stop_stream() raise e ``` # Type Text Source: https://docs.orgo.ai/api-reference/computers/type POST /computers/{id}/type # Wait Duration Source: https://docs.orgo.ai/api-reference/computers/wait POST /computers/{id}/wait # Delete File Source: https://docs.orgo.ai/api-reference/files/delete DELETE /files/{id} Delete a file from storage Delete a file from storage. This removes the file from cloud storage and the database. # Download File Source: https://docs.orgo.ai/api-reference/files/download GET /files/{id}/download Get a signed download URL for a file Get a signed download URL for a file. The URL expires after 1 hour. ## Example ```bash theme={null} curl https://www.orgo.ai/api/files/{id}/download \ -H "Authorization: Bearer sk_live_..." ``` ### Response ```json theme={null} { "url": "https://signed-url-here..." } ``` Then open the URL in a browser or use it to download the file. # Export File Source: https://docs.orgo.ai/api-reference/files/export POST /files/export Export a file from a computer's filesystem. Returns a download URL for the file. Export a file from a computer's filesystem. This allows you to pull files created inside the VM (like results, screenshots, or generated content) and get a download URL. The computer must be in a running state to export files. ## Path Formats The path parameter accepts several formats: | Format | Example | | ---------------- | -------------------------------- | | Relative to home | `Desktop/results.txt` | | Absolute path | `/home/user/Desktop/results.txt` | | With tilde | `~/Desktop/results.txt` | ## Security Files can only be exported from within `/home/user`. Attempting to access paths outside this directory will return a 403 error. ## Example ```bash theme={null} curl -X POST https://www.orgo.ai/api/files/export \ -H "Authorization: Bearer sk_live_..." \ -H "Content-Type: application/json" \ -d '{"desktopId": "8823f0ff-f4bc-4ab2-833e-40d82c10b505", "path": "Desktop/results.txt"}' ``` ### Response ```json theme={null} { "success": true, "file": { "id": "550e8400-e29b-41d4-a716-446655440000", "filename": "results.txt", "size_bytes": 1024, "content_type": "text/plain", "created_at": "2024-01-15T10:30:00Z", "desktop_id": "8823f0ff-f4bc-4ab2-833e-40d82c10b505", "project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }, "url": "https://fly.storage.tigris.dev/bucket/..." } ``` # List Files Source: https://docs.orgo.ai/api-reference/files/list GET /computers/{id}/files List all files associated with a computer List all files associated with a computer, including both uploaded files and exported files. # Upload File Source: https://docs.orgo.ai/api-reference/files/upload POST /computers/{id}/files/upload Upload a file to a computer's Desktop folder. The file will be synced to all running computers in the project. Upload a file to a computer's Desktop folder. The file will automatically sync to all running computers in the project. ## Supported Files * Maximum file size: 10MB * All file types supported ## Example ```bash theme={null} curl -X POST https://www.orgo.ai/api/computers/{id}/files/upload \ -H "Authorization: Bearer sk_live_..." \ -F "file=@./document.pdf" ``` # Introduction Source: https://docs.orgo.ai/api-reference/introduction Build with virtual computers programmatically ## Overview The Orgo API lets you create projects, provision virtual computers, and control them programmatically. Build AI agent fleets, automation workflows, or browser testing at scale. ## Authentication All requests require a Bearer token: ```bash theme={null} Authorization: Bearer your_api_key ``` Get your API key at [orgo.ai/projects](https://www.orgo.ai/projects). ## Base URL ``` https://www.orgo.ai/api ``` ## Quick Start ### 1. Create a Project Projects are containers for computers. ```bash theme={null} curl -X POST https://www.orgo.ai/api/projects \ -H "Authorization: Bearer your_api_key" \ -H "Content-Type: application/json" \ -d '{"name": "manus"}' ``` ### 2. Create a Computer Add a computer to your project: ```bash theme={null} curl -X POST https://www.orgo.ai/api/projects/manus/computers \ -H "Authorization: Bearer your_api_key" \ -H "Content-Type: application/json" \ -d '{ "name": "agent-1", "os": "linux", "ram": 2, "cpu": 2 }' ``` ### 3. Control the Computer ```bash theme={null} # Screenshot curl https://www.orgo.ai/api/projects/manus/computers/agent-1/screenshot \ -H "Authorization: Bearer your_api_key" # Click curl -X POST https://www.orgo.ai/api/projects/manus/computers/agent-1/click \ -H "Authorization: Bearer your_api_key" \ -H "Content-Type: application/json" \ -d '{"x": 100, "y": 200}' # Type curl -X POST https://www.orgo.ai/api/projects/manus/computers/agent-1/type \ -H "Authorization: Bearer your_api_key" \ -H "Content-Type: application/json" \ -d '{"text": "Hello world"}' ``` ## Resource Hierarchy ``` User └── Projects (e.g., "manus") └── Computers (e.g., "agent-1", "agent-2") ``` Projects organize your computers. Free tier: 2 concurrent computers. ## Computer Specs * **OS**: Linux or Windows * **RAM**: 2GB, 4GB, or 8GB * **CPU**: 2, 4, or 8 cores * **GPU**: None, T4, or A10 (coming soon) ## Control Operations ### Mouse * Click (left, right, double) * Drag * Scroll ### Keyboard * Type text * Press keys (Enter, Tab, ctrl+c, etc.) ### Execution * Bash commands * Python code ### Other * Screenshots * Wait/delays * Streaming (RTMP) ## Error Responses ```json theme={null} { "error": "Error message" } ``` **Status codes:** * `200` - Success * `400` - Invalid request * `401` - Invalid API key * `404` - Resource not found * `500` - Server error ## Next Steps All endpoints Get started fast AI agent guide Setup # Create Project Source: https://docs.orgo.ai/api-reference/projects/create POST /projects Create a new named project # Delete Project Source: https://docs.orgo.ai/api-reference/projects/delete POST /projects/{id}/delete Delete project and all its computers # Get Project by Project ID Source: https://docs.orgo.ai/api-reference/projects/get-by-name GET /projects/by-name/{name} # List Projects Source: https://docs.orgo.ai/api-reference/projects/list GET /projects List all projects for authenticated user # Restart Project Source: https://docs.orgo.ai/api-reference/projects/restart POST /projects/{id}/restart # Start Project Source: https://docs.orgo.ai/api-reference/projects/start POST /projects/{id}/start # Stop Project Source: https://docs.orgo.ai/api-reference/projects/stop POST /projects/{id}/stop # Agent S2 Source: https://docs.orgo.ai/guides/agent-s2 Let Agent S2 control a virtual desktop ## Overview This guide walks through setting up Agent S2, the open-source SOTA computer use agent by Simular AI. These steps include trying it locally on your own computer or on a virtual desktop through Orgo. ## Setup Install the required packages: ```bash pip theme={null} pip install gui-agents pyautogui python-dotenv orgo ``` ```bash requirements.txt theme={null} gui-agents pyautogui python-dotenv orgo pillow ``` Set up your API keys: ```bash terminal icon="terminal" theme={null} # Export as environment variables export OPENAI_API_KEY=your_openai_api_key export ANTHROPIC_API_KEY=your_anthropic_api_key export ORGO_API_KEY=your_orgo_api_key # Optional for remote ``` ```python setup.py icon="python" theme={null} import os os.environ["OPENAI_API_KEY"] = "your_openai_api_key" os.environ["ANTHROPIC_API_KEY"] = "your_anthropic_api_key" os.environ["ORGO_API_KEY"] = "your_orgo_api_key" # Optional ``` ```bash .env icon="file" theme={null} OPENAI_API_KEY=your_openai_api_key ANTHROPIC_API_KEY=your_anthropic_api_key # Optional for remote execution ORGO_API_KEY=your_orgo_api_key USE_CLOUD_ENVIRONMENT=false ``` ## Simple Usage Run Agent S2 with natural language commands: ```bash local icon="terminal" theme={null} # Local mode - controls your computer python agent_s2.py "Open Chrome and search for weather" ``` ```bash remote icon="terminal" theme={null} # Remote mode - controls cloud desktop via Orgo USE_CLOUD_ENVIRONMENT=true python agent_s2.py "Open Chrome" ``` ```bash interactive icon="terminal" theme={null} # Interactive mode python agent_s2.py ``` This approach uses Agent S2's compositional framework to execute complex computer use tasks. ## Complete Example ```python agent_s2.py expandable icon="python" theme={null} #!/usr/bin/env python3 import os import io import sys import time from dotenv import load_dotenv from gui_agents.s2.agents.agent_s import AgentS2 from gui_agents.s2.agents.grounding import OSWorldACI from orgo import Computer import pyautogui load_dotenv() CONFIG = { "model": os.getenv("AGENT_MODEL", "gpt-4o"), "model_type": os.getenv("AGENT_MODEL_TYPE", "openai"), "grounding_model": os.getenv("GROUNDING_MODEL", "claude-3-7-sonnet-20250219"), "grounding_type": os.getenv("GROUNDING_MODEL_TYPE", "anthropic"), "max_steps": int(os.getenv("MAX_STEPS", "10")), "step_delay": float(os.getenv("STEP_DELAY", "0.5")), "remote": os.getenv("USE_CLOUD_ENVIRONMENT", "false").lower() == "true" } class LocalExecutor: def __init__(self): self.pyautogui = pyautogui if sys.platform == "win32": self.platform = "windows" elif sys.platform == "darwin": self.platform = "darwin" else: self.platform = "linux" def screenshot(self): img = self.pyautogui.screenshot() buffer = io.BytesIO() img.save(buffer, format="PNG") buffer.seek(0) return buffer.getvalue() def exec(self, code): exec(code, {"pyautogui": self.pyautogui, "time": time}) def destroy(self): # No cleanup needed for local executor pass class RemoteExecutor: def __init__(self): self.computer = Computer() self.platform = "linux" def screenshot(self): return self.computer.screenshot_base64() def exec(self, code): result = self.computer.exec(code) if not result['success']: raise Exception(result.get('error', 'Execution failed')) if result['output']: print(f"Output: {result['output']}") def destroy(self): self.computer.destroy() def create_agent(executor): engine_params = {"engine_type": CONFIG["model_type"], "model": CONFIG["model"]} grounding_params = {"engine_type": CONFIG["grounding_type"], "model": CONFIG["grounding_model"]} grounding_agent = OSWorldACI( platform=executor.platform, engine_params_for_generation=engine_params, engine_params_for_grounding=grounding_params ) return AgentS2( engine_params=engine_params, grounding_agent=grounding_agent, platform=executor.platform, action_space="pyautogui", observation_type="screenshot" ) def run_task(agent, executor, instruction): print(f"\n🤖 Task: {instruction}") print(f"📍 Mode: {'Remote' if CONFIG['remote'] else 'Local'}\n") for step in range(CONFIG["max_steps"]): print(f"Step {step + 1}/{CONFIG['max_steps']}") obs = {"screenshot": executor.screenshot()} info, action = agent.predict(instruction=instruction, observation=obs) if info: print(f"💭 {info}") if not action or not action[0]: print("✅ Complete") return True try: print(f"🔧 {action[0]}") executor.exec(action[0]) except Exception as e: print(f"❌ Error: {e}") instruction = "The previous action failed. Try a different approach." time.sleep(CONFIG["step_delay"]) print("⏱️ Max steps reached") return False def main(): executor = RemoteExecutor() if CONFIG["remote"] else LocalExecutor() try: agent = create_agent(executor) if len(sys.argv) > 1: run_task(agent, executor, " ".join(sys.argv[1:])) else: print("🎮 Interactive Mode (type 'exit' to quit)\n") while True: task = input("Task: ").strip() if task == "exit": break elif task: run_task(agent, executor, task) finally: # Clean up executor.destroy() if __name__ == "__main__": main() ``` ## Platform Requirements ### macOS Grant Terminal access: System Settings → Privacy & Security → Accessibility ### Windows May require running Terminal as Administrator ### Linux Install dependencies: ```bash icon="terminal" theme={null} sudo apt-get install python3-tk python3-dev ``` ## Environment Variables | Variable | Default | Description | | ----------------------- | ---------------------------- | ---------------------------------- | | `OPENAI_API_KEY` | - | OpenAI API key | | `ANTHROPIC_API_KEY` | - | Anthropic API key | | `ORGO_API_KEY` | - | Orgo API key (remote mode) | | `USE_CLOUD_ENVIRONMENT` | `false` | Set to `true` for remote execution | | `AGENT_MODEL` | `gpt-4o` | Main reasoning model | | `GROUNDING_MODEL` | `claude-3-7-sonnet-20250219` | Visual grounding model | | `MAX_STEPS` | `10` | Maximum steps per task | | `STEP_DELAY` | `0.5` | Seconds between actions | ## Architecture Agent S2 uses a compositional framework with specialized modules: **Mixture of Grounding** - Routes actions to specialized visual grounding models for precise UI localization **Proactive Hierarchical Planning** - Dynamically refines plans based on evolving observations **Cross-platform Support** - Works on macOS, Windows, and Linux ## Performance Agent S2 achieves state-of-the-art results on computer use benchmarks: | Benchmark | Success Rate | Rank | | ----------------- | ------------ | ---- | | OSWorld | 27.0% | #3 | | WindowsAgentArena | 29.8% | #1 | | AndroidWorld | 54.3% | #1 | ## Resources * [GitHub Repository](https://github.com/simular-ai/Agent-S) * [Agent S2 Whitepaper](https://arxiv.org/abs/2504.00906) * [OSWorld Benchmark](https://os-world.github.io/) Agent S2 is currently ranked #3 on the OSWorld benchmark, demonstrating leading performance on complex computer use tasks. ## Video Tutorial Here is a video version of this guide: