### Install Dependencies and Start Dev Server Source: https://github.com/nanogpt-community/nanocode/blob/dev/CONTRIBUTING.md Install project dependencies and start the development server from the repository root. Requires Bun 1.3+. ```bash bun install bun dev ``` -------------------------------- ### Install Mintlify CLI and Start Dev Server Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/docs/quickstart.mdx Install the Mintlify CLI globally and then run the development server in your docs directory. Changes are reflected live. ```bash npm i -g mint mint dev ``` -------------------------------- ### Install Dependencies and Start Development Server Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/desktop/README.md Installs project dependencies and then starts the Tauri development server for the desktop app. Ensure you are in the repo root. ```bash bun install bun run --cwd packages/desktop tauri dev ``` -------------------------------- ### Start SolidStart Development Server Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/console/app/README.md After installing dependencies, run `npm run dev` to start the development server. Use the `-- --open` flag to automatically open the application in your browser. ```bash npm run dev # or start the server and open the app in a new browser tab npm run dev -- --open ``` -------------------------------- ### Install NanoCode CLI Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/github.mdx Run this command in a GitHub repository to start the NanoCode installation process, which includes setting up the GitHub app and workflow. ```bash nanocode github install ``` -------------------------------- ### Start OpenCode Web Backend and Attach TUI Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/cli.mdx This example demonstrates starting the OpenCode backend server for web/mobile access on a specific port and hostname, and then attaching the TUI to this running backend from another terminal. ```bash # Start the backend server for web/mobile access opencode web --port 4096 --hostname 0.0.0.0 # In another terminal, attach the TUI to the running backend opencode attach http://10.20.30.40:4096 ``` -------------------------------- ### Card Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/docs/ai-tools/cursor.mdx Shows how to use Card components for highlighting specific information or links. Ideal for getting started guides or feature summaries. ```jsx Complete walkthrough from installation to your first API call in under 10 minutes. ``` -------------------------------- ### Install nanogpt-client via npm Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Install the nanogpt-client package using npm. ```bash npm install nanogpt-client ``` -------------------------------- ### Install nanocode SDK Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/sdk.mdx Install the nanocode SDK using npm. This is the first step to using the SDK in your project. ```bash npm install @nanogpt/sdk ``` -------------------------------- ### Setup Virtual Framebuffer for Headless Linux Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/troubleshooting.mdx In headless Linux environments, use `xvfb` to simulate a display for clipboard functionality. This command installs `xvfb` and sets up a virtual display. ```bash apt install -y xvfb # and run: Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & export DISPLAY=:99.0 ``` -------------------------------- ### Install NanoCode with Bun Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/index.mdx Install NanoCode globally using Bun. This is an alternative package manager installation method. ```bash bun install -g nanocode ``` -------------------------------- ### Start Web Server Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/web.mdx Run this command to start the local NanoCode web server. It automatically opens in your default browser. ```bash nanocode web ``` -------------------------------- ### Install NanoGPTJS Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Install the NanoGPTJS library using npm. ```bash npm install nanogptjs ``` -------------------------------- ### Start Headless Web Server Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/cli.mdx Starts a headless OpenCode server with a web interface. Set OPENCODE_SERVER_PASSWORD for basic auth. ```bash opencode web ``` -------------------------------- ### TUI Configuration Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/tui.mdx Example tui.json file demonstrating various customization options for the TUI, including theme, keybinds, and scrolling behavior. ```json { "$schema": "https://opencode.ai/tui.json", "theme": "opencode", "keybinds": { "leader": "ctrl+x" }, "scroll_speed": 3, "scroll_acceleration": { "enabled": true }, "diff_style": "auto" } ``` -------------------------------- ### TEE Verification Example (Python) Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Python script for TEE Attestation & Signature Verification. Requires installation of 'eth-account'. ```python #!/usr/bin/env python3 """ TEE Attestation & Signature Verification Example for NanoGPT. """ import requests import json import hashlib from cryptography import x509 from cryptography.hazmat.primitives import serialization from cryptography.hazmat.backends import default_backend import base64 try: from eth_account.messages import encode_defunct from eth_account.account import Account except ImportError: raise ImportError("Please install eth_account: pip install eth-account") import os from cryptography.x509.oid import ObjectIdentifier # if needed ``` -------------------------------- ### Install Dependencies Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/app/README.md Install project dependencies using npm, pnpm, or yarn. ```bash $ npm install # or pnpm install or yarn install ``` -------------------------------- ### Chat Example with NanoGPTJS Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Example of how to perform a chat completion using the NanoGPTJS library. ```javascript async function chatExample() { try { const response = await nanogpt.chat({ model: 'chatgpt-4o-latest', messages: [ { role: 'system', content: 'You are a helpful assistant.' }, { role: 'user', content: 'What is the capital of France?' } ] }); console.log(response); } catch (error) { console.error('Error:', error); } } chatExample(); ``` -------------------------------- ### Install Clipboard Utilities on Linux (Wayland) Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/troubleshooting.mdx For copy/paste functionality on Wayland systems, install `wl-clipboard` using apt. ```bash apt install -y wl-clipboard ``` -------------------------------- ### Install Clipboard Utilities on Linux (X11) Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/troubleshooting.mdx For copy/paste functionality on X11 systems, install `xclip` or `xsel` using apt. ```bash apt install -y xclip # or apt install -y xsel ``` -------------------------------- ### Start Headless OpenCode Server Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/cli.mdx Starts a headless OpenCode server for API access. This server can be attached to by other `opencode run` commands. ```bash opencode serve ``` -------------------------------- ### Install Opencode GitHub Action via CLI Source: https://github.com/nanogpt-community/nanocode/blob/dev/github/README.md Run this command in your GitHub repo's terminal to install the GitHub app, create the workflow, and set up secrets. ```bash opencode github install ``` -------------------------------- ### Install Mintlify CLI Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/docs/README.md Install the Mintlify CLI globally using npm. This tool is required for local development and previewing documentation changes. ```bash npm i -g mint ``` -------------------------------- ### Model Naming Convention Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/troubleshooting.mdx Models should be referenced using the format `/`. This example shows correct formatting for different providers. ```bash openai/gpt-4.1 openrouter/google/gemini-2.5-flash nanocode/kimi-k2 ``` -------------------------------- ### Example AGENTS.md Content Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/rules.mdx This markdown file provides an example of custom instructions for a monorepo project, including project structure, code standards, and conventions. ```markdown # SST v3 Monorepo Project This is an SST v3 monorepo with TypeScript. The project uses bun workspaces for package management. ## Project Structure - `packages/` - Contains all workspace packages (functions, core, web, etc.) - `infra/` - Infrastructure definitions split by service (storage.ts, api.ts, web.ts) - `sst.config.ts` - Main SST configuration with dynamic imports ## Code Standards - Use TypeScript with strict mode enabled - Shared code goes in `packages/core/` with proper exports configuration - Functions go in `packages/functions/` - Infrastructure should be split into logical files in `infra/` ## Monorepo Conventions - Import shared modules using workspace names: `@my-app/core/example` ``` -------------------------------- ### Run Desktop App Development Source: https://github.com/nanogpt-community/nanocode/blob/dev/CONTRIBUTING.md Start the native desktop application for development using Tauri. This command also starts the web dev server. Additional Tauri prerequisites are required. ```bash bun run --cwd packages/desktop tauri dev ``` ```bash bun run --cwd packages/desktop dev ``` -------------------------------- ### Binary Response Headers Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md OpenAI models return audio data directly as binary. This example shows the expected Content-Type and Content-Length headers. ```text Content-Type: audio/mp3 Content-Length: 123456 [Binary audio data] ``` -------------------------------- ### Start Local Development Server Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/docs/README.md Run the Mintlify development server from the root of your documentation project. Ensure your 'docs.json' file is present. The preview will be available at http://localhost:3000. ```bash mint dev ``` -------------------------------- ### Start Web Development Server Only Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/desktop-electron/README.md Starts only the Vite web development server without launching the native Tauri shell. Useful for focusing on web-related development. ```bash bun run --cwd packages/desktop dev ``` -------------------------------- ### Mintlify Request/Response Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/docs/ai-tools/cursor.mdx Illustrates how to document API requests and their corresponding responses. ```bash curl -X POST 'https://api.example.com/users' \ -H 'Content-Type: application/json' \ -d '{"name": "John Doe", "email": "john@example.com"}' ``` -------------------------------- ### Initialize New Project Source: https://github.com/nanogpt-community/nanocode/blob/dev/specs/project.md Initializes a new project. ```http POST /project/init -> Project ``` -------------------------------- ### Accordion Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/docs/ai-tools/cursor.mdx Demonstrates how to use AccordionGroup and Accordion components for collapsible content sections. Useful for organizing FAQs or troubleshooting guides. ```jsx - **Firewall blocking**: Ensure ports 80 and 443 are open - **Proxy configuration**: Set HTTP_PROXY environment variable - **DNS resolution**: Try using 8.8.8.8 as DNS server ```javascript const config = { performance: { cache: true, timeout: 30000 }, security: { encryption: 'AES-256' } }; ``` ``` -------------------------------- ### Documentation Agent Configuration Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/agents.mdx Example configuration for a 'docs-writer' subagent, specifying its description, mode, and available tools. The system prompt guides its behavior as a technical writer. ```markdown --- description: Writes and maintains project documentation mode: subagent tools: bash: false --- You are a technical writer. Create clear, comprehensive documentation. Focus on: - Clear explanations - Proper structure - Code examples - User-friendly language ``` -------------------------------- ### Build the Desktop Application Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/desktop/README.md Builds the release version of the desktop application. Run this command from the repository root. ```bash bun run --cwd packages/desktop tauri build ``` -------------------------------- ### Quick Start: Create Embedding with NanoGPT Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Initialize the OpenAI client to point to the NanoGPT API and create an embedding for a given text. This example demonstrates the basic usage for generating embeddings. ```python from openai import OpenAI # Initialize client pointing to NanoGPT client = OpenAI( api_key="YOUR_NANOGPT_API_KEY", base_url="https://nano-gpt.com/api/v1" ) # Create embedding response = client.embeddings.create( input="Your text to embed", model="text-embedding-3-small" ) embedding = response.data[0].embedding print(f"Embedding has {len(embedding)} dimensions") ``` -------------------------------- ### Verify Agents SDK Installation Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/opencode/test/fixture/skills/agents-sdk/SKILL.md Check if the agents package is installed in your project. If not, install it using npm. ```bash npm ls agents # Should show agents package ``` ```bash npm install agents ``` -------------------------------- ### Install NanoCode with pnpm Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/index.mdx Install NanoCode globally using pnpm. This is another package manager option for installation. ```bash pnpm install -g nanocode ``` -------------------------------- ### Create Client (with server) Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/sdk.mdx Create an instance of nanocode, which starts both a server and a client. You can optionally provide configuration options. ```javascript import { createOpencode } from "@nanogpt/sdk" const { client } = await createOpencode() // Optional configuration: // const nanocode = await createOpencode({ // hostname: "127.0.0.1", // port: 4096, // config: { // model: "anthropic/claude-3-5-sonnet-20241022", // }, // }) // console.log(`Server running at ${nanocode.server.url}`) // nanocode.server.close() ``` -------------------------------- ### Navigate to project directory Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/index.mdx Before initializing NanoCode, navigate to the root directory of the project you want to work on. ```bash cd /path/to/project ``` -------------------------------- ### Install Droid CLI Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Install the Droid command-line interface using curl. This command fetches and executes the installation script. ```bash curl -fsSL https://app.factory.ai/cli | sh ``` -------------------------------- ### Install NanoCode via curl Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/index.mdx Use this command to install NanoCode using the provided script. Ensure you have curl installed. ```bash curl -fsSL https://nanocode.ai/install | bash ``` -------------------------------- ### Use Grep by Vercel MCP Server in Prompt Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/mcp-servers.mdx Example prompt demonstrating how to use the Grep by Vercel MCP server to find information on setting custom domains in an Astro component. ```text What's the right way to set a custom domain in an SST Astro component? use the gh_grep tool ``` -------------------------------- ### Search for Configuration Files Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/opencode/src/session/prompt/gemini.txt Demonstrates how to find all instances of a specific configuration file across the project using a glob pattern. It then offers to read the content of the found files. ```text user: Where are all the 'app.config' files in this project? I need to check their settings. model: [tool_call: glob for pattern '**/app.config'] (Assuming GlobTool returns a list of paths like ['/path/to/moduleA/app.config', '/path/to/moduleB/app.config']) I found the following 'app.config' files: - /path/to/moduleA/app.config - /path/to/moduleB/app.config To help you check their settings, I can read their contents. Which one would you like to start with, or should I read all of them? ``` -------------------------------- ### Install Dependencies with Bun Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/opencode/README.md Installs project dependencies using the Bun package manager. Ensure Bun is installed on your system. ```bash bun install ``` -------------------------------- ### Print 'Hello World' in Python Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/opencode/src/tool/todowrite.txt Use this for simple, single-line code execution. The todo list is not needed for trivial tasks. ```python print("Hello World") ``` -------------------------------- ### Initialize NanoCode for a project Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/index.mdx Run this command in your project's root directory to initialize NanoCode. It will analyze the project and create an AGENTS.md file. ```bash /init ``` -------------------------------- ### Install Nanocode CLI Source: https://github.com/nanogpt-community/nanocode/blob/dev/README.md Installs the latest version of the Nanocode CLI globally. ```bash bun i -g nanocode@latest ``` -------------------------------- ### Run Backend Development Server Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/app/AGENTS.md Starts the backend development server for local UI changes. Ensure you are in the 'packages/opencode' directory. ```shell bun run --conditions=browser ./src/index.ts serve --port 4096 ``` -------------------------------- ### Text-to-Speech API Parameter Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Example of the text parameter for text-to-speech generation. ```string "Hello! This is a test of the text-to-speech API." ``` -------------------------------- ### Configure Local MCP Server with Command and Environment Variables Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/mcp-servers.mdx Set up a local MCP server by specifying 'type: "local"' and providing the 'command' to execute it. Environment variables can be passed using the 'environment' object. ```jsonc { "$schema": "https://nanocode.ai/config.json", "mcp": { "my-local-mcp-server": { "type": "local", // Or ["bun", "x", "my-mcp-command"] "command": ["npx", "-y", "my-mcp-command"], "enabled": true, "environment": { "MY_ENV_VAR": "my_env_var_value" } } } } ``` -------------------------------- ### Create a New SolidStart Project Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/console/app/README.md Use `npm init solid@latest` to create a new SolidStart project. You can initialize it in the current directory or specify a new directory name. ```bash npm init solid@latest # create a new project in my-app npm init solid@latest my-app ``` -------------------------------- ### Install Playwright Browsers Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/app/README.md Installs the necessary Playwright browser binaries for end-to-end testing. ```bash bunx playwright install ``` -------------------------------- ### Development vs. Production CLI Commands Source: https://github.com/nanogpt-community/nanocode/blob/dev/CONTRIBUTING.md Compares the command-line interface commands for development using 'bun dev' and production using 'opencode'. Shows how to display help, start servers, and run the TUI in a specific directory. ```bash # Development (from project root) bun dev --help # Show all available commands bun dev serve # Start headless API server bun dev web # Start server + open web interface bun dev # Start TUI in specific directory # Production opencode --help # Show all available commands opencode serve # Start headless API server opencode web # Start server + open web interface opencode # Start TUI in specific directory ``` -------------------------------- ### Bearer Authentication Header Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Example of the Authorization header for Bearer token authentication. ```http Authorization: Bearer YOUR_API_KEY ``` -------------------------------- ### Command Line Interface for Connecting to Providers Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/providers.mdx Use the /connect command to initiate the connection process with various AI providers. ```txt /connect ``` ```txt /models ``` -------------------------------- ### Polling Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md An example JavaScript function demonstrating how to poll for video generation status. ```APIDOC ## Polling Example An example JavaScript function demonstrating how to poll for video generation status. ```javascript async function pollVideoStatus(runId, model) { const maxAttempts = 120; // ~10 minutes total const delayMs = 5000; // 5 seconds (max ~10 minutes) for (let i = 0; i < maxAttempts; i++) { const response = await fetch( `/api/generate-video/status?runId=${runId}&model=${model}` ); const result = await response.json(); if (result.data.status === 'COMPLETED') { return result.data.output.video.url; } else if (result.data.status === 'FAILED') { throw new Error(result.data.error || 'Video generation failed'); } // Wait before next poll await new Promise((resolve) => setTimeout(resolve, delayMs)); } throw new Error('Video generation timed out'); } ``` ``` -------------------------------- ### Create a video Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Example of creating a video using the client, specifying prompt, framework, and target length in words. ```typescript const video = await client.videos.create({ prompt: 'A short animation of code being written', framework: 'emotional_story', targetLengthInWords: 70 }); ``` -------------------------------- ### Mintlify Success Response Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/docs/ai-tools/cursor.mdx Provides an example of a successful API response structure. ```json { "id": "user_123", "name": "John Doe", "email": "john@example.com", "created_at": "2024-01-15T10:30:00Z" } ``` -------------------------------- ### Use Context7 MCP Server in Prompt Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/mcp-servers.mdx Example prompt demonstrating how to use the Context7 MCP server to configure a Cloudflare Worker script. ```text Configure a Cloudflare Worker script to cache JSON API responses for five minutes. use context7 ``` -------------------------------- ### Execute npm install command Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/opencode/src/tool/todowrite.txt This snippet demonstrates a single command execution. The todo list is unnecessary for tasks with immediate, single-step results. ```bash npm install ``` -------------------------------- ### API Key Authentication Header Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Example of the x-api-key header for API key authentication. ```http x-api-key: YOUR_API_KEY ``` -------------------------------- ### TEE Signature Response Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Example JSON response structure for a TEE signature request. ```json { "signature": "" } ``` -------------------------------- ### Run Web App Development Server Source: https://github.com/nanogpt-community/nanocode/blob/dev/CONTRIBUTING.md Start the web app development server to test UI changes. Requires the OpenCode server to be running first. The output will show the local development URL. ```bash bun run --cwd packages/app dev ``` -------------------------------- ### Install Claude Code CLI Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/docs/ai-tools/claude-code.mdx Install the Claude Code CLI tool globally using npm. ```bash npm install -g @anthropic-ai/claude-code ``` -------------------------------- ### Mintlify Steps for Procedures Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/docs/ai-tools/cursor.mdx Demonstrates structuring documentation as a series of steps with verification and warnings. ```Steps Run `npm install` to install required packages. Verify installation by running `npm list`. Create a `.env` file with your API credentials. ```bash API_KEY=your_api_key_here ``` Never commit API keys to version control. ``` -------------------------------- ### Error Handling Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Example of how to catch and log API response errors, including status and message. ```javascript try { const response = await nanogpt.chat({ model: 'chatgpt-4o-latest', messages: [ { role: 'user', content: 'Hello!' } ] }); } catch (error) { console.error('Status:', error.status); console.error('Message:', error.message); } ``` -------------------------------- ### Run Slack Bot Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/slack/README.md Start the Slack bot development server. Ensure your .env file is configured with Slack app credentials. ```bash # Edit .env with your Slack app credentials bun dev ``` -------------------------------- ### Install NanoCode with Yarn Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/index.mdx Install NanoCode globally using Yarn. This is a common package manager for JavaScript projects. ```bash yarn global add nanocode ``` -------------------------------- ### Set Up Proxy Environment Variables Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/network.mdx Configure proxy settings for NanoCode by exporting standard environment variables. Ensure to bypass the proxy for local connections. ```bash export HTTPS_PROXY=https://proxy.example.com:8080 export HTTP_PROXY=http://proxy.example.com:8080 export NO_PROXY=localhost,127.0.0.1 ``` -------------------------------- ### Install NanoCode with npm Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/index.mdx Install NanoCode globally using npm. This is one of the package manager options available. ```bash npm install -g nanocode ``` -------------------------------- ### session.init({ path, body }) Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/sdk.mdx Analyzes an application and creates an AGENTS.md file for a given session path. Returns a boolean indicating success. ```APIDOC ## session.init({ path, body }) ### Description Analyzes an app and creates `AGENTS.md` for a session. ### Method N/A (SDK Method) ### Parameters #### Path Parameters - **path** (string) - Required - The path identifier of the session. #### Request Body - **body** (object) - Required - An object containing details for the analysis (e.g., app path). ### Response #### Success Response - **success** (boolean) - True if the initialization was successful, false otherwise. ### Response Example ```json true ``` ``` -------------------------------- ### OpenHands Custom Model Prefix Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Example showing the required 'openai/' prefix for custom models in OpenHands. ```text Custom Model: openai/claude-3-5-sonnet-20241022 ``` -------------------------------- ### Use Sentry MCP Server in Prompt Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/web/src/content/docs/mcp-servers.mdx Example prompt demonstrating how to use the authenticated Sentry MCP server to query for unresolved issues. ```text Show me the latest unresolved issues in my project. use sentry ``` -------------------------------- ### Error Response Example Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md This is an example of an error response that might be returned by the API, indicating a content policy violation. ```json { "status": "error", "code": "CONTENT_POLICY_VIOLATION", "error": "Content rejected by provider. Please modify your prompt and try again." } ``` -------------------------------- ### OpenAPI Configuration Examples Source: https://github.com/nanogpt-community/nanocode/blob/dev/packages/docs/essentials/settings.mdx Configure OpenAPI file paths. Supports absolute URLs, relative paths, and multiple OpenAPI files. ```json "openapi": "https://example.com/openapi.json" ``` ```json "openapi": "@nanogpt/openapi.json" ``` ```json "openapi": ["https://example.com/openapi1.json", "@nanogpt/openapi2.json", "@nanogpt/openapi3.json"] ``` -------------------------------- ### Text Completion Model Examples Source: https://github.com/nanogpt-community/nanocode/blob/dev/nanogpt.md Examples of model identifiers for text completion, including options for web search. ```string "chatgpt-4o-latest" ``` ```string "chatgpt-4o-latest:online" ``` ```string "chatgpt-4o-latest:online/linkup-deep" ``` ```string "claude-3-5-sonnet-20241022:online" ```